[PATCH] D100276: [clang] p1099 using enum part 1

Nathan Sidwell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 11 15:35:47 PDT 2021


urnathan created this revision.
urnathan added reviewers: rsmith, Quuxplusone, bruno.
urnathan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This adds support for p1099's 'using SCOPED_ENUM::MEMNER;'
functionality, bringing a member of an enumerator into the current
scope.  The novel feature here, is that there need not be a class
hierarchical relationship between the current scope and the scope of
the SCOPED_ENUM.  That's a new thing, the closest equivalent is a
typedef or alias declaration.  But this means that
Sema::CheckUsingDeclQualifier needs adjustment.  (a) one can't call it
until one knows the set of decls that are being referenced -- if
exactly one is an enumerator, we're in the new territory.  Thus it
needs calling later in some cases.  Also (b) there are two ways we
hold the set of such decls.  During parsing (or instantiating a
dependent scope) we have a lookup result, and during instantiation we
have a set of shadow decls.  Thus two optional arguments, at most one
of which should be non-null.

The change to
clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3.cpp is to
silence an uninteresting access error that the above change causes.

Perhaps deferring the scope check until after construction of the
shadow-decls in the parsing case would be preferred?  Also moving up
the check for naming a scoped-enumerator member might be more helpful?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100276

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3.cpp
  clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p7-cxx20.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100276.336707.patch
Type: text/x-patch
Size: 14927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210411/86066ece/attachment.bin>


More information about the cfe-commits mailing list