c++: Unconfuse lookup_name_real API a bit
Thu Aug 13 18:18:31 GMT 2020
modules has uncovered some exciting issues with hidden friends, and I
need to wander into name lookup again. This is a piece I punted on the
first time round. But now I have C++11, it's better than it would have
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.
* 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_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.
* 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)
* semantics.c (capture_decltype): Likewise.
* libcp1plugin.cc (plugin_build_dependent_expr): Likewise.
pushing to trunk
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 10826 bytes
Desc: not available
More information about the Gcc-patches