gcc/gcc/cp/ptree.c

302 lines
8.9 KiB
C
Raw Normal View History

1994-02-24 02:02:37 +01:00
/* Prints out trees in human readable form.
Copyright (C) 1992-2017 Free Software Foundation, Inc.
1994-02-24 02:02:37 +01:00
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
1994-02-24 02:02:37 +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
the Free Software Foundation; either version 3, or (at your option)
1994-02-24 02:02:37 +01:00
any later version.
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
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"
#include "system.h"
#include "coretypes.h"
1994-02-24 02:02:37 +01:00
#include "cp-tree.h"
decl.c: Reorder #include's and remove duplicates. ada 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * gcc-interface/decl.c: Reorder #include's and remove duplicates. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. c 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * c-array-notation.c: Reorder #include's and remove duplicates. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. c-family 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * array-notation-common.c: Reorder #include's and remove duplicates. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.c: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * call.c: Reorder #include's and remove duplicates. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-cilkplus.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * cxx-pretty-print.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. * vtable-class-hierarchy.c: Likewise. fortran 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * array.c: Reorder #include's and remove duplicates. * convert.c: Likewise. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * frontend-passes.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * resolve.c: Likewise. * simplify.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * go-backend.c: Reorder #include's and remove duplicates. * go-lang.c: Likewise. java 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * boehm.c: Reorder #include's and remove duplicates. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. * verify-impl.c: Likewise. jit 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * dummy-frontend.c: Reorder #include's and remove duplicates. * jit-builtins.c: Likewise. * jit-playback.c: Likewise. * jit-recording.c: Likewise. * libgccjit.c: Likewise. lto 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * lto-lang.c: Reorder #include's and remove duplicates. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * objc-lang.c: Reorder #include's and remove duplicates. * objc-map.c: Likewise. objcp 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * objcp-decl.c: Reorder #include's and remove duplicates. * objcp-lang.c: Likewise. From-SVN: r229533
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
{
if (TREE_CODE (node) == FIELD_DECL)
1994-02-24 02:02:37 +01:00
{
if (DECL_MUTABLE_P (node))
{
indent_to (file, indent + 3);
fprintf (file, " mutable ");
}
return;
1994-02-24 02:02:37 +01:00
}
In gcc/ 2005-12-05 Daniel Berlin <dberlin@dberlin.org> In gcc/ 2005-12-05 Daniel Berlin <dberlin@dberlin.org> * print-tree.c (print_node): Ditto. * tree-dfa.c (add_referenced_var): Tag's don't have DECL_INITIAL. * tree-dump.c (dequeue_and_dump): Check for decl_common structure before accessing DECL_ARTIFICIAL. Handle new tag tree codes. * tree-flow-inline.h (clear_call_clobbered): Update for tag changes. (unmodifiable_var_p): Ditto. * tree-flow.h (mem_tag_kind): Remove. (struct var_ann_d): Remove mem_tag_kind member. * tree-gimple.c (is_gimple_reg): Tags are not gimple registers. * tree-pretty-print.c (dump_generic_node): Handle memory tags. * tree-ssa-alias.c (init_alias_info): Update for memory tag changes. (group_aliases): Ditto. (setup_pointers_and_addressables): Ditto. (is_escape_site): Ditto. (may_alias_p): Ditto. (create_tag_raw): New function. (create_memory_tag): Use it. (dump_alias_info): Update for tags. (may_be_aliased): Ditto. (add_type_alias): Ditto. (new_type_alias): Ditto. (create_sft): Ditto. (create_structure_vars): Ditto. * tree-ssa-ccp.c (get_default_value): Ditto. * tree-ssa-operands.c (get_expr_operands): Ditto. (add_stmt_operand): Ditto. (add_call_clobber_ops): Remove duplicated condition. * tree-ssa.c (verify_flow_insensitive_alias_info): Update for tags. * tree-tailcall.c (suitable_for_tail_opt_p): Ditto. * tree-vect-transform.c (vect_create_data_ref_ptr): Ditto. * tree.c (init_ttree): Update structures for new tree codes. (tree_code_size): Update sizes for new tree codes. (make_node_stat): Don't try to set common things on minimal structures. (tree_node_structure): Update for tags. (is_global_var): Ditto. * tree.def: Add new tree codes. * tree.h (MTAG_P): New macro. (TREE_MEMORY_TAG_CHECK): Ditto. (SSA_VAR_P): Update for tags. (struct tree_memory_tag): New structure. (MTAG_GLOBAL): New macro. (union tree_node): Add memory tag member. * treestruct.def (TS_MEMORY_TAG): New. In gcc/cp 2005-12-05 Daniel Berlin <dberlin@dberlin.org> * ptree.c (cxx_print_decl): Update to check for decl_common structure. From-SVN: r108102
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;
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)
{
print_node (file, "parms", DECL_TEMPLATE_PARMS (node), indent + 4);
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);
if (DECL_EXTERNAL (node) && DECL_NOT_REALLY_EXTERN (node))
fprintf (file, " not-really-extern");
if (TREE_CODE (node) == FUNCTION_DECL
&& DECL_PENDING_INLINE_INFO (node))
fprintf (file, " pending-inline-info %p",
(void *) DECL_PENDING_INLINE_INFO (node));
if (VAR_OR_FUNCTION_DECL_P (node)
&& DECL_TEMPLATE_INFO (node))
fprintf (file, " template-info %p",
(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
{
switch (TREE_CODE (node))
1994-02-24 02:02:37 +01:00
{
case BOUND_TEMPLATE_TEMPLATE_PARM:
print_node (file, "args", TYPE_TI_ARGS (node), indent + 4);
gcc_fallthrough ();
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);
fprintf (file, "index %d level %d orig_level %d",
TEMPLATE_TYPE_IDX (node), TEMPLATE_TYPE_LEVEL (node),
TEMPLATE_TYPE_ORIG_LEVEL (node));
1994-02-24 02:02:37 +01:00
return;
case FUNCTION_TYPE:
case METHOD_TYPE:
if (TYPE_RAISES_EXCEPTIONS (node))
print_node (file, "throws", TYPE_RAISES_EXCEPTIONS (node), indent + 4);
return;
case RECORD_TYPE:
case UNION_TYPE:
break;
case DECLTYPE_TYPE:
print_node (file, "expr", DECLTYPE_TYPE_EXPR (node), indent + 4);
return;
case TYPENAME_TYPE:
print_node (file, "fullname", TYPENAME_TYPE_FULLNAME (node),
indent + 4);
return;
case TYPE_PACK_EXPANSION:
print_node (file, "args", PACK_EXPANSION_EXTRA_ARGS (node), indent + 4);
return;
default:
return;
1994-02-24 02:02:37 +01:00
}
if (TYPE_PTRMEMFUNC_P (node))
print_node (file, "ptrmemfunc fn type", TYPE_PTRMEMFUNC_FN_TYPE (node),
indent + 4);
if (! CLASS_TYPE_P (node))
1994-02-24 02:02:37 +01:00
return;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
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))
fputs ( " needs-constructor", file);
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);
if (TYPE_HAS_COPY_CTOR (node))
1994-02-24 02:02:37 +01: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);
}
if (TYPE_HAS_NEW_OPERATOR (node))
fputs (" new", file);
if (TYPE_HAS_ARRAY_NEW_OPERATOR (node))
fputs (" new[]", file);
if (TYPE_GETS_DELETE (node) & 1)
fputs (" delete", file);
if (TYPE_GETS_DELETE (node) & 2)
fputs (" delete[]", file);
if (TYPE_HAS_COPY_ASSIGN (node))
1994-02-24 02:02:37 +01:00
fputs (" this=(X&)", file);
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
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)
{
call.c (build_user_type_conversion_1, [...]): Pass type directly to lookup_fnfields & build_special_member_call. * call.c (build_user_type_conversion_1, build_new_op, check_constructor_callable, build_temp, perform_direct_initialization_of_possible): Pass type directly to lookup_fnfields & build_special_member_call. (build_special_member_call): Accept a type, and complete it. * class.c (finish_stuct_bits): Copy the BINFOs here. * cvt.c (ocp_convert): Pass type directly to build_special_member_call. * decl.c (build_ptrmemfunc_type): Call xref_bastypes here. (xref_basetypes): Allocate the binfo here. Adjust. * init.c (build_init, build_new_1): Pass type directly to build_special_member_call. * lex.c (cxx_make_type): Do not allocate binfo here. * name-lookup.c (arg_assoc_class): Incomplete types have no binfo. * parser.c (cp_parser_class_head): Always call xref_basetypes. * pt.c (instantiate_class_template): Likewise. Inhibit access checking for template friends. * ptree.c (cxx_print_type): Adjust record printing. * search.c (lookup_base): When taking a type, complete it before looking for a binfo. (lookup_member): Delay completing a type. (push_class_decls): Don't walk an incomplete type. (lookup_conversions): Likewise. * semantics.c (finish_stmt_expr_expr): Pass type directly to build_special_member_call. * tree.c (copy_base_binfos): Adjust. (make_binfo): Likewise. * typeck.c (build_modify_expr): Pass type directly to build_special_member_call. * typeck2.c (process_init_constructor): Check a binfo exists. (build_m_component_ref): Allow accessing an incomplete type. (build_functional_cast): Pass type directly to build_special_member_call. From-SVN: r84562
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");
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");
}
}
Compile-time improvement: 2/n. * cp-tree.h (struct cxx_binding): New datatype; (struct lang_identifier): Use it. (LOCAL_BINDING_P): Adjust definition. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Likewise. (BINDING_HAS_LEVEL_P): Likewise. (BINDING_VALUE): Likewise. (BINDING_TYPE): Likewise. (IDENTIFIER_VALUE): Likewise. (struct tree_binding): Remove. (TS_CP_BINDING): Likewise. ((union lang_tree_node): Remove field "binding". (cxx_binding_clear): New macro. (binding_for_name): Adjust return type. (qualified_lookup_using_namespace): Adjust prototype. (lookup_using_namespace): Adjust prototype. (cxx_scope_find_binding_for_name): Declare. * cp-tree.def: Remove CPLUS_BINDING definition. * parse.y (parse_scoped_id): Don't type-abuse of 'id'. Allocate temporary cxx_binding on stack. Simplify. * decl.c (push_binding): Adjust local variable type. (add_binding): Likewise. (push_class_binding): Likewise. (pop_binding): Likewise. (poplevel): Likewise. (poplevel_class): Likewise. (free_bindings): Adjust type. (find_binding): Adjust return type, add a third parameter. Remove non-useful assertion now that we use static typing. (cxx_scope_find_binding_for_name): New function. (binding_for_name): Use it. Adjust local variable type. Simplify. (namespace_binding): Simplify. (set_namespace_binding): Likewise. (set_identifier_type_value_with_scope): Adjust local variable type. (lookup_tag): Don't type-abuse of local variable 'old'. (lookup_namespace_name): Likewise. Allocate binding on stack. (select_decl): Adjust prototype. (unqualified_namespace_lookup): Allocate binding on stack. Don't type-abuse of local variable 'val'. (lookup_name_real): Likewise. (maybe_inject_for_scope_var): Adjust local variable type. (cp_tree_node_structure): Remove CPLUS_BINDING case label. (namespace_binding): Adjust logic, simplify. (BINDING_LEVEL): Adjust definition. (push_class_level_binding): Adjust local variable type. (struct cxx_saved_binding): Adjust field 'binding' type. * decl2.c (ambiguous_decl): Adjust prototype. (lookup_using_namespace): Adjust local variable type. (qualified_lookup_using_namespace): Catch type error and correct ensueing logic error. (do_nonmember_using_decl): Adjust local variable type. Allocate temporary cxx_binding on stack. (do_toplevel_using_decl): Adjust local variable type. * ptree.c (cxx_print_cxx_binding): New function. (cxx_print_identifier): Use it. (cxx_print_xnode): Delete CPLUS_BINDING case label. From-SVN: r64405
2003-03-15 17:30:02 +01:00
static void
cxx_print_binding (FILE *stream, cxx_binding *binding, const char *prefix)
{
fprintf (stream, "%s <%p>",
prefix, (void *) binding);
Compile-time improvement: 2/n. * cp-tree.h (struct cxx_binding): New datatype; (struct lang_identifier): Use it. (LOCAL_BINDING_P): Adjust definition. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Likewise. (BINDING_HAS_LEVEL_P): Likewise. (BINDING_VALUE): Likewise. (BINDING_TYPE): Likewise. (IDENTIFIER_VALUE): Likewise. (struct tree_binding): Remove. (TS_CP_BINDING): Likewise. ((union lang_tree_node): Remove field "binding". (cxx_binding_clear): New macro. (binding_for_name): Adjust return type. (qualified_lookup_using_namespace): Adjust prototype. (lookup_using_namespace): Adjust prototype. (cxx_scope_find_binding_for_name): Declare. * cp-tree.def: Remove CPLUS_BINDING definition. * parse.y (parse_scoped_id): Don't type-abuse of 'id'. Allocate temporary cxx_binding on stack. Simplify. * decl.c (push_binding): Adjust local variable type. (add_binding): Likewise. (push_class_binding): Likewise. (pop_binding): Likewise. (poplevel): Likewise. (poplevel_class): Likewise. (free_bindings): Adjust type. (find_binding): Adjust return type, add a third parameter. Remove non-useful assertion now that we use static typing. (cxx_scope_find_binding_for_name): New function. (binding_for_name): Use it. Adjust local variable type. Simplify. (namespace_binding): Simplify. (set_namespace_binding): Likewise. (set_identifier_type_value_with_scope): Adjust local variable type. (lookup_tag): Don't type-abuse of local variable 'old'. (lookup_namespace_name): Likewise. Allocate binding on stack. (select_decl): Adjust prototype. (unqualified_namespace_lookup): Allocate binding on stack. Don't type-abuse of local variable 'val'. (lookup_name_real): Likewise. (maybe_inject_for_scope_var): Adjust local variable type. (cp_tree_node_structure): Remove CPLUS_BINDING case label. (namespace_binding): Adjust logic, simplify. (BINDING_LEVEL): Adjust definition. (push_class_level_binding): Adjust local variable type. (struct cxx_saved_binding): Adjust field 'binding' type. * decl2.c (ambiguous_decl): Adjust prototype. (lookup_using_namespace): Adjust local variable type. (qualified_lookup_using_namespace): Catch type error and correct ensueing logic error. (do_nonmember_using_decl): Adjust local variable type. Allocate temporary cxx_binding on stack. (do_toplevel_using_decl): Adjust local variable type. * ptree.c (cxx_print_cxx_binding): New function. (cxx_print_identifier): Use it. (cxx_print_xnode): Delete CPLUS_BINDING case label. From-SVN: r64405
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
{
if (indent == 0)
fprintf (file, " ");
else
indent_to (file, indent + 4);
Compile-time improvement: 2/n. * cp-tree.h (struct cxx_binding): New datatype; (struct lang_identifier): Use it. (LOCAL_BINDING_P): Adjust definition. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Likewise. (BINDING_HAS_LEVEL_P): Likewise. (BINDING_VALUE): Likewise. (BINDING_TYPE): Likewise. (IDENTIFIER_VALUE): Likewise. (struct tree_binding): Remove. (TS_CP_BINDING): Likewise. ((union lang_tree_node): Remove field "binding". (cxx_binding_clear): New macro. (binding_for_name): Adjust return type. (qualified_lookup_using_namespace): Adjust prototype. (lookup_using_namespace): Adjust prototype. (cxx_scope_find_binding_for_name): Declare. * cp-tree.def: Remove CPLUS_BINDING definition. * parse.y (parse_scoped_id): Don't type-abuse of 'id'. Allocate temporary cxx_binding on stack. Simplify. * decl.c (push_binding): Adjust local variable type. (add_binding): Likewise. (push_class_binding): Likewise. (pop_binding): Likewise. (poplevel): Likewise. (poplevel_class): Likewise. (free_bindings): Adjust type. (find_binding): Adjust return type, add a third parameter. Remove non-useful assertion now that we use static typing. (cxx_scope_find_binding_for_name): New function. (binding_for_name): Use it. Adjust local variable type. Simplify. (namespace_binding): Simplify. (set_namespace_binding): Likewise. (set_identifier_type_value_with_scope): Adjust local variable type. (lookup_tag): Don't type-abuse of local variable 'old'. (lookup_namespace_name): Likewise. Allocate binding on stack. (select_decl): Adjust prototype. (unqualified_namespace_lookup): Allocate binding on stack. Don't type-abuse of local variable 'val'. (lookup_name_real): Likewise. (maybe_inject_for_scope_var): Adjust local variable type. (cp_tree_node_structure): Remove CPLUS_BINDING case label. (namespace_binding): Adjust logic, simplify. (BINDING_LEVEL): Adjust definition. (push_class_level_binding): Adjust local variable type. (struct cxx_saved_binding): Adjust field 'binding' type. * decl2.c (ambiguous_decl): Adjust prototype. (lookup_using_namespace): Adjust local variable type. (qualified_lookup_using_namespace): Catch type error and correct ensueing logic error. (do_nonmember_using_decl): Adjust local variable type. Allocate temporary cxx_binding on stack. (do_toplevel_using_decl): Adjust local variable type. * ptree.c (cxx_print_cxx_binding): New function. (cxx_print_identifier): Use it. (cxx_print_xnode): Delete CPLUS_BINDING case label. From-SVN: r64405
2003-03-15 17:30:02 +01:00
cxx_print_binding (file, IDENTIFIER_NAMESPACE_BINDINGS (node), "bindings");
if (indent == 0)
fprintf (file, " ");
else
indent_to (file, indent + 4);
Compile-time improvement: 2/n. * cp-tree.h (struct cxx_binding): New datatype; (struct lang_identifier): Use it. (LOCAL_BINDING_P): Adjust definition. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Likewise. (BINDING_HAS_LEVEL_P): Likewise. (BINDING_VALUE): Likewise. (BINDING_TYPE): Likewise. (IDENTIFIER_VALUE): Likewise. (struct tree_binding): Remove. (TS_CP_BINDING): Likewise. ((union lang_tree_node): Remove field "binding". (cxx_binding_clear): New macro. (binding_for_name): Adjust return type. (qualified_lookup_using_namespace): Adjust prototype. (lookup_using_namespace): Adjust prototype. (cxx_scope_find_binding_for_name): Declare. * cp-tree.def: Remove CPLUS_BINDING definition. * parse.y (parse_scoped_id): Don't type-abuse of 'id'. Allocate temporary cxx_binding on stack. Simplify. * decl.c (push_binding): Adjust local variable type. (add_binding): Likewise. (push_class_binding): Likewise. (pop_binding): Likewise. (poplevel): Likewise. (poplevel_class): Likewise. (free_bindings): Adjust type. (find_binding): Adjust return type, add a third parameter. Remove non-useful assertion now that we use static typing. (cxx_scope_find_binding_for_name): New function. (binding_for_name): Use it. Adjust local variable type. Simplify. (namespace_binding): Simplify. (set_namespace_binding): Likewise. (set_identifier_type_value_with_scope): Adjust local variable type. (lookup_tag): Don't type-abuse of local variable 'old'. (lookup_namespace_name): Likewise. Allocate binding on stack. (select_decl): Adjust prototype. (unqualified_namespace_lookup): Allocate binding on stack. Don't type-abuse of local variable 'val'. (lookup_name_real): Likewise. (maybe_inject_for_scope_var): Adjust local variable type. (cp_tree_node_structure): Remove CPLUS_BINDING case label. (namespace_binding): Adjust logic, simplify. (BINDING_LEVEL): Adjust definition. (push_class_level_binding): Adjust local variable type. (struct cxx_saved_binding): Adjust field 'binding' type. * decl2.c (ambiguous_decl): Adjust prototype. (lookup_using_namespace): Adjust local variable type. (qualified_lookup_using_namespace): Catch type error and correct ensueing logic error. (do_nonmember_using_decl): Adjust local variable type. Allocate temporary cxx_binding on stack. (do_toplevel_using_decl): Adjust local variable type. * ptree.c (cxx_print_cxx_binding): New function. (cxx_print_identifier): Use it. (cxx_print_xnode): Delete CPLUS_BINDING case label. From-SVN: r64405
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
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))
{
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),
indent + 4);
break;
case OVERLOAD:
print_node (file, "function", OVL_FUNCTION (node), indent+4);
print_node (file, "chain", TREE_CHAIN (node), indent+4);
break;
case TEMPLATE_PARM_INDEX:
print_node (file, "decl", TEMPLATE_PARM_DECL (node), indent+4);
indent_to (file, indent + 3);
fprintf (file, "index %d level %d orig_level %d",
TEMPLATE_PARM_IDX (node), TEMPLATE_PARM_LEVEL (node),
TEMPLATE_PARM_ORIG_LEVEL (node));
break;
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;
}
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;
case DEFERRED_NOEXCEPT:
print_node (file, "pattern", DEFERRED_NOEXCEPT_PATTERN (node), indent+4);
print_node (file, "args", DEFERRED_NOEXCEPT_ARGS (node), indent+4);
break;
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;
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;
}
}
/* Print the node NODE on standard error, for debugging. */
DEBUG_FUNCTION void
debug_tree (cp_expr node)
{
debug_tree (node.get_value());
}