Mercurial > hg > CbC > CbC_gcc
diff gcc/cp/cp-tree.h @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
line wrap: on
line diff
--- a/gcc/cp/cp-tree.h Fri Oct 27 22:46:09 2017 +0900 +++ b/gcc/cp/cp-tree.h Thu Oct 25 07:37:49 2018 +0900 @@ -1,5 +1,5 @@ /* Definitions for C++ parsing and type checking. - Copyright (C) 1987-2017 Free Software Foundation, Inc. + Copyright (C) 1987-2018 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GCC. @@ -47,6 +47,8 @@ but not all node kinds do (e.g. constants, and references to params, locals, etc), so we stash a copy here. */ +extern location_t cp_expr_location (const_tree); + class cp_expr { public: @@ -54,14 +56,11 @@ m_value (NULL), m_loc (UNKNOWN_LOCATION) {} cp_expr (tree value) : - m_value (value), m_loc (EXPR_LOCATION (m_value)) {} + m_value (value), m_loc (cp_expr_location (m_value)) {} cp_expr (tree value, location_t loc): m_value (value), m_loc (loc) {} - cp_expr (const cp_expr &other) : - m_value (other.m_value), m_loc (other.m_loc) {} - /* Implicit conversions to tree. */ operator tree () const { return m_value; } tree & operator* () { return m_value; } @@ -93,6 +92,12 @@ set_location (make_location (m_loc, start, finish)); } + cp_expr& maybe_add_location_wrapper () + { + m_value = maybe_wrap_with_location (m_value, m_loc); + return *this; + } + private: tree m_value; location_t m_loc; @@ -149,6 +154,24 @@ CPTI_AUTO_IDENTIFIER, CPTI_DECLTYPE_AUTO_IDENTIFIER, CPTI_INIT_LIST_IDENTIFIER, + CPTI_FOR_RANGE__IDENTIFIER, + CPTI_FOR_BEGIN__IDENTIFIER, + CPTI_FOR_END__IDENTIFIER, + CPTI_FOR_RANGE_IDENTIFIER, + CPTI_FOR_BEGIN_IDENTIFIER, + CPTI_FOR_END_IDENTIFIER, + CPTI_ABI_TAG_IDENTIFIER, + CPTI_ALIGNED_IDENTIFIER, + CPTI_BEGIN_IDENTIFIER, + CPTI_END_IDENTIFIER, + CPTI_GET_IDENTIFIER, + CPTI_GNU_IDENTIFIER, + CPTI_TUPLE_ELEMENT_IDENTIFIER, + CPTI_TUPLE_SIZE_IDENTIFIER, + CPTI_TYPE_IDENTIFIER, + CPTI_VALUE_IDENTIFIER, + CPTI_FUN_IDENTIFIER, + CPTI_CLOSURE_IDENTIFIER, CPTI_LANG_NAME_C, CPTI_LANG_NAME_CPLUSPLUS, @@ -217,7 +240,7 @@ things) to iterate over their overloads defined by/for a type. For example: - tree ovlid = cp_assignment_operator_id (NOP_EXPR); + tree ovlid = assign_op_identifier; tree overloads = get_class_binding (type, ovlid); for (ovl_iterator it (overloads); it; ++it) { ... } @@ -244,22 +267,15 @@ /* The name of a destructor that destroys virtual base classes, and then deletes the entire object. */ #define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER] + +#define ovl_op_identifier(ISASS, CODE) (OVL_OP_INFO(ISASS, CODE)->identifier) +#define assign_op_identifier (ovl_op_info[true][OVL_OP_NOP_EXPR].identifier) +#define call_op_identifier (ovl_op_info[false][OVL_OP_CALL_EXPR].identifier) /* The name used for conversion operators -- but note that actual conversion functions use special identifiers outside the identifier table. */ #define conv_op_identifier cp_global_trees[CPTI_CONV_OP_IDENTIFIER] -/* The name of the identifier used internally to represent operator CODE. */ -#define cp_operator_id(CODE) \ - (operator_name_info[(int) (CODE)].identifier) - -/* The name of the identifier used to represent assignment operator CODE, - both simple (i.e., operator= with CODE == NOP_EXPR) and compound (e.g., - operator+= with CODE == PLUS_EXPR). Includes copy and move assignment. - Use copy_fn_p() to test specifically for copy assignment. */ -#define cp_assignment_operator_id(CODE) \ - (assignment_operator_name_info[(int) (CODE)].identifier) - #define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER] #define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER] /* The name of the parameter that contains a pointer to the VTT to use @@ -276,6 +292,24 @@ #define auto_identifier cp_global_trees[CPTI_AUTO_IDENTIFIER] #define decltype_auto_identifier cp_global_trees[CPTI_DECLTYPE_AUTO_IDENTIFIER] #define init_list_identifier cp_global_trees[CPTI_INIT_LIST_IDENTIFIER] +#define for_range__identifier cp_global_trees[CPTI_FOR_RANGE__IDENTIFIER] +#define for_begin__identifier cp_global_trees[CPTI_FOR_BEGIN__IDENTIFIER] +#define for_end__identifier cp_global_trees[CPTI_FOR_END__IDENTIFIER] +#define for_range_identifier cp_global_trees[CPTI_FOR_RANGE_IDENTIFIER] +#define for_begin_identifier cp_global_trees[CPTI_FOR_BEGIN_IDENTIFIER] +#define for_end_identifier cp_global_trees[CPTI_FOR_END_IDENTIFIER] +#define abi_tag_identifier cp_global_trees[CPTI_ABI_TAG_IDENTIFIER] +#define aligned_identifier cp_global_trees[CPTI_ALIGNED_IDENTIFIER] +#define begin_identifier cp_global_trees[CPTI_BEGIN_IDENTIFIER] +#define end_identifier cp_global_trees[CPTI_END_IDENTIFIER] +#define get__identifier cp_global_trees[CPTI_GET_IDENTIFIER] +#define gnu_identifier cp_global_trees[CPTI_GNU_IDENTIFIER] +#define tuple_element_identifier cp_global_trees[CPTI_TUPLE_ELEMENT_IDENTIFIER] +#define tuple_size_identifier cp_global_trees[CPTI_TUPLE_SIZE_IDENTIFIER] +#define type_identifier cp_global_trees[CPTI_TYPE_IDENTIFIER] +#define value_identifier cp_global_trees[CPTI_VALUE_IDENTIFIER] +#define fun_identifier cp_global_trees[CPTI_FUN_IDENTIFIER] +#define closure_identifier cp_global_trees[CPTI_CLOSURE_IDENTIFIER] #define lang_name_c cp_global_trees[CPTI_LANG_NAME_C] #define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS] @@ -353,6 +387,7 @@ TEMPLATE_PARM_PARAMETER_PACK (in TEMPLATE_PARM_INDEX) ATTR_IS_DEPENDENT (in the TREE_LIST for an attribute) ABI_TAG_IMPLICIT (in the TREE_LIST for the argument of abi_tag) + LAMBDA_CAPTURE_EXPLICIT_P (in a TREE_LIST in LAMBDA_EXPR_CAPTURE_LIST) CONSTRUCTOR_IS_DIRECT_INIT (in CONSTRUCTOR) LAMBDA_EXPR_CAPTURES_THIS_P (in LAMBDA_EXPR) DECLTYPE_FOR_LAMBDA_CAPTURE (in DECLTYPE_TYPE) @@ -371,6 +406,9 @@ IF_STMT_CONSTEXPR_P (IF_STMT) TEMPLATE_TYPE_PARM_FOR_CLASS (TEMPLATE_TYPE_PARM) DECL_NAMESPACE_INLINE_P (in NAMESPACE_DECL) + SWITCH_STMT_ALL_CASES_P (in SWITCH_STMT) + REINTERPRET_CAST_P (in NOP_EXPR) + ALIGNOF_EXPR_STD_P (in ALIGNOF_EXPR) 1: IDENTIFIER_KIND_BIT_1 (in IDENTIFIER_NODE) TI_PENDING_TEMPLATE_FLAG. TEMPLATE_PARMS_FOR_INLINE. @@ -385,10 +423,10 @@ DECL_FINAL_P (in FUNCTION_DECL) QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF) DECLTYPE_FOR_INIT_CAPTURE (in DECLTYPE_TYPE) - CONSTRUCTOR_NO_IMPLICIT_ZERO (in CONSTRUCTOR) TINFO_USED_TEMPLATE_ID (in TEMPLATE_INFO) PACK_EXPANSION_SIZEOF_P (in *_PACK_EXPANSION) OVL_USING_P (in OVERLOAD) + IMPLICIT_CONV_EXPR_NONTYPE_ARG (in IMPLICIT_CONV_EXPR) 2: IDENTIFIER_KIND_BIT_2 (in IDENTIFIER_NODE) ICS_THIS_FLAG (in _CONV) DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL) @@ -397,18 +435,20 @@ TARGET_EXPR_DIRECT_INIT_P (in TARGET_EXPR) FNDECL_USED_AUTO (in FUNCTION_DECL) DECLTYPE_FOR_LAMBDA_PROXY (in DECLTYPE_TYPE) - REF_PARENTHESIZED_P (in COMPONENT_REF, INDIRECT_REF, SCOPE_REF) + REF_PARENTHESIZED_P (in COMPONENT_REF, INDIRECT_REF, SCOPE_REF, VIEW_CONVERT_EXPR) AGGR_INIT_ZERO_FIRST (in AGGR_INIT_EXPR) CONSTRUCTOR_MUTABLE_POISON (in CONSTRUCTOR) OVL_HIDDEN_P (in OVERLOAD) + SWITCH_STMT_NO_BREAK_P (in SWITCH_STMT) + LAMBDA_EXPR_CAPTURE_OPTIMIZED (in LAMBDA_EXPR) 3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out). ICS_BAD_FLAG (in _CONV) FN_TRY_BLOCK_P (in TRY_BLOCK) BIND_EXPR_BODY_BLOCK (in BIND_EXPR) - DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL) + DECL_NONTRIVIALLY_INITIALIZED_P (in VAR_DECL) CALL_EXPR_ORDERED_ARGS (in CALL_EXPR, AGGR_INIT_EXPR) DECLTYPE_FOR_REF_CAPTURE (in DECLTYPE_TYPE) - CONSTUCTOR_C99_COMPOUND_LITERAL (in CONSTRUCTOR) + CONSTRUCTOR_C99_COMPOUND_LITERAL (in CONSTRUCTOR) OVL_NESTED_P (in OVERLOAD) 4: IDENTIFIER_MARKED (IDENTIFIER_NODEs) TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR, @@ -421,6 +461,7 @@ DECL_VTABLE_OR_VTT_P (in VAR_DECL) FUNCTION_RVALUE_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE) CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR) + CONSTRUCTOR_PLACEHOLDER_BOUNDARY (in CONSTRUCTOR) 6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE) DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL) TYPE_MARKED_P (in _TYPE) @@ -440,8 +481,7 @@ 6: TYPE_DEPENDENT_P_VALID Usage of DECL_LANG_FLAG_?: - 0: DECL_ERROR_REPORTED (in VAR_DECL). - DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL) + 0: DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL) DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL) DECL_MUTABLE_P (in FIELD_DECL) DECL_DEPENDENT_P (in USING_DECL) @@ -468,8 +508,7 @@ 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL). DECL_FIELD_IS_BASE (in FIELD_DECL) TYPE_DECL_ALIAS_P (in TYPE_DECL) - 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL). - DECL_THUNK_P (in a member FUNCTION_DECL) + 7: 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) @@ -626,6 +665,11 @@ #define COND_EXPR_IS_VEC_DELETE(NODE) \ TREE_LANG_FLAG_0 (COND_EXPR_CHECK (NODE)) +/* Nonzero if this NOP_EXPR is a reinterpret_cast. Such conversions + are not constexprs. Other NOP_EXPRs are. */ +#define REINTERPRET_CAST_P(NODE) \ + TREE_LANG_FLAG_0 (NOP_EXPR_CHECK (NODE)) + /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual sense of `same'. */ #define same_type_p(TYPE1, TYPE2) \ @@ -1003,9 +1047,9 @@ cik_dtor = 3, /* Destructor (in-chg, deleting, complete or base). */ cik_simple_op = 4, /* Non-assignment operator name. */ - cik_newdel_op = 5, /* New or delete operator name. */ - cik_assign_op = 6, /* An assignment operator name. */ - cik_conv_op = 7, /* Conversion operator name. */ + cik_assign_op = 5, /* An assignment operator name. */ + cik_conv_op = 6, /* Conversion operator name. */ + cik_reserved_for_udlit = 7, /* Not yet in use */ cik_max }; @@ -1060,24 +1104,38 @@ #define IDENTIFIER_ANY_OP_P(NODE) \ (IDENTIFIER_KIND_BIT_2 (NODE)) -/* True if this identifier is for new or delete operator. Value 5. */ -#define IDENTIFIER_NEWDEL_OP_P(NODE) \ - (IDENTIFIER_KIND_BIT_2 (NODE) \ - & (!IDENTIFIER_KIND_BIT_1 (NODE)) \ +/* True if this identifier is for an overloaded operator. Values 4, 5. */ +#define IDENTIFIER_OVL_OP_P(NODE) \ + (IDENTIFIER_ANY_OP_P (NODE) \ + & (!IDENTIFIER_KIND_BIT_1 (NODE))) + +/* True if this identifier is for any assignment. Values 5. */ +#define IDENTIFIER_ASSIGN_OP_P(NODE) \ + (IDENTIFIER_OVL_OP_P (NODE) \ & IDENTIFIER_KIND_BIT_0 (NODE)) -/* True if this identifier is for any assignment. Values 6. */ -#define IDENTIFIER_ASSIGN_OP_P(NODE) \ - (IDENTIFIER_KIND_BIT_2 (NODE) \ - & IDENTIFIER_KIND_BIT_1 (NODE) \ - & (!IDENTIFIER_KIND_BIT_0 (NODE))) - /* True if this identifier is the name of a type-conversion operator. Value 7. */ #define IDENTIFIER_CONV_OP_P(NODE) \ - (IDENTIFIER_KIND_BIT_2 (NODE) \ + (IDENTIFIER_ANY_OP_P (NODE) \ & IDENTIFIER_KIND_BIT_1 (NODE) \ - & IDENTIFIER_KIND_BIT_0 (NODE)) + & (!IDENTIFIER_KIND_BIT_0 (NODE))) + +/* True if this identifier is a new or delete operator. */ +#define IDENTIFIER_NEWDEL_OP_P(NODE) \ + (IDENTIFIER_OVL_OP_P (NODE) \ + && IDENTIFIER_OVL_OP_FLAGS (NODE) & OVL_OP_FLAG_ALLOC) + +/* True if this identifier is a new operator. */ +#define IDENTIFIER_NEW_OP_P(NODE) \ + (IDENTIFIER_OVL_OP_P (NODE) \ + && (IDENTIFIER_OVL_OP_FLAGS (NODE) \ + & (OVL_OP_FLAG_ALLOC | OVL_OP_FLAG_DELETE)) == OVL_OP_FLAG_ALLOC) + +/* Access a C++-specific index for identifier NODE. + Used to optimize operator mappings etc. */ +#define IDENTIFIER_CP_INDEX(NODE) \ + (IDENTIFIER_NODE_CHECK(NODE)->base.u.bits.address_space) /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */ #define C_TYPE_FIELDS_READONLY(TYPE) \ @@ -1203,9 +1261,10 @@ (CLASS_TYPE_P (NODE) && CLASSTYPE_LAMBDA_EXPR (NODE)) /* Test if FUNCTION_DECL is a lambda function. */ -#define LAMBDA_FUNCTION_P(FNDECL) \ - (DECL_DECLARES_FUNCTION_P (FNDECL) \ - && DECL_OVERLOADED_OPERATOR_P (FNDECL) == CALL_EXPR \ +#define LAMBDA_FUNCTION_P(FNDECL) \ + (DECL_DECLARES_FUNCTION_P (FNDECL) \ + && DECL_OVERLOADED_OPERATOR_P (FNDECL) \ + && DECL_OVERLOADED_OPERATOR_IS (FNDECL, CALL_EXPR) \ && LAMBDA_TYPE_P (CP_DECL_CONTEXT (FNDECL))) enum cp_lambda_default_capture_mode_type { @@ -1241,6 +1300,15 @@ #define LAMBDA_EXPR_MUTABLE_P(NODE) \ TREE_LANG_FLAG_1 (LAMBDA_EXPR_CHECK (NODE)) +/* True iff uses of a const variable capture were optimized away. */ +#define LAMBDA_EXPR_CAPTURE_OPTIMIZED(NODE) \ + TREE_LANG_FLAG_2 (LAMBDA_EXPR_CHECK (NODE)) + +/* True if this TREE_LIST in LAMBDA_EXPR_CAPTURE_LIST is for an explicit + capture. */ +#define LAMBDA_CAPTURE_EXPLICIT_P(NODE) \ + TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE)) + /* The source location of the lambda. */ #define LAMBDA_EXPR_LOCATION(NODE) \ (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->locus) @@ -1628,6 +1696,25 @@ ~warning_sentinel() { flag = val; } }; +/* RAII sentinel that saves the value of a variable, optionally + overrides it right away, and restores its value when the sentinel + id destructed. */ + +template <typename T> +class temp_override +{ + T& overridden_variable; + T saved_value; +public: + temp_override(T& var) : overridden_variable (var), saved_value (var) {} + temp_override(T& var, T overrider) + : overridden_variable (var), saved_value (var) + { + overridden_variable = overrider; + } + ~temp_override() { overridden_variable = saved_value; } +}; + /* The cached class binding level, from the most recently exited class, or NULL if none. */ @@ -1790,6 +1877,8 @@ /* In parser.c. */ extern tree cp_literal_operator_id (const char *); +#define NON_ERROR(NODE) ((NODE) == error_mark_node ? NULL_TREE : (NODE)) + /* TRUE if a tree code represents a statement. */ extern bool statement_code_p[MAX_TREE_CODES]; @@ -2438,7 +2527,8 @@ unsigned u2sel : 1; unsigned concept_p : 1; /* applies to vars and functions */ unsigned var_declared_inline_p : 1; /* var */ - /* 2 spare bits */ + unsigned dependent_init_p : 1; /* var */ + /* 1 spare bit */ }; /* True for DECL codes which have template info and access. */ @@ -2480,26 +2570,24 @@ struct GTY(()) lang_decl_fn { struct lang_decl_min min; - /* In an overloaded operator, this is the value of - DECL_OVERLOADED_OPERATOR_P. - FIXME: We should really do better in compressing this. */ - ENUM_BITFIELD (tree_code) operator_code : 16; - + /* In a overloaded operator, this is the compressed operator code. */ + unsigned ovl_op_code : 6; unsigned global_ctor_p : 1; unsigned global_dtor_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 pending_inline_p : 1; - unsigned nonconverting : 1; unsigned thunk_p : 1; + unsigned this_thunk_p : 1; unsigned hidden_friend_p : 1; unsigned omp_declare_reduction_p : 1; - /* 3 spare bits. */ + unsigned spare : 13; /* 32-bits padding on 64-bit host. */ @@ -2679,7 +2767,7 @@ /* For FUNCTION_DECLs and TEMPLATE_DECLs: nonzero means that this function is a constructor. */ #define DECL_CONSTRUCTOR_P(NODE) \ - IDENTIFIER_CTOR_P (DECL_NAME (NODE)) + DECL_CXX_CONSTRUCTOR_P (STRIP_TEMPLATE (NODE)) /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete object. */ @@ -2708,7 +2796,7 @@ /* Nonzero if NODE (a FUNCTION_DECL or TEMPLATE_DECL) is a destructor. */ #define DECL_DESTRUCTOR_P(NODE) \ - IDENTIFIER_DTOR_P (DECL_NAME (NODE)) + DECL_CXX_DESTRUCTOR_P (STRIP_TEMPLATE (NODE)) /* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the specialized in-charge constructor, in-charge deleting constructor, @@ -2731,6 +2819,12 @@ #define DECL_DELETING_DESTRUCTOR_P(NODE) \ (DECL_NAME (NODE) == deleting_dtor_identifier) +/* Nonzero if either DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P or + DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P is true of NODE. */ +#define DECL_MAYBE_IN_CHARGE_CDTOR_P(NODE) \ + (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (NODE) \ + || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (NODE)) + /* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or destructor. */ #define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true)) @@ -2748,8 +2842,7 @@ */ #define FOR_EACH_CLONE(CLONE, FN) \ if (!(TREE_CODE (FN) == FUNCTION_DECL \ - && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \ - || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))))\ + && DECL_MAYBE_IN_CHARGE_CDTOR_P (FN))) \ ; \ else \ for (CLONE = DECL_CHAIN (FN); \ @@ -2806,23 +2899,24 @@ #define SET_VAR_HAD_UNKNOWN_BOUND(NODE) \ (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.unknown_bound_p = true) -/* Set the overloaded operator code for NODE to CODE. */ -#define SET_OVERLOADED_OPERATOR_CODE(NODE, 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. If NODE is not an - overloaded operator, ERROR_MARK is returned. Since the numerical - value of ERROR_MARK is zero, this macro can be used as a predicate - to test whether or not NODE is an overloaded operator. */ +/* True iff decl NODE is for an overloaded operator. */ #define DECL_OVERLOADED_OPERATOR_P(NODE) \ - (IDENTIFIER_ANY_OP_P (DECL_NAME (NODE)) \ - ? LANG_DECL_FN_CHECK (NODE)->operator_code : ERROR_MARK) + IDENTIFIER_ANY_OP_P (DECL_NAME (NODE)) /* Nonzero if NODE is an assignment operator (including += and such). */ -#define DECL_ASSIGNMENT_OPERATOR_P(NODE) \ +#define DECL_ASSIGNMENT_OPERATOR_P(NODE) \ IDENTIFIER_ASSIGN_OP_P (DECL_NAME (NODE)) +/* NODE is a function_decl for an overloaded operator. Return its + compressed (raw) operator code. Note that this is not a TREE_CODE. */ +#define DECL_OVERLOADED_OPERATOR_CODE_RAW(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->ovl_op_code) + +/* DECL is an overloaded operator. Test whether it is for TREE_CODE + (a literal constant). */ +#define DECL_OVERLOADED_OPERATOR_IS(DECL, CODE) \ + (DECL_OVERLOADED_OPERATOR_CODE_RAW (DECL) == OVL_OP_##CODE) + /* 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. */ @@ -3043,7 +3137,7 @@ /* For a non-member friend function, the class (if any) in which this friend was defined. For example, given: - struct S { friend void f (); }; + struct S { friend void f () { ... } }; the DECL_FRIEND_CONTEXT for `f' will be `S'. */ #define DECL_FRIEND_CONTEXT(NODE) \ @@ -3157,9 +3251,6 @@ was inherited from a template parameter, not explicitly indicated. */ #define ABI_TAG_IMPLICIT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE)) -extern tree decl_shadowed_for_var_lookup (tree); -extern void decl_shadowed_for_var_insert (tree, tree); - /* Non zero if this is a using decl for a dependent scope. */ #define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE)) @@ -3172,19 +3263,6 @@ /* Non zero if the using decl refers to a dependent type. */ #define USING_DECL_TYPENAME_P(NODE) DECL_LANG_FLAG_1 (USING_DECL_CHECK (NODE)) -/* In a VAR_DECL, true if we have a shadowed local variable - in the shadowed var table for this VAR_DECL. */ -#define DECL_HAS_SHADOWED_FOR_VAR_P(NODE) \ - (VAR_DECL_CHECK (NODE)->decl_with_vis.shadowed_for_var_p) - -/* In a VAR_DECL for a variable declared in a for statement, - this is the shadowed (local) variable. */ -#define DECL_SHADOWED_FOR_VAR(NODE) \ - (DECL_HAS_SHADOWED_FOR_VAR_P(NODE) ? decl_shadowed_for_var_lookup (NODE) : NULL) - -#define SET_DECL_SHADOWED_FOR_VAR(NODE, VAL) \ - (decl_shadowed_for_var_insert (NODE, VAL)) - /* In a FUNCTION_DECL, this is nonzero if this function was defined in the class definition. We have saved away the text of the function, but have not yet processed it. */ @@ -3218,11 +3296,11 @@ DECL_USE_TEMPLATE is nonzero) or the abstract instance of the template itself. - In either case, DECL_TEMPLATE_INFO is a TREE_LIST, whose - TREE_PURPOSE is the TEMPLATE_DECL of which this entity is a - specialization or abstract instance. The TREE_VALUE is the + In either case, DECL_TEMPLATE_INFO is a TEMPLATE_INFO, whose + TI_TEMPLATE is the TEMPLATE_DECL of which this entity is a + specialization or abstract instance. The TI_ARGS is the template arguments used to specialize the template. - + Consider: template <typename T> struct S { friend void f(T) {} }; @@ -3289,11 +3367,14 @@ #define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE)) #define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE)) -#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE) +#define TI_PENDING_TEMPLATE_FLAG(NODE) \ + TREE_LANG_FLAG_1 (TEMPLATE_INFO_CHECK (NODE)) /* For a given TREE_VEC containing a template argument list, this property contains the number of arguments that are not defaulted. */ -#define NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) TREE_CHAIN (TREE_VEC_CHECK (NODE)) +#define NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \ + TREE_CHAIN (TREE_VEC_CHECK (NODE)) + /* Below are the setter and getter of the NON_DEFAULT_TEMPLATE_ARGS_COUNT property. */ #define SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE, INT_VALUE) \ @@ -3460,7 +3541,7 @@ /* Extracts the type or expression pattern from a TYPE_PACK_EXPANSION or EXPR_PACK_EXPANSION. */ #define PACK_EXPANSION_PATTERN(NODE) \ - (TREE_CODE (NODE) == TYPE_PACK_EXPANSION? TREE_TYPE (NODE) \ + (TREE_CODE (NODE) == TYPE_PACK_EXPANSION ? TREE_TYPE (NODE) \ : TREE_OPERAND (NODE, 0)) /* Sets the type or expression pattern for a TYPE_PACK_EXPANSION or @@ -3479,7 +3560,11 @@ : &TYPE_MIN_VALUE_RAW (TYPE_PACK_EXPANSION_CHECK (NODE))) /* Any additional template args to be applied when substituting into - the pattern, set by tsubst_pack_expansion for partial instantiations. */ + the pattern, set by tsubst_pack_expansion for partial instantiations. + If this is a TREE_LIST, the TREE_VALUE of the first element is the + usual template argument TREE_VEC, and the TREE_PURPOSE of later elements + are enclosing functions that provided function parameter packs we'll need + to map appropriately. */ #define PACK_EXPANSION_EXTRA_ARGS(NODE) \ *(TREE_CODE (NODE) == TYPE_PACK_EXPANSION \ ? &TYPE_MAX_VALUE_RAW (NODE) \ @@ -3537,12 +3622,6 @@ #define ARGUMENT_PACK_SELECT_INDEX(NODE) \ (((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->index) -/* In an ARGUMENT_PACK_SELECT, the actual underlying argument that the - ARGUMENT_PACK_SELECT represents. */ -#define ARGUMENT_PACK_SELECT_ARG(NODE) \ - TREE_VEC_ELT (ARGUMENT_PACK_ARGS (ARGUMENT_PACK_SELECT_FROM_PACK (NODE)), \ - ARGUMENT_PACK_SELECT_INDEX (NODE)) - #define FOLD_EXPR_CHECK(NODE) \ TREE_CHECK4 (NODE, UNARY_LEFT_FOLD_EXPR, UNARY_RIGHT_FOLD_EXPR, \ BINARY_LEFT_FOLD_EXPR, BINARY_RIGHT_FOLD_EXPR) @@ -3579,12 +3658,11 @@ (LANG_DECL_FN_CHECK (FUNCTION_DECL_CHECK (NODE)) \ ->u.saved_language_function) -/* True if NODE is an implicit INDIRECT_EXPR from convert_from_reference. */ +/* True if NODE is an implicit INDIRECT_REF from convert_from_reference. */ #define REFERENCE_REF_P(NODE) \ (INDIRECT_REF_P (NODE) \ && TREE_TYPE (TREE_OPERAND (NODE, 0)) \ - && (TREE_CODE (TREE_TYPE (TREE_OPERAND ((NODE), 0))) \ - == REFERENCE_TYPE)) + && TYPE_REF_P (TREE_TYPE (TREE_OPERAND ((NODE), 0)))) /* True if NODE is a REFERENCE_TYPE which is OK to instantiate to be a reference to VLA type, because it's used for VLA capture. */ @@ -3636,7 +3714,7 @@ of the time in C++14 mode. */ #define REF_PARENTHESIZED_P(NODE) \ - TREE_LANG_FLAG_2 (TREE_CHECK3 ((NODE), COMPONENT_REF, INDIRECT_REF, SCOPE_REF)) + TREE_LANG_FLAG_2 (TREE_CHECK4 ((NODE), COMPONENT_REF, INDIRECT_REF, SCOPE_REF, VIEW_CONVERT_EXPR)) /* Nonzero if this AGGR_INIT_EXPR provides for initialization via a constructor call, rather than an ordinary function call. */ @@ -3788,14 +3866,6 @@ #define TYPE_CONTAINS_VPTR_P(NODE) \ (TYPE_POLYMORPHIC_P (NODE) || CLASSTYPE_VBASECLASSES (NODE)) -/* This flag is true of a local VAR_DECL if it was declared in a for - statement, but we are no longer in the scope of the for. */ -#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE)) - -/* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL - if we already emitted a warning about using it. */ -#define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)) - /* Nonzero if NODE is a FUNCTION_DECL (for a function with global scope) declared in a local scope. */ #define DECL_LOCAL_FUNCTION_P(NODE) \ @@ -3869,6 +3939,13 @@ (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.var_declared_inline_p \ = true) +/* True if NODE is a constant variable with a value-dependent initializer. */ +#define DECL_DEPENDENT_INIT_P(NODE) \ + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) \ + && DECL_LANG_SPECIFIC (NODE)->u.base.dependent_init_p) +#define SET_DECL_DEPENDENT_INIT_P(NODE, X) \ + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.dependent_init_p = (X)) + /* Nonzero if NODE is an artificial VAR_DECL for a C++17 structured binding declaration or one of VAR_DECLs for the user identifiers in it. */ #define DECL_DECOMPOSITION_P(NODE) \ @@ -4096,11 +4173,6 @@ B b{1,2}, not B b({1,2}) or B b = {1,2}. */ #define CONSTRUCTOR_IS_DIRECT_INIT(NODE) (TREE_LANG_FLAG_0 (CONSTRUCTOR_CHECK (NODE))) -/* True if an uninitialized element in NODE should not be treated as - implicitly value-initialized. Only used in constexpr evaluation. */ -#define CONSTRUCTOR_NO_IMPLICIT_ZERO(NODE) \ - (TREE_LANG_FLAG_1 (CONSTRUCTOR_CHECK (NODE))) - /* True if this CONSTRUCTOR should not be used as a variable initializer because it was loaded from a constexpr variable with mutable fields. */ #define CONSTRUCTOR_MUTABLE_POISON(NODE) \ @@ -4111,6 +4183,12 @@ #define CONSTRUCTOR_C99_COMPOUND_LITERAL(NODE) \ (TREE_LANG_FLAG_3 (CONSTRUCTOR_CHECK (NODE))) +/* True if this CONSTRUCTOR contains PLACEHOLDER_EXPRs referencing the + CONSTRUCTOR's type not nested inside another CONSTRUCTOR marked with + CONSTRUCTOR_PLACEHOLDER_BOUNDARY. */ +#define CONSTRUCTOR_PLACEHOLDER_BOUNDARY(NODE) \ + (TREE_LANG_FLAG_5 (CONSTRUCTOR_CHECK (NODE))) + #define DIRECT_LIST_INIT_P(NODE) \ (BRACE_ENCLOSED_INITIALIZER_P (NODE) && CONSTRUCTOR_IS_DIRECT_INIT (NODE)) @@ -4119,6 +4197,11 @@ #define IMPLICIT_CONV_EXPR_DIRECT_INIT(NODE) \ (TREE_LANG_FLAG_0 (IMPLICIT_CONV_EXPR_CHECK (NODE))) +/* True if NODE represents a dependent conversion of a non-type template + argument. Set by maybe_convert_nontype_argument. */ +#define IMPLICIT_CONV_EXPR_NONTYPE_ARG(NODE) \ + (TREE_LANG_FLAG_1 (IMPLICIT_CONV_EXPR_CHECK (NODE))) + /* Nonzero means that an object of this type can not be initialized using an initializer list. */ #define CLASSTYPE_NON_AGGREGATE(NODE) \ @@ -4179,10 +4262,19 @@ /* Returns true if NODE is a pointer-to-data-member. */ #define TYPE_PTRDATAMEM_P(NODE) \ (TREE_CODE (NODE) == OFFSET_TYPE) + /* Returns true if NODE is a pointer. */ #define TYPE_PTR_P(NODE) \ (TREE_CODE (NODE) == POINTER_TYPE) +/* Returns true if NODE is a reference. */ +#define TYPE_REF_P(NODE) \ + (TREE_CODE (NODE) == REFERENCE_TYPE) + +/* Returns true if NODE is a pointer or a reference. */ +#define INDIRECT_TYPE_P(NODE) \ + (TYPE_PTR_P (NODE) || TYPE_REF_P (NODE)) + /* Returns true if NODE is an object type: [basic.types] @@ -4192,7 +4284,7 @@ Keep these checks in ascending order, for speed. */ #define TYPE_OBJ_P(NODE) \ - (TREE_CODE (NODE) != REFERENCE_TYPE \ + (!TYPE_REF_P (NODE) \ && !VOID_TYPE_P (NODE) \ && TREE_CODE (NODE) != FUNCTION_TYPE \ && TREE_CODE (NODE) != METHOD_TYPE) @@ -4205,7 +4297,7 @@ /* Returns true if NODE is a reference to an object. Keep these checks in ascending tree code order. */ #define TYPE_REF_OBJ_P(NODE) \ - (TREE_CODE (NODE) == REFERENCE_TYPE && TYPE_OBJ_P (TREE_TYPE (NODE))) + (TYPE_REF_P (NODE) && TYPE_OBJ_P (TREE_TYPE (NODE))) /* Returns true if NODE is a pointer to an object, or a pointer to void. Keep these checks in ascending tree code order. */ @@ -4221,7 +4313,7 @@ /* Returns true if NODE is a reference to function type. */ #define TYPE_REFFN_P(NODE) \ - (TREE_CODE (NODE) == REFERENCE_TYPE \ + (TYPE_REF_P (NODE) \ && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) /* Returns true if NODE is a pointer to member function type. */ @@ -4490,6 +4582,12 @@ || TREE_CODE (NODE) == TYPE_DECL \ || TREE_CODE (NODE) == TEMPLATE_DECL)) +/* Nonzero for a raw template parameter node. */ +#define TEMPLATE_PARM_P(NODE) \ + (TREE_CODE (NODE) == TEMPLATE_TYPE_PARM \ + || TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM \ + || TREE_CODE (NODE) == TEMPLATE_PARM_INDEX) + /* Mark NODE as a template parameter. */ #define SET_DECL_TEMPLATE_PARM_P(NODE) \ (DECL_LANG_FLAG_0 (NODE) = 1) @@ -4649,7 +4747,8 @@ entity with its own template parameter list, and which is not a full specialization. */ #define PROCESSING_REAL_TEMPLATE_DECL_P() \ - (processing_template_decl > template_class_depth (current_scope ())) + (!processing_template_parmlist \ + && processing_template_decl > template_class_depth (current_scope ())) /* Nonzero if this VAR_DECL or FUNCTION_DECL has already been instantiated, i.e. its definition has been generated from the @@ -4796,6 +4895,10 @@ #define IF_SCOPE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 3) #define IF_STMT_CONSTEXPR_P(NODE) TREE_LANG_FLAG_0 (IF_STMT_CHECK (NODE)) +/* Like PACK_EXPANSION_EXTRA_ARGS, for constexpr if. IF_SCOPE is used while + building an IF_STMT; IF_STMT_EXTRA_ARGS is used after it is complete. */ +#define IF_STMT_EXTRA_ARGS(NODE) IF_SCOPE (NODE) + /* WHILE_STMT accessors. These give access to the condition of the while statement and the body of the while statement, respectively. */ #define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0) @@ -4821,12 +4924,22 @@ #define RANGE_FOR_EXPR(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 1) #define RANGE_FOR_BODY(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 2) #define RANGE_FOR_SCOPE(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 3) +#define RANGE_FOR_UNROLL(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 4) +#define RANGE_FOR_INIT_STMT(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 5) #define RANGE_FOR_IVDEP(NODE) TREE_LANG_FLAG_6 (RANGE_FOR_STMT_CHECK (NODE)) #define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0) #define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1) #define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2) #define SWITCH_STMT_SCOPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 3) +/* True if there are case labels for all possible values of switch cond, either + because there is a default: case label or because the case label ranges cover + all values. */ +#define SWITCH_STMT_ALL_CASES_P(NODE) \ + TREE_LANG_FLAG_0 (SWITCH_STMT_CHECK (NODE)) +/* True if the body of a switch stmt contains no BREAK_STMTs. */ +#define SWITCH_STMT_NO_BREAK_P(NODE) \ + TREE_LANG_FLAG_2 (SWITCH_STMT_CHECK (NODE)) /* STMT_EXPR accessor. */ #define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0) @@ -4870,6 +4983,10 @@ #define SIZEOF_EXPR_TYPE_P(NODE) \ TREE_LANG_FLAG_0 (SIZEOF_EXPR_CHECK (NODE)) +/* True if the ALIGNOF_EXPR was spelled "alignof". */ +#define ALIGNOF_EXPR_STD_P(NODE) \ + TREE_LANG_FLAG_0 (ALIGNOF_EXPR_CHECK (NODE)) + /* An enumeration of the kind of tags that C++ accepts. */ enum tag_types { none_type = 0, /* Not a tag type. */ @@ -5117,7 +5234,6 @@ /* An array of vtable-needing types that have no key function, or have an emitted key function. */ extern GTY(()) vec<tree, va_gc> *keyed_classes; - /* Here's where we control how name mangling takes place. */ @@ -5153,10 +5269,6 @@ #else /* NO_DOLLAR_IN_LABEL */ -#define AUTO_TEMP_NAME "__tmp_" -#define TEMP_NAME_P(ID_NODE) \ - (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \ - sizeof (AUTO_TEMP_NAME) - 1)) #define VTABLE_NAME "__vt_" #define VTABLE_NAME_P(ID_NODE) \ (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \ @@ -5191,8 +5303,6 @@ && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \ && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER) -#define TEMP_NAME_P(ID_NODE) \ - (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1)) #define VFIELD_NAME_P(ID_NODE) \ (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1)) @@ -5479,23 +5589,63 @@ extern void init_reswords (void); -typedef struct GTY(()) operator_name_info_t { +/* Various flags for the overloaded operator information. */ +enum ovl_op_flags + { + OVL_OP_FLAG_NONE = 0, /* Don't care. */ + OVL_OP_FLAG_UNARY = 1, /* Is unary. */ + OVL_OP_FLAG_BINARY = 2, /* Is binary. */ + OVL_OP_FLAG_AMBIARY = 3, /* May be unary or binary. */ + OVL_OP_FLAG_ALLOC = 4, /* operator new or delete. */ + OVL_OP_FLAG_DELETE = 1, /* operator delete. */ + OVL_OP_FLAG_VEC = 2 /* vector new or delete. */ + }; + +/* Compressed operator codes. Order is determined by operators.def + and does not match that of tree_codes. */ +enum ovl_op_code + { + OVL_OP_ERROR_MARK, + OVL_OP_NOP_EXPR, +#define DEF_OPERATOR(NAME, CODE, MANGLING, FLAGS) OVL_OP_##CODE, +#define DEF_ASSN_OPERATOR(NAME, CODE, MANGLING) /* NOTHING */ +#include "operators.def" + OVL_OP_MAX + }; + +struct GTY(()) ovl_op_info_t { /* The IDENTIFIER_NODE for the operator. */ tree identifier; /* The name of the operator. */ const char *name; /* The mangled name of the operator. */ const char *mangled_name; - /* The arity of the operator. */ - int arity; -} operator_name_info_t; - -/* A mapping from tree codes to operator name information. */ -extern GTY(()) operator_name_info_t operator_name_info - [(int) MAX_TREE_CODES]; -/* Similar, but for assignment operators. */ -extern GTY(()) operator_name_info_t assignment_operator_name_info - [(int) MAX_TREE_CODES]; + /* The (regular) tree code. */ + enum tree_code tree_code : 16; + /* The (compressed) operator code. */ + enum ovl_op_code ovl_op_code : 8; + /* The ovl_op_flags of the operator */ + unsigned flags : 8; +}; + +/* Overloaded operator info indexed by ass_op_p & ovl_op_code. */ +extern GTY(()) ovl_op_info_t ovl_op_info[2][OVL_OP_MAX]; +/* Mapping from tree_codes to ovl_op_codes. */ +extern GTY(()) unsigned char ovl_op_mapping[MAX_TREE_CODES]; +/* Mapping for ambi-ary operators from the binary to the unary. */ +extern GTY(()) unsigned char ovl_op_alternate[OVL_OP_MAX]; + +/* Given an ass_op_p boolean and a tree code, return a pointer to its + overloaded operator info. Tree codes for non-overloaded operators + map to the error-operator. */ +#define OVL_OP_INFO(IS_ASS_P, TREE_CODE) \ + (&ovl_op_info[(IS_ASS_P) != 0][ovl_op_mapping[(TREE_CODE)]]) +/* Overloaded operator info for an identifier for which + IDENTIFIER_OVL_OP_P is true. */ +#define IDENTIFIER_OVL_OP_INFO(NODE) \ + (&ovl_op_info[IDENTIFIER_KIND_BIT_0 (NODE)][IDENTIFIER_CP_INDEX (NODE)]) +#define IDENTIFIER_OVL_OP_FLAGS(NODE) \ + (IDENTIFIER_OVL_OP_INFO (NODE)->flags) /* A type-qualifier, or bitmask therefore, using the TYPE_QUAL constants. */ @@ -5747,19 +5897,83 @@ /* The immediately deeper level in the chain. */ struct tinst_level *next; - /* The original node. Can be either a DECL (for a function or static - data member) or a TYPE (for a class), depending on what we were - asked to instantiate. */ - tree decl; + /* The original node. TLDCL can be a DECL (for a function or static + data member), a TYPE (for a class), depending on what we were + asked to instantiate, or a TREE_LIST with the template as PURPOSE + and the template args as VALUE, if we are substituting for + overload resolution. In all these cases, TARGS is NULL. + However, to avoid creating TREE_LIST objects for substitutions if + we can help, we store PURPOSE and VALUE in TLDCL and TARGS, + respectively. So TLDCL stands for TREE_LIST or DECL (the + template is a DECL too), whereas TARGS stands for the template + arguments. */ + tree tldcl, targs; + + private: + /* Return TRUE iff the original node is a split list. */ + bool split_list_p () const { return targs; } + + /* Return TRUE iff the original node is a TREE_LIST object. */ + bool tree_list_p () const + { + return !split_list_p () && TREE_CODE (tldcl) == TREE_LIST; + } + + /* Return TRUE iff the original node is not a list, split or not. */ + bool not_list_p () const + { + return !split_list_p () && !tree_list_p (); + } + + /* Convert (in place) the original node from a split list to a + TREE_LIST. */ + tree to_list (); + + public: + /* Release storage for OBJ and node, if it's a TREE_LIST. */ + static void free (tinst_level *obj); + + /* Return TRUE iff the original node is a list, split or not. */ + bool list_p () const { return !not_list_p (); } + + /* Return the original node; if it's a split list, make it a + TREE_LIST first, so that it can be returned as a single tree + object. */ + tree get_node () { + if (!split_list_p ()) return tldcl; + else return to_list (); + } + + /* Return the original node if it's a DECL or a TREE_LIST, but do + NOT convert a split list to a TREE_LIST: return NULL instead. */ + tree maybe_get_node () const { + if (!split_list_p ()) return tldcl; + else return NULL_TREE; + } /* The location where the template is instantiated. */ location_t locus; - /* errorcount+sorrycount when we pushed this level. */ - int errors; - - /* True if the location is in a system header. */ - bool in_system_header_p; + /* errorcount + sorrycount when we pushed this level. */ + unsigned short errors; + + /* Count references to this object. If refcount reaches + refcount_infinity value, we don't increment or decrement the + refcount anymore, as the refcount isn't accurate anymore. + The object can be still garbage collected if unreferenced from + anywhere, which might keep referenced objects referenced longer than + otherwise necessary. Hitting the infinity is rare though. */ + unsigned short refcount; + + /* Infinity value for the above refcount. */ + static const unsigned short refcount_infinity = (unsigned short) ~0; +}; + +/* BUILT_IN_FRONTEND function codes. */ +enum cp_built_in_function { + CP_BUILT_IN_IS_CONSTANT_EVALUATED, + CP_BUILT_IN_INTEGER_PACK, + CP_BUILT_IN_LAST }; bool decl_spec_seq_has_spec_p (const cp_decl_specifier_seq *, cp_decl_spec); @@ -5843,6 +6057,7 @@ extern bool sufficient_parms_p (const_tree); extern tree type_decays_to (tree); extern tree extract_call_expr (tree); +extern tree build_trivial_dtor_call (tree); extern tree build_user_type_conversion (tree, tree, int, tsubst_flags_t); extern tree build_new_function_call (tree, vec<tree, va_gc> **, @@ -5872,6 +6087,13 @@ tsubst_flags_t); extern bool can_convert_arg_bad (tree, tree, tree, int, tsubst_flags_t); +extern int conv_flags (int, int, tree, tree, int); +extern struct conversion * good_conversion (tree, tree, tree, int, tsubst_flags_t); +extern location_t get_fndecl_argument_location (tree, int); +extern void complain_about_bad_argument (location_t arg_loc, + tree from_type, tree to_type, + tree fndecl, int parmnum); + /* A class for recording information about access failures (e.g. private fields), so that we can potentially supply a fix-it hint about @@ -5881,18 +6103,27 @@ class access_failure_info { public: - access_failure_info () : m_was_inaccessible (false), m_basetype_path (NULL_TREE), - m_field_decl (NULL_TREE) {} - - void record_access_failure (tree basetype_path, tree field_decl); + access_failure_info () : m_was_inaccessible (false), + m_basetype_path (NULL_TREE), + m_decl (NULL_TREE), m_diag_decl (NULL_TREE) {} + + void record_access_failure (tree basetype_path, tree decl, tree diag_decl); + + bool was_inaccessible_p () const { return m_was_inaccessible; } + tree get_decl () const { return m_decl; } + tree get_diag_decl () const { return m_diag_decl; } + tree get_any_accessor (bool const_p) const; void maybe_suggest_accessor (bool const_p) const; + static void add_fixit_hint (rich_location *richloc, tree accessor); private: bool m_was_inaccessible; tree m_basetype_path; - tree m_field_decl; + tree m_decl; + tree m_diag_decl; }; +extern void complain_about_access (tree, tree, bool); extern bool enforce_access (tree, tree, tree, tsubst_flags_t, access_failure_info *afi = NULL); @@ -5926,6 +6157,7 @@ extern bool is_list_ctor (tree); extern void validate_conversion_obstack (void); extern void mark_versions_used (tree); +extern bool cp_warn_deprecated_use (tree, tsubst_flags_t = tf_warning_or_error); extern tree get_function_version_dispatcher (tree); /* in class.c */ @@ -5959,7 +6191,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 build_self_reference (void); extern int same_signature_p (const_tree, const_tree); extern void maybe_add_class_template_decl_list (tree, tree, int); @@ -5988,6 +6219,8 @@ extern bool type_has_constexpr_default_constructor (tree); extern bool type_has_virtual_destructor (tree); extern bool classtype_has_move_assign_or_move_ctor_p (tree, bool user_declared); +extern bool classtype_has_non_deleted_move_ctor (tree); +extern tree classtype_has_user_copy_or_dtor (tree); extern bool type_build_ctor_call (tree); extern bool type_build_dtor_call (tree); extern void explain_non_literal_class (tree); @@ -6018,7 +6251,8 @@ extern tree cp_fold_convert (tree, tree); extern tree cp_get_callee (tree); extern tree cp_get_callee_fndecl (tree); -extern tree cp_get_fndecl_from_callee (tree); +extern tree cp_get_callee_fndecl_nofold (tree); +extern tree cp_get_fndecl_from_callee (tree, bool fold = true); extern tree convert_to_void (tree, impl_conv_void, tsubst_flags_t); extern tree convert_force (tree, tree, int, @@ -6035,10 +6269,6 @@ /* in name-lookup.c */ extern void maybe_push_cleanup_level (tree); extern tree make_anon_name (void); -extern tree check_for_out_of_scope_variable (tree); -extern void dump (cp_binding_level &ref); -extern void dump (cp_binding_level *ptr); -extern void print_other_binding_stack (cp_binding_level *); extern tree maybe_push_decl (tree); extern tree current_decl_namespace (void); @@ -6050,9 +6280,12 @@ extern void finish_scope (void); extern void push_switch (tree); extern void pop_switch (void); +extern void note_break_stmt (void); +extern bool note_iteration_stmt_body_start (void); +extern void note_iteration_stmt_body_end (bool); extern tree make_lambda_name (void); -extern int decls_match (tree, tree); -extern bool maybe_version_functions (tree, tree); +extern int decls_match (tree, tree, bool = true); +extern bool maybe_version_functions (tree, tree, bool); extern tree duplicate_decls (tree, tree, bool); extern tree declare_local_label (tree); extern tree define_label (location_t, tree); @@ -6076,6 +6309,7 @@ extern bool check_array_initializer (tree, tree, tree); extern void cp_finish_decl (tree, tree, bool, tree, int); extern tree lookup_decomp_type (tree); +extern void cp_maybe_mangle_decomp (tree, tree, unsigned int); extern void cp_finish_decomp (tree, tree, unsigned int); extern int cp_complete_array_type (tree *, tree, bool); extern int cp_complete_array_type_or_error (tree *, tree, bool, tsubst_flags_t); @@ -6138,9 +6372,13 @@ extern tree finish_case_label (location_t, tree, tree); extern tree cxx_maybe_build_cleanup (tree, tsubst_flags_t); +extern bool check_array_designated_initializer (constructor_elt *, + unsigned HOST_WIDE_INT); +extern bool check_for_uninitialized_const_var (tree, bool, tsubst_flags_t); /* in decl2.c */ extern void record_mangling (tree, bool); +extern void overwrite_mangling (tree, tree); extern void note_mangling_alias (tree, tree); extern void generate_mangling_aliases (void); extern tree build_memfn_type (tree, tree, cp_cv_quals, cp_ref_qualifier); @@ -6165,8 +6403,8 @@ extern void cplus_decl_attributes (tree *, tree, int); extern void finish_anon_union (tree); extern void cxx_post_compilation_parsing_cleanups (void); -extern tree coerce_new_type (tree); -extern tree coerce_delete_type (tree); +extern tree coerce_new_type (tree, location_t); +extern tree coerce_delete_type (tree, location_t); extern void comdat_linkage (tree); extern void determine_visibility (tree); extern void constrain_class_visibility (tree); @@ -6232,7 +6470,7 @@ extern bool nothrow_spec_p (const_tree); extern bool type_noexcept_p (const_tree); extern bool type_throw_all_p (const_tree); -extern tree build_noexcept_spec (tree, int); +extern tree build_noexcept_spec (tree, tsubst_flags_t); extern void choose_personality_routine (enum languages); extern tree build_must_not_throw_expr (tree,tree); extern tree eh_type_info (tree); @@ -6244,9 +6482,12 @@ /* in expr.c */ extern tree cplus_expand_constant (tree); +extern tree mark_use (tree expr, bool rvalue_p, bool read_p, + location_t = UNKNOWN_LOCATION, + bool reject_builtin = true); extern tree mark_rvalue_use (tree, location_t = UNKNOWN_LOCATION, - bool = true); + bool reject_builtin = true); extern tree mark_lvalue_use (tree); extern tree mark_lvalue_use_nonread (tree); extern tree mark_type_use (tree); @@ -6257,7 +6498,8 @@ extern int is_friend (tree, tree); extern void make_friend_class (tree, tree, bool); extern void add_friend (tree, tree, bool); -extern tree do_friend (tree, tree, tree, tree, enum overload_flags, bool); +extern tree do_friend (tree, tree, tree, tree, + enum overload_flags, bool); extern void set_global_friend (tree); extern bool is_global_friend (tree); @@ -6313,8 +6555,8 @@ extern void fit_decomposition_lang_decl (tree, tree); extern tree copy_decl (tree CXX_MEM_STAT_INFO); extern tree copy_type (tree CXX_MEM_STAT_INFO); -extern tree cxx_make_type (enum tree_code); -extern tree make_class_type (enum tree_code); +extern tree cxx_make_type (enum tree_code CXX_MEM_STAT_INFO); +extern tree make_class_type (enum tree_code CXX_MEM_STAT_INFO); extern const char *get_identifier_kind_name (tree); extern void set_identifier_kind (tree, cp_identifier_kind); extern bool cxx_init (void); @@ -6356,15 +6598,18 @@ extern bool maybe_clone_body (tree); /* In parser.c */ -extern tree cp_convert_range_for (tree, tree, tree, tree, unsigned int, bool); +extern tree cp_convert_range_for (tree, tree, tree, tree, unsigned int, bool, + unsigned short); extern bool parsing_nsdmi (void); extern bool parsing_default_capturing_generic_lambda_in_template (void); extern void inject_this_parameter (tree, cp_cv_quals); extern location_t defarg_location (tree); extern void maybe_show_extern_c_location (void); +extern bool literal_integer_zerop (const_tree); /* in pt.c */ extern bool check_template_shadow (tree); +extern bool check_auto_in_tmpl_args (tree, tree); extern tree get_innermost_template_args (tree, int); extern void maybe_begin_member_template_processing (tree); extern void maybe_end_member_template_processing (void); @@ -6376,17 +6621,19 @@ extern void begin_explicit_instantiation (void); extern void end_explicit_instantiation (void); extern void check_unqualified_spec_or_inst (tree, location_t); -extern tree check_explicit_specialization (tree, tree, int, int); +extern tree check_explicit_specialization (tree, tree, int, int, + tree = NULL_TREE); extern int num_template_headers_for_class (tree); extern void check_template_variable (tree); extern tree make_auto (void); extern tree make_decltype_auto (void); extern tree make_template_placeholder (tree); extern bool template_placeholder_p (tree); -extern tree do_auto_deduction (tree, tree, tree); extern tree do_auto_deduction (tree, tree, tree, - tsubst_flags_t, - auto_deduction_context, + tsubst_flags_t + = tf_warning_or_error, + auto_deduction_context + = adc_unspecified, tree = NULL_TREE, int = LOOKUP_NORMAL); extern tree type_uses_auto (tree); @@ -6415,12 +6662,12 @@ extern bool uses_template_parms_level (tree, int); extern bool in_template_function (void); extern bool need_generic_capture (void); -extern bool processing_nonlambda_template (void); extern tree instantiate_class_template (tree); extern tree instantiate_template (tree, tree, tsubst_flags_t); extern tree fn_type_unification (tree, tree, tree, const tree *, unsigned int, tree, unification_kind_t, int, + struct conversion **, bool, bool); extern void mark_decl_instantiated (tree, int); extern int more_specialized_fn (tree, tree, int); @@ -6435,8 +6682,8 @@ 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 make_pack_expansion (tree, tsubst_flags_t = tf_warning_or_error); +extern bool check_for_bare_parameter_packs (tree, location_t = UNKNOWN_LOCATION); extern tree build_template_info (tree, tree); extern tree get_template_info (const_tree); extern vec<qualified_typedef_usage_t, va_gc> *get_types_needing_access_check (tree); @@ -6470,6 +6717,7 @@ extern bool dependent_type_p (tree); extern bool dependent_scope_p (tree); extern bool any_dependent_template_arguments_p (const_tree); +extern bool any_erroneous_template_args_p (const_tree); extern bool dependent_template_p (tree); extern bool dependent_template_id_p (tree, tree); extern bool type_dependent_expression_p (tree); @@ -6504,7 +6752,7 @@ extern void print_template_statistics (void); bool template_template_parameter_p (const_tree); bool template_type_parameter_p (const_tree); -extern bool primary_template_instantiation_p (const_tree); +extern bool primary_template_specialization_p (const_tree); extern tree get_primary_template_innermost_parameters (const_tree); extern tree get_template_parms_at_level (tree, int); extern tree get_template_innermost_arguments (const_tree); @@ -6618,9 +6866,9 @@ struct deferring_access_check_sentinel { - deferring_access_check_sentinel () + deferring_access_check_sentinel (enum deferring_kind kind = dk_deferred) { - push_deferring_access_checks (dk_deferred); + push_deferring_access_checks (kind); } ~deferring_access_check_sentinel () { @@ -6642,16 +6890,16 @@ extern void finish_else_clause (tree); extern void finish_if_stmt (tree); extern tree begin_while_stmt (void); -extern void finish_while_stmt_cond (tree, tree, bool); +extern void finish_while_stmt_cond (tree, tree, bool, unsigned short); extern void finish_while_stmt (tree); extern tree begin_do_stmt (void); extern void finish_do_body (tree); -extern void finish_do_stmt (tree, tree, bool); +extern void finish_do_stmt (tree, tree, bool, unsigned short); extern tree finish_return_stmt (tree); extern tree begin_for_scope (tree *); extern tree begin_for_stmt (tree, tree); extern void finish_init_stmt (tree); -extern void finish_for_cond (tree, tree, bool); +extern void finish_for_cond (tree, tree, bool, unsigned short); extern void finish_for_expr (tree, tree); extern void finish_for_stmt (tree); extern tree begin_range_for_stmt (tree, tree); @@ -6693,6 +6941,7 @@ extern cp_expr finish_parenthesized_expr (cp_expr); extern tree force_paren_expr (tree); extern tree maybe_undo_parenthesized_ref (tree); +extern tree maybe_strip_ref_conversion (tree); extern tree finish_non_static_data_member (tree, tree, tree); extern tree begin_stmt_expr (void); extern tree finish_stmt_expr_expr (tree, tree); @@ -6733,9 +6982,9 @@ location_t); extern tree finish_typeof (tree); extern tree finish_underlying_type (tree); -extern tree calculate_bases (tree); +extern tree calculate_bases (tree, tsubst_flags_t); extern tree finish_bases (tree, bool); -extern tree calculate_direct_bases (tree); +extern tree calculate_direct_bases (tree, tsubst_flags_t); extern tree finish_offsetof (tree, tree, location_t); extern void finish_decl_cleanup (tree, tree); extern void finish_eh_cleanup (tree); @@ -6803,11 +7052,11 @@ extern void apply_deduced_return_type (tree, tree); extern tree add_capture (tree, tree, tree, bool, bool); extern tree add_default_capture (tree, tree, tree); -extern tree build_capture_proxy (tree, tree); extern void insert_capture_proxy (tree); extern void insert_pending_capture_proxies (void); extern bool is_capture_proxy (tree); extern bool is_normal_capture_proxy (tree); +extern bool is_constant_capture_proxy (tree); extern void register_capture_members (tree); extern tree lambda_expr_this_capture (tree, bool); extern void maybe_generic_this_capture (tree, tree); @@ -6815,6 +7064,7 @@ extern tree current_nonlambda_function (void); extern tree nonlambda_method_basetype (void); extern tree current_nonlambda_scope (void); +extern tree current_lambda_expr (void); extern bool generic_lambda_fn_p (tree); extern tree do_dependent_capture (tree, bool = false); extern bool lambda_fn_in_template_p (tree); @@ -6825,6 +7075,7 @@ tsubst_flags_t); extern void start_lambda_scope (tree); extern void record_lambda_scope (tree); +extern void record_null_lambda_scope (tree); extern void finish_lambda_scope (void); extern tree start_lambda_function (tree fn, tree lambda_expr); extern void finish_lambda_function (tree body); @@ -6886,6 +7137,7 @@ extern tree build_cplus_array_type (tree, tree); extern tree build_array_of_n_type (tree, int); extern bool array_of_runtime_bound_p (tree); +extern bool vla_type_p (tree); extern tree build_array_copy (tree); extern tree build_vec_init_expr (tree, tree, tsubst_flags_t); extern void diagnose_non_constexpr_vec_init (tree); @@ -6903,23 +7155,26 @@ extern tree lookup_add (tree fns, tree lookup); extern tree lookup_maybe_add (tree fns, tree lookup, bool deduping); -extern void lookup_keep (tree lookup, bool keep); +extern void lookup_keep (tree lookup); extern int is_overloaded_fn (tree) ATTRIBUTE_PURE; extern bool really_overloaded_fn (tree) ATTRIBUTE_PURE; extern tree dependent_name (tree); +extern tree maybe_get_fns (tree) ATTRIBUTE_PURE; extern tree get_fns (tree) ATTRIBUTE_PURE; extern tree get_first_fn (tree) ATTRIBUTE_PURE; extern tree ovl_scope (tree); extern const char *cxx_printable_name (tree, int); extern const char *cxx_printable_name_translate (tree, int); extern tree canonical_eh_spec (tree); +extern tree build_cp_fntype_variant (tree, cp_ref_qualifier, tree, bool); extern tree build_exception_variant (tree, tree); extern tree bind_template_template_parm (tree, tree); extern tree array_type_nelts_total (tree); extern tree array_type_nelts_top (tree); -extern tree break_out_target_exprs (tree); +extern tree break_out_target_exprs (tree, bool = false); extern tree build_ctor_subob_ref (tree, tree, tree); extern tree replace_placeholders (tree, tree, bool * = NULL); +extern bool find_placeholders (tree); extern tree get_type_decl (tree); extern tree decl_namespace_context (tree); extern bool decl_anon_ns_mem_p (const_tree); @@ -6993,7 +7248,7 @@ extern int comp_cv_qualification (int, int); extern int comp_cv_qual_signature (tree, tree); extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code, bool); -extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool); +extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool, bool); extern tree cxx_alignas_expr (tree); extern tree cxx_sizeof_nowarn (tree); extern tree is_bitfield_expr_with_lowered_type (const_tree); @@ -7009,6 +7264,7 @@ ref_operator, tsubst_flags_t); extern tree cp_build_indirect_ref (tree, ref_operator, tsubst_flags_t); +extern tree cp_build_fold_indirect_ref (tree); extern tree build_array_ref (location_t, tree, tree); extern tree cp_build_array_ref (location_t, tree, tree, tsubst_flags_t); @@ -7032,6 +7288,7 @@ extern tree cp_build_addr_expr (tree, tsubst_flags_t); extern tree cp_build_unary_op (enum tree_code, tree, bool, tsubst_flags_t); +extern tree genericize_compound_lvalue (tree); extern tree unary_complex_lvalue (enum tree_code, tree); extern tree build_x_conditional_expr (location_t, tree, tree, tree, tsubst_flags_t); @@ -7068,7 +7325,8 @@ extern int cp_type_quals (const_tree); extern int type_memfn_quals (const_tree); extern cp_ref_qualifier type_memfn_rqual (const_tree); -extern tree apply_memfn_quals (tree, cp_cv_quals, cp_ref_qualifier); +extern tree apply_memfn_quals (tree, cp_cv_quals, + cp_ref_qualifier = REF_QUAL_NONE); extern bool cp_has_mutable_p (const_tree); extern bool at_least_as_qualified_p (const_tree, const_tree); extern void cp_apply_type_quals_to_decl (int, tree); @@ -7088,7 +7346,7 @@ extern tree build_x_vec_perm_expr (location_t, tree, tree, tree, tsubst_flags_t); -#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true) +#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, false, true) extern tree build_simple_component_ref (tree, tree); extern tree build_ptrmemfunc_access_expr (tree, tree); extern tree build_address (tree); @@ -7111,16 +7369,27 @@ extern tree finish_left_unary_fold_expr (tree, int); extern tree finish_right_unary_fold_expr (tree, int); extern tree finish_binary_fold_expr (tree, tree, int); +extern bool treat_lvalue_as_rvalue_p (tree, bool); /* in typeck2.c */ extern void require_complete_eh_spec_types (tree, tree); extern void cxx_incomplete_type_diagnostic (location_t, const_tree, const_tree, diagnostic_t); + +inline location_t +cp_expr_loc_or_loc (const_tree t, location_t or_loc) +{ + location_t loc = cp_expr_location (t); + if (loc == UNKNOWN_LOCATION) + loc = or_loc; + return loc; +} + inline void cxx_incomplete_type_diagnostic (const_tree value, const_tree type, diagnostic_t diag_kind) { - cxx_incomplete_type_diagnostic (EXPR_LOC_OR_LOC (value, input_location), + cxx_incomplete_type_diagnostic (cp_expr_loc_or_loc (value, input_location), value, type, diag_kind); } @@ -7135,7 +7404,8 @@ extern void cxx_incomplete_type_inform (const_tree); extern tree error_not_base_type (tree, tree); extern tree binfo_or_else (tree, tree); -extern void cxx_readonly_error (tree, enum lvalue_use); +extern void cxx_readonly_error (location_t, tree, + enum lvalue_use); extern void complete_type_check_abstract (tree); extern int abstract_virtuals_error (tree, tree); extern int abstract_virtuals_error (abstract_class_use, tree); @@ -7144,7 +7414,8 @@ extern tree store_init_value (tree, tree, vec<tree, va_gc>**, int); extern tree split_nonconstant_init (tree, tree); -extern bool check_narrowing (tree, tree, tsubst_flags_t); +extern bool check_narrowing (tree, tree, tsubst_flags_t, + bool = false); extern tree digest_init (tree, tree, tsubst_flags_t); extern tree digest_init_flags (tree, tree, int, tsubst_flags_t); extern tree digest_nsdmi_init (tree, tree, tsubst_flags_t); @@ -7153,7 +7424,7 @@ tsubst_flags_t); extern tree build_m_component_ref (tree, tree, tsubst_flags_t); extern tree build_functional_cast (tree, tree, tsubst_flags_t); -extern tree add_exception_specifier (tree, tree, int); +extern tree add_exception_specifier (tree, tree, tsubst_flags_t); extern tree merge_exception_specifiers (tree, tree); /* in mangle.c */ @@ -7186,7 +7457,6 @@ extern bool cp_var_mod_type_p (tree, tree); extern void cxx_initialize_diagnostics (diagnostic_context *); extern int cxx_types_compatible_p (tree, tree); -extern void init_shadowed_var_for_decl (void); extern bool cxx_block_may_fallthru (const_tree); /* in cp-gimplify.c */ @@ -7194,6 +7464,7 @@ gimple_seq *); extern void cp_genericize (tree); extern bool cxx_omp_const_qual_no_mutable (tree); +extern enum omp_clause_default_kind cxx_omp_predetermined_sharing_1 (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); @@ -7305,17 +7576,13 @@ extern void vtv_recover_class_info (void); extern void vtv_build_vtable_verify_fndecl (void); -/* In cp/cp-array-notations.c */ -extern tree expand_array_notation_exprs (tree); -bool cilkplus_an_triplet_types_ok_p (location_t, tree, tree, tree, - tree); - /* In constexpr.c */ extern void fini_constexpr (void); extern bool literal_type_p (tree); extern tree register_constexpr_fundef (tree, tree); extern bool is_valid_constexpr_fn (tree, bool); extern bool check_constexpr_ctor_body (tree, tree, bool); +extern tree constexpr_fn_retval (tree); extern tree ensure_literal_type_for_constexpr_object (tree); extern bool potential_constant_expression (tree); extern bool is_constant_expression (tree); @@ -7325,11 +7592,13 @@ extern bool potential_rvalue_constant_expression (tree); extern bool require_potential_constant_expression (tree); extern bool require_constant_expression (tree); +extern bool require_rvalue_constant_expression (tree); extern bool require_potential_rvalue_constant_expression (tree); extern tree cxx_constant_value (tree, tree = NULL_TREE); +extern tree cxx_constant_init (tree, tree = NULL_TREE); extern tree maybe_constant_value (tree, tree = NULL_TREE); -extern tree maybe_constant_init (tree, tree = NULL_TREE); -extern tree fold_non_dependent_expr (tree); +extern tree maybe_constant_init (tree, tree = NULL_TREE, bool = false); +extern tree fold_non_dependent_expr (tree, tsubst_flags_t = tf_warning_or_error); extern tree fold_simple (tree); extern bool is_sub_constant_expr (tree); extern bool reduced_constant_expression_p (tree); @@ -7341,9 +7610,6 @@ extern tree fold_sizeof_expr (tree); extern void clear_cv_and_fold_caches (void); -/* In c-family/cilk.c */ -extern bool cilk_valid_spawn (tree); - /* In cp-ubsan.c */ extern void cp_ubsan_maybe_instrument_member_call (tree); extern void cp_ubsan_instrument_member_accesses (tree *); @@ -7351,12 +7617,6 @@ extern tree cp_ubsan_maybe_instrument_cast_to_vbase (location_t, tree, tree); extern void cp_ubsan_maybe_initialize_vtbl_ptrs (tree); -#if CHECKING_P -namespace selftest { - extern void run_cp_tests (void); -} // namespace selftest -#endif /* #if CHECKING_P */ - /* Inline bodies. */ inline tree @@ -7387,6 +7647,24 @@ return candidate == name; } +inline bool +null_node_p (const_tree expr) +{ + STRIP_ANY_LOCATION_WRAPPER (expr); + return expr == null_node; +} + +#if CHECKING_P +namespace selftest { + extern void run_cp_tests (void); + + /* Declarations for specific families of tests within cp, + by source file, in alphabetical order. */ + extern void cp_pt_c_tests (); + extern void cp_tree_c_tests (void); +} // namespace selftest +#endif /* #if CHECKING_P */ + /* -- end of C++ */ #endif /* ! GCC_CP_TREE_H */