From 6322ee6863f0385f1adec1e59672000e6133184b Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 6 Dec 2023 21:30:18 -0500 Subject: [PATCH] c++: avoid DECL_NONSTATIC_MEMBER_FUNCTION_P To: gcc-patches@gcc.gnu.org Explicit object member functions are also non-static member functions, so we need to change uses of DECL_NONSTATIC_MEMBER_FUNCTION_P to clarify whether they intend to include or exclude them. gcc/cp/ChangeLog: * cp-tree.h (DECL_NONSTATIC_MEMBER_FUNCTION_P): Poison. (DECL_CONST_MEMFUNC_P) (DECL_VOLATILE_MEMFUNC_P) (DECL_NONSTATIC_MEMBER_P) * call.cc (maybe_warn_class_memaccess) (joust) (do_warn_dangling_reference): Don't use it. * class.cc (finalize_literal_type_property) (finish_struct) * constexpr.cc (is_valid_constexpr_fn) * contracts.cc (build_contract_condition_function) * cp-objcp-common.cc (cp_decl_dwarf_attribute) * cxx-pretty-print.cc (cxx_pretty_printer::postfix_expression) (cxx_pretty_printer::declaration_specifiers) (cxx_pretty_printer::direct_declarator) * decl.cc (cp_finish_decl) (record_key_method_defined) * decl2.cc (cp_handle_deprecated_or_unavailable) * init.cc (find_uninit_fields_r) (build_offset_ref) * lambda.cc (nonlambda_method_basetype) * method.cc (early_check_defaulted_comparison) (num_artificial_parms_for) * pt.cc (is_specialization_of_friend) (determine_specialization) (copy_default_args_to_explicit_spec) (check_explicit_specialization) (tsubst_contract_attribute) (check_non_deducible_conversions) (maybe_instantiate_noexcept) (register_parameter_specializations) (value_dependent_expression_p) * search.cc (shared_member_p) (lookup_member) (field_access_p) * semantics.cc (finish_omp_declare_simd_methods) * tree.cc (lvalue_kind): Don't use DECL_NONSTATIC_MEMBER_FUNCTION_P. libcc1/ChangeLog: * libcp1plugin.cc (plugin_pragma_push_user_expression): Don't use DECL_NONSTATIC_MEMBER_FUNCTION_P. --- gcc/cp/cp-tree.h | 16 +++++++++------- gcc/cp/call.cc | 11 ++++++----- gcc/cp/class.cc | 4 ++-- gcc/cp/constexpr.cc | 2 +- gcc/cp/contracts.cc | 6 +++--- gcc/cp/cp-objcp-common.cc | 4 ++-- gcc/cp/cxx-pretty-print.cc | 6 +++--- gcc/cp/decl.cc | 4 ++-- gcc/cp/decl2.cc | 2 +- gcc/cp/init.cc | 4 ++-- gcc/cp/lambda.cc | 2 +- gcc/cp/method.cc | 6 +++--- gcc/cp/pt.cc | 24 ++++++++++++------------ gcc/cp/search.cc | 5 +++-- gcc/cp/semantics.cc | 2 +- gcc/cp/tree.cc | 2 +- libcc1/libcp1plugin.cc | 2 +- 17 files changed, 53 insertions(+), 49 deletions(-) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e222742092f..111cb7f6a0e 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3348,10 +3348,12 @@ struct GTY(()) lang_decl { #define DECL_STATIC_FUNCTION_P(NODE) \ (LANG_DECL_FN_CHECK (NODE)->static_function) -/* Nonzero for FUNCTION_DECL means that this decl is a non-static - member function, use DECL_IOBJ_MEMBER_FUNCTION_P instead. */ -#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \ - (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE) +/* Nonzero for FUNCTION_DECL means that this decl is a non-static member + function. C++23 explicit object member functions are also considered + non-static, but most former uses of this macro meant implicit object member + function. Instead of this macro, use DECL_IOBJ_MEMBER_FUNCTION_P or + DECL_OBJECT_MEMBER_FUNCTION_P. */ +#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) did_you_mean_object_or_iobj /* Nonzero for FUNCTION_DECL means that this decl is an implicit object member function. */ @@ -3381,20 +3383,20 @@ struct GTY(()) lang_decl { /* Nonzero for FUNCTION_DECL means that this member function has `this' as const X *const. */ #define DECL_CONST_MEMFUNC_P(NODE) \ - (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \ + (DECL_IOBJ_MEMBER_FUNCTION_P (NODE) \ && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE \ (TYPE_ARG_TYPES (TREE_TYPE (NODE)))))) /* Nonzero for FUNCTION_DECL means that this member function has `this' as volatile X *const. */ #define DECL_VOLATILE_MEMFUNC_P(NODE) \ - (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \ + (DECL_IOBJ_MEMBER_FUNCTION_P (NODE) \ && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE \ (TYPE_ARG_TYPES (TREE_TYPE (NODE)))))) /* Nonzero for a DECL means that this member is a non-static member. */ #define DECL_NONSTATIC_MEMBER_P(NODE) \ - (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \ + (DECL_OBJECT_MEMBER_FUNCTION_P (NODE) \ || TREE_CODE (NODE) == FIELD_DECL) /* Nonzero for a FIELD_DECL means that this member object type diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index c64d420f073..3d9b575a89b 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -10705,7 +10705,8 @@ maybe_warn_class_memaccess (location_t loc, tree fndecl, type. If so, and if the class has no non-trivial bases or members, be more permissive. */ if (current_function_decl - && DECL_NONSTATIC_MEMBER_FUNCTION_P (current_function_decl) + && DECL_OBJECT_MEMBER_FUNCTION_P (current_function_decl) + /* ??? is_object_parameter? */ && is_this_parameter (tree_strip_nop_conversions (dest))) { tree ctx = DECL_CONTEXT (current_function_decl); @@ -12799,7 +12800,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn, print_z_candidate (input_location, N_("candidate 2:"), l); if (w->fn == l->fn - && DECL_NONSTATIC_MEMBER_FUNCTION_P (w->fn) + && DECL_IOBJ_MEMBER_FUNCTION_P (w->fn) && (type_memfn_quals (TREE_TYPE (w->fn)) & TYPE_QUAL_CONST) == 0) { @@ -13929,7 +13930,7 @@ do_warn_dangling_reference (tree expr, bool arg_p) because R refers to one of the int elements of V, not to a temporary object. Member operator* may return a reference but probably not to one of its arguments. */ - || (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl) + || (DECL_OBJECT_MEMBER_FUNCTION_P (fndecl) && DECL_OVERLOADED_OPERATOR_P (fndecl) && DECL_OVERLOADED_OPERATOR_IS (fndecl, INDIRECT_REF))) return NULL_TREE; @@ -13955,7 +13956,7 @@ do_warn_dangling_reference (tree expr, bool arg_p) tree arg = CALL_EXPR_ARG (expr, i); /* Check that this argument initializes a reference, except for the argument initializing the object of a member function. */ - if (!DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl) + if (!DECL_IOBJ_MEMBER_FUNCTION_P (fndecl) && !TYPE_REF_P (TREE_TYPE (arg))) continue; STRIP_NOPS (arg); @@ -13975,7 +13976,7 @@ do_warn_dangling_reference (tree expr, bool arg_p) const S& s = S().self(); where 's' dangles. If we've gotten here, the object this function is invoked on is not a temporary. */ - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)) + if (DECL_OBJECT_MEMBER_FUNCTION_P (fndecl)) break; } return NULL_TREE; diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc index d7a4ad5ad51..99c33380c2d 100644 --- a/gcc/cp/class.cc +++ b/gcc/cp/class.cc @@ -6123,7 +6123,7 @@ finalize_literal_type_property (tree t) for (fn = TYPE_FIELDS (t); fn; fn = DECL_CHAIN (fn)) if (TREE_CODE (fn) == FUNCTION_DECL && DECL_DECLARED_CONSTEXPR_P (fn) - && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) + && DECL_IOBJ_MEMBER_FUNCTION_P (fn) && !DECL_CONSTRUCTOR_P (fn)) { DECL_DECLARED_CONSTEXPR_P (fn) = false; @@ -8087,7 +8087,7 @@ finish_struct (tree t, tree attributes) if (flag_openmp) for (tree decl = TYPE_FIELDS (t); decl; decl = DECL_CHAIN (decl)) if (TREE_CODE (decl) == FUNCTION_DECL - && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) + && DECL_OBJECT_MEMBER_FUNCTION_P (decl)) if (tree attr = lookup_attribute ("omp declare variant base", DECL_ATTRIBUTES (decl))) omp_declare_variant_finalize (decl, attr); diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index 58187a4fd12..4da6f1a0524 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -291,7 +291,7 @@ is_valid_constexpr_fn (tree fun, bool complain) /* C++14 DR 1684 removed this restriction. */ if (cxx_dialect < cxx14 - && DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) + && DECL_IOBJ_MEMBER_FUNCTION_P (fun) && !CLASSTYPE_LITERAL_P (DECL_CONTEXT (fun))) { ret = false; diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc index 035ca4827e7..c505b67d339 100644 --- a/gcc/cp/contracts.cc +++ b/gcc/cp/contracts.cc @@ -1398,7 +1398,7 @@ build_contract_condition_function (tree fndecl, bool pre) { if (TREE_TYPE (fndecl) == error_mark_node) return error_mark_node; - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl) + if (DECL_IOBJ_MEMBER_FUNCTION_P (fndecl) && !TYPE_METHOD_BASETYPE (TREE_TYPE (fndecl))) return error_mark_node; @@ -1421,7 +1421,7 @@ build_contract_condition_function (tree fndecl, bool pre) arg_type && arg_type != void_list_node; arg_type = TREE_CHAIN (arg_type)) { - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl) + if (DECL_IOBJ_MEMBER_FUNCTION_P (fndecl) && TYPE_ARG_TYPES (TREE_TYPE (fn)) == arg_type) { class_type = TREE_TYPE (TREE_VALUE (arg_type)); @@ -1451,7 +1451,7 @@ build_contract_condition_function (tree fndecl, bool pre) } TREE_TYPE (fn) = build_function_type (value_type, arg_types); - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)) + if (DECL_IOBJ_MEMBER_FUNCTION_P (fndecl)) TREE_TYPE (fn) = build_method_type (class_type, TREE_TYPE (fn)); DECL_NAME (fn) = copy_node (DECL_NAME (fn)); diff --git a/gcc/cp/cp-objcp-common.cc b/gcc/cp/cp-objcp-common.cc index 9439c4dc744..f3ba8179329 100644 --- a/gcc/cp/cp-objcp-common.cc +++ b/gcc/cp/cp-objcp-common.cc @@ -349,7 +349,7 @@ cp_decl_dwarf_attribute (const_tree decl, int attr) case DW_AT_reference: if (TREE_CODE (decl) == FUNCTION_DECL - && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) + && DECL_IOBJ_MEMBER_FUNCTION_P (decl) && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl)) && !FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl))) return 1; @@ -357,7 +357,7 @@ cp_decl_dwarf_attribute (const_tree decl, int attr) case DW_AT_rvalue_reference: if (TREE_CODE (decl) == FUNCTION_DECL - && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) + && DECL_IOBJ_MEMBER_FUNCTION_P (decl) && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl)) && FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl))) return 1; diff --git a/gcc/cp/cxx-pretty-print.cc b/gcc/cp/cxx-pretty-print.cc index 6a82358f370..53c0722d2f3 100644 --- a/gcc/cp/cxx-pretty-print.cc +++ b/gcc/cp/cxx-pretty-print.cc @@ -553,7 +553,7 @@ cxx_pretty_printer::postfix_expression (tree t) instantiation time. */ if (TREE_CODE (fun) != FUNCTION_DECL) ; - else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun)) + else if (DECL_OBJECT_MEMBER_FUNCTION_P (fun)) { tree object = (code == AGGR_INIT_EXPR ? (AGGR_INIT_VIA_CTOR_P (t) @@ -1342,7 +1342,7 @@ cxx_pretty_printer::declaration_specifiers (tree t) do not have a type-specifier in their return types. */ if (DECL_CONSTRUCTOR_P (t) || DECL_CONV_FN_P (t)) function_specifier (t); - else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t)) + else if (DECL_IOBJ_MEMBER_FUNCTION_P (t)) declaration_specifiers (TREE_TYPE (TREE_TYPE (t))); else c_pretty_printer::declaration_specifiers (t); @@ -1700,7 +1700,7 @@ cxx_pretty_printer::direct_declarator (tree t) expression (t); pp_cxx_parameter_declaration_clause (this, t); - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t)) + if (DECL_IOBJ_MEMBER_FUNCTION_P (t)) { padding = pp_before; pp_cxx_cv_qualifier_seq (this, pp_cxx_implicit_parameter_type (t)); diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index e51ede5d043..e5d19ab9162 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -8524,7 +8524,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, && TREE_CODE (decl) == FUNCTION_DECL /* #pragma omp declare variant on methods handled in finish_struct instead. */ - && (!DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) + && (!DECL_OBJECT_MEMBER_FUNCTION_P (decl) || COMPLETE_TYPE_P (DECL_CONTEXT (decl)))) if (tree attr = lookup_attribute ("omp declare variant base", DECL_ATTRIBUTES (decl))) @@ -18288,7 +18288,7 @@ outer_curly_brace_block (tree fndecl) static void record_key_method_defined (tree fndecl) { - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl) + if (DECL_OBJECT_MEMBER_FUNCTION_P (fndecl) && DECL_VIRTUAL_P (fndecl) && !processing_template_decl) { diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index bee84879023..59c41d8e583 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -5625,7 +5625,7 @@ cp_handle_deprecated_or_unavailable (tree decl, tsubst_flags_t complain) if (cxx_dialect >= cxx11 && DECL_P (decl) && DECL_ARTIFICIAL (decl) - && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) + && DECL_IOBJ_MEMBER_FUNCTION_P (decl) && copy_fn_p (decl)) { /* Don't warn if the flag was disabled around the class definition diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc index 6444f0a8518..fb5f404805b 100644 --- a/gcc/cp/init.cc +++ b/gcc/cp/init.cc @@ -866,7 +866,7 @@ find_uninit_fields_r (tree *tp, int *walk_subtrees, void *data) else if (code == CALL_EXPR) { tree fn = get_callee_fndecl (init); - if (fn && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)) + if (fn && DECL_IOBJ_MEMBER_FUNCTION_P (fn)) { tree op = CALL_EXPR_ARG (init, 0); if (TREE_CODE (op) == ADDR_EXPR) @@ -2477,7 +2477,7 @@ build_offset_ref (tree type, tree member, bool address_p, -- in a mem-initializer for a constructor for that class or for a class derived from that class (_class.base.init_). */ - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (member)) + if (DECL_OBJECT_MEMBER_FUNCTION_P (member)) { /* Build a representation of the qualified name suitable for use as the operand to "&" -- even though the "&" is diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc index 8baf82578c7..ee48b2170d2 100644 --- a/gcc/cp/lambda.cc +++ b/gcc/cp/lambda.cc @@ -1015,7 +1015,7 @@ nonlambda_method_basetype (void) tree fn = TYPE_CONTEXT (type); if (!fn || TREE_CODE (fn) != FUNCTION_DECL - || !DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)) + || !DECL_IOBJ_MEMBER_FUNCTION_P (fn)) /* No enclosing non-lambda method. */ return NULL_TREE; if (!LAMBDA_FUNCTION_P (fn)) diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc index ca3102a57a5..8302ae2370d 100644 --- a/gcc/cp/method.cc +++ b/gcc/cp/method.cc @@ -1187,7 +1187,7 @@ early_check_defaulted_comparison (tree fn) ok = false; } - bool mem = DECL_NONSTATIC_MEMBER_FUNCTION_P (fn); + bool mem = DECL_IOBJ_MEMBER_FUNCTION_P (fn); if (mem && type_memfn_quals (TREE_TYPE (fn)) != TYPE_QUAL_CONST) { error_at (loc, "defaulted %qD must be %", fn); @@ -1230,7 +1230,7 @@ early_check_defaulted_comparison (tree fn) if (saw_bad || (saw_byval && saw_byref)) { - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)) + if (DECL_IOBJ_MEMBER_FUNCTION_P (fn)) error_at (loc, "defaulted member %qD must have parameter type " "%", fn, ctx); else if (saw_bad) @@ -3627,7 +3627,7 @@ num_artificial_parms_for (const_tree fn) { int count = 0; - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)) + if (DECL_IOBJ_MEMBER_FUNCTION_P (fn)) count++; else return 0; diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 4a677d5910b..76b5640beac 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -1443,9 +1443,9 @@ is_specialization_of_friend (tree decl, tree friend_decl) `this' parameter. */ friend_args_type = TYPE_ARG_TYPES (friend_type); decl_args_type = TYPE_ARG_TYPES (decl_type); - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (friend_decl)) + if (DECL_IOBJ_MEMBER_FUNCTION_P (friend_decl)) friend_args_type = TREE_CHAIN (friend_args_type); - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) + if (DECL_IOBJ_MEMBER_FUNCTION_P (decl)) decl_args_type = TREE_CHAIN (decl_args_type); return compparms (decl_args_type, friend_args_type); @@ -2222,7 +2222,7 @@ determine_specialization (tree template_id, that the const qualification is the same. Since get_bindings does not try to merge the "this" parameter, we must do the comparison explicitly. */ - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)) + if (DECL_IOBJ_MEMBER_FUNCTION_P (fn)) { if (!same_type_p (TREE_VALUE (fn_arg_types), TREE_VALUE (decl_arg_types))) @@ -2345,14 +2345,14 @@ determine_specialization (tree template_id, /* Adjust the type of DECL in case FN is a static member. */ decl_arg_types = TYPE_ARG_TYPES (TREE_TYPE (decl)); if (DECL_STATIC_FUNCTION_P (fn) - && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) + && DECL_IOBJ_MEMBER_FUNCTION_P (decl)) decl_arg_types = TREE_CHAIN (decl_arg_types); if (!compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)), decl_arg_types)) continue; - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) + if (DECL_IOBJ_MEMBER_FUNCTION_P (fn) && (type_memfn_rqual (TREE_TYPE (decl)) != type_memfn_rqual (TREE_TYPE (fn)))) continue; @@ -2538,7 +2538,7 @@ copy_default_args_to_explicit_spec (tree decl) old_type = TREE_TYPE (decl); spec_types = TYPE_ARG_TYPES (old_type); - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) + if (DECL_IOBJ_MEMBER_FUNCTION_P (decl)) { /* Remove the this pointer, but remember the object's type for CV quals. */ @@ -3123,7 +3123,7 @@ check_explicit_specialization (tree declarator, make DECL a static member function as well. */ if (DECL_FUNCTION_TEMPLATE_P (tmpl) && DECL_STATIC_FUNCTION_P (tmpl) - && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) + && DECL_IOBJ_MEMBER_FUNCTION_P (decl)) revert_static_member_fn (decl); /* If this is a specialization of a member template of a @@ -11743,7 +11743,7 @@ tsubst_contract_attribute (tree decl, tree t, tree args, /* For member functions, make this available for semantic analysis. */ tree save_ccp = current_class_ptr; tree save_ccr = current_class_ref; - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) + if (DECL_IOBJ_MEMBER_FUNCTION_P (decl)) { tree arg_types = TYPE_ARG_TYPES (TREE_TYPE (decl)); tree this_type = TREE_TYPE (TREE_VALUE (arg_types)); @@ -22054,7 +22054,7 @@ check_non_deducible_conversions (tree parms, const tree *args, unsigned nargs, { /* Non-constructor methods need to leave a conversion for 'this', which isn't included in nargs here. */ - unsigned offset = (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) + unsigned offset = (DECL_IOBJ_MEMBER_FUNCTION_P (fn) && !DECL_CONSTRUCTOR_P (fn)); for (unsigned ia = 0; @@ -26633,7 +26633,7 @@ maybe_instantiate_noexcept (tree fn, tsubst_flags_t complain) push_deferring_access_checks (dk_no_deferred); input_location = DECL_SOURCE_LOCATION (fn); - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) + if (DECL_IOBJ_MEMBER_FUNCTION_P (fn) && !DECL_LOCAL_DECL_P (fn)) { /* If needed, set current_class_ptr for the benefit of @@ -26696,7 +26696,7 @@ register_parameter_specializations (tree pattern, tree inst) { tree tmpl_parm = DECL_ARGUMENTS (pattern); tree spec_parm = DECL_ARGUMENTS (inst); - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (inst)) + if (DECL_IOBJ_MEMBER_FUNCTION_P (inst)) { register_local_specialization (spec_parm, tmpl_parm); spec_parm = skip_artificial_parms_for (inst, spec_parm); @@ -28043,7 +28043,7 @@ value_dependent_expression_p (tree expression) cause the call to be considered value-dependent. We also look through it in potential_constant_expression. */ if (i == 0 && fn && DECL_DECLARED_CONSTEXPR_P (fn) - && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) + && DECL_IOBJ_MEMBER_FUNCTION_P (fn) && TREE_CODE (op) == ADDR_EXPR) op = TREE_OPERAND (op, 0); if (value_dependent_expression_p (op)) diff --git a/gcc/cp/search.cc b/gcc/cp/search.cc index efea5078992..a22202fe6f3 100644 --- a/gcc/cp/search.cc +++ b/gcc/cp/search.cc @@ -1010,7 +1010,7 @@ shared_member_p (tree t) /* Conservatively assume a dependent using-declaration might resolve to a non-static member. */ return false; - if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) + if (DECL_OBJECT_MEMBER_FUNCTION_P (decl)) return false; } return true; @@ -1266,7 +1266,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type, decl = strip_using_decl (decl); /* A dependent USING_DECL will be checked after tsubsting. */ if (TREE_CODE (decl) != USING_DECL - && !DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) + && !DECL_IOBJ_MEMBER_FUNCTION_P (decl) && !perform_or_defer_access_check (basetype_path, decl, decl, complain, afi)) return error_mark_node; @@ -1739,6 +1739,7 @@ field_access_p (tree component_ref, tree field_decl, tree field_type) return false; tree ptr = STRIP_NOPS (TREE_OPERAND (indirect_ref, 0)); + /* ??? is_object_parameter? */ if (!is_this_parameter (ptr)) return false; diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index c47f57e889d..21831792ec5 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -6704,7 +6704,7 @@ finish_omp_declare_simd_methods (tree t) for (tree x = TYPE_FIELDS (t); x; x = DECL_CHAIN (x)) { if (TREE_CODE (x) == USING_DECL - || !DECL_NONSTATIC_MEMBER_FUNCTION_P (x)) + || !DECL_IOBJ_MEMBER_FUNCTION_P (x)) continue; tree ods = lookup_attribute ("omp declare simd", DECL_ATTRIBUTES (x)); if (!ods || !TREE_VALUE (ods)) diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index 79b6fa05c06..4635cbbba5b 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -298,7 +298,7 @@ lvalue_kind (const_tree ref) case FUNCTION_DECL: /* All functions (except non-static-member functions) are lvalues. */ - return (DECL_NONSTATIC_MEMBER_FUNCTION_P (ref) + return (DECL_IOBJ_MEMBER_FUNCTION_P (ref) ? clk_none : clk_ordinary); case BASELINK: diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc index 3c8e9e8b436..108d5786167 100644 --- a/libcc1/libcp1plugin.cc +++ b/libcc1/libcp1plugin.cc @@ -468,7 +468,7 @@ plugin_pragma_push_user_expression (cpp_reader *) } } - if (unchanged_cfun || DECL_NONSTATIC_MEMBER_FUNCTION_P (changed_func_decl)) + if (unchanged_cfun || DECL_OBJECT_MEMBER_FUNCTION_P (changed_func_decl)) { /* Check whether the oracle supplies us with a "this", and if so, arrange for data members and this itself to be -- 2.39.3