X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fcp%2Fcp-tree.h;h=68be934547199727e8e2eae1e3cdaf8962beb460;hb=67484828603f721feb1d9772a53d1288ef676b71;hp=aedf5b96749b44388b3dec2728a09f7c6c2e96c2;hpb=aa23a857d9af00e7b39a6025e7e34f864e2bffbe;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index aedf5b96749..68be9345471 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -43,9 +43,6 @@ along with GCC; see the file COPYING3. If not see #else #define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m) #endif -extern void cp_cpp_error (cpp_reader *, int, - const char *, va_list *) - ATTRIBUTE_GCC_CXXDIAG(3,0); #ifdef GCC_TOPLEV_H #error \ In order for the format checking to accept the C++ front end diagnostic \ @@ -80,6 +77,8 @@ framework extensions, you must include this file before toplev.h, not after. TYPE_REF_IS_RVALUE (in REFERENCE_TYPE) ATTR_IS_DEPENDENT (in the TREE_LIST for an attribute) CONSTRUCTOR_IS_DIRECT_INIT (in CONSTRUCTOR) + LAMBDA_EXPR_CAPTURES_THIS_P (in LAMBDA_EXPR) + DECLTYPE_FOR_LAMBDA_CAPTURE (in DECLTYPE_TYPE) 1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE) TI_PENDING_TEMPLATE_FLAG. TEMPLATE_PARMS_FOR_INLINE. @@ -90,11 +89,15 @@ framework extensions, you must include this file before toplev.h, not after. TYPENAME_IS_CLASS_P (in TYPENAME_TYPE) STMT_IS_FULL_EXPR_P (in _STMT) TARGET_EXPR_LIST_INIT_P (in TARGET_EXPR) + LAMBDA_EXPR_MUTABLE_P (in LAMBDA_EXPR) + DECLTYPE_FOR_LAMBDA_RETURN (in DECLTYPE_TYPE) 2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE) ICS_THIS_FLAG (in _CONV) DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL) STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST) TYPENAME_IS_RESOLVING_P (in TYPE_NAME_TYPE) + LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P (in LAMBDA_EXPR) + TARGET_EXPR_DIRECT_INIT_P (in TARGET_EXPR) 3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out). ICS_BAD_FLAG (in _CONV) FN_TRY_BLOCK_P (in TRY_BLOCK) @@ -114,7 +117,7 @@ framework extensions, you must include this file before toplev.h, not after. Usage of TYPE_LANG_FLAG_?: 0: TYPE_DEPENDENT_P 1: TYPE_HAS_USER_CONSTRUCTOR. - 2: Unused + 2: unused 3: TYPE_FOR_JAVA. 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR 5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE) @@ -143,6 +146,8 @@ framework extensions, you must include this file before toplev.h, not after. DECL_FIELD_IS_BASE (in FIELD_DECL) 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL). DECL_THUNK_P (in a member FUNCTION_DECL) + DECL_NORMAL_CAPTURE_P (in FIELD_DECL) + 8: DECL_DECLARED_CONSTEXPR_P (in VAR_DECL, FUNCTION_DECL) Usage of language-independent fields in a language-dependent manner: @@ -202,28 +207,19 @@ framework extensions, you must include this file before toplev.h, not after. TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM) #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) -#define NON_THUNK_FUNCTION_CHECK(NODE) __extension__ \ -({ __typeof(NODE) const __t = (NODE); \ - if (TREE_CODE (__t) != FUNCTION_DECL && \ - TREE_CODE (__t) != TEMPLATE_DECL && __t->decl_common.lang_specific \ - && __t->decl_common.lang_specific->decl_flags.thunk_p) \ - tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \ - __t; }) #define THUNK_FUNCTION_CHECK(NODE) __extension__ \ ({ __typeof (NODE) const __t = (NODE); \ - if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \ - || !__t->decl_common.lang_specific->decl_flags.thunk_p) \ + if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \ + || !__t->decl_common.lang_specific->u.fn.thunk_p) \ tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \ __t; }) #else -#define NON_THUNK_FUNCTION_CHECK(NODE) (NODE) #define THUNK_FUNCTION_CHECK(NODE) (NODE) #endif /* Language-dependent contents of an identifier. */ -struct lang_identifier GTY(()) -{ +struct GTY(()) lang_identifier { struct c_common_identifier c_common; cxx_binding *namespace_bindings; cxx_binding *bindings; @@ -240,8 +236,7 @@ struct lang_identifier GTY(()) #define LANG_IDENTIFIER_CAST(NODE) \ ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE)) -struct template_parm_index_s GTY(()) -{ +struct GTY(()) template_parm_index_s { struct tree_common common; int index; int level; @@ -250,8 +245,7 @@ struct template_parm_index_s GTY(()) }; typedef struct template_parm_index_s template_parm_index; -struct ptrmem_cst GTY(()) -{ +struct GTY(()) ptrmem_cst { struct tree_common common; /* This isn't used, but the middle-end expects all constants to have this field. */ @@ -334,8 +328,7 @@ typedef struct ptrmem_cst * ptrmem_cst_t; is not important for this node. */ #define OVL_USED(NODE) TREE_USED (NODE) -struct tree_overload GTY(()) -{ +struct GTY(()) tree_overload { struct tree_common common; tree function; }; @@ -366,8 +359,7 @@ struct tree_overload GTY(()) #define BASELINK_QUALIFIED_P(NODE) \ TREE_LANG_FLAG_0 (BASELINK_CHECK (NODE)) -struct tree_baselink GTY(()) -{ +struct GTY(()) tree_baselink { struct tree_common common; tree binfo; tree functions; @@ -456,8 +448,7 @@ typedef enum cp_id_kind #define DEFARG_INSTANTIATIONS(NODE) \ (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->instantiations) -struct tree_default_arg GTY (()) -{ +struct GTY (()) tree_default_arg { struct tree_common common; struct cp_token_cache *tokens; VEC(tree,gc) *instantiations; @@ -478,16 +469,14 @@ struct tree_default_arg GTY (()) #define STATIC_ASSERT_SOURCE_LOCATION(NODE) \ (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->location) -struct tree_static_assert GTY (()) -{ +struct GTY (()) tree_static_assert { struct tree_common common; tree condition; tree message; location_t location; }; -struct tree_argument_pack_select GTY (()) -{ +struct GTY (()) tree_argument_pack_select { struct tree_common common; tree argument_pack; int index; @@ -513,6 +502,8 @@ typedef enum cp_trait_kind CPTK_IS_ENUM, CPTK_IS_POD, CPTK_IS_POLYMORPHIC, + CPTK_IS_STD_LAYOUT, + CPTK_IS_TRIVIAL, CPTK_IS_UNION } cp_trait_kind; @@ -527,14 +518,88 @@ typedef enum cp_trait_kind #define TRAIT_EXPR_KIND(NODE) \ (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->kind) -struct tree_trait_expr GTY (()) -{ +struct GTY (()) tree_trait_expr { struct tree_common common; tree type1; tree type2; enum cp_trait_kind kind; }; +/* Based off of TYPE_ANONYMOUS_P. */ +#define LAMBDA_TYPE_P(NODE) \ + (CLASS_TYPE_P (NODE) && LAMBDANAME_P (TYPE_LINKAGE_IDENTIFIER (NODE))) + +/* Test if FUNCTION_DECL is a lambda function. */ +#define LAMBDA_FUNCTION_P(FNDECL) \ + (DECL_OVERLOADED_OPERATOR_P (FNDECL) == CALL_EXPR \ + && LAMBDA_TYPE_P (CP_DECL_CONTEXT (FNDECL))) + +enum cp_lambda_default_capture_mode_type { + CPLD_NONE, + CPLD_COPY, + CPLD_REFERENCE +}; + +/* The method of default capture, if any. */ +#define LAMBDA_EXPR_DEFAULT_CAPTURE_MODE(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->default_capture_mode) + +/* The capture-list, including `this'. Each capture is stored as a FIELD_DECL + * so that the name, type, and field are all together, whether or not it has + * been added to the lambda's class type. + TREE_LIST: + TREE_PURPOSE: The FIELD_DECL for this capture. + TREE_VALUE: The initializer. This is part of a GNU extension. */ +#define LAMBDA_EXPR_CAPTURE_LIST(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->capture_list) + +/* The node in the capture-list that holds the 'this' capture. */ +#define LAMBDA_EXPR_THIS_CAPTURE(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->this_capture) + +/* Predicate tracking whether `this' is in the effective capture set. */ +#define LAMBDA_EXPR_CAPTURES_THIS_P(NODE) \ + LAMBDA_EXPR_THIS_CAPTURE(NODE) + +/* Predicate tracking whether the lambda was declared 'mutable'. */ +#define LAMBDA_EXPR_MUTABLE_P(NODE) \ + TREE_LANG_FLAG_1 (LAMBDA_EXPR_CHECK (NODE)) + +/* True iff we should try to deduce the lambda return type from any return + statement. */ +#define LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P(NODE) \ + TREE_LANG_FLAG_2 (LAMBDA_EXPR_CHECK (NODE)) + +/* The return type in the expression. + * NULL_TREE indicates that none was specified. */ +#define LAMBDA_EXPR_RETURN_TYPE(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->return_type) + +/* The source location of the lambda. */ +#define LAMBDA_EXPR_LOCATION(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->locus) + +/* The mangling scope for the lambda: FUNCTION_DECL, PARM_DECL, VAR_DECL, + FIELD_DECL or NULL_TREE. If this is NULL_TREE, we have no linkage. */ +#define LAMBDA_EXPR_EXTRA_SCOPE(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->extra_scope) + +/* If EXTRA_SCOPE, this is the number of the lambda within that scope. */ +#define LAMBDA_EXPR_DISCRIMINATOR(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->discriminator) + +struct GTY (()) tree_lambda_expr +{ + struct tree_common common; + location_t locus; + enum cp_lambda_default_capture_mode_type default_capture_mode; + tree capture_list; + tree this_capture; + tree return_type; + tree extra_scope; + int discriminator; +}; + enum cp_tree_node_structure_enum { TS_CP_GENERIC, TS_CP_IDENTIFIER, @@ -548,13 +613,13 @@ enum cp_tree_node_structure_enum { TS_CP_STATIC_ASSERT, TS_CP_ARGUMENT_PACK_SELECT, TS_CP_TRAIT_EXPR, + TS_CP_LAMBDA_EXPR, LAST_TS_CP_ENUM }; /* The resulting tree type. */ -union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"), - chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) -{ +union GTY((desc ("cp_tree_node_structure (&%h)"), + chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) lang_tree_node { union tree_node GTY ((tag ("TS_CP_GENERIC"), desc ("tree_node_structure (&%h)"))) generic; struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi; @@ -569,6 +634,8 @@ union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"), argument_pack_select; struct tree_trait_expr GTY ((tag ("TS_CP_TRAIT_EXPR"))) trait_expression; + struct tree_lambda_expr GTY ((tag ("TS_CP_LAMBDA_EXPR"))) + lambda_expression; }; @@ -750,8 +817,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; /* Global state. */ -struct saved_scope GTY(()) -{ +struct GTY(()) saved_scope { VEC(cxx_saved_binding,gc) *old_bindings; tree old_namespace; tree decl_ns_list; @@ -769,7 +835,9 @@ struct saved_scope GTY(()) int x_processing_specialization; BOOL_BITFIELD x_processing_explicit_instantiation : 1; BOOL_BITFIELD need_pop_function_context : 1; - BOOL_BITFIELD skip_evaluation : 1; + + int unevaluated_operand; + int inhibit_evaluation_warnings; struct stmt_tree_s x_stmt_tree; @@ -829,8 +897,7 @@ struct saved_scope GTY(()) extern GTY(()) struct saved_scope *scope_chain; -struct cxx_int_tree_map GTY(()) -{ +struct GTY(()) cxx_int_tree_map { unsigned int uid; tree to; }; @@ -840,8 +907,7 @@ extern int cxx_int_tree_map_eq (const void *, const void *); /* Global state pertinent to the current function. */ -struct language_function GTY(()) -{ +struct GTY(()) language_function { struct c_language_function base; tree x_cdtor_label; @@ -1064,8 +1130,7 @@ enum languages { lang_c, lang_cplusplus, lang_java }; #define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) \ DECL_VISIBILITY_SPECIFIED (TYPE_NAME (TYPE)) -typedef struct tree_pair_s GTY (()) -{ +typedef struct GTY (()) tree_pair_s { tree purpose; tree value; } tree_pair_s; @@ -1076,8 +1141,7 @@ DEF_VEC_ALLOC_O (tree_pair_s,gc); /* This is a few header flags for 'struct lang_type'. Actually, all but the first are used only for lang_type_class; they are put in this structure to save space. */ -struct lang_type_header GTY(()) -{ +struct GTY(()) lang_type_header { BOOL_BITFIELD is_lang_type_class : 1; BOOL_BITFIELD has_type_conversion : 1; @@ -1103,8 +1167,7 @@ struct lang_type_header GTY(()) many (i.e., thousands) of classes can easily be generated. Therefore, we should endeavor to keep the size of this structure to a minimum. */ -struct lang_type_class GTY(()) -{ +struct GTY(()) lang_type_class { struct lang_type_header h; unsigned char align; @@ -1149,6 +1212,9 @@ struct lang_type_class GTY(()) unsigned non_aggregate : 1; unsigned has_complex_dflt : 1; unsigned has_list_ctor : 1; + unsigned non_std_layout : 1; + unsigned lazy_move_ctor : 1; + unsigned is_literal : 1; /* When adding a flag here, consider whether or not it ought to apply to a template instance if it applies to the template. If @@ -1157,7 +1223,7 @@ struct lang_type_class GTY(()) /* There are some bits left to fill out a 32-bit word. Keep track of this by updating the size of this bitfield whenever you add or remove a flag. */ - unsigned dummy : 10; + unsigned dummy : 7; tree primary_base; VEC(tree_pair_s,gc) *vcall_indices; @@ -1177,16 +1243,20 @@ struct lang_type_class GTY(()) as a list of adopted protocols or a pointer to a corresponding @interface. See objc/objc-act.h for details. */ tree objc_info; + /* sorted_fields is sorted based on a pointer, so we need to be able + to resort it if pointers get rearranged. */ + struct sorted_fields_type * GTY ((reorder ("resort_sorted_fields"))) + sorted_fields; + /* FIXME reuse another field? */ + tree lambda_expr; }; -struct lang_type_ptrmem GTY(()) -{ +struct GTY(()) lang_type_ptrmem { struct lang_type_header h; tree record; }; -struct lang_type GTY(()) -{ +struct GTY(()) lang_type { union lang_type_u { struct lang_type_header GTY((skip (""))) h; @@ -1216,13 +1286,6 @@ struct lang_type GTY(()) #endif /* ENABLE_TREE_CHECKING */ -/* Fields used for storing information before the class is defined. - After the class is defined, these fields hold other information. */ - -/* VEC(tree) of friends which were defined inline in this class - definition. */ -#define CLASSTYPE_INLINE_FRIENDS(NODE) CLASSTYPE_PURE_VIRTUALS (NODE) - /* Nonzero for _CLASSTYPE means that operator delete is defined. */ #define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete) #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1) @@ -1248,6 +1311,11 @@ struct lang_type GTY(()) #define CLASSTYPE_LAZY_COPY_CTOR(NODE) \ (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_ctor) +/* Nonzero means that NODE (a class type) has a move constructor -- + but that it has not yet been declared. */ +#define CLASSTYPE_LAZY_MOVE_CTOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_ctor) + /* Nonzero means that NODE (a class type) has an assignment operator -- but that it has not yet been declared. */ #define CLASSTYPE_LAZY_ASSIGNMENT_OP(NODE) \ @@ -1415,8 +1483,14 @@ struct lang_type GTY(()) #define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable) #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE)) -/* Nonzero means that this class type is a non-POD class. */ -#define CLASSTYPE_NON_POD_P(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class) +/* Nonzero means that this class type is not POD for the purpose of layout + (as defined in the ABI). This is different from the language's POD. */ +#define CLASSTYPE_NON_LAYOUT_POD_P(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class) + +/* Nonzero means that this class type is a non-standard-layout class. */ +#define CLASSTYPE_NON_STD_LAYOUT(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->non_std_layout) /* Nonzero means that this class contains pod types whose default initialization is not a zero initialization (namely, pointers to @@ -1447,6 +1521,13 @@ struct lang_type GTY(()) #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \ (LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes) +/* The associated LAMBDA_EXPR that made this class. */ +#define CLASSTYPE_LAMBDA_EXPR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lambda_expr) +/* The extra mangling scope for this closure type. */ +#define LAMBDA_TYPE_EXTRA_SCOPE(NODE) \ + (LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR (NODE))) + /* Say whether this node was declared as a "class" or a "struct". */ #define CLASSTYPE_DECLARED_CLASS(NODE) \ (LANG_TYPE_CLASS_CHECK (NODE)->declared_class) @@ -1582,144 +1663,205 @@ struct lang_type GTY(()) /* The binding level associated with the namespace. */ #define NAMESPACE_LEVEL(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.u.level) + (LANG_DECL_NS_CHECK (NODE)->level) +/* Flags shared by all forms of DECL_LANG_SPECIFIC. -/* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or - a lang_decl (which has lang_decl_flags as its initial prefix). - This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is - the full lang_decl, and not just lang_decl_flags. Keep these - checks in ascending code order. */ -#define CAN_HAVE_FULL_LANG_DECL_P(NODE) \ - (!(TREE_CODE (NODE) == FIELD_DECL \ - || TREE_CODE (NODE) == VAR_DECL \ - || TREE_CODE (NODE) == CONST_DECL \ - || TREE_CODE (NODE) == USING_DECL)) + Some of the flags live here only to make lang_decl_min/fn smaller. Do + not make this struct larger than 32 bits; instead, make sel smaller. */ -struct lang_decl_flags GTY(()) -{ +struct GTY(()) lang_decl_base { + unsigned selector : 16; /* Larger than necessary for faster access. */ ENUM_BITFIELD(languages) language : 4; + unsigned use_template : 2; + unsigned not_really_extern : 1; /* var or fn */ + unsigned initialized_in_class : 1; /* var or fn */ + unsigned repo_available_p : 1; /* var or fn */ + unsigned threadprivate_or_deleted_p : 1; /* var or fn */ + unsigned anticipated_p : 1; /* fn or type */ + unsigned friend_attr : 1; /* fn or type */ + unsigned template_conv_p : 1; /* template only? */ + unsigned odr_used : 1; /* var or fn */ + unsigned u2sel : 1; + /* 1 spare bit */ +}; + +/* True for DECL codes which have template info and access. */ +#define LANG_DECL_HAS_MIN(NODE) \ + (TREE_CODE (NODE) == FUNCTION_DECL \ + || TREE_CODE (NODE) == FIELD_DECL \ + || TREE_CODE (NODE) == VAR_DECL \ + || TREE_CODE (NODE) == CONST_DECL \ + || TREE_CODE (NODE) == TYPE_DECL \ + || TREE_CODE (NODE) == TEMPLATE_DECL \ + || TREE_CODE (NODE) == USING_DECL) + +/* DECL_LANG_SPECIFIC for the above codes. */ + +struct GTY(()) lang_decl_min { + struct lang_decl_base base; + + /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is + THUNK_ALIAS. + In a FUNCTION_DECL for which DECL_THUNK_P does not hold, + VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is + DECL_TEMPLATE_INFO. */ + tree template_info; + + union lang_decl_u2 { + /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is + THUNK_VIRTUAL_OFFSET. + Otherwise this is DECL_ACCESS. */ + tree GTY ((tag ("0"))) access; + + /* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */ + int GTY ((tag ("1"))) discriminator; + } GTY ((desc ("%0.u.base.u2sel"))) u2; +}; + +/* Additional DECL_LANG_SPECIFIC information for functions. */ + +struct GTY(()) lang_decl_fn { + struct lang_decl_min min; + + /* In an overloaded operator, this is the value of + DECL_OVERLOADED_OPERATOR_P. */ + ENUM_BITFIELD (tree_code) operator_code : 16; + unsigned global_ctor_p : 1; unsigned global_dtor_p : 1; - unsigned anticipated_p : 1; - unsigned template_conv_p : 1; - - unsigned operator_attr : 1; unsigned constructor_attr : 1; unsigned destructor_attr : 1; - unsigned friend_attr : 1; + unsigned assignment_operator_p : 1; unsigned static_function : 1; unsigned pure_virtual : 1; + unsigned defaulted_p : 1; + unsigned has_in_charge_parm_p : 1; unsigned has_vtt_parm_p : 1; - - unsigned deferred : 1; - unsigned use_template : 2; + unsigned pending_inline_p : 1; unsigned nonconverting : 1; - unsigned not_really_extern : 1; - unsigned initialized_in_class : 1; - unsigned assignment_operator_p : 1; - unsigned u1sel : 1; - - unsigned u2sel : 1; - unsigned can_be_full : 1; unsigned thunk_p : 1; unsigned this_thunk_p : 1; - unsigned repo_available_p : 1; unsigned hidden_friend_p : 1; - unsigned threadprivate_or_deleted_p : 1; - unsigned defaulted_p : 1; + /* 1 spare bit. */ - union lang_decl_u { - /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is - THUNK_ALIAS. - In a FUNCTION_DECL for which DECL_THUNK_P does not hold, - VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is - DECL_TEMPLATE_INFO. */ - tree GTY ((tag ("0"))) template_info; + /* For a non-thunk function decl, this is a tree list of + friendly classes. For a thunk function decl, it is the + thunked to function decl. */ + tree befriending_classes; - /* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */ - struct cp_binding_level * GTY ((tag ("1"))) level; - } GTY ((desc ("%1.u1sel"))) u; + /* For a non-virtual FUNCTION_DECL, this is + DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which + DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both + this pointer and result pointer adjusting thunks are + chained here. This pointer thunks to return pointer thunks + will be chained on the return pointer thunk. */ + tree context; - union lang_decl_u2 { - /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is - THUNK_VIRTUAL_OFFSET. - Otherwise this is DECL_ACCESS. */ - tree GTY ((tag ("0"))) access; + union lang_decl_u5 + { + /* In a non-thunk FUNCTION_DECL or TEMPLATE_DECL, this is + DECL_CLONED_FUNCTION. */ + tree GTY ((tag ("0"))) cloned_function; + + /* In a FUNCTION_DECL for which THUNK_P holds this is the + THUNK_FIXED_OFFSET. */ + HOST_WIDE_INT GTY ((tag ("1"))) fixed_offset; + } GTY ((desc ("%1.thunk_p"))) u5; + + union lang_decl_u3 + { + struct cp_token_cache * GTY ((tag ("1"))) pending_inline_info; + struct language_function * GTY ((tag ("0"))) + saved_language_function; + } GTY ((desc ("%1.pending_inline_p"))) u; - /* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */ - int GTY ((tag ("1"))) discriminator; - } GTY ((desc ("%1.u2sel"))) u2; }; -/* sorted_fields is sorted based on a pointer, so we need to be able - to resort it if pointers get rearranged. */ +/* DECL_LANG_SPECIFIC for namespaces. */ -struct lang_decl GTY(()) -{ - struct lang_decl_flags decl_flags; - - union lang_decl_u4 - { - struct full_lang_decl - { - /* In an overloaded operator, this is the value of - DECL_OVERLOADED_OPERATOR_P. */ - ENUM_BITFIELD (tree_code) operator_code : 16; - - unsigned u3sel : 1; - unsigned pending_inline_p : 1; - unsigned spare : 14; - - /* For a non-thunk function decl, this is a tree list of - friendly classes. For a thunk function decl, it is the - thunked to function decl. */ - tree befriending_classes; - - /* For a non-virtual FUNCTION_DECL, this is - DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which - DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both - this pointer and result pointer adjusting thunks are - chained here. This pointer thunks to return pointer thunks - will be chained on the return pointer thunk. */ - tree context; - - union lang_decl_u5 - { - /* In a non-thunk FUNCTION_DECL or TEMPLATE_DECL, this is - DECL_CLONED_FUNCTION. */ - tree GTY ((tag ("0"))) cloned_function; - - /* In a FUNCTION_DECL for which THUNK_P holds this is the - THUNK_FIXED_OFFSET. */ - HOST_WIDE_INT GTY ((tag ("1"))) fixed_offset; - } GTY ((desc ("%0.decl_flags.thunk_p"))) u5; - - union lang_decl_u3 - { - struct sorted_fields_type * GTY ((tag ("0"), reorder ("resort_sorted_fields"))) - sorted_fields; - struct cp_token_cache * GTY ((tag ("2"))) pending_inline_info; - struct language_function * GTY ((tag ("1"))) - saved_language_function; - } GTY ((desc ("%1.u3sel + %1.pending_inline_p"))) u; - } GTY ((tag ("1"))) f; - } GTY ((desc ("%1.decl_flags.can_be_full"))) u; +struct GTY(()) lang_decl_ns { + struct lang_decl_base base; + struct cp_binding_level *level; }; +/* DECL_LANG_SPECIFIC for parameters. */ + +struct GTY(()) lang_decl_parm { + struct lang_decl_base base; + int index; +}; + +/* DECL_LANG_SPECIFIC for all types. It would be nice to just make this a + union rather than a struct containing a union as its only field, but + tree.h declares it as a struct. */ + +struct GTY(()) lang_decl { + union GTY((desc ("%h.base.selector"))) lang_decl_u { + struct lang_decl_base GTY ((default)) base; + struct lang_decl_min GTY((tag ("0"))) min; + struct lang_decl_fn GTY ((tag ("1"))) fn; + struct lang_decl_ns GTY((tag ("2"))) ns; + struct lang_decl_parm GTY((tag ("3"))) parm; + } u; +}; + +/* Looks through a template (if present) to find what it declares. */ +#define STRIP_TEMPLATE(NODE) \ + (TREE_CODE (NODE) == TEMPLATE_DECL ? DECL_TEMPLATE_RESULT (NODE) : NODE) + #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) +#define LANG_DECL_MIN_CHECK(NODE) __extension__ \ +({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \ + if (!LANG_DECL_HAS_MIN (NODE)) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.min; }) + +/* We want to be able to check DECL_CONSTRUCTOR_P and such on a function + template, not just on a FUNCTION_DECL. So when looking for things in + lang_decl_fn, look down through a TEMPLATE_DECL into its result. */ +#define LANG_DECL_FN_CHECK(NODE) __extension__ \ +({ struct lang_decl *lt = DECL_LANG_SPECIFIC (STRIP_TEMPLATE (NODE)); \ + if (!DECL_DECLARES_FUNCTION_P (NODE) || lt->u.base.selector != 1) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.fn; }) + +#define LANG_DECL_NS_CHECK(NODE) __extension__ \ +({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \ + if (TREE_CODE (NODE) != NAMESPACE_DECL || lt->u.base.selector != 2) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.ns; }) + +#define LANG_DECL_PARM_CHECK(NODE) __extension__ \ +({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \ + if (TREE_CODE (NODE) != PARM_DECL) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.parm; }) + #define LANG_DECL_U2_CHECK(NODE, TF) __extension__ \ ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \ - if (lt->decl_flags.u2sel != TF) \ + if (!LANG_DECL_HAS_MIN (NODE) || lt->u.base.u2sel != TF) \ lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ - <->decl_flags.u2; }) + <->u.min.u2; }) #else +#define LANG_DECL_MIN_CHECK(NODE) \ + (&DECL_LANG_SPECIFIC (NODE)->u.min) + +#define LANG_DECL_FN_CHECK(NODE) \ + (&DECL_LANG_SPECIFIC (STRIP_TEMPLATE (NODE))->u.fn) + +#define LANG_DECL_NS_CHECK(NODE) \ + (&DECL_LANG_SPECIFIC (NODE)->u.ns) + +#define LANG_DECL_PARM_CHECK(NODE) \ + (&DECL_LANG_SPECIFIC (NODE)->u.parm) + #define LANG_DECL_U2_CHECK(NODE, TF) \ - (&DECL_LANG_SPECIFIC (NODE)->decl_flags.u2) + (&DECL_LANG_SPECIFIC (NODE)->u.min.u2) #endif /* ENABLE_TREE_CHECKING */ @@ -1734,17 +1876,17 @@ struct lang_decl GTY(()) we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */ #define DECL_LANGUAGE(NODE) \ (DECL_LANG_SPECIFIC (NODE) \ - ? DECL_LANG_SPECIFIC (NODE)->decl_flags.language \ + ? DECL_LANG_SPECIFIC (NODE)->u.base.language \ : (TREE_CODE (NODE) == FUNCTION_DECL \ ? lang_c : lang_cplusplus)) /* Set the language linkage for NODE to LANGUAGE. */ #define SET_DECL_LANGUAGE(NODE, LANGUAGE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.language = (LANGUAGE)) + (DECL_LANG_SPECIFIC (NODE)->u.base.language = (LANGUAGE)) /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */ #define DECL_CONSTRUCTOR_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.constructor_attr) + (LANG_DECL_FN_CHECK (NODE)->constructor_attr) /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete object. */ @@ -1762,7 +1904,8 @@ struct lang_decl GTY(()) specialized in-charge constructor or the specialized not-in-charge constructor. */ #define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \ - (DECL_CONSTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE)) + (DECL_DECLARES_FUNCTION_P (NODE) && DECL_CONSTRUCTOR_P (NODE) \ + && !DECL_CLONED_FUNCTION_P (NODE)) /* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */ #define DECL_COPY_CONSTRUCTOR_P(NODE) \ @@ -1774,13 +1917,14 @@ struct lang_decl GTY(()) /* Nonzero if NODE is a destructor. */ #define DECL_DESTRUCTOR_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.destructor_attr) + (LANG_DECL_FN_CHECK (NODE)->destructor_attr) /* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the specialized in-charge constructor, in-charge deleting constructor, or the base destructor. */ #define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \ - (DECL_DESTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE)) + (DECL_DECLARES_FUNCTION_P (NODE) && DECL_DESTRUCTOR_P (NODE) \ + && !DECL_CLONED_FUNCTION_P (NODE)) /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete object. */ @@ -1802,17 +1946,11 @@ struct lang_decl GTY(()) /* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or destructor. */ -#define DECL_CLONED_FUNCTION_P(NODE) \ - ((TREE_CODE (NODE) == FUNCTION_DECL \ - || TREE_CODE (NODE) == TEMPLATE_DECL) \ - && DECL_LANG_SPECIFIC (NODE) \ - && !DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p \ - && DECL_CLONED_FUNCTION (NODE) != NULL_TREE) +#define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true)) /* If DECL_CLONED_FUNCTION_P holds, this is the function that was cloned. */ -#define DECL_CLONED_FUNCTION(NODE) \ - (DECL_LANG_SPECIFIC (NON_THUNK_FUNCTION_CHECK(NODE))->u.f.u5.cloned_function) +#define DECL_CLONED_FUNCTION(NODE) (*decl_cloned_function_p (NODE, false)) /* Perform an action for each clone of FN, if FN is a function with clones. This macro should be used like: @@ -1837,9 +1975,14 @@ struct lang_decl GTY(()) /* Discriminator for name mangling. */ #define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator) +/* The index of a user-declared parameter in its function, starting at 1. + All artificial parameters will have index 0. */ +#define DECL_PARM_INDEX(NODE) \ + (LANG_DECL_PARM_CHECK (NODE)->index) + /* Nonzero if the VTT parm has been added to NODE. */ #define DECL_HAS_VTT_PARM_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_vtt_parm_p) + (LANG_DECL_FN_CHECK (NODE)->has_vtt_parm_p) /* Nonzero if NODE is a FUNCTION_DECL for which a VTT parameter is required. */ @@ -1861,11 +2004,11 @@ struct lang_decl GTY(()) conversion operator to a type dependent on the innermost template args. */ #define DECL_TEMPLATE_CONV_FN_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.template_conv_p) + (DECL_LANG_SPECIFIC (TEMPLATE_DECL_CHECK (NODE))->u.base.template_conv_p) /* Set the overloaded operator code for NODE to CODE. */ #define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \ - (DECL_LANG_SPECIFIC (NODE)->u.f.operator_code = (CODE)) + (LANG_DECL_FN_CHECK (NODE)->operator_code = (CODE)) /* If NODE is an overloaded operator, then this returns the TREE_CODE associated with the overloaded operator. @@ -1876,17 +2019,17 @@ struct lang_decl GTY(()) to test whether or not NODE is an overloaded operator. */ #define DECL_OVERLOADED_OPERATOR_P(NODE) \ (IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \ - ? DECL_LANG_SPECIFIC (NODE)->u.f.operator_code : ERROR_MARK) + ? LANG_DECL_FN_CHECK (NODE)->operator_code : ERROR_MARK) /* Nonzero if NODE is an assignment operator (including += and such). */ #define DECL_ASSIGNMENT_OPERATOR_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.assignment_operator_p) + (LANG_DECL_FN_CHECK (NODE)->assignment_operator_p) /* For FUNCTION_DECLs: nonzero means that this function is a constructor or a destructor with an extra in-charge parameter to control whether or not virtual bases are constructed. */ #define DECL_HAS_IN_CHARGE_PARM_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_in_charge_parm_p) + (LANG_DECL_FN_CHECK (NODE)->has_in_charge_parm_p) /* Nonzero if DECL is a declaration of __builtin_constant_p. */ #define DECL_IS_BUILTIN_CONSTANT_P(NODE) \ @@ -1938,20 +2081,27 @@ struct lang_decl GTY(()) rather than outside the class. This is used for both static member VAR_DECLS, and FUNCTION_DECLS that are defined in the class. */ #define DECL_INITIALIZED_IN_CLASS_P(DECL) \ - (DECL_LANG_SPECIFIC (DECL)->decl_flags.initialized_in_class) + (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \ + ->u.base.initialized_in_class) + +/* Nonzero if the DECL is used in the sense of 3.2 [basic.def.odr]. + Only available for decls with DECL_LANG_SPECIFIC. */ +#define DECL_ODR_USED(DECL) \ + (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \ + ->u.base.odr_used) /* Nonzero for DECL means that this decl is just a friend declaration, and should not be added to the list of members for this class. */ -#define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.friend_attr) +#define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->u.base.friend_attr) /* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */ #define DECL_BEFRIENDING_CLASSES(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes) + (LANG_DECL_FN_CHECK (NODE)->befriending_classes) /* Nonzero for FUNCTION_DECL means that this decl is a static member function. */ #define DECL_STATIC_FUNCTION_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.static_function) + (LANG_DECL_FN_CHECK (NODE)->static_function) /* Nonzero for FUNCTION_DECL means that this decl is a non-static member function. */ @@ -1961,7 +2111,7 @@ struct lang_decl GTY(()) /* Nonzero for FUNCTION_DECL means that this decl is a member function (static or non-static). */ #define DECL_FUNCTION_MEMBER_P(NODE) \ - (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE)) + (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE)) /* Nonzero for FUNCTION_DECL means that this member function has `this' as const X *const. */ @@ -1986,15 +2136,15 @@ struct lang_decl GTY(()) is mutable. */ #define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE)) -/* Nonzero for _DECL means that this constructor is a non-converting - constructor. */ +/* Nonzero for _DECL means that this constructor or conversion function is + non-converting. */ #define DECL_NONCONVERTING_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.nonconverting) + (LANG_DECL_FN_CHECK (NODE)->nonconverting) /* Nonzero for FUNCTION_DECL means that this member function is a pure virtual function. */ #define DECL_PURE_VIRTUAL_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.pure_virtual) + (LANG_DECL_FN_CHECK (NODE)->pure_virtual) /* True (in a FUNCTION_DECL) if NODE is a virtual function that is an invalid overrider for a function from a base class. Once we have @@ -2005,27 +2155,26 @@ struct lang_decl GTY(()) /* The thunks associated with NODE, a FUNCTION_DECL. */ #define DECL_THUNKS(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->u.f.context) + (LANG_DECL_FN_CHECK (NODE)->context) /* Nonzero if NODE is a thunk, rather than an ordinary function. */ #define DECL_THUNK_P(NODE) \ (TREE_CODE (NODE) == FUNCTION_DECL \ && DECL_LANG_SPECIFIC (NODE) \ - && DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p) + && LANG_DECL_FN_CHECK (NODE)->thunk_p) /* Set DECL_THUNK_P for node. */ #define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p = 1, \ - DECL_LANG_SPECIFIC (NODE)->u.f.u3sel = 1, \ - DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p = (THIS_ADJUSTING)) + (LANG_DECL_FN_CHECK (NODE)->thunk_p = 1, \ + LANG_DECL_FN_CHECK (NODE)->this_thunk_p = (THIS_ADJUSTING)) /* Nonzero if NODE is a this pointer adjusting thunk. */ #define DECL_THIS_THUNK_P(NODE) \ - (DECL_THUNK_P (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p) + (DECL_THUNK_P (NODE) && LANG_DECL_FN_CHECK (NODE)->this_thunk_p) /* Nonzero if NODE is a result pointer adjusting thunk. */ #define DECL_RESULT_THUNK_P(NODE) \ - (DECL_THUNK_P (NODE) && !DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p) + (DECL_THUNK_P (NODE) && !LANG_DECL_FN_CHECK (NODE)->this_thunk_p) /* Nonzero if NODE is a FUNCTION_DECL, but not a thunk. */ #define DECL_NON_THUNK_FUNCTION_P(NODE) \ @@ -2042,7 +2191,11 @@ struct lang_decl GTY(()) /* True iff DECL is an entity with vague linkage whose definition is available in this translation unit. */ #define DECL_REPO_AVAILABLE_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.repo_available_p) + (DECL_LANG_SPECIFIC (NODE)->u.base.repo_available_p) + +/* True if DECL is declared 'constexpr'. */ +#define DECL_DECLARED_CONSTEXPR_P(DECL) \ + DECL_LANG_FLAG_8 (VAR_OR_FUNCTION_DECL_CHECK (DECL)) /* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a template function. */ @@ -2061,13 +2214,14 @@ struct lang_decl GTY(()) the DECL_FRIEND_CONTEXT for `f' will be `S'. */ #define DECL_FRIEND_CONTEXT(NODE) \ - ((DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \ - ? DECL_LANG_SPECIFIC (NODE)->u.f.context \ + ((DECL_DECLARES_FUNCTION_P (NODE) \ + && DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \ + ? LANG_DECL_FN_CHECK (NODE)->context \ : NULL_TREE) /* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */ #define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \ - (DECL_LANG_SPECIFIC (NODE)->u.f.context = (CONTEXT)) + (LANG_DECL_FN_CHECK (NODE)->context = (CONTEXT)) /* NULL_TREE in DECL_CONTEXT represents the global namespace. */ #define CP_DECL_CONTEXT(NODE) \ @@ -2081,6 +2235,9 @@ struct lang_decl GTY(()) (!DECL_TEMPLATE_PARM_P (NODE) \ && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL) +#define TYPE_NAMESPACE_SCOPE_P(NODE) \ + (TREE_CODE (CP_TYPE_CONTEXT (NODE)) == NAMESPACE_DECL) + /* 1 iff NODE is a class member. */ #define DECL_CLASS_SCOPE_P(NODE) \ (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE))) @@ -2093,6 +2250,9 @@ struct lang_decl GTY(()) (DECL_CONTEXT (NODE) \ && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL) +#define TYPE_FUNCTION_SCOPE_P(NODE) \ + (TYPE_CONTEXT (NODE) && TREE_CODE (TYPE_CONTEXT (NODE)) == FUNCTION_DECL) + /* 1 iff VAR_DECL node NODE is a type-info decl. This flag is set for both the primary typeinfo object and the associated NTBS name. */ #define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE)) @@ -2174,21 +2334,17 @@ extern void decl_shadowed_for_var_insert (tree, tree); the class definition. We have saved away the text of the function, but have not yet processed it. */ #define DECL_PENDING_INLINE_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->u.f.pending_inline_p) + (LANG_DECL_FN_CHECK (NODE)->pending_inline_p) /* If DECL_PENDING_INLINE_P holds, this is the saved text of the function. */ #define DECL_PENDING_INLINE_INFO(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->u.f.u.pending_inline_info) + (LANG_DECL_FN_CHECK (NODE)->u.pending_inline_info) -/* For a TYPE_DECL: if this structure has many fields, we'll sort them +/* For a class type: if this structure has many fields, we'll sort them and put them into a TREE_VEC. */ -#define DECL_SORTED_FIELDS(NODE) \ - (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.f.u.sorted_fields) - -/* True if on the deferred_fns (see decl2.c) list. */ -#define DECL_DEFERRED_FN(DECL) \ - (DECL_LANG_SPECIFIC (DECL)->decl_flags.deferred) +#define CLASSTYPE_SORTED_FIELDS(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->sorted_fields) /* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL or TEMPLATE_DECL, the entity is either a template specialization (if @@ -2211,7 +2367,7 @@ extern void decl_shadowed_for_var_insert (tree, tree); will be non-NULL, but DECL_USE_TEMPLATE will be zero. */ #define DECL_TEMPLATE_INFO(NODE) \ (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \ - ->decl_flags.u.template_info) + ->u.min.template_info) /* For a VAR_DECL, indicates that the variable is actually a non-static data member of anonymous union that has been promoted to @@ -2255,6 +2411,9 @@ extern void decl_shadowed_for_var_insert (tree, tree); #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE)) #define TI_ARGS(NODE) (TREE_VALUE (NODE)) #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE) +/* The list of typedefs - used in the template - that need + access checking at template instantiation time. */ +#define TI_TYPEDEFS_NEEDING_ACCESS_CHECKING(NODE) (TREE_CHAIN (NODE)) /* We use TREE_VECs to hold template arguments. If there is only one level of template arguments, then the TREE_VEC contains the @@ -2458,8 +2617,8 @@ extern void decl_shadowed_for_var_insert (tree, tree); /* In a FUNCTION_DECL, the saved language-specific per-function data. */ #define DECL_SAVED_FUNCTION_DATA(NODE) \ - (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE)) \ - ->u.f.u.saved_language_function) + (LANG_DECL_FN_CHECK (FUNCTION_DECL_CHECK (NODE)) \ + ->u.saved_language_function) /* Indicates an indirect_expr is for converting a reference. */ #define REFERENCE_REF_P(NODE) \ @@ -2520,8 +2679,7 @@ extern void decl_shadowed_for_var_insert (tree, tree); /* Abstract iterators for AGGR_INIT_EXPRs. */ /* Structure containing iterator state. */ -typedef struct aggr_init_expr_arg_iterator_d GTY (()) -{ +typedef struct GTY (()) aggr_init_expr_arg_iterator_d { tree t; /* the aggr_init_expr */ int n; /* argument count */ int i; /* next argument index */ @@ -2576,6 +2734,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) for ((arg) = first_aggr_init_expr_arg ((call), &(iter)); (arg); \ (arg) = next_aggr_init_expr_arg (&(iter))) +/* VEC_INIT_EXPR accessors. */ +#define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (NODE, 0) +#define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (NODE, 1) + /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a TEMPLATE_DECL. This macro determines whether or not a given class type is really a template type, as opposed to an instantiation or @@ -2636,26 +2798,34 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) declared inside a class. In the latter case DECL_HIDDEN_FRIEND_P will be set. */ #define DECL_ANTICIPATED(NODE) \ - (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.anticipated_p) + (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->u.base.anticipated_p) /* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend within a class but has not been declared in the surrounding scope. The function is invisible except via argument dependent lookup. */ #define DECL_HIDDEN_FRIEND_P(NODE) \ - (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.hidden_friend_p) + (LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->hidden_friend_p) /* Nonzero if DECL has been declared threadprivate by #pragma omp threadprivate. */ #define CP_DECL_THREADPRIVATE_P(DECL) \ - (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (DECL))->decl_flags.threadprivate_or_deleted_p) + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (DECL))->u.base.threadprivate_or_deleted_p) /* Nonzero if DECL was declared with '= delete'. */ #define DECL_DELETED_FN(DECL) \ - (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.threadprivate_or_deleted_p) + (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.base.threadprivate_or_deleted_p) -/* Nonzero if DECL was declared with '= default'. */ +/* Nonzero if DECL was declared with '= default' (maybe implicitly). */ #define DECL_DEFAULTED_FN(DECL) \ - (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.defaulted_p) + (LANG_DECL_FN_CHECK (DECL)->defaulted_p) + +/* Nonzero if DECL is explicitly defaulted in the class body. */ +#define DECL_DEFAULTED_IN_CLASS_P(DECL) \ + (DECL_DEFAULTED_FN (DECL) && DECL_INITIALIZED_IN_CLASS_P (DECL)) +/* Nonzero if DECL was defaulted outside the class body. */ +#define DECL_DEFAULTED_OUTSIDE_CLASS_P(DECL) \ + (DECL_DEFAULTED_FN (DECL) \ + && !(DECL_ARTIFICIAL (DECL) || DECL_INITIALIZED_IN_CLASS_P (DECL))) /* Record whether a typedef for type `int' was actually `signed int'. */ #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP) @@ -2695,6 +2865,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) #define INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P(TYPE) \ (UNSCOPED_ENUM_P (TYPE) || CP_INTEGRAL_TYPE_P (TYPE)) +/* True if the class type TYPE is a literal type. */ +#define CLASSTYPE_LITERAL_P(TYPE) \ + (LANG_TYPE_CLASS_CHECK (TYPE)->is_literal) + /* [basic.fundamental] Integral and floating types are collectively called arithmetic @@ -3009,6 +3183,14 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) #define DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P(NODE) \ (DECLTYPE_TYPE_CHECK (NODE))->type.string_flag +/* These flags indicate that we want different semantics from normal + decltype: lambda capture just drops references, lambda return also does + type decay. */ +#define DECLTYPE_FOR_LAMBDA_CAPTURE(NODE) \ + TREE_LANG_FLAG_0 (DECLTYPE_TYPE_CHECK (NODE)) +#define DECLTYPE_FOR_LAMBDA_RETURN(NODE) \ + TREE_LANG_FLAG_1 (DECLTYPE_TYPE_CHECK (NODE)) + /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was specified in its declaration. This can also be set for an erroneously declared PARM_DECL. */ @@ -3026,6 +3208,12 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) #define DECL_FIELD_IS_BASE(NODE) \ DECL_LANG_FLAG_6 (FIELD_DECL_CHECK (NODE)) +/* Nonzero for FIELD_DECL node means that this field is a simple (no + explicit initializer) lambda capture field, making it invisible to + name lookup in unevaluated contexts. */ +#define DECL_NORMAL_CAPTURE_P(NODE) \ + DECL_LANG_FLAG_7 (FIELD_DECL_CHECK (NODE)) + /* Nonzero if TYPE is an anonymous union or struct type. We have to use a flag for this because "A union for which objects or pointers are declared is not an anonymous union" [class.union]. */ @@ -3065,11 +3253,11 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* Nonzero if the FUNCTION_DECL is a global constructor. */ #define DECL_GLOBAL_CTOR_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_ctor_p) + (LANG_DECL_FN_CHECK (NODE)->global_ctor_p) /* Nonzero if the FUNCTION_DECL is a global destructor. */ #define DECL_GLOBAL_DTOR_P(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_dtor_p) + (LANG_DECL_FN_CHECK (NODE)->global_dtor_p) /* Accessor macros for C++ template decl nodes. */ @@ -3091,15 +3279,18 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE)) /* For function, method, class-data templates. */ #define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT_FLD (NODE) -/* For a static member variable template, the - DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and - implicitly generated instantiations of the variable. There are no - partial instantiations of static member variables, so all of these - will be full instantiations. +/* For a function template at namespace scope, DECL_TEMPLATE_INSTANTIATIONS + lists all instantiations and specializations of the function so that + tsubst_friend_function can reassign them to another template if we find + that the namespace-scope template is really a partial instantiation of a + friend template. For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds all instantiations and specializations of the class type, including - partial instantiations and partial specializations. + partial instantiations and partial specializations, so that if we + explicitly specialize a partial instantiation we can walk the list + in maybe_process_partial_specialization and reassign them or complain + as appropriate. In both cases, the TREE_PURPOSE of each node contains the arguments used; the TREE_VALUE contains the generated variable. The template @@ -3115,29 +3306,9 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) DECL_TEMPLATE_INSTANTIATIONS list for `template template struct S1::S2'. - This list is not used for function templates. */ + This list is not used for other templates. */ #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX (NODE) -/* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists - contains all instantiations and specializations of the function, - including partial instantiations. For a partial instantiation - which is a specialization, this list holds only full - specializations of the template that are instantiations of the - partial instantiation. For example, given: - - template struct S { - template void f(U); - template <> void f(T); - }; - - the `S::f(int)' function will appear on the - DECL_TEMPLATE_SPECIALIZATIONS list for both `template - template void S::f(U)' and `template void - S::f(T)'. In the latter case, however, it will have only the - innermost set of arguments (T, in this case). The DECL_TI_TEMPLATE - for the function declaration will point at the specialization, not - the fully general template. - - For a class template, this list contains the partial +/* For a class template, this list contains the partial specializations of this template. (Full specializations are not recorded on this list.) The TREE_PURPOSE holds the arguments used in the partial specialization (e.g., for `template struct @@ -3147,7 +3318,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) example above.) The TREE_TYPE is the _TYPE node for the partial specialization. - This list is not used for static variable templates. */ + This list is not used for other templates. */ #define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE (NODE) /* Nonzero for a DECL which is actually a template parameter. Keep @@ -3178,16 +3349,19 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL) /* Nonzero for a DECL that represents a template class. */ -#define DECL_CLASS_TEMPLATE_P(NODE) \ - (TREE_CODE (NODE) == TEMPLATE_DECL \ - && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \ - && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \ - && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE)) +#define DECL_CLASS_TEMPLATE_P(NODE) \ + (TREE_CODE (NODE) == TEMPLATE_DECL \ + && DECL_TEMPLATE_RESULT (NODE) != NULL_TREE \ + && DECL_IMPLICIT_TYPEDEF_P (DECL_TEMPLATE_RESULT (NODE))) /* Nonzero if NODE which declares a type. */ #define DECL_DECLARES_TYPE_P(NODE) \ (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE)) +/* Nonzero if NODE declares a function. */ +#define DECL_DECLARES_FUNCTION_P(NODE) \ + (TREE_CODE (NODE) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (NODE)) + /* Nonzero if NODE is the typedef implicitly generated for a type when the type is declared. In C++, `struct S {};' is roughly equivalent to `struct S {}; typedef struct S S;' in C. @@ -3241,7 +3415,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) If DECL_USE_TEMPLATE is nonzero, then DECL_TEMPLATE_INFO will also be non-NULL. */ -#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.use_template) +#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->u.base.use_template) /* Like DECL_USE_TEMPLATE, but for class types. */ #define CLASSTYPE_USE_TEMPLATE(NODE) \ @@ -3251,7 +3425,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) #define CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P(NODE) \ (CLASS_TYPE_P (NODE) \ && CLASSTYPE_USE_TEMPLATE (NODE) \ - && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (arg))) + && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE))) #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1) #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \ @@ -3314,7 +3488,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) current translation unit; it indicates whether or not we should emit the decl at the end of compilation if it is defined and needed. */ #define DECL_NOT_REALLY_EXTERN(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern) + (DECL_LANG_SPECIFIC (NODE)->u.base.not_really_extern) #define DECL_REALLY_EXTERN(NODE) \ (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE)) @@ -3361,7 +3535,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* An integer indicating how many bytes should be subtracted from the this or result pointer when this function is called. */ #define THUNK_FIXED_OFFSET(DECL) \ - (DECL_LANG_SPECIFIC (THUNK_FUNCTION_CHECK (DECL))->u.f.u5.fixed_offset) + (DECL_LANG_SPECIFIC (THUNK_FUNCTION_CHECK (DECL))->u.fn.u5.fixed_offset) /* A tree indicating how to perform the virtual adjustment. For a this adjusting thunk it is the number of bytes to be added to the vtable @@ -3378,12 +3552,12 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* A thunk which is equivalent to another thunk. */ #define THUNK_ALIAS(DECL) \ - (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.u.template_info) + (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.min.template_info) /* For thunk NODE, this is the FUNCTION_DECL thunked to. It is possible for the target to be a thunk too. */ #define THUNK_TARGET(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes) + (LANG_DECL_FN_CHECK (NODE)->befriending_classes) /* True for a SCOPE_REF iff the "template" keyword was used to indicate that the qualified name denotes a template. */ @@ -3474,6 +3648,16 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) #define TARGET_EXPR_LIST_INIT_P(NODE) \ TREE_LANG_FLAG_1 (TARGET_EXPR_CHECK (NODE)) +/* True if this TARGET_EXPR expresses direct-initialization of an object + to be named later. */ +#define TARGET_EXPR_DIRECT_INIT_P(NODE) \ + TREE_LANG_FLAG_2 (TARGET_EXPR_CHECK (NODE)) + +/* True if EXPR expresses direct-initialization of a TYPE. */ +#define DIRECT_INIT_EXPR_P(TYPE,EXPR) \ + (TREE_CODE (EXPR) == TARGET_EXPR && TREE_LANG_FLAG_2 (EXPR) \ + && same_type_ignoring_top_level_qualifiers_p (TYPE, TREE_TYPE (EXPR))) + /* An enumeration of the kind of tags that C++ accepts. */ enum tag_types { none_type = 0, /* Not a tag type. */ @@ -3485,13 +3669,18 @@ enum tag_types { }; /* The various kinds of lvalues we distinguish. */ -typedef enum cp_lvalue_kind { +enum cp_lvalue_kind_flags { clk_none = 0, /* Things that are not an lvalue. */ clk_ordinary = 1, /* An ordinary lvalue. */ - clk_class = 2, /* An rvalue of class-type. */ - clk_bitfield = 4, /* An lvalue for a bit-field. */ - clk_packed = 8 /* An lvalue for a packed field. */ -} cp_lvalue_kind; + clk_rvalueref = 2,/* An rvalue formed using an rvalue reference */ + clk_class = 4, /* An rvalue of class-type. */ + clk_bitfield = 8, /* An lvalue for a bit-field. */ + clk_packed = 16 /* An lvalue for a packed field. */ +}; + +/* This type is used for parameters and variables which hold + combinations of the flags in enum cp_lvalue_kind_flags. */ +typedef int cp_lvalue_kind; /* Various kinds of template specialization, instantiation, etc. */ typedef enum tmpl_spec_kind { @@ -3530,6 +3719,7 @@ typedef enum special_function_kind { special_function_p. */ sfk_constructor, /* A constructor. */ sfk_copy_constructor, /* A copy constructor. */ + sfk_move_constructor, /* A move constructor. */ sfk_assignment_operator, /* An assignment operator. */ sfk_destructor, /* A destructor. */ sfk_complete_destructor, /* A destructor for complete objects. */ @@ -3564,7 +3754,7 @@ typedef enum linkage_kind { } linkage_kind; /* Bitmask flags to control type substitution. */ -typedef enum tsubst_flags_t { +enum tsubst_flags { tf_none = 0, /* nothing special */ tf_error = 1 << 0, /* give error messages */ tf_warning = 1 << 1, /* give warnings too */ @@ -3581,12 +3771,18 @@ typedef enum tsubst_flags_t { conversion. */ tf_no_access_control = 1 << 7, /* Do not perform access checks, even when issuing other errors. */ + /* Do not instantiate classes (used by count_non_default_template_args). */ + tf_no_class_instantiations = 1 << 8, /* Convenient substitution flags combinations. */ tf_warning_or_error = tf_warning | tf_error -} tsubst_flags_t; +}; + +/* This type is used for parameters and variables which hold + combinations of the flags in enum tsubst_flags. */ +typedef int tsubst_flags_t; /* The kind of checking we can do looking in a class hierarchy. */ -typedef enum base_access { +enum base_access_flags { ba_any = 0, /* Do not check access, allow an ambiguous base, prefer a non-virtual base */ ba_unique = 1 << 0, /* Must be a unique base. */ @@ -3594,7 +3790,11 @@ typedef enum base_access { ba_check = ba_unique | ba_check_bit, ba_ignore_scope = 1 << 2, /* Ignore access allowed by local scope. */ ba_quiet = 1 << 3 /* Do not issue error messages. */ -} base_access; +}; + +/* This type is used for parameters and variables which hold + combinations of the flags in enum base_access_flags. */ +typedef int base_access; /* The various kinds of access check during parsing. */ typedef enum deferring_kind { @@ -3630,6 +3830,14 @@ extern GTY(()) tree integer_three_node; function, two inside the body of a function in a local class, etc.) */ extern int function_depth; +/* In parser.c. */ + +/* Nonzero if we are parsing an unevaluated operand: an operand to + sizeof, typeof, or alignof. This is a count since operands to + sizeof can be nested. */ + +extern int cp_unevaluated_operand; + /* in pt.c */ /* These values are used for the `STRICT' parameter to type_unification and @@ -3660,20 +3868,8 @@ extern GTY(()) VEC(tree,gc) *local_classes; at a particular location, we can index into the string at any other location that provides distinguishing characters). */ -/* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler - doesn't allow '$' in symbol names. */ -#ifndef NO_DOLLAR_IN_LABEL - -#define JOINER '$' - -#define AUTO_TEMP_NAME "_$tmp_" -#define VFIELD_BASE "$vf" -#define VFIELD_NAME "_vptr$" -#define VFIELD_NAME_FORMAT "_vptr$%s" -#define ANON_AGGRNAME_FORMAT "$_%d" - -#else /* NO_DOLLAR_IN_LABEL */ - +/* Define NO_DOT_IN_LABEL in your favorite tm file if your assembler + doesn't allow '.' in symbol names. */ #ifndef NO_DOT_IN_LABEL #define JOINER '.' @@ -3687,6 +3883,18 @@ extern GTY(()) VEC(tree,gc) *local_classes; #else /* NO_DOT_IN_LABEL */ +#ifndef NO_DOLLAR_IN_LABEL + +#define JOINER '$' + +#define AUTO_TEMP_NAME "_$tmp_" +#define VFIELD_BASE "$vf" +#define VFIELD_NAME "_vptr$" +#define VFIELD_NAME_FORMAT "_vptr$%s" +#define ANON_AGGRNAME_FORMAT "$_%d" + +#else /* NO_DOLLAR_IN_LABEL */ + #define IN_CHARGE_NAME "__in_chrg" #define AUTO_TEMP_NAME "__tmp_" #define TEMP_NAME_P(ID_NODE) \ @@ -3709,8 +3917,8 @@ extern GTY(()) VEC(tree,gc) *local_classes; sizeof (ANON_AGGRNAME_PREFIX) - 1)) #define ANON_AGGRNAME_FORMAT "__anon_%d" -#endif /* NO_DOT_IN_LABEL */ #endif /* NO_DOLLAR_IN_LABEL */ +#endif /* NO_DOT_IN_LABEL */ #define THIS_NAME "this" @@ -3720,6 +3928,13 @@ extern GTY(()) VEC(tree,gc) *local_classes; #define VTABLE_DELTA_NAME "__delta" #define VTABLE_PFN_NAME "__pfn" +#define LAMBDANAME_PREFIX "__lambda" +#define LAMBDANAME_FORMAT LAMBDANAME_PREFIX "%d" +#define LAMBDANAME_P(ID_NODE) \ + (!strncmp (IDENTIFIER_POINTER (ID_NODE), \ + LAMBDANAME_PREFIX, \ + sizeof (LAMBDANAME_PREFIX) - 1)) + #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \ @@ -3749,7 +3964,7 @@ extern int at_eof; TREE_PURPOSE slot. */ extern GTY(()) tree static_aggregates; -enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; +enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG }; /* These are uses as bits in flags passed to various functions to control their behavior. Despite the LOOKUP_ prefix, many of these @@ -3765,8 +3980,10 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; /* Even if the function found by lookup is a virtual function, it should be called directly. */ #define LOOKUP_NONVIRTUAL (1 << 2) -/* Non-converting (i.e., "explicit") constructors are not tried. */ +/* Non-converting (i.e., "explicit") constructors are not tried. This flag + indicates that we are not performing direct-initialization. */ #define LOOKUP_ONLYCONVERTING (1 << 3) +#define LOOKUP_IMPLICIT (LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING) /* If a temporary is created, it should be created so that it lives as long as the current variable bindings; otherwise it only lives until the end of the complete-expression. It also forces @@ -3800,6 +4017,8 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; /* Avoid user-defined conversions for the first parameter of a copy constructor. */ #define LOOKUP_NO_COPY_CTOR_CONVERSION (LOOKUP_NO_NARROWING << 1) +/* This is the first parameter of a copy constructor. */ +#define LOOKUP_COPY_PARM (LOOKUP_NO_COPY_CTOR_CONVERSION << 1) #define LOOKUP_NAMESPACES_ONLY(F) \ (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES)) @@ -3928,7 +4147,9 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; TFF_EXPR_IN_PARENS: parenthesize expressions. TFF_NO_FUNCTION_ARGUMENTS: don't show function arguments. TFF_UNQUALIFIED_NAME: do not print the qualifying scope of the - top-level entity. */ + top-level entity. + TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS: do not omit template arguments + identical to their defaults. */ #define TFF_PLAIN_IDENTIFIER (0) #define TFF_SCOPE (1) @@ -3943,6 +4164,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; #define TFF_EXPR_IN_PARENS (1 << 9) #define TFF_NO_FUNCTION_ARGUMENTS (1 << 10) #define TFF_UNQUALIFIED_NAME (1 << 11) +#define TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS (1 << 12) /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM node. */ @@ -3955,13 +4177,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; extern void init_reswords (void); -/* Indexed by TREE_CODE, these tables give C-looking names to - operators represented by TREE_CODES. For example, - opname_tab[(int) MINUS_EXPR] == "-". */ -extern const char **opname_tab, **assignop_tab; - -typedef struct operator_name_info_t GTY(()) -{ +typedef struct GTY(()) operator_name_info_t { /* The IDENTIFIER_NODE for the operator. */ tree identifier; /* The name of the operator. */ @@ -4013,6 +4229,7 @@ typedef enum cp_decl_spec { ds_explicit, ds_friend, ds_typedef, + ds_constexpr, ds_complex, ds_thread, ds_last @@ -4050,6 +4267,8 @@ typedef struct cp_decl_specifier_seq { BOOL_BITFIELD conflicting_specifiers_p : 1; /* True iff at least one decl-specifier was found. */ BOOL_BITFIELD any_specifiers_p : 1; + /* True iff at least one type-specifier was found. */ + BOOL_BITFIELD any_type_specifiers_p : 1; /* True iff "int" was explicitly provided. */ BOOL_BITFIELD explicit_int_p : 1; /* True iff "char" was explicitly provided. */ @@ -4150,8 +4369,7 @@ struct cp_declarator { }; /* A level of template instantiation. */ -struct tinst_level GTY(()) -{ +struct GTY(()) tinst_level { /* The immediately deeper level in the chain. */ struct tinst_level *next; @@ -4171,10 +4389,12 @@ struct tinst_level GTY(()) e.g "int f(void)". */ extern cp_parameter_declarator *no_parameters; +/* True if we saw "#pragma GCC java_exceptions". */ +extern bool pragma_java_exceptions; + /* in call.c */ extern bool check_dtor_name (tree, tree); -extern tree build_vfield_ref (tree, tree); extern tree build_conditional_expr (tree, tree, tree, tsubst_flags_t); extern tree build_addr_func (tree); @@ -4184,21 +4404,24 @@ extern bool null_ptr_cst_p (tree); extern bool sufficient_parms_p (const_tree); extern tree type_decays_to (tree); extern tree build_user_type_conversion (tree, tree, int); -extern tree build_new_function_call (tree, tree, bool, +extern tree build_new_function_call (tree, VEC(tree,gc) **, bool, tsubst_flags_t); -extern tree build_operator_new_call (tree, tree, tree *, tree *, - tree *); -extern tree build_new_method_call (tree, tree, tree, tree, int, - tree *, tsubst_flags_t); -extern tree build_special_member_call (tree, tree, tree, tree, int, - tsubst_flags_t); +extern tree build_operator_new_call (tree, VEC(tree,gc) **, tree *, + tree *, tree *); +extern tree build_new_method_call (tree, tree, VEC(tree,gc) **, + tree, int, tree *, + tsubst_flags_t); +extern tree build_special_member_call (tree, tree, VEC(tree,gc) **, + tree, int, tsubst_flags_t); extern tree build_new_op (enum tree_code, int, tree, tree, tree, bool *, tsubst_flags_t); +extern tree build_op_call (tree, VEC(tree,gc) **, + tsubst_flags_t); extern tree build_op_delete_call (enum tree_code, tree, tree, bool, tree, tree); extern bool can_convert (tree, tree); extern bool can_convert_arg (tree, tree, tree, int); -extern bool can_convert_arg_bad (tree, tree, tree); +extern bool can_convert_arg_bad (tree, tree, tree, int); extern bool enforce_access (tree, tree, tree); extern tree convert_default_arg (tree, tree, tree, int); extern tree convert_arg_to_ellipsis (tree); @@ -4208,10 +4431,12 @@ extern tree type_passed_as (tree); extern tree convert_for_arg_passing (tree, tree); extern bool is_properly_derived_from (tree, tree); extern tree set_up_extended_ref_temp (tree, tree, tree *, tree *); -extern tree initialize_reference (tree, tree, tree, tree *); +extern tree initialize_reference (tree, tree, tree, tree *, tsubst_flags_t); extern tree make_temporary_var_for_ref_to_temp (tree, tree); extern tree strip_top_quals (tree); +extern bool reference_related_p (tree, tree); extern tree perform_implicit_conversion (tree, tree, tsubst_flags_t); +extern tree perform_implicit_conversion_flags (tree, tree, tsubst_flags_t, int); extern tree perform_direct_initialization_if_possible (tree, tree, bool, tsubst_flags_t); extern tree in_charge_arg_for_name (tree); @@ -4223,6 +4448,7 @@ extern void validate_conversion_obstack (void); #endif /* ENABLE_CHECKING */ /* in class.c */ +extern tree build_vfield_ref (tree, tree); extern tree build_base_path (enum tree_code, tree, tree, int); extern tree convert_to_base (tree, tree, bool, bool); @@ -4250,14 +4476,6 @@ extern void push_lang_context (tree); extern void pop_lang_context (void); extern tree instantiate_type (tree, tree, tsubst_flags_t); extern void print_class_statistics (void); -extern void cxx_print_statistics (void); -extern void cxx_print_xnode (FILE *, tree, int); -extern void cxx_print_decl (FILE *, tree, int); -extern void cxx_print_type (FILE *, tree, int); -extern void cxx_print_identifier (FILE *, tree, int); -extern void cxx_print_error_function (struct diagnostic_context *, - const char *, - struct diagnostic_info *); extern void build_self_reference (void); extern int same_signature_p (const_tree, const_tree); extern void maybe_add_class_template_decl_list (tree, tree, int); @@ -4275,9 +4493,15 @@ extern void check_for_override (tree, tree); extern void push_class_stack (void); extern void pop_class_stack (void); extern bool type_has_user_nondefault_constructor (tree); +extern bool user_provided_p (tree); extern bool type_has_user_provided_constructor (tree); extern bool type_has_user_provided_default_constructor (tree); -extern bool defaultable_fn_p (tree); +extern void defaulted_late_check (tree); +extern bool defaultable_fn_check (tree); +extern void fixup_type_variants (tree); +extern tree* decl_cloned_function_p (const_tree, bool); +extern void clone_function_decl (tree, int); +extern void adjust_clone_args (tree); /* in cvt.c */ extern tree convert_to_reference (tree, tree, int, int, tree); @@ -4286,41 +4510,43 @@ extern tree force_rvalue (tree); extern tree ocp_convert (tree, tree, int, int); extern tree cp_convert (tree, tree); extern tree cp_convert_and_check (tree, tree); +extern tree cp_fold_convert (tree, tree); extern tree convert_to_void (tree, const char */*implicit context*/, tsubst_flags_t); extern tree convert_force (tree, tree, int); extern tree build_expr_type_conversion (int, tree, bool); extern tree type_promotes_to (tree); extern tree perform_qualification_conversions (tree, tree); -extern void clone_function_decl (tree, int); -extern void adjust_clone_args (tree); -/* decl.c */ -extern tree poplevel (int, int, int); -extern void insert_block (tree); +/* in name-lookup.c */ extern tree pushdecl (tree); extern tree pushdecl_maybe_friend (tree, bool); +extern void maybe_push_cleanup_level (tree); +extern tree pushtag (tree, tree, tag_scope); +extern tree make_anon_name (void); +extern tree pushdecl_top_level_maybe_friend (tree, bool); +extern tree pushdecl_top_level_and_finish (tree, tree); +extern tree check_for_out_of_scope_variable (tree); +extern void print_other_binding_stack (struct cp_binding_level *); +extern tree maybe_push_decl (tree); + +/* decl.c */ +extern tree poplevel (int, int, int); extern void cxx_init_decl_processing (void); enum cp_tree_node_structure_enum cp_tree_node_structure (union lang_tree_node *); -extern bool cxx_mark_addressable (tree); -extern void maybe_push_cleanup_level (tree); extern void finish_scope (void); extern void push_switch (tree); extern void pop_switch (void); -extern tree pushtag (tree, tree, tag_scope); -extern tree make_anon_name (void); +extern tree make_lambda_name (void); extern int decls_match (tree, tree); extern tree duplicate_decls (tree, tree, bool); -extern tree pushdecl_top_level_maybe_friend (tree, bool); -extern tree pushdecl_top_level_and_finish (tree, tree); extern tree declare_local_label (tree); extern tree define_label (location_t, tree); extern void check_goto (tree); extern bool check_omp_return (void); extern tree make_typename_type (tree, tree, enum tag_types, tsubst_flags_t); extern tree make_unbound_class_template (tree, tree, tree, tsubst_flags_t); -extern tree check_for_out_of_scope_variable (tree); extern tree build_library_fn_ptr (const char *, tree); extern tree build_cp_library_fn_ptr (const char *, tree); extern tree push_library_fn (tree, tree, tree); @@ -4328,12 +4554,11 @@ extern tree push_void_library_fn (tree, tree); extern tree push_throw_library_fn (tree, tree); extern tree check_tag_decl (cp_decl_specifier_seq *); extern tree shadow_tag (cp_decl_specifier_seq *); -extern tree groktypename (cp_decl_specifier_seq *, const cp_declarator *); +extern tree groktypename (cp_decl_specifier_seq *, const cp_declarator *, bool); extern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *); extern void start_decl_1 (tree, bool); extern bool check_array_initializer (tree, tree, tree); extern void cp_finish_decl (tree, tree, bool, tree, int); -extern void finish_decl (tree, tree, tree); extern int cp_complete_array_type (tree *, tree, bool); extern tree build_ptrmemfunc_type (tree); extern tree build_ptrmem_type (tree, tree); @@ -4358,13 +4583,11 @@ extern tree begin_function_body (void); extern void finish_function_body (tree); extern tree outer_curly_brace_block (tree); extern tree finish_function (int); -extern tree start_method (cp_decl_specifier_seq *, const cp_declarator *, tree); -extern tree finish_method (tree); +extern tree grokmethod (cp_decl_specifier_seq *, const cp_declarator *, tree); extern void maybe_register_incomplete_var (tree); extern void maybe_commonize_var (tree); extern void complete_vars (tree); extern void finish_stmt (void); -extern void print_other_binding_stack (struct cp_binding_level *); extern void revert_static_member_fn (tree); extern void fixup_anonymous_aggr (tree); extern int check_static_variable_definition (tree, tree); @@ -4375,9 +4598,6 @@ extern int walk_namespaces (walk_namespaces_fn, void *); extern int wrapup_globals_for_namespace (tree, void *); extern tree create_implicit_typedef (tree, tree); -extern tree maybe_push_decl (tree); -extern tree force_target_expr (tree, tree); -extern tree build_target_expr_with_type (tree, tree); extern int local_variable_p (const_tree); extern tree register_dtor_fn (tree); extern tmpl_spec_kind current_tmpl_spec_kind (int); @@ -4386,7 +4606,7 @@ extern tree cxx_builtin_function (tree decl); extern tree cxx_builtin_function_ext_scope (tree decl); extern tree check_elaborated_type_specifier (enum tag_types, tree, bool); extern void warn_extern_redeclared_static (tree, tree); -extern const char *cxx_comdat_group (tree); +extern tree cxx_comdat_group (tree); extern bool cp_missing_noreturn_ok_p (tree); extern void initialize_artificial_var (tree, tree); extern tree check_var_type (tree, tree); @@ -4394,12 +4614,15 @@ extern tree reshape_init (tree, tree); extern bool defer_mark_used_calls; extern GTY(()) VEC(tree, gc) *deferred_mark_used_calls; +extern tree finish_case_label (location_t, tree, tree); +extern tree cxx_maybe_build_cleanup (tree); /* in decl2.c */ extern bool check_java_method (tree); extern tree build_memfn_type (tree, tree, cp_cv_quals); extern void maybe_retrofit_in_chrg (tree); extern void maybe_make_one_only (tree); +extern bool vague_linkage_fn_p (tree); extern void grokclassfn (tree, tree, enum overload_flags); extern tree grok_array_decl (tree, tree); @@ -4419,10 +4642,9 @@ extern tree coerce_delete_type (tree); extern void comdat_linkage (tree); extern void determine_visibility (tree); extern void constrain_class_visibility (tree); -extern void update_member_visibility (tree); extern void import_export_decl (tree); extern tree build_cleanup (tree); -extern tree build_offset_ref_call_from_tree (tree, tree); +extern tree build_offset_ref_call_from_tree (tree, VEC(tree,gc) **); extern void check_default_args (tree); extern void mark_used (tree); extern void finish_static_data_member_decl (tree, tree, bool, tree, int); @@ -4436,18 +4658,22 @@ extern bool decl_needed_p (tree); extern void note_vague_linkage_fn (tree); extern tree build_artificial_parm (tree, tree); extern bool possibly_inlined_p (tree); +extern int parm_index (tree); /* in error.c */ extern void init_error (void); extern const char *type_as_string (tree, int); +extern const char *type_as_string_translate (tree, int); extern const char *decl_as_string (tree, int); +extern const char *decl_as_string_translate (tree, int); extern const char *expr_as_string (tree, int); -extern const char *lang_decl_name (tree, int); +extern const char *lang_decl_name (tree, int, bool); extern const char *language_to_string (enum languages); extern const char *class_key_or_enum_as_string (tree); extern void print_instantiation_context (void); extern void maybe_warn_variadic_templates (void); extern void maybe_warn_cpp0x (const char *); +extern bool pedwarn_cxx98 (location_t, int, const char *, ...) ATTRIBUTE_GCC_CXXDIAG(3,4); /* in except.c */ extern void init_exception_processing (void); @@ -4459,6 +4685,9 @@ extern int nothrow_libfn_p (const_tree); extern void check_handlers (tree); extern void choose_personality_routine (enum languages); extern tree eh_type_info (tree); +extern tree begin_eh_spec_block (void); +extern void finish_eh_spec_block (tree, tree); +extern tree build_eh_type_type (tree); /* in expr.c */ extern tree cplus_expand_constant (tree); @@ -4480,7 +4709,8 @@ extern tree build_zero_init (tree, tree, bool); extern tree build_value_init (tree); extern tree build_value_init_noctor (tree); extern tree build_offset_ref (tree, tree, bool); -extern tree build_new (tree, tree, tree, tree, int, +extern tree build_new (VEC(tree,gc) **, tree, tree, + VEC(tree,gc) **, int, tsubst_flags_t); extern tree build_vec_init (tree, tree, tree, bool, int, tsubst_flags_t); @@ -4507,8 +4737,6 @@ extern tree copy_decl (tree); extern tree copy_type (tree); extern tree cxx_make_type (enum tree_code); extern tree make_class_type (enum tree_code); -extern void yyerror (const char *); -extern void yyhook (int); extern bool cxx_init (void); extern void cxx_finish (void); extern bool in_main_input_context (void); @@ -4547,9 +4775,11 @@ extern tree check_explicit_specialization (tree, tree, int, int); extern tree make_auto (void); extern tree do_auto_deduction (tree, tree, tree); extern tree type_uses_auto (tree); +extern void append_type_to_template_for_access_check (tree, tree, tree); extern tree splice_late_return_type (tree, tree); extern bool is_auto (const_tree); -extern tree process_template_parm (tree, tree, bool, bool); +extern tree process_template_parm (tree, location_t, tree, + bool, bool); extern tree end_template_parm_list (tree); extern void end_template_decl (void); extern bool check_default_tmpl_args (tree, tree, int, int, int); @@ -4563,28 +4793,35 @@ extern int uses_template_parms (tree); extern int uses_template_parms_level (tree, int); extern tree instantiate_class_template (tree); extern tree instantiate_template (tree, tree, tsubst_flags_t); -extern int fn_type_unification (tree, tree, tree, tree, +extern int fn_type_unification (tree, tree, tree, + const tree *, unsigned int, tree, unification_kind_t, int); extern void mark_decl_instantiated (tree, int); extern int more_specialized_fn (tree, tree, int); extern void do_decl_instantiation (tree, tree); extern void do_type_instantiation (tree, tree, tsubst_flags_t); +extern bool always_instantiate_p (tree); extern tree instantiate_decl (tree, int, bool); extern int comp_template_parms (const_tree, const_tree); extern bool uses_parameter_packs (tree); extern bool template_parameter_pack_p (const_tree); +extern bool function_parameter_pack_p (const_tree); +extern bool function_parameter_expanded_from_pack_p (tree, tree); extern tree make_pack_expansion (tree); extern bool check_for_bare_parameter_packs (tree); -extern tree get_template_info (tree); +extern tree get_template_info (const_tree); +extern tree get_types_needing_access_check (tree); extern int template_class_depth (tree); extern int is_specialization_of (tree, tree); extern bool is_specialization_of_friend (tree, tree); +extern tree get_pattern_parm (tree, tree); extern int comp_template_args (tree, tree); extern tree maybe_process_partial_specialization (tree); extern tree most_specialized_instantiation (tree); extern void print_candidates (tree); extern void instantiate_pending_templates (int); extern tree tsubst_default_argument (tree, tree, tree); +extern tree tsubst (tree, tree, tsubst_flags_t, tree); extern tree tsubst_copy_and_build (tree, tree, tsubst_flags_t, tree, bool, bool); extern tree most_general_template (tree); @@ -4600,19 +4837,27 @@ extern bool any_dependent_template_arguments_p (const_tree); extern bool dependent_template_p (tree); extern bool dependent_template_id_p (tree, tree); extern bool type_dependent_expression_p (tree); -extern bool any_type_dependent_arguments_p (const_tree); +extern bool any_type_dependent_arguments_p (const VEC(tree,gc) *); +extern bool type_dependent_expression_p_push (tree); extern bool value_dependent_expression_p (tree); extern bool any_value_dependent_elements_p (const_tree); extern bool dependent_omp_for_p (tree, tree, tree, tree); extern tree resolve_typename_type (tree, bool); extern tree template_for_substitution (tree); extern tree build_non_dependent_expr (tree); -extern tree build_non_dependent_args (tree); +extern void make_args_non_dependent (VEC(tree,gc) *); extern bool reregister_specialization (tree, tree, tree); extern tree fold_non_dependent_expr (tree); extern bool explicit_class_specialization_p (tree); extern struct tinst_level *outermost_tinst_level(void); extern bool parameter_of_template_p (tree, tree); +extern void init_template_processing (void); +bool template_template_parameter_p (const_tree); +extern tree get_primary_template_innermost_parameters (const_tree); +extern tree get_template_innermost_arguments (const_tree); +extern tree get_template_argument_pack_elems (const_tree); +extern tree get_function_template_decl (const_tree); +extern tree resolve_nondeduced_context (tree); /* in repo.c */ extern void init_repo (void); @@ -4676,8 +4921,7 @@ extern int shared_member_p (tree); /* The representation of a deferred access check. */ -typedef struct deferred_access_check GTY(()) -{ +typedef struct GTY(()) deferred_access_check { /* The base class in which the declaration is referenced. */ tree binfo; /* The declaration whose access must be checked. */ @@ -4726,12 +4970,9 @@ extern tree finish_continue_stmt (void); extern tree begin_switch_stmt (void); extern void finish_switch_cond (tree, tree); extern void finish_switch_stmt (tree); -extern tree finish_case_label (tree, tree); extern tree finish_goto_stmt (tree); extern tree begin_try_block (void); extern void finish_try_block (tree); -extern tree begin_eh_spec_block (void); -extern void finish_eh_spec_block (tree, tree); extern void finish_handler_sequence (tree); extern tree begin_function_try_block (tree *); extern void finish_function_try_block (tree); @@ -4741,6 +4982,9 @@ extern tree begin_handler (void); extern void finish_handler_parms (tree, tree); extern void finish_handler (tree); extern void finish_cleanup (tree, tree); +extern bool literal_type_p (tree); +extern tree validate_constexpr_fundecl (tree); +extern tree ensure_literal_type_for_constexpr_object (tree); enum { BCS_NO_SCOPE = 1, @@ -4750,7 +4994,8 @@ enum { extern tree begin_compound_stmt (unsigned int); extern void finish_compound_stmt (tree); -extern tree finish_asm_stmt (int, tree, tree, tree, tree); +extern tree finish_asm_stmt (int, tree, tree, tree, tree, + tree); extern tree finish_label_stmt (tree); extern void finish_label_decl (tree); extern tree finish_parenthesized_expr (tree); @@ -4759,9 +5004,9 @@ extern tree begin_stmt_expr (void); extern tree finish_stmt_expr_expr (tree, tree); extern tree finish_stmt_expr (tree, bool); extern tree stmt_expr_value_expr (tree); -extern tree perform_koenig_lookup (tree, tree); -extern tree finish_call_expr (tree, tree, bool, int, - tsubst_flags_t); +extern tree perform_koenig_lookup (tree, VEC(tree,gc) *); +extern tree finish_call_expr (tree, VEC(tree,gc) **, bool, + bool, tsubst_flags_t); extern tree finish_increment_expr (tree, enum tree_code); extern tree finish_this_expr (void); extern tree finish_pseudo_destructor_expr (tree, tree, tree); @@ -4778,7 +5023,6 @@ extern tree finish_base_specifier (tree, tree, bool); extern void finish_member_declaration (tree); extern void qualified_name_lookup_error (tree, tree, tree, location_t); -extern void check_template_keyword (tree); extern tree finish_id_expression (tree, tree, tree, cp_id_kind *, bool, bool, bool *, @@ -4813,13 +5057,6 @@ extern void finish_omp_atomic (enum tree_code, tree, tree); extern void finish_omp_barrier (void); extern void finish_omp_flush (void); extern void finish_omp_taskwait (void); -extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree); -extern tree cxx_omp_clause_default_ctor (tree, tree, tree); -extern tree cxx_omp_clause_copy_ctor (tree, tree, tree); -extern tree cxx_omp_clause_assign_op (tree, tree, tree); -extern tree cxx_omp_clause_dtor (tree, tree); -extern void cxx_omp_finish_clause (tree); -extern bool cxx_omp_privatize_by_reference (const_tree); extern bool cxx_omp_create_clause_info (tree, tree, bool, bool, bool); extern tree baselink_for_fns (tree); extern void finish_static_assert (tree, tree, location_t, @@ -4827,8 +5064,22 @@ extern void finish_static_assert (tree, tree, location_t, extern tree describable_type (tree); extern tree finish_decltype_type (tree, bool); extern tree finish_trait_expr (enum cp_trait_kind, tree, tree); +extern tree build_lambda_expr (void); +extern tree build_lambda_object (tree); +extern tree begin_lambda_type (tree); +extern tree lambda_capture_field_type (tree); +extern tree lambda_return_type (tree); +extern tree lambda_function (tree); +extern void apply_lambda_return_type (tree, tree); +extern tree add_capture (tree, tree, tree, bool, bool); +extern tree add_default_capture (tree, tree, tree); +extern tree lambda_expr_this_capture (tree); +extern void maybe_add_lambda_conv_op (tree); /* in tree.c */ +void cp_free_lang_data (tree t); +extern tree force_target_expr (tree, tree); +extern tree build_target_expr_with_type (tree, tree); extern void lang_check_failed (const char *, int, const char *) ATTRIBUTE_NORETURN; extern tree stabilize_expr (tree, tree *); @@ -4836,26 +5087,32 @@ extern void stabilize_call (tree, tree *); extern void stabilize_aggr_init (tree, tree *); extern bool stabilize_init (tree, tree *); extern tree add_stmt_to_compound (tree, tree); -extern tree cxx_maybe_build_cleanup (tree); extern void init_tree (void); -extern int pod_type_p (const_tree); +extern bool pod_type_p (const_tree); +extern bool layout_pod_type_p (const_tree); +extern bool std_layout_type_p (const_tree); +extern bool trivial_type_p (const_tree); +extern bool type_has_nontrivial_default_init (const_tree); +extern bool type_has_nontrivial_copy_init (const_tree); extern bool class_tmpl_impl_spec_p (const_tree); extern int zero_init_p (const_tree); -extern tree canonical_type_variant (tree); +extern tree strip_typedefs (tree); extern tree copy_binfo (tree, tree, tree, tree *, int); extern int member_p (const_tree); extern cp_lvalue_kind real_lvalue_p (tree); +extern bool lvalue_or_rvalue_with_address_p (const_tree); extern bool builtin_valid_in_constant_expr_p (const_tree); extern tree build_min (enum tree_code, tree, ...); extern tree build_min_nt (enum tree_code, ...); extern tree build_min_non_dep (enum tree_code, tree, ...); -extern tree build_min_non_dep_call_list (tree, tree, tree); +extern tree build_min_non_dep_call_vec (tree, tree, VEC(tree,gc) *); extern tree build_cplus_new (tree, tree); extern tree build_aggr_init_expr (tree, tree); extern tree get_target_expr (tree); extern tree build_cplus_array_type (tree, tree); extern tree build_array_of_n_type (tree, int); +extern tree build_array_copy (tree); extern tree hash_tree_cons (tree, tree, tree); extern tree hash_tree_chain (tree, tree); extern tree build_qualified_name (tree, tree, tree, bool); @@ -4864,6 +5121,7 @@ extern tree get_first_fn (tree); extern tree ovl_cons (tree, tree); extern tree build_overload (tree, tree); extern const char *cxx_printable_name (tree, int); +extern const char *cxx_printable_name_translate (tree, int); extern tree build_exception_variant (tree, tree); extern tree bind_template_template_parm (tree, tree); extern tree array_type_nelts_total (tree); @@ -4886,9 +5144,11 @@ extern const struct attribute_spec cxx_attribute_table[]; extern tree make_ptrmem_cst (tree, tree); extern tree cp_build_type_attribute_variant (tree, tree); extern tree cp_build_reference_type (tree, bool); +extern tree move (tree); extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t); #define cp_build_qualified_type(TYPE, QUALS) \ cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error) +extern tree cv_unqualified (tree); extern special_function_kind special_function_p (const_tree); extern int count_trees (tree); extern int char_type_p (tree); @@ -4907,7 +5167,19 @@ extern tree cp_save_expr (tree); extern bool cast_valid_in_integral_constant_expression_p (tree); extern bool cxx_type_hash_eq (const_tree, const_tree); +extern void cxx_print_statistics (void); + +/* in ptree.c */ +extern void cxx_print_xnode (FILE *, tree, int); +extern void cxx_print_decl (FILE *, tree, int); +extern void cxx_print_type (FILE *, tree, int); +extern void cxx_print_identifier (FILE *, tree, int); +extern void cxx_print_error_function (struct diagnostic_context *, + const char *, + struct diagnostic_info *); + /* in typeck.c */ +extern bool cxx_mark_addressable (tree); extern int string_conv_p (const_tree, const_tree, int); extern tree cp_truthvalue_conversion (tree); extern tree condition_conversion (tree); @@ -4934,9 +5206,11 @@ extern tree build_x_indirect_ref (tree, const char *, tsubst_flags_t); extern tree cp_build_indirect_ref (tree, const char *, tsubst_flags_t); -extern tree build_array_ref (tree, tree, location_t); +extern tree build_array_ref (location_t, tree, tree); extern tree get_member_function_from_ptrfunc (tree *, tree); extern tree cp_build_function_call (tree, tree, tsubst_flags_t); +extern tree cp_build_function_call_vec (tree, VEC(tree,gc) **, + tsubst_flags_t); extern tree build_x_binary_op (enum tree_code, tree, enum tree_code, tree, enum tree_code, bool *, @@ -4950,13 +5224,14 @@ extern tree unary_complex_lvalue (enum tree_code, tree); extern tree build_x_conditional_expr (tree, tree, tree, tsubst_flags_t); extern tree build_x_compound_expr_from_list (tree, const char *); +extern tree build_x_compound_expr_from_vec (VEC(tree,gc) *, const char *); extern tree build_x_compound_expr (tree, tree, tsubst_flags_t); -extern tree build_compound_expr (tree, tree); +extern tree build_compound_expr (location_t, tree, tree); extern tree cp_build_compound_expr (tree, tree, tsubst_flags_t); extern tree build_static_cast (tree, tree, tsubst_flags_t); extern tree build_reinterpret_cast (tree, tree, tsubst_flags_t); extern tree build_const_cast (tree, tree, tsubst_flags_t); -extern tree build_c_cast (tree, tree); +extern tree build_c_cast (location_t, tree, tree); extern tree cp_build_c_cast (tree, tree, tsubst_flags_t); extern tree build_x_modify_expr (tree, enum tree_code, tree, tsubst_flags_t); @@ -4988,6 +5263,7 @@ extern tree cp_build_binary_op (location_t, #define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true) extern tree build_ptrmemfunc_access_expr (tree, tree); extern tree build_address (tree); +extern tree build_typed_address (tree, tree); extern tree build_nop (tree, tree); extern tree non_reference (tree); extern tree lookup_anon_field (tree, tree); @@ -4996,7 +5272,7 @@ extern tree convert_member_func_to_ptr (tree, tree); extern tree convert_ptrmem (tree, tree, bool, bool); extern int lvalue_or_else (tree, enum lvalue_use, tsubst_flags_t); -extern int lvalue_p (tree); +extern void check_template_keyword (tree); /* in typeck2.c */ extern void require_complete_eh_spec_types (tree, tree); @@ -5011,9 +5287,10 @@ extern void readonly_error (tree, const char *); extern void complete_type_check_abstract (tree); extern int abstract_virtuals_error (tree, tree); -extern tree store_init_value (tree, tree); +extern tree store_init_value (tree, tree, int); extern void check_narrowing (tree, tree); extern tree digest_init (tree, tree); +extern tree digest_init_flags (tree, tree, int); extern tree build_scoped_ref (tree, tree, tree *); extern tree build_x_arrow (tree); extern tree build_m_component_ref (tree, tree); @@ -5034,7 +5311,6 @@ extern tree mangle_thunk (tree, int, tree, tree); extern tree mangle_conv_op_name_for_type (tree); extern tree mangle_guard_variable (tree); extern tree mangle_ref_init_variable (tree); -extern tree mangle_compound_literal (void); /* in dump.c */ extern bool cp_dump_tree (void *, tree); @@ -5049,12 +5325,18 @@ extern bool cp_var_mod_type_p (tree, tree); extern void cxx_initialize_diagnostics (struct diagnostic_context *); extern int cxx_types_compatible_p (tree, tree); extern void init_shadowed_var_for_decl (void); -extern tree cxx_staticp (tree); /* in cp-gimplify.c */ extern int cp_gimplify_expr (tree *, gimple_seq *, gimple_seq *); extern void cp_genericize (tree); +extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree); +extern tree cxx_omp_clause_default_ctor (tree, tree, tree); +extern tree cxx_omp_clause_copy_ctor (tree, tree, tree); +extern tree cxx_omp_clause_assign_op (tree, tree, tree); +extern tree cxx_omp_clause_dtor (tree, tree); +extern void cxx_omp_finish_clause (tree); +extern bool cxx_omp_privatize_by_reference (const_tree); /* -- end of C++ */