[cfe-dev] Advice on patch
Nathan Sidwell via cfe-dev
cfe-dev at lists.llvm.org
Fri Apr 30 04:14:21 PDT 2021
hi, I've been working on p1099
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1099r5.html)--
c++20's using-enum feature. Among other things it allows you to being
the enumerators of a scoped enumeration into the local scope 'using enum
maybe-qualified-tag-name ;' Brings the members of that enum in, as if
by individual using declarations. I posted an initial patch seeking
advice on a couple of issues as https://reviews.llvm.org/D101370
I chose to extend EnumDecl, rather than a new decl as we still need the
shadow decl chain. The enum is parsed with ParseEnumSpecifier.
Q1) I need to add the EnumDecl to the UsingDecl, and don't need the
QualifiedLoc or DNLoc fields. Should I use a local union to overlay
those pieces of data, or just live with the size expansion?
Q2) When the scoped enum is a template member, the members are
instantiated when one looks inside the enum -- not when the enum decl is
instantiated. That's done with RequireCompleteDeclContext, which is
designed for when the parser is looking, and therefore takes a ScopeRef.
This is a new situation where we don't have a ScopeRef, we have an
EnumDecl, which we desire to complete. Is it best to break
RequireCompleteDeclContext apart in some way so there's a new entry
point for the new use?
thanks,
nathan
--
Nathan Sidwell
More information about the cfe-dev
mailing list