1994-02-24 02:02:37 +01:00
|
|
|
/* Prints out trees in human readable form.
|
2016-01-04 15:30:50 +01:00
|
|
|
Copyright (C) 1992-2016 Free Software Foundation, Inc.
|
1994-02-24 02:02:37 +01:00
|
|
|
Hacked by Michael Tiemann (tiemann@cygnus.com)
|
|
|
|
|
call.c, [...]: Replace "GNU CC" with "GCC" in the copyright header.
* call.c, class.c, cp-lang.c, cp-tree.h, cvt.c, dump.c, error.c,
except.c, expr.c friend.c, g++spec.c, init.c, lang-options.h,
lang-specs.h, lex.c, mangle.c, method.c, optimize.c, parser.c,
pt.c, ptree.c, repo.c, rtti.c, search.c, semantics.c, tree.c,
typeck.c, typeck2.c: Replace "GNU CC" with "GCC" in the
copyright header.
* lex.h: parse.y is dead, so don't mention it. Also replace the
copyright header with the default GNU copyright header.
From-SVN: r60738
2003-01-01 12:58:58 +01:00
|
|
|
This file is part of GCC.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
call.c, [...]: Replace "GNU CC" with "GCC" in the copyright header.
* call.c, class.c, cp-lang.c, cp-tree.h, cvt.c, dump.c, error.c,
except.c, expr.c friend.c, g++spec.c, init.c, lang-options.h,
lang-specs.h, lex.c, mangle.c, method.c, optimize.c, parser.c,
pt.c, ptree.c, repo.c, rtti.c, search.c, semantics.c, tree.c,
typeck.c, typeck2.c: Replace "GNU CC" with "GCC" in the
copyright header.
* lex.h: parse.y is dead, so don't mention it. Also replace the
copyright header with the default GNU copyright header.
From-SVN: r60738
2003-01-01 12:58:58 +01:00
|
|
|
GCC is free software; you can redistribute it and/or modify
|
1994-02-24 02:02:37 +01:00
|
|
|
it under the terms of the GNU General Public License as published by
|
typeck.c: Change copyright header to refer to version 3 of the GNU General Public...
* typeck.c: Change copyright header to refer to version 3 of the GNU General
Public License and to point readers at the COPYING3 file and the FSF's license
web page.
* optimize.c, lang-specs.h, init.c, class.c, repo.c, decl.c, config-lang.in,
cp-tree.def, call.c, decl.h, ptree.c, Make-lang.in, method.c, rtti.c,
cp-objcp-common.c, g++spec.c, cp-objcp-common.h, except.c, error.c,
operators.def, cvt.c, tree.c, mangle.c, cp-tree.h, dump.c, search.c,
friend.c, expr.c, cp-gimplify.c, cxx-pretty-print.c, cp-lang.c, typeck2.c,
pt.c, cxx-pretty-print.h, semantics.c, name-lookup.c, lex.c, decl2.c,
name-lookup.h, parser.c: Likewise.
From-SVN: r127154
2007-08-02 12:36:13 +02:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1994-02-24 02:02:37 +01:00
|
|
|
any later version.
|
|
|
|
|
call.c, [...]: Replace "GNU CC" with "GCC" in the copyright header.
* call.c, class.c, cp-lang.c, cp-tree.h, cvt.c, dump.c, error.c,
except.c, expr.c friend.c, g++spec.c, init.c, lang-options.h,
lang-specs.h, lex.c, mangle.c, method.c, optimize.c, parser.c,
pt.c, ptree.c, repo.c, rtti.c, search.c, semantics.c, tree.c,
typeck.c, typeck2.c: Replace "GNU CC" with "GCC" in the
copyright header.
* lex.h: parse.y is dead, so don't mention it. Also replace the
copyright header with the default GNU copyright header.
From-SVN: r60738
2003-01-01 12:58:58 +01:00
|
|
|
GCC is distributed in the hope that it will be useful,
|
1994-02-24 02:02:37 +01:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
typeck.c: Change copyright header to refer to version 3 of the GNU General Public...
* typeck.c: Change copyright header to refer to version 3 of the GNU General
Public License and to point readers at the COPYING3 file and the FSF's license
web page.
* optimize.c, lang-specs.h, init.c, class.c, repo.c, decl.c, config-lang.in,
cp-tree.def, call.c, decl.h, ptree.c, Make-lang.in, method.c, rtti.c,
cp-objcp-common.c, g++spec.c, cp-objcp-common.h, except.c, error.c,
operators.def, cvt.c, tree.c, mangle.c, cp-tree.h, dump.c, search.c,
friend.c, expr.c, cp-gimplify.c, cxx-pretty-print.c, cp-lang.c, typeck2.c,
pt.c, cxx-pretty-print.h, semantics.c, name-lookup.c, lex.c, decl2.c,
name-lookup.h, parser.c: Likewise.
From-SVN: r127154
2007-08-02 12:36:13 +02:00
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
call.c: Include system.h.
* call.c: Include system.h. Remove includes, declarations and
defines provided by system.h.
* class.c, cvt.c, decl.c, decl2.c, errfn.c error.c: Likewise.
* except.c, expr.c friend.c, g++spec.c, init.c, input.c: Likewise.
* lex.c, parse.y, pt.c, ptree.c repo.c rtti.c, search.c: Likewise.
* semantics.c, sig.c, spew.c, tree.c, typeck.c: Likewise.
* typeck2.c, xref.c: Likewise.
* Makefile.in: Dependencies updated as appropriate.
* Make-lang.in: Likewise.
system.h cutover from the cp subdir
From-SVN: r18917
1998-03-31 15:25:46 +02:00
|
|
|
#include "system.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
#include "coretypes.h"
|
1994-02-24 02:02:37 +01:00
|
|
|
#include "cp-tree.h"
|
2015-10-29 16:27:20 +01:00
|
|
|
#include "print-tree.h"
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
void
|
Remove traditional C constructs 4/n.
* decl2.c (grok_method_quals, warn_if_unknown_interface,
grok_x_components, cp_build_parm_decl, build_artificial_parm,
maybe_retrofit_in_chrg, grokclassfn, grok_array_decl,
delete_sanity, check_member_template, check_java_method,
check_classfn, finish_static_data_member_decl, grokfield,
grokbitfield, grokoptypename, grok_function_init,
cplus_decl_attributes, constructor_name, defer_fn,
build_anon_union_vars, finish_anon_union, coerce_new_type,
coerce_delete_type, comdat_linkage, maybe_make_one_only,
key_method, import_export_vtable, import_export_class,
output_vtable_inherit, import_export_decl, import_export_tinfo,
build_cleanup, get_guard, get_guard_bits, get_guard_cond,
set_guard, start_objects, finish_objects,
start_static_storage_duration_function,
finish_static_storage_duration_function, get_priority_info,
start_static_initialization_or_destruction,
finish_static_initialization_or_destruction,
do_static_initialization, do_static_destruction,
prune_vars_needing_no_initialization, write_out_vars,
reparse_decl_as_expr, finish_decl_parsing, namespace_ancestor,
add_using_namespace, merge_functions, ambiguous_decl,
lookup_using_namespace, lookup_using_namespace,
qualified_lookup_using_namespace, set_decl_namespace,
decl_namespace, current_decl_namespace, push_decl_namespace,
pop_decl_namespace, push_scope, pop_scope, add_function,
arg_assoc_namespace, arg_assoc_template_arg, arg_assoc,
lookup_arg_dependent, do_namespace_alias,
validate_nonmember_using_decl, do_nonmember_using_decl,
do_toplevel_using_decl, do_local_using_decl,
do_class_using_decl, do_using_directive, check_default_args,
mark_used, handle_class_head): Use C90 prototypings. Use booleans.
* parser.c (cp_parser_class_head): Use booleanss.
* decl.c (walk_globals, walk_vtables): Likewise.
* cp-tree.h (walk_globals_pred, walk_globals_fn, walk_vtables,
walk_globals): Change return type from 'int' to 'bool'.
* rtti.c (init_rtti_processing, build_headof, throw_bad_cast
throw_bad_typeid, get_tinfo_decl_dynamic, typeid_ok_p,
build_typeid, tinfo_name, get_tinfo_decl, get_tinfo_ptr,
get_typeid, ifnonnull, build_dynamic_cast_1, build_dynamic_cast,
qualifier_flags, tinfo_base_init, generic_initializer,
ptr_initializer, dfs_class_hint_mark, ptm_initializer,
dfs_class_hint_unmark, class_hint_flags, class_initializer,
typeinfo_in_lib_p, get_pseudo_ti_init, create_pseudo_type_info,
get_pseudo_ti_desc, create_tinfo_types, emit_support_tinfos,
unemitted_tinfo_decl_p, emit_tinfo_decl): Likewise.
* repo.c (repo_compile_flags, repo_template_declared,
repo_template_defined, repo_class_defined, repo_get_id,
repo_template_used, repo_vtable_used, repo_inline_used,
repo_tinfo_used, repo_template_instantiated, extract_string,
open_repo_file, afgets, init_repo, reopen_repo_file_for_write,
finish_repo): Likewise.
* ptree.c (cxx_print_decl, cxx_print_type, cxx_print_identifier,
cxx_print_xnode): Likewise..
* cp-lang.c (ok_to_generate_alias_set_for_type, cxx_get_alias_set,
cxx_warn_unused_global_decl, cp_expr_size): Likewise.
* cxxfilt.c (demangle_it, print_demangler_list, usage,
standard_symbol_characters, hp_symbol_characters, main, fatal):
Likewise.
(strip_underscore): Change type from 'int' to 'bool'.
(main): Use boolean constants.
From-SVN: r60601
2002-12-29 15:53:05 +01:00
|
|
|
cxx_print_decl (FILE *file, tree node, int indent)
|
1994-02-24 02:02:37 +01:00
|
|
|
{
|
2000-05-24 08:15:04 +02:00
|
|
|
if (TREE_CODE (node) == FIELD_DECL)
|
1994-02-24 02:02:37 +01:00
|
|
|
{
|
2000-05-24 08:15:04 +02:00
|
|
|
if (DECL_MUTABLE_P (node))
|
|
|
|
{
|
|
|
|
indent_to (file, indent + 3);
|
|
|
|
fprintf (file, " mutable ");
|
|
|
|
}
|
|
|
|
return;
|
1994-02-24 02:02:37 +01:00
|
|
|
}
|
2000-05-24 08:15:04 +02:00
|
|
|
|
2005-12-06 05:22:11 +01:00
|
|
|
if (!CODE_CONTAINS_STRUCT (TREE_CODE (node), TS_DECL_COMMON)
|
|
|
|
|| !DECL_LANG_SPECIFIC (node))
|
1994-02-24 02:02:37 +01:00
|
|
|
return;
|
2009-03-31 21:13:15 +02:00
|
|
|
if (TREE_CODE (node) == FUNCTION_DECL)
|
|
|
|
{
|
|
|
|
int flags = TFF_DECL_SPECIFIERS|TFF_RETURN_TYPE
|
|
|
|
|TFF_FUNCTION_DEFAULT_ARGUMENTS|TFF_EXCEPTION_SPECIFICATION ;
|
|
|
|
indent_to (file, indent + 3);
|
|
|
|
fprintf (file, " full-name \"%s\"", decl_as_string (node, flags));
|
|
|
|
}
|
|
|
|
else if (TREE_CODE (node) == TEMPLATE_DECL)
|
|
|
|
{
|
2016-12-21 20:11:41 +01:00
|
|
|
print_node (file, "parms", DECL_TEMPLATE_PARMS (node), indent + 4);
|
2009-03-31 21:13:15 +02:00
|
|
|
indent_to (file, indent + 3);
|
|
|
|
fprintf (file, " full-name \"%s\"",
|
|
|
|
decl_as_string (node, TFF_TEMPLATE_HEADER));
|
|
|
|
}
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
indent_to (file, indent + 3);
|
2009-03-31 21:13:15 +02:00
|
|
|
if (DECL_EXTERNAL (node) && DECL_NOT_REALLY_EXTERN (node))
|
|
|
|
fprintf (file, " not-really-extern");
|
1999-07-09 18:15:04 +02:00
|
|
|
if (TREE_CODE (node) == FUNCTION_DECL
|
|
|
|
&& DECL_PENDING_INLINE_INFO (node))
|
2005-08-16 02:13:53 +02:00
|
|
|
fprintf (file, " pending-inline-info %p",
|
2003-07-08 02:35:52 +02:00
|
|
|
(void *) DECL_PENDING_INLINE_INFO (node));
|
2013-03-26 21:05:55 +01:00
|
|
|
if (VAR_OR_FUNCTION_DECL_P (node)
|
1999-09-24 00:20:08 +02:00
|
|
|
&& DECL_TEMPLATE_INFO (node))
|
2005-08-16 02:13:53 +02:00
|
|
|
fprintf (file, " template-info %p",
|
2003-07-08 02:35:52 +02:00
|
|
|
(void *) DECL_TEMPLATE_INFO (node));
|
1994-02-24 02:02:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Remove traditional C constructs 4/n.
* decl2.c (grok_method_quals, warn_if_unknown_interface,
grok_x_components, cp_build_parm_decl, build_artificial_parm,
maybe_retrofit_in_chrg, grokclassfn, grok_array_decl,
delete_sanity, check_member_template, check_java_method,
check_classfn, finish_static_data_member_decl, grokfield,
grokbitfield, grokoptypename, grok_function_init,
cplus_decl_attributes, constructor_name, defer_fn,
build_anon_union_vars, finish_anon_union, coerce_new_type,
coerce_delete_type, comdat_linkage, maybe_make_one_only,
key_method, import_export_vtable, import_export_class,
output_vtable_inherit, import_export_decl, import_export_tinfo,
build_cleanup, get_guard, get_guard_bits, get_guard_cond,
set_guard, start_objects, finish_objects,
start_static_storage_duration_function,
finish_static_storage_duration_function, get_priority_info,
start_static_initialization_or_destruction,
finish_static_initialization_or_destruction,
do_static_initialization, do_static_destruction,
prune_vars_needing_no_initialization, write_out_vars,
reparse_decl_as_expr, finish_decl_parsing, namespace_ancestor,
add_using_namespace, merge_functions, ambiguous_decl,
lookup_using_namespace, lookup_using_namespace,
qualified_lookup_using_namespace, set_decl_namespace,
decl_namespace, current_decl_namespace, push_decl_namespace,
pop_decl_namespace, push_scope, pop_scope, add_function,
arg_assoc_namespace, arg_assoc_template_arg, arg_assoc,
lookup_arg_dependent, do_namespace_alias,
validate_nonmember_using_decl, do_nonmember_using_decl,
do_toplevel_using_decl, do_local_using_decl,
do_class_using_decl, do_using_directive, check_default_args,
mark_used, handle_class_head): Use C90 prototypings. Use booleans.
* parser.c (cp_parser_class_head): Use booleanss.
* decl.c (walk_globals, walk_vtables): Likewise.
* cp-tree.h (walk_globals_pred, walk_globals_fn, walk_vtables,
walk_globals): Change return type from 'int' to 'bool'.
* rtti.c (init_rtti_processing, build_headof, throw_bad_cast
throw_bad_typeid, get_tinfo_decl_dynamic, typeid_ok_p,
build_typeid, tinfo_name, get_tinfo_decl, get_tinfo_ptr,
get_typeid, ifnonnull, build_dynamic_cast_1, build_dynamic_cast,
qualifier_flags, tinfo_base_init, generic_initializer,
ptr_initializer, dfs_class_hint_mark, ptm_initializer,
dfs_class_hint_unmark, class_hint_flags, class_initializer,
typeinfo_in_lib_p, get_pseudo_ti_init, create_pseudo_type_info,
get_pseudo_ti_desc, create_tinfo_types, emit_support_tinfos,
unemitted_tinfo_decl_p, emit_tinfo_decl): Likewise.
* repo.c (repo_compile_flags, repo_template_declared,
repo_template_defined, repo_class_defined, repo_get_id,
repo_template_used, repo_vtable_used, repo_inline_used,
repo_tinfo_used, repo_template_instantiated, extract_string,
open_repo_file, afgets, init_repo, reopen_repo_file_for_write,
finish_repo): Likewise.
* ptree.c (cxx_print_decl, cxx_print_type, cxx_print_identifier,
cxx_print_xnode): Likewise..
* cp-lang.c (ok_to_generate_alias_set_for_type, cxx_get_alias_set,
cxx_warn_unused_global_decl, cp_expr_size): Likewise.
* cxxfilt.c (demangle_it, print_demangler_list, usage,
standard_symbol_characters, hp_symbol_characters, main, fatal):
Likewise.
(strip_underscore): Change type from 'int' to 'bool'.
(main): Use boolean constants.
From-SVN: r60601
2002-12-29 15:53:05 +01:00
|
|
|
cxx_print_type (FILE *file, tree node, int indent)
|
1994-02-24 02:02:37 +01:00
|
|
|
{
|
1999-08-09 04:30:21 +02:00
|
|
|
switch (TREE_CODE (node))
|
1994-02-24 02:02:37 +01:00
|
|
|
{
|
2016-12-21 20:11:41 +01:00
|
|
|
case BOUND_TEMPLATE_TEMPLATE_PARM:
|
|
|
|
print_node (file, "args", TYPE_TI_ARGS (node), indent + 4);
|
|
|
|
gcc_fallthrough ();
|
|
|
|
|
1999-08-09 04:30:21 +02:00
|
|
|
case TEMPLATE_TYPE_PARM:
|
|
|
|
case TEMPLATE_TEMPLATE_PARM:
|
Support for friend templates.
* typeck.c (build_x_function_call): Handle static member function
templates like non-templates. Handle friend templates like normal
function templates.
* pt.c (tsubst, *_PARM): Don't use orig_level.
(get_bindings): Don't call add_to_template_args.
(instantiate_template): Likewise.
(tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate.
* ptree.c (print_lang_type): Print index/level for template parms.
* Make-lang.in (cc1plus): Note that cc1plus depends on
cp/cp-tree.h and cp/cp-tree.def.
* cp-tree.def (TEMPLATE_CONST_PARM): Remove.
(TEMPLATE_PARM_INDEX): New tree code, used to indicate a
position in a template parameter list.
* cp-tree.h (template_parm_index): New structure, used as the tree
structure for a TEMPLATE_PARM_INDEX.
(TEMPLATE_PARM_IDX): New macro.
(TEMPLATE_PARM_LEVEL): Likewise.
(TEMPLATE_PARM_DESCENDANTS): Likewise.
(TEMPLATE_PARM_ORIG_LEVEL): Likewise.
(TEMPLATE_PARM_DECL): Likewise.
(TEMPLATE_TYPE_PARM_INDEX): Likewise.
(TEMPLATE_TYPE_ORIG_LEVEL): Likewise.
(TEMPLATE_TYPE_DECL): Likewise.
(TEMPLATE_CONST_IDX): Remove.
(TEMPLATE_CONST_LEVEL): Likewise.
(TEMPLATE_CONST_SET_INFO): Likewise.
(TEMPLATE_TYPE_SET_INFO): Likewise.
(TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX
node.
(TEMPLATE_TYPE_LEVEL): Likewise.
* decl.c (decls_match): Call comp_template_parms, rather than
expanding it inline.
(duplicate_decls): If two template declarations are being merged,
then their TEMPLATE_INFOs should be merged as well.
(grokfndecl): Save template-id information when declaring a friend
with explicit template arguments. Pass arguments to
check_explicit_specialization via correct convention; at some
point check_explicit_specialization changed, but these call-sites
did not.
(grokdeclarator): Tidy up slightly.
* decl2.c (check_classfn): Tidy up slightly. Don't assume that
two template functions with the same DECL_ASSEMBLER_NAME the same,
since the names are not yet mangled.
* error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of
TEMPLATE_CONST_PARM.
(dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the
decl for a non-type parameter, rather than printing `<tparm ...>'.
* friend.c (is_friend): Handle TEMPLATE_DECL friends.
(do_friend): Deal with template friends.
* lex.c (do_pending_inlines): Call
maybe_begin_member_template_processing, rather than
conditionally calling begin_member_template_processing.
(process_next_inline): Likewise. Call
maybe_end_member_template_processing, rather than
conditionally calling end_member_template_processing.
(do_pending_defargs): Likewise.
(do_identifier): Use TEMPLATE_PARM_INDEX instead of
TEMPLATE_CONST_PARM.
* method.c (build_mangled_template_parm_index): New function.
(build_overload_value): Use it.
(build_overload_name): Likewise.
* pt.c (finish_member_template_decl): Allow friend declarations.
(template_class_depth): New function.
(is_member_template): Rename, and modify, to become...
(is_member_or_friend_template): New function.
(end_member_template_processing): Rename, and modify, to become...
(maybe_end_member_template_processing).
(build_template_parm_index): New function.
(reduce_template_parm_level): New function.
(process_template_parm): Modify to use build_template_parm_index.
(current_template_args): Change name to current_template_parms.
(push_template_decl): Deal with friend templates.
(uses_template_parms): Use TEMPLATE_PARM_INDEX instead of
TEMPLATE_CONST_PARM.
(tsubst_friend_function): New function.
(instantiate_class_template): Generate the DECL_FRIENDLIST
for a new instantiation by using tsubst_friend_function rather
than just tsubst.
(tsubst): Don't tsubst into a type which is a TEMPLATE_DECL.
Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the
appropriate new macros. Use reduce_template_parm_level to
generate lower-level template parameters. Handle tsubst'ing into
TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget
to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created
templates. Similarly for the template parameters for a new
template.
(tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead
of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them.
(unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM.
(get_bindings): Call add_to_template_args if necessary.
(instantiate_decl): Handle instantiations of friend templates.
* search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a
TEMPLATE_TYPE_PARM as a list of fields; it's not!
* spew.c (yylex): Do a little manual constant propogation to
clarify the code.
From-SVN: r18198
1998-02-23 04:17:44 +01:00
|
|
|
indent_to (file, indent + 3);
|
2007-03-15 14:51:09 +01:00
|
|
|
fprintf (file, "index %d level %d orig_level %d",
|
2003-05-17 03:40:45 +02:00
|
|
|
TEMPLATE_TYPE_IDX (node), TEMPLATE_TYPE_LEVEL (node),
|
|
|
|
TEMPLATE_TYPE_ORIG_LEVEL (node));
|
1994-02-24 02:02:37 +01:00
|
|
|
return;
|
1999-08-09 04:30:21 +02:00
|
|
|
|
|
|
|
case FUNCTION_TYPE:
|
|
|
|
case METHOD_TYPE:
|
|
|
|
if (TYPE_RAISES_EXCEPTIONS (node))
|
|
|
|
print_node (file, "throws", TYPE_RAISES_EXCEPTIONS (node), indent + 4);
|
|
|
|
return;
|
|
|
|
|
2009-07-05 04:09:15 +02:00
|
|
|
case RECORD_TYPE:
|
|
|
|
case UNION_TYPE:
|
|
|
|
break;
|
|
|
|
|
2009-09-02 17:48:44 +02:00
|
|
|
case DECLTYPE_TYPE:
|
|
|
|
print_node (file, "expr", DECLTYPE_TYPE_EXPR (node), indent + 4);
|
|
|
|
return;
|
|
|
|
|
2011-04-27 07:17:10 +02:00
|
|
|
case TYPENAME_TYPE:
|
|
|
|
print_node (file, "fullname", TYPENAME_TYPE_FULLNAME (node),
|
|
|
|
indent + 4);
|
|
|
|
return;
|
|
|
|
|
2011-11-21 03:04:54 +01:00
|
|
|
case TYPE_PACK_EXPANSION:
|
|
|
|
print_node (file, "args", PACK_EXPANSION_EXTRA_ARGS (node), indent + 4);
|
|
|
|
return;
|
|
|
|
|
1999-08-09 04:30:21 +02:00
|
|
|
default:
|
|
|
|
return;
|
1994-02-24 02:02:37 +01:00
|
|
|
}
|
|
|
|
|
1999-08-09 04:30:21 +02:00
|
|
|
if (TYPE_PTRMEMFUNC_P (node))
|
|
|
|
print_node (file, "ptrmemfunc fn type", TYPE_PTRMEMFUNC_FN_TYPE (node),
|
|
|
|
indent + 4);
|
|
|
|
|
1999-05-19 02:48:10 +02:00
|
|
|
if (! CLASS_TYPE_P (node))
|
1994-02-24 02:02:37 +01:00
|
|
|
return;
|
|
|
|
|
2009-07-04 02:43:26 +02:00
|
|
|
indent_to (file, indent + 4);
|
|
|
|
fprintf (file, "full-name \"%s\"",
|
|
|
|
type_as_string (node, TFF_CLASS_KEY_OR_ENUM));
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
indent_to (file, indent + 3);
|
|
|
|
|
|
|
|
if (TYPE_NEEDS_CONSTRUCTING (node))
|
2009-03-31 21:13:15 +02:00
|
|
|
fputs ( " needs-constructor", file);
|
2000-03-03 03:27:15 +01:00
|
|
|
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (node))
|
1994-02-24 02:02:37 +01:00
|
|
|
fputs (" needs-destructor", file);
|
|
|
|
if (TYPE_HAS_DEFAULT_CONSTRUCTOR (node))
|
|
|
|
fputs (" X()", file);
|
|
|
|
if (TYPE_HAS_CONVERSION (node))
|
|
|
|
fputs (" has-type-conversion", file);
|
2010-06-30 02:50:34 +02:00
|
|
|
if (TYPE_HAS_COPY_CTOR (node))
|
1994-02-24 02:02:37 +01:00
|
|
|
{
|
2010-06-30 02:50:34 +02:00
|
|
|
if (TYPE_HAS_CONST_COPY_CTOR (node))
|
1994-02-24 02:02:37 +01:00
|
|
|
fputs (" X(constX&)", file);
|
|
|
|
else
|
|
|
|
fputs (" X(X&)", file);
|
|
|
|
}
|
2000-03-03 03:27:15 +01:00
|
|
|
if (TYPE_HAS_NEW_OPERATOR (node))
|
1994-04-15 03:44:15 +02:00
|
|
|
fputs (" new", file);
|
2000-03-03 03:27:15 +01:00
|
|
|
if (TYPE_HAS_ARRAY_NEW_OPERATOR (node))
|
1994-04-15 03:44:15 +02:00
|
|
|
fputs (" new[]", file);
|
|
|
|
if (TYPE_GETS_DELETE (node) & 1)
|
|
|
|
fputs (" delete", file);
|
|
|
|
if (TYPE_GETS_DELETE (node) & 2)
|
|
|
|
fputs (" delete[]", file);
|
2010-06-30 02:50:34 +02:00
|
|
|
if (TYPE_HAS_COPY_ASSIGN (node))
|
1994-02-24 02:02:37 +01:00
|
|
|
fputs (" this=(X&)", file);
|
2009-07-04 02:43:26 +02:00
|
|
|
if (CLASSTYPE_SORTED_FIELDS (node))
|
|
|
|
fprintf (file, " sorted-fields %p",
|
|
|
|
(void *) CLASSTYPE_SORTED_FIELDS (node));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
if (TREE_CODE (node) == RECORD_TYPE)
|
|
|
|
{
|
2004-07-12 18:06:40 +02:00
|
|
|
if (TYPE_BINFO (node))
|
|
|
|
fprintf (file, " n_parents=%d",
|
|
|
|
BINFO_N_BASE_BINFOS (TYPE_BINFO (node)));
|
|
|
|
else
|
|
|
|
fprintf (file, " no-binfo");
|
2005-06-14 22:01:59 +02:00
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
fprintf (file, " use_template=%d", CLASSTYPE_USE_TEMPLATE (node));
|
|
|
|
if (CLASSTYPE_INTERFACE_ONLY (node))
|
|
|
|
fprintf (file, " interface-only");
|
|
|
|
if (CLASSTYPE_INTERFACE_UNKNOWN (node))
|
|
|
|
fprintf (file, " interface-unknown");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-15 17:30:02 +01:00
|
|
|
|
|
|
|
static void
|
|
|
|
cxx_print_binding (FILE *stream, cxx_binding *binding, const char *prefix)
|
|
|
|
{
|
2005-08-16 02:13:53 +02:00
|
|
|
fprintf (stream, "%s <%p>",
|
2003-07-08 02:35:52 +02:00
|
|
|
prefix, (void *) binding);
|
2003-03-15 17:30:02 +01:00
|
|
|
}
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
void
|
Remove traditional C constructs 4/n.
* decl2.c (grok_method_quals, warn_if_unknown_interface,
grok_x_components, cp_build_parm_decl, build_artificial_parm,
maybe_retrofit_in_chrg, grokclassfn, grok_array_decl,
delete_sanity, check_member_template, check_java_method,
check_classfn, finish_static_data_member_decl, grokfield,
grokbitfield, grokoptypename, grok_function_init,
cplus_decl_attributes, constructor_name, defer_fn,
build_anon_union_vars, finish_anon_union, coerce_new_type,
coerce_delete_type, comdat_linkage, maybe_make_one_only,
key_method, import_export_vtable, import_export_class,
output_vtable_inherit, import_export_decl, import_export_tinfo,
build_cleanup, get_guard, get_guard_bits, get_guard_cond,
set_guard, start_objects, finish_objects,
start_static_storage_duration_function,
finish_static_storage_duration_function, get_priority_info,
start_static_initialization_or_destruction,
finish_static_initialization_or_destruction,
do_static_initialization, do_static_destruction,
prune_vars_needing_no_initialization, write_out_vars,
reparse_decl_as_expr, finish_decl_parsing, namespace_ancestor,
add_using_namespace, merge_functions, ambiguous_decl,
lookup_using_namespace, lookup_using_namespace,
qualified_lookup_using_namespace, set_decl_namespace,
decl_namespace, current_decl_namespace, push_decl_namespace,
pop_decl_namespace, push_scope, pop_scope, add_function,
arg_assoc_namespace, arg_assoc_template_arg, arg_assoc,
lookup_arg_dependent, do_namespace_alias,
validate_nonmember_using_decl, do_nonmember_using_decl,
do_toplevel_using_decl, do_local_using_decl,
do_class_using_decl, do_using_directive, check_default_args,
mark_used, handle_class_head): Use C90 prototypings. Use booleans.
* parser.c (cp_parser_class_head): Use booleanss.
* decl.c (walk_globals, walk_vtables): Likewise.
* cp-tree.h (walk_globals_pred, walk_globals_fn, walk_vtables,
walk_globals): Change return type from 'int' to 'bool'.
* rtti.c (init_rtti_processing, build_headof, throw_bad_cast
throw_bad_typeid, get_tinfo_decl_dynamic, typeid_ok_p,
build_typeid, tinfo_name, get_tinfo_decl, get_tinfo_ptr,
get_typeid, ifnonnull, build_dynamic_cast_1, build_dynamic_cast,
qualifier_flags, tinfo_base_init, generic_initializer,
ptr_initializer, dfs_class_hint_mark, ptm_initializer,
dfs_class_hint_unmark, class_hint_flags, class_initializer,
typeinfo_in_lib_p, get_pseudo_ti_init, create_pseudo_type_info,
get_pseudo_ti_desc, create_tinfo_types, emit_support_tinfos,
unemitted_tinfo_decl_p, emit_tinfo_decl): Likewise.
* repo.c (repo_compile_flags, repo_template_declared,
repo_template_defined, repo_class_defined, repo_get_id,
repo_template_used, repo_vtable_used, repo_inline_used,
repo_tinfo_used, repo_template_instantiated, extract_string,
open_repo_file, afgets, init_repo, reopen_repo_file_for_write,
finish_repo): Likewise.
* ptree.c (cxx_print_decl, cxx_print_type, cxx_print_identifier,
cxx_print_xnode): Likewise..
* cp-lang.c (ok_to_generate_alias_set_for_type, cxx_get_alias_set,
cxx_warn_unused_global_decl, cp_expr_size): Likewise.
* cxxfilt.c (demangle_it, print_demangler_list, usage,
standard_symbol_characters, hp_symbol_characters, main, fatal):
Likewise.
(strip_underscore): Change type from 'int' to 'bool'.
(main): Use boolean constants.
From-SVN: r60601
2002-12-29 15:53:05 +01:00
|
|
|
cxx_print_identifier (FILE *file, tree node, int indent)
|
1994-02-24 02:02:37 +01:00
|
|
|
{
|
2005-07-26 04:38:20 +02:00
|
|
|
if (indent == 0)
|
|
|
|
fprintf (file, " ");
|
|
|
|
else
|
2011-04-27 07:17:10 +02:00
|
|
|
indent_to (file, indent + 4);
|
2003-03-15 17:30:02 +01:00
|
|
|
cxx_print_binding (file, IDENTIFIER_NAMESPACE_BINDINGS (node), "bindings");
|
2005-07-26 04:38:20 +02:00
|
|
|
if (indent == 0)
|
|
|
|
fprintf (file, " ");
|
|
|
|
else
|
2011-04-27 07:17:10 +02:00
|
|
|
indent_to (file, indent + 4);
|
2003-03-15 17:30:02 +01:00
|
|
|
cxx_print_binding (file, IDENTIFIER_BINDING (node), "local bindings");
|
1994-02-24 02:02:37 +01:00
|
|
|
print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
|
|
|
|
print_node (file, "template", IDENTIFIER_TEMPLATE (node), indent + 4);
|
|
|
|
}
|
Partial implementation of namespaces.
* decl.c (push_namespace): Handle redeclaration error.
* cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro.
(IDENTIFIER_NAMESPACE_BINDINGS): New macro.
(NAMESPACE_BINDING): New macro.
(IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING.
* *.c: Use them.
* pt.c (push_template_decl): Use innermost_args.
* decl.c (get_unique_name): Tweak from earlier in the name.
* cp-tree.def: Add CPLUS_BINDING node.
* cp-tree.h (tree_binding): new struct
(BINDING_SCOPE, BINDING_VALUE): new macros
(current_namespace, global_namespace): declare extern
(struct lang_decl_flags): new field in_namespace
(DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros
(DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros
(TREE_INDIRECT_USING): new macro
* decl2.c (current_namespace, global_namespace): Declare. The
value is a NAMESPACE_DECL now, not a TREE_LIST.
(is_namespace_ancestor, namespace_ancestor):new static functions.
(add_using_namespace, ambiguous_decl): likewise.
(lookup_using_namespace): new support function for lookup_name.
(qualified_lookup_using_namespace): new support function for
do_scoped_id and lookup_namespace_name
(get_namespace_id): mark as obsolete.
(current_namespace_id): Likewise.
(do_namespace_alias): Implement.
(do_using_directive): Implement as call to add_using_namespace.
* decl.c (binding_for_name): new function.
(push_namespace, pop_namespace): implement.
(push_decl): don't install a FUNCTION_DECL in the global branch.
(lookup_namespace_name): implement using qualified lookup.
(lookup_name_real): For global scoping, lookup in
global_namespace. For namespace scoping, lookup in given
namespace. For unscoped lookup, iterate over namespace,
considering using directives.
(init_decl_processing): initialize global_namespace.
(grokvardecl): Build assembler name as static name for globals.
(grokdeclarator): Remove old namespace mangling.
(xref_tag): When installing a global binding for the
tag, make sure we have an identifier.
* method.c (build_overload_nested_name): mangle namespaces.
(build_qualified_name): Likewise.
(build_decl_overload_real): Likewise.
* lex.c (build_lang_decl): set namespace for new declaration to
current_namespace.
(do_scoped_id): find global names in global or current
namespace, or using qualified namespace lookup, depending on
context.
* init.c (build_member_call): When scope is namespace, use
build_x_function_call instead.
(build_offset_ref): When scope is namespace, collapse processing
to lookup_namespace_name instead.
* error.c (dump_decl): Support NAMESPACE_DECL.
* decl.c (pushdecl): Bind globals to current namespace.
(push_overloaded_decl): Likewise.
(lookup_tag): Likewise.
(lookup_name_current_level): Likewise.
(xref_tag): Likewise.
(start_function): Likewise.
* lex.c (do_identifier): Likewise.
(identifier_typedecl_value): Likewise.
(real_yylex): Likewise.
* method.c (do_inline_function_hair): Likewise.
* parse.y (unscoped): Likewise.
* pt.c (check_explicit_specialization): Likewise.
(lookup_template_class): Likewise.
* rtti.c (call_void_fn): Likewise.
* sig.c (build_sigtable): Likewise.
* ptree.c (lang_print_xnode): New function.
From-SVN: r18227
1998-02-25 01:49:51 +01:00
|
|
|
|
2015-03-06 22:58:31 +01:00
|
|
|
void
|
|
|
|
cxx_print_lambda_node (FILE *file, tree node, int indent)
|
|
|
|
{
|
|
|
|
if (LAMBDA_EXPR_MUTABLE_P (node))
|
|
|
|
fprintf (file, " /mutable");
|
|
|
|
fprintf (file, " default_capture_mode=[");
|
|
|
|
switch (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (node))
|
|
|
|
{
|
|
|
|
case CPLD_NONE:
|
|
|
|
fprintf (file, "NONE");
|
|
|
|
break;
|
|
|
|
case CPLD_COPY:
|
|
|
|
fprintf (file, "COPY");
|
|
|
|
break;
|
|
|
|
case CPLD_REFERENCE:
|
|
|
|
fprintf (file, "CPLD_REFERENCE");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
fprintf (file, "??");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
fprintf (file, "] ");
|
|
|
|
print_node (file, "capture_list", LAMBDA_EXPR_CAPTURE_LIST (node), indent + 4);
|
|
|
|
print_node (file, "this_capture", LAMBDA_EXPR_THIS_CAPTURE (node), indent + 4);
|
|
|
|
print_node (file, "return_type", LAMBDA_EXPR_RETURN_TYPE (node), indent + 4);
|
|
|
|
print_node (file, "closure", LAMBDA_EXPR_CLOSURE (node), indent + 4);
|
|
|
|
}
|
|
|
|
|
Partial implementation of namespaces.
* decl.c (push_namespace): Handle redeclaration error.
* cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro.
(IDENTIFIER_NAMESPACE_BINDINGS): New macro.
(NAMESPACE_BINDING): New macro.
(IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING.
* *.c: Use them.
* pt.c (push_template_decl): Use innermost_args.
* decl.c (get_unique_name): Tweak from earlier in the name.
* cp-tree.def: Add CPLUS_BINDING node.
* cp-tree.h (tree_binding): new struct
(BINDING_SCOPE, BINDING_VALUE): new macros
(current_namespace, global_namespace): declare extern
(struct lang_decl_flags): new field in_namespace
(DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros
(DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros
(TREE_INDIRECT_USING): new macro
* decl2.c (current_namespace, global_namespace): Declare. The
value is a NAMESPACE_DECL now, not a TREE_LIST.
(is_namespace_ancestor, namespace_ancestor):new static functions.
(add_using_namespace, ambiguous_decl): likewise.
(lookup_using_namespace): new support function for lookup_name.
(qualified_lookup_using_namespace): new support function for
do_scoped_id and lookup_namespace_name
(get_namespace_id): mark as obsolete.
(current_namespace_id): Likewise.
(do_namespace_alias): Implement.
(do_using_directive): Implement as call to add_using_namespace.
* decl.c (binding_for_name): new function.
(push_namespace, pop_namespace): implement.
(push_decl): don't install a FUNCTION_DECL in the global branch.
(lookup_namespace_name): implement using qualified lookup.
(lookup_name_real): For global scoping, lookup in
global_namespace. For namespace scoping, lookup in given
namespace. For unscoped lookup, iterate over namespace,
considering using directives.
(init_decl_processing): initialize global_namespace.
(grokvardecl): Build assembler name as static name for globals.
(grokdeclarator): Remove old namespace mangling.
(xref_tag): When installing a global binding for the
tag, make sure we have an identifier.
* method.c (build_overload_nested_name): mangle namespaces.
(build_qualified_name): Likewise.
(build_decl_overload_real): Likewise.
* lex.c (build_lang_decl): set namespace for new declaration to
current_namespace.
(do_scoped_id): find global names in global or current
namespace, or using qualified namespace lookup, depending on
context.
* init.c (build_member_call): When scope is namespace, use
build_x_function_call instead.
(build_offset_ref): When scope is namespace, collapse processing
to lookup_namespace_name instead.
* error.c (dump_decl): Support NAMESPACE_DECL.
* decl.c (pushdecl): Bind globals to current namespace.
(push_overloaded_decl): Likewise.
(lookup_tag): Likewise.
(lookup_name_current_level): Likewise.
(xref_tag): Likewise.
(start_function): Likewise.
* lex.c (do_identifier): Likewise.
(identifier_typedecl_value): Likewise.
(real_yylex): Likewise.
* method.c (do_inline_function_hair): Likewise.
* parse.y (unscoped): Likewise.
* pt.c (check_explicit_specialization): Likewise.
(lookup_template_class): Likewise.
* rtti.c (call_void_fn): Likewise.
* sig.c (build_sigtable): Likewise.
* ptree.c (lang_print_xnode): New function.
From-SVN: r18227
1998-02-25 01:49:51 +01:00
|
|
|
void
|
Remove traditional C constructs 4/n.
* decl2.c (grok_method_quals, warn_if_unknown_interface,
grok_x_components, cp_build_parm_decl, build_artificial_parm,
maybe_retrofit_in_chrg, grokclassfn, grok_array_decl,
delete_sanity, check_member_template, check_java_method,
check_classfn, finish_static_data_member_decl, grokfield,
grokbitfield, grokoptypename, grok_function_init,
cplus_decl_attributes, constructor_name, defer_fn,
build_anon_union_vars, finish_anon_union, coerce_new_type,
coerce_delete_type, comdat_linkage, maybe_make_one_only,
key_method, import_export_vtable, import_export_class,
output_vtable_inherit, import_export_decl, import_export_tinfo,
build_cleanup, get_guard, get_guard_bits, get_guard_cond,
set_guard, start_objects, finish_objects,
start_static_storage_duration_function,
finish_static_storage_duration_function, get_priority_info,
start_static_initialization_or_destruction,
finish_static_initialization_or_destruction,
do_static_initialization, do_static_destruction,
prune_vars_needing_no_initialization, write_out_vars,
reparse_decl_as_expr, finish_decl_parsing, namespace_ancestor,
add_using_namespace, merge_functions, ambiguous_decl,
lookup_using_namespace, lookup_using_namespace,
qualified_lookup_using_namespace, set_decl_namespace,
decl_namespace, current_decl_namespace, push_decl_namespace,
pop_decl_namespace, push_scope, pop_scope, add_function,
arg_assoc_namespace, arg_assoc_template_arg, arg_assoc,
lookup_arg_dependent, do_namespace_alias,
validate_nonmember_using_decl, do_nonmember_using_decl,
do_toplevel_using_decl, do_local_using_decl,
do_class_using_decl, do_using_directive, check_default_args,
mark_used, handle_class_head): Use C90 prototypings. Use booleans.
* parser.c (cp_parser_class_head): Use booleanss.
* decl.c (walk_globals, walk_vtables): Likewise.
* cp-tree.h (walk_globals_pred, walk_globals_fn, walk_vtables,
walk_globals): Change return type from 'int' to 'bool'.
* rtti.c (init_rtti_processing, build_headof, throw_bad_cast
throw_bad_typeid, get_tinfo_decl_dynamic, typeid_ok_p,
build_typeid, tinfo_name, get_tinfo_decl, get_tinfo_ptr,
get_typeid, ifnonnull, build_dynamic_cast_1, build_dynamic_cast,
qualifier_flags, tinfo_base_init, generic_initializer,
ptr_initializer, dfs_class_hint_mark, ptm_initializer,
dfs_class_hint_unmark, class_hint_flags, class_initializer,
typeinfo_in_lib_p, get_pseudo_ti_init, create_pseudo_type_info,
get_pseudo_ti_desc, create_tinfo_types, emit_support_tinfos,
unemitted_tinfo_decl_p, emit_tinfo_decl): Likewise.
* repo.c (repo_compile_flags, repo_template_declared,
repo_template_defined, repo_class_defined, repo_get_id,
repo_template_used, repo_vtable_used, repo_inline_used,
repo_tinfo_used, repo_template_instantiated, extract_string,
open_repo_file, afgets, init_repo, reopen_repo_file_for_write,
finish_repo): Likewise.
* ptree.c (cxx_print_decl, cxx_print_type, cxx_print_identifier,
cxx_print_xnode): Likewise..
* cp-lang.c (ok_to_generate_alias_set_for_type, cxx_get_alias_set,
cxx_warn_unused_global_decl, cp_expr_size): Likewise.
* cxxfilt.c (demangle_it, print_demangler_list, usage,
standard_symbol_characters, hp_symbol_characters, main, fatal):
Likewise.
(strip_underscore): Change type from 'int' to 'bool'.
(main): Use boolean constants.
From-SVN: r60601
2002-12-29 15:53:05 +01:00
|
|
|
cxx_print_xnode (FILE *file, tree node, int indent)
|
Partial implementation of namespaces.
* decl.c (push_namespace): Handle redeclaration error.
* cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro.
(IDENTIFIER_NAMESPACE_BINDINGS): New macro.
(NAMESPACE_BINDING): New macro.
(IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING.
* *.c: Use them.
* pt.c (push_template_decl): Use innermost_args.
* decl.c (get_unique_name): Tweak from earlier in the name.
* cp-tree.def: Add CPLUS_BINDING node.
* cp-tree.h (tree_binding): new struct
(BINDING_SCOPE, BINDING_VALUE): new macros
(current_namespace, global_namespace): declare extern
(struct lang_decl_flags): new field in_namespace
(DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros
(DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros
(TREE_INDIRECT_USING): new macro
* decl2.c (current_namespace, global_namespace): Declare. The
value is a NAMESPACE_DECL now, not a TREE_LIST.
(is_namespace_ancestor, namespace_ancestor):new static functions.
(add_using_namespace, ambiguous_decl): likewise.
(lookup_using_namespace): new support function for lookup_name.
(qualified_lookup_using_namespace): new support function for
do_scoped_id and lookup_namespace_name
(get_namespace_id): mark as obsolete.
(current_namespace_id): Likewise.
(do_namespace_alias): Implement.
(do_using_directive): Implement as call to add_using_namespace.
* decl.c (binding_for_name): new function.
(push_namespace, pop_namespace): implement.
(push_decl): don't install a FUNCTION_DECL in the global branch.
(lookup_namespace_name): implement using qualified lookup.
(lookup_name_real): For global scoping, lookup in
global_namespace. For namespace scoping, lookup in given
namespace. For unscoped lookup, iterate over namespace,
considering using directives.
(init_decl_processing): initialize global_namespace.
(grokvardecl): Build assembler name as static name for globals.
(grokdeclarator): Remove old namespace mangling.
(xref_tag): When installing a global binding for the
tag, make sure we have an identifier.
* method.c (build_overload_nested_name): mangle namespaces.
(build_qualified_name): Likewise.
(build_decl_overload_real): Likewise.
* lex.c (build_lang_decl): set namespace for new declaration to
current_namespace.
(do_scoped_id): find global names in global or current
namespace, or using qualified namespace lookup, depending on
context.
* init.c (build_member_call): When scope is namespace, use
build_x_function_call instead.
(build_offset_ref): When scope is namespace, collapse processing
to lookup_namespace_name instead.
* error.c (dump_decl): Support NAMESPACE_DECL.
* decl.c (pushdecl): Bind globals to current namespace.
(push_overloaded_decl): Likewise.
(lookup_tag): Likewise.
(lookup_name_current_level): Likewise.
(xref_tag): Likewise.
(start_function): Likewise.
* lex.c (do_identifier): Likewise.
(identifier_typedecl_value): Likewise.
(real_yylex): Likewise.
* method.c (do_inline_function_hair): Likewise.
* parse.y (unscoped): Likewise.
* pt.c (check_explicit_specialization): Likewise.
(lookup_template_class): Likewise.
* rtti.c (call_void_fn): Likewise.
* sig.c (build_sigtable): Likewise.
* ptree.c (lang_print_xnode): New function.
From-SVN: r18227
1998-02-25 01:49:51 +01:00
|
|
|
{
|
|
|
|
switch (TREE_CODE (node))
|
|
|
|
{
|
2005-12-27 10:05:17 +01:00
|
|
|
case BASELINK:
|
|
|
|
print_node (file, "functions", BASELINK_FUNCTIONS (node), indent + 4);
|
|
|
|
print_node (file, "binfo", BASELINK_BINFO (node), indent + 4);
|
2006-06-06 13:44:09 +02:00
|
|
|
print_node (file, "access_binfo", BASELINK_ACCESS_BINFO (node),
|
2005-12-27 10:05:17 +01:00
|
|
|
indent + 4);
|
|
|
|
break;
|
1998-05-08 04:06:26 +02:00
|
|
|
case OVERLOAD:
|
|
|
|
print_node (file, "function", OVL_FUNCTION (node), indent+4);
|
|
|
|
print_node (file, "chain", TREE_CHAIN (node), indent+4);
|
1998-05-11 13:37:13 +02:00
|
|
|
break;
|
1998-03-30 12:56:25 +02:00
|
|
|
case TEMPLATE_PARM_INDEX:
|
2016-10-21 21:45:39 +02:00
|
|
|
print_node (file, "decl", TEMPLATE_PARM_DECL (node), indent+4);
|
1998-03-30 12:56:25 +02:00
|
|
|
indent_to (file, indent + 3);
|
2007-03-15 14:51:09 +01:00
|
|
|
fprintf (file, "index %d level %d orig_level %d",
|
2003-05-17 03:40:45 +02:00
|
|
|
TEMPLATE_PARM_IDX (node), TEMPLATE_PARM_LEVEL (node),
|
|
|
|
TEMPLATE_PARM_ORIG_LEVEL (node));
|
1998-03-30 12:56:25 +02:00
|
|
|
break;
|
2010-07-16 23:05:07 +02:00
|
|
|
case TEMPLATE_INFO:
|
|
|
|
print_node (file, "template", TI_TEMPLATE (node), indent+4);
|
|
|
|
print_node (file, "args", TI_ARGS (node), indent+4);
|
|
|
|
if (TI_PENDING_TEMPLATE_FLAG (node))
|
|
|
|
{
|
|
|
|
indent_to (file, indent + 3);
|
|
|
|
fprintf (file, "pending_template");
|
|
|
|
}
|
|
|
|
break;
|
Add C++ Concepts TS support.
gcc/c-family/
* c-common.c (c_common_reswords): Add __is_same_as, concept, requires.
* c-common.h (enum rid): Add RID_IS_SAME_AS, RID_CONCEPT, RID_REQUIRES.
(D_CXX_CONCEPTS, D_CXX_CONCEPTS_FLAGS): New.
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_concepts.
* c-opts.c (set_std_cxx1z): Set flag_concepts.
* c.opt (fconcepts): New.
gcc/cp/
* constraint.cc, logic.cc: New files.
* Make-lang.in (CXX_AND_OBJCXX_OBJS): Add constraint.o and logic.o.
(c++.tags): Also process .cc files.
* call.c (enum rejection_reason_code): Add rr_constraint_failure.
(print_z_candidate): Handle it.
(constraint_failure): New.
(add_function_candidate): Check constraints.
(build_new_function_call): Handle evaluating concepts.
(joust): Check more_constrained.
* class.c (add_method): Check equivalently_constrained.
(build_clone): Copy constraints.
(currently_open_class): Return tree.
(resolve_address_of_overloaded_function): Check constraints.
* constexpr.c (cxx_eval_constant_expression): Handle REQUIRES_EXPR.
(potential_constant_expression_1): Likewise.
* cp-objcp-common.c (cp_tree_size): Handle CONSTRAINT_INFO.
(cp_common_init_ts): Handle WILDCARD_DECL and REQUIRES_EXPR.
* cp-tree.def: Add CONSTRAINT_INFO, WILDCARD_DECL, REQUIRES_EXPR,
SIMPLE_REQ, TYPE_REQ, COMPOUND_REQ, NESTED_REQ, PRED_CONSTR,
EXPR_CONSTR, TYPE_CONSTR, ICONV_CONSTR, DEDUCT_CONSTR,
EXCEPT_CONSTR, PARM_CONSTR, CONJ_CONSTR, DISJ_CONSTR.
* cp-tree.h (struct tree_constraint_info, check_nonnull)
(check_constraint_info, CI_TEMPLATE_REQS, CI_DECLARATOR_REQS)
(CI_ASSOCIATED_CONSTRAINTS, CI_NORMALIZED_CONSTRAINTS)
(CI_ASSUMPTIONS, TEMPLATE_PARMS_CONSTRAINTS)
(TEMPLATE_PARM_CONSTRAINTS, COMPOUND_REQ_NOEXCEPT_P)
(PLACEHOLDER_TYPE_CONSTRAINTS, PRED_CONSTR_EXPR, EXPR_CONSTR_EXPR)
(TYPE_CONSTR_TYPE, ICONV_CONSTR_EXPR, ICONV_CONSTR_TYPE)
(DEDUCT_CONSTR_EXPR, DEDUCT_CONSTR_PATTERN)
(DEDUCT_CONSTR_PLACEHOLDER, EXCEPT_CONSTR_EXPR, PARM_CONSTR_PARMS)
(PARM_CONSTR_OPERAND, CONSTRAINT_VAR_P, CONSTRAINED_PARM_CONCEPT)
(CONSTRAINED_PARM_EXTRA_ARGS, CONSTRAINED_PARM_PROTOTYPE)
(DECL_DECLARED_CONCEPT_P, WILDCARD_PACK_P, struct cp_unevaluated)
(struct local_specialization_stack, enum auto_deduction_context)
(variable_concept_p, concept_template_p)
(struct deferring_access_check_sentinel): New.
(enum cp_tree_node_structure_enum): Add TS_CP_CONSTRAINT_INFO.
(union lang_tree_node): Add constraint_info field.
(struct lang_decl_base): Add concept_p flag.
(enum cp_decl_spec): Add ds_concept.
(struct cp_declarator): Add requires_clause.
* cxx-pretty-print.c (cxx_pretty_printer::primary_expression)
(cxx_pretty_printer::expression): Handle REQUIRES_EXPR,
TRAIT_EXPR, *_CONSTR.
(pp_cxx_parameter_declaration_clause): Accept a chain of
PARM_DECLs.
(cxx_pretty_printer::declarator): Print requires-clause.
(pp_cxx_template_declaration): Likewise.
(pp_cxx_trait_expression): Handle CPTK_IS_SAME_AS.
(pp_cxx_requires_clause, pp_cxx_requirement)
(pp_cxx_requirement_list, pp_cxx_requirement_body)
(pp_cxx_requires_expr, pp_cxx_simple_requirement)
(pp_cxx_type_requirement, pp_cxx_compound_requirement)
(pp_cxx_nested_requirement, pp_cxx_predicate_constraint)
(pp_cxx_expression_constraint, pp_cxx_type_constraint)
(pp_cxx_implicit_conversion_constraint)
(pp_cxx_argument_deduction_constraint)
(pp_cxx_exception_constraint, pp_cxx_parameterized_constraint)
(pp_cxx_conjunction, pp_cxx_disjunction, pp_cxx_constraint): New.
* cxx-pretty-print.h: Declare them.
* decl.c (decls_match): Compare constraints.
(duplicate_decls): Likewise. Remove constraints before freeing.
(cxx_init_decl_processing): Call init_constraint_processing.
(cp_finish_decl): Diagnose concept without initializer.
(grokfndecl, grokvardecl): Handle concepts and constraints.
(grokdeclarator): Handle concept, requires-clause.
(grokparms): No longer static.
(xref_tag_1): Check constraints.
(finish_function): Call check_function_concept.
(cp_tree_node_structure): Handle CONSTRAINT_INFO.
(check_concept_refinement, is_concept_var, check_concept_fn): New.
* decl2.c (check_classfn): Compare constraints.
(mark_used): Don't instantiate concepts.
* error.c (dump_template_decl): Print constraints.
(dump_function_decl): Likewise.
(dump_expr): Handle REQUIRES_EXPR, *_REQ, *_CONSTR.
* lex.c (init_reswords): Set D_CXX_CONCEPTS.
* method.c (implicitly_declare_fn): Copy constraints from
inherited ctor.
* parser.h (struct cp_parser): Add in_result_type_constraint_p and
prevent_constrained_type_specifiers fields.
* parser.c (make_call_declarator): Add requires_clause parm.
(cp_parser_new): Clear prevent_constrained_type_specifiers.
(cp_parser_primary_expression): Handle RID_IS_SAME_AS, RID_REQUIRES.
(cp_parser_postfix_expression): Set prevent_constrained_type_specifiers.
(cp_parser_trait_expr): Handle RID_IS_SAME_AS.
(cp_parser_declaration): Handle concept introduction.
(cp_parser_member_declaration): Likewise.
(cp_parser_template_parameter): Handle constrained parameter.
(cp_parser_type_parameter): Handle constraints.
(cp_parser_decl_specifier_seq): Handle RID_CONCEPT.
(cp_parser_template_id): Handle partial concept id.
(cp_parser_type_name): Add overload that takes typename_keyword_p.
Handle constrained parameter.
(cp_parser_nonclass_name): Handle concept names.
(cp_parser_alias_declaration): Handle constraints.
(cp_parser_late_return_type_opt): Also handle requires-clause.
(cp_parser_type_id_1): Handle deduction constraint.
(cp_parser_parameter_declaration): Handle constrained parameters.
(cp_parser_class_specifier_1): Handle constraints.
(cp_parser_template_declaration_after_parameters): Split out from
cp_parser_template_declaration_after_export.
(cp_parser_single_declaration): Handle constraints.
(synthesize_implicit_template_parm): Handle constraints.
(cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id)
(cp_parser_introduction_list, get_id_declarator)
(get_unqualified_id, is_constrained_parameter)
(cp_parser_check_constrained_type_parm)
(cp_parser_constrained_type_template_parm)
(cp_parser_constrained_template_template_parm)
(constrained_non_type_template_parm, finish_constrained_parameter)
(declares_constrained_type_template_parameter)
(declares_constrained_template_template_parameter)
(check_type_concept, cp_parser_maybe_constrained_type_specifier)
(cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id)
(cp_parser_requires_clause, cp_parser_requires_clause_opt)
(cp_parser_requires_expression)
(cp_parser_requirement_parameter_list, cp_parser_requirement_body)
(cp_parser_requirement_list, cp_parser_requirement)
(cp_parser_simple_requirement, cp_parser_type_requirement)
(cp_parser_compound_requirement, cp_parser_nested_requirement)
(cp_parser_template_introduction)
(cp_parser_explicit_template_declaration)
(get_concept_from_constraint): New.
* pt.c (local_specialization_stack): Implement.
(maybe_new_partial_specialization): New.
(maybe_process_partial_specialization): Use it.
(retrieve_local_specialization, register_local_specialization)
(template_parm_to_arg, build_template_decl, extract_fnparm_pack)
(tsubst_expr): No longer static.
(spec_hasher::equal): Compare constraints.
(determine_specialization): Handle constraints.
(check_explicit_specialization): Handle concepts.
(process_template_parm): Handle constraints.
(end_template_parm_list): Add overload taking no arguments.
(process_partial_specialization): Handle concepts and constraints.
Register partial specializations of variable templates.
(redeclare_class_template): Handle constraints.
(convert_template_argument): Handle WILDCARD_DECL. Check
is_compatible_template_arg.
(coerce_template_parameter_pack): Handle wildcard packs.
(coerce_template_parms): DR 1430 also applies to concepts. Add
overloads taking fewer parameters.
(lookup_template_class_1): Handle constraints.
(lookup_template_variable): Concepts are always bool.
(finish_template_variable): Handle concepts and constraints.
(tsubst_friend_class): Handle constraints.
(gen_elem_of_pack_expansion_instantiation): Handle constraints.
(tsubst_pack_expansion): Handle local parameters.
(tsubst_decl) [FUNCTION_DECL]: Handle constraints.
(tsubst) [TEMPLATE_TYPE_PARM]: Handle deduction constraints.
(tsubst_copy_and_build): Handle REQUIRES_EXPR.
(more_specialized_fn, more_specialized_partial_spec): Check constraints.
(more_specialized_inst): Split out from most_specialized_instantiation.
(most_specialized_partial_spec): Check constraints.
(instantiate_decl): Never instantiate a concept.
(value_dependent_expression_p): Handle REQUIRES_EXPR, TYPE_REQ,
variable concepts.
(type_dependent_expression_p): Handle WILDCARD_DECL, REQUIRES_EXPR.
(instantiation_dependent_r): Handle REQUIRES_EXPR and concepts.
(do_auto_deduction): Add overload taking tsubst flags and context enum.
Handle constraints.
(get_template_for_ordering, most_constrained_function)
(is_compatible_template_arg, convert_wildcard_argument)
(struct constr_entry, struct constr_hasher, decl_constraints)
(valid_constraints_p, get_constraints, set_constraints)
(remove_constraints, init_constraint_processing): New.
* ptree.c (cxx_print_xnode): Handle CONSTRAINT_INFO.
* search.c (lookup_member): Do lookup in the open partial
instantiation.
* semantics.c (finish_template_template_parm): Handle constraints.
(fixup_template_type): New.
(finish_template_type): Call it.
(trait_expr_value, finish_trait_expr): Handle CPTK_IS_SAME_AS.
* tree.c (cp_tree_equal): Handle local parameters, CONSTRAINT_INFO.
(cp_walk_subtrees): Handle REQUIRES_EXPR.
* typeck.c (cp_build_function_call_vec): Check constraints.
Co-Authored-By: Braden Obrzut <admin@maniacsvault.net>
Co-Authored-By: Jason Merrill <jason@redhat.com>
From-SVN: r226713
2015-08-07 07:44:49 +02:00
|
|
|
case CONSTRAINT_INFO:
|
|
|
|
{
|
|
|
|
tree_constraint_info *cinfo = (tree_constraint_info *)node;
|
|
|
|
if (cinfo->template_reqs)
|
|
|
|
print_node (file, "template_reqs", cinfo->template_reqs, indent+4);
|
|
|
|
if (cinfo->declarator_reqs)
|
|
|
|
print_node (file, "declarator_reqs", cinfo->declarator_reqs,
|
|
|
|
indent+4);
|
|
|
|
print_node (file, "associated_constr",
|
|
|
|
cinfo->associated_constr, indent+4);
|
|
|
|
break;
|
|
|
|
}
|
2011-05-25 21:52:18 +02:00
|
|
|
case ARGUMENT_PACK_SELECT:
|
|
|
|
print_node (file, "pack", ARGUMENT_PACK_SELECT_FROM_PACK (node),
|
|
|
|
indent+4);
|
|
|
|
indent_to (file, indent + 3);
|
|
|
|
fprintf (file, "index %d", ARGUMENT_PACK_SELECT_INDEX (node));
|
|
|
|
break;
|
2011-06-08 23:35:02 +02:00
|
|
|
case DEFERRED_NOEXCEPT:
|
|
|
|
print_node (file, "pattern", DEFERRED_NOEXCEPT_PATTERN (node), indent+4);
|
|
|
|
print_node (file, "args", DEFERRED_NOEXCEPT_ARGS (node), indent+4);
|
|
|
|
break;
|
2015-05-18 19:13:59 +02:00
|
|
|
case TRAIT_EXPR:
|
|
|
|
indent_to (file, indent+4);
|
|
|
|
fprintf (file, "kind %d", TRAIT_EXPR_KIND (node));
|
|
|
|
print_node (file, "type 1", TRAIT_EXPR_TYPE1 (node), indent+4);
|
|
|
|
if (TRAIT_EXPR_TYPE2 (node))
|
|
|
|
print_node (file, "type 2", TRAIT_EXPR_TYPE2 (node), indent+4);
|
|
|
|
break;
|
2015-03-06 22:58:31 +01:00
|
|
|
case LAMBDA_EXPR:
|
|
|
|
cxx_print_lambda_node (file, node, indent);
|
|
|
|
break;
|
Partial implementation of namespaces.
* decl.c (push_namespace): Handle redeclaration error.
* cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro.
(IDENTIFIER_NAMESPACE_BINDINGS): New macro.
(NAMESPACE_BINDING): New macro.
(IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING.
* *.c: Use them.
* pt.c (push_template_decl): Use innermost_args.
* decl.c (get_unique_name): Tweak from earlier in the name.
* cp-tree.def: Add CPLUS_BINDING node.
* cp-tree.h (tree_binding): new struct
(BINDING_SCOPE, BINDING_VALUE): new macros
(current_namespace, global_namespace): declare extern
(struct lang_decl_flags): new field in_namespace
(DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros
(DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros
(TREE_INDIRECT_USING): new macro
* decl2.c (current_namespace, global_namespace): Declare. The
value is a NAMESPACE_DECL now, not a TREE_LIST.
(is_namespace_ancestor, namespace_ancestor):new static functions.
(add_using_namespace, ambiguous_decl): likewise.
(lookup_using_namespace): new support function for lookup_name.
(qualified_lookup_using_namespace): new support function for
do_scoped_id and lookup_namespace_name
(get_namespace_id): mark as obsolete.
(current_namespace_id): Likewise.
(do_namespace_alias): Implement.
(do_using_directive): Implement as call to add_using_namespace.
* decl.c (binding_for_name): new function.
(push_namespace, pop_namespace): implement.
(push_decl): don't install a FUNCTION_DECL in the global branch.
(lookup_namespace_name): implement using qualified lookup.
(lookup_name_real): For global scoping, lookup in
global_namespace. For namespace scoping, lookup in given
namespace. For unscoped lookup, iterate over namespace,
considering using directives.
(init_decl_processing): initialize global_namespace.
(grokvardecl): Build assembler name as static name for globals.
(grokdeclarator): Remove old namespace mangling.
(xref_tag): When installing a global binding for the
tag, make sure we have an identifier.
* method.c (build_overload_nested_name): mangle namespaces.
(build_qualified_name): Likewise.
(build_decl_overload_real): Likewise.
* lex.c (build_lang_decl): set namespace for new declaration to
current_namespace.
(do_scoped_id): find global names in global or current
namespace, or using qualified namespace lookup, depending on
context.
* init.c (build_member_call): When scope is namespace, use
build_x_function_call instead.
(build_offset_ref): When scope is namespace, collapse processing
to lookup_namespace_name instead.
* error.c (dump_decl): Support NAMESPACE_DECL.
* decl.c (pushdecl): Bind globals to current namespace.
(push_overloaded_decl): Likewise.
(lookup_tag): Likewise.
(lookup_name_current_level): Likewise.
(xref_tag): Likewise.
(start_function): Likewise.
* lex.c (do_identifier): Likewise.
(identifier_typedecl_value): Likewise.
(real_yylex): Likewise.
* method.c (do_inline_function_hair): Likewise.
* parse.y (unscoped): Likewise.
* pt.c (check_explicit_specialization): Likewise.
(lookup_template_class): Likewise.
* rtti.c (call_void_fn): Likewise.
* sig.c (build_sigtable): Likewise.
* ptree.c (lang_print_xnode): New function.
From-SVN: r18227
1998-02-25 01:49:51 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-02-10 16:34:45 +01:00
|
|
|
|
|
|
|
/* Print the node NODE on standard error, for debugging. */
|
|
|
|
|
|
|
|
DEBUG_FUNCTION void
|
|
|
|
debug_tree (cp_expr node)
|
|
|
|
{
|
|
|
|
debug_tree (node.get_value());
|
|
|
|
}
|