aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-08-13 10:59:00 -0700
committerNathan Sidwell <nathan@acm.org>2020-08-13 11:16:42 -0700
commit0c5f6bbfe2ec7c3d6425fee43c53948a3652f738 (patch)
tree93635729d6d168ab6b0e8e763b648bb9cf3851bf /gcc/cp/semantics.c
parent55484a0f816ef9ad7e13fb1057751223ed8471d8 (diff)
downloadgcc-0c5f6bbfe2ec7c3d6425fee43c53948a3652f738.zip
gcc-0c5f6bbfe2ec7c3d6425fee43c53948a3652f738.tar.gz
gcc-0c5f6bbfe2ec7c3d6425fee43c53948a3652f738.tar.bz2
[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.
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 3096fe8..e979a8b 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -10322,8 +10322,8 @@ static tree
capture_decltype (tree decl)
{
tree lam = CLASSTYPE_LAMBDA_EXPR (DECL_CONTEXT (current_function_decl));
- tree cap = lookup_name_real (DECL_NAME (decl), /*type*/0, /*nonclass*/1,
- /*block_p=*/true, /*ns*/0, LOOKUP_HIDDEN);
+ tree cap = lookup_name_real (DECL_NAME (decl), LOOK_where::BLOCK_NAMESPACE,
+ /*type*/0, /*ns*/false, LOOKUP_HIDDEN);
tree type;
if (cap && is_capture_proxy (cap))