From 0c5f6bbfe2ec7c3d6425fee43c53948a3652f738 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 13 Aug 2020 10:59:00 -0700 Subject: [c++]: Unconfuse lookup_name_real API a bit The API for lookup_name_real is really confusing. This addresses the part where we have NONCLASS to say DON'T search class scopes, and BLOCK_P to say DO search block scopes. I've added a single bitmask to explicitly say which scopes to search. I used an enum class so one can't accidentally misorder it. It's also reordered so we don't mix it up with the parameters that say what kind of thing we're looking for. gcc/cp/ * name-lookup.h (enum class LOOK_where): New. (operator|, operator&): Overloads for it. (lookup_name_real): Replace NONCLASS & BLOCK_P parms with WHERE. * name-lookup.c (identifier_type_value_w): Adjust lookup_name_real call. (lookup_name_real_1): Replace NONCLASS and BLOCK_P parameters with WHERE bitmask. Don't search namespaces if not asked to. (lookup_name_real): Adjust lookup_name_real_1 call. (lookup_name_nonclass, lookup_name) (lookup_name_prefer_type): Likewise. * call.c (build_operator_new_call) (add_operator_candidates): Adjust lookup_name_real calls. * parser.c (cp_parser_lookup_name): Likewise. * pt.c (tsubst_friend_class, lookup_init_capture_pack) (tsubst_expr): Likewise. * semantics.c (capture_decltype): Likewise. libcc1/ * libcp1plugin.cc (plugin_build_dependent_expr): Likewise. --- libcc1/libcp1plugin.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libcc1') diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc index 01aecf00735..24582c74a86 100644 --- a/libcc1/libcp1plugin.cc +++ b/libcc1/libcp1plugin.cc @@ -2652,7 +2652,7 @@ plugin_build_dependent_expr (cc1_plugin::connection *self, } tree res = identifier; if (!scope) - res = lookup_name_real (res, 0, 0, true, 0, 0); + res = lookup_name_real (res, LOOK_where::BLOCK_NAMESPACE, 0, 0, 0); else if (!TYPE_P (scope) || !dependent_scope_p (scope)) { res = lookup_qualified_name (scope, res, false, true); -- cgit v1.2.3