[PATCH] D101777: [clang] p1099 1/5: [NFC] Break out BaseUsingDecl from UsingDecl
David Rector via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat May 22 08:26:56 PDT 2021
davrec accepted this revision.
davrec added a comment.
Sorry for the delay.
Richard should probably weigh in before absolutely committing to
1. BaseUsingDecl/UsingEnumDecl/UsingDecl (as implemented here) vs. single UsingDecl (Nathan's original approach) and
2. Renaming `getUsingDecl()` to `getIntroducer()` (if it is to return a `BaseUsingDecl`).
(Main rationale for separating UsingEnumDecl vs. UsingDecl: parallels the naming distinction in P1099 <https://reviews.llvm.org/P1099> between a "using-declaration" and a "using-enum-declaration". Cons: churn, adds to quite a collection of Using*-named AST nodes already. Nonetheless I favor distinguishing them.)
================
Comment at: clang/include/clang/AST/DeclCXX.h:3390
ConstructorUsingShadowDecl(ASTContext &C, DeclContext *DC, SourceLocation Loc,
- UsingDecl *Using, NamedDecl *Target,
+ BaseUsingDecl *Using, NamedDecl *Target,
bool TargetInVirtualBase)
----------------
`BaseUsingDecl` here should remain `UsingDecl`.
Additionally, I would add a `UsingDecl *getIntroducer() { return cast<UsingDecl>(UsingShadowDecl::getIntroducer()); }` method here.
================
Comment at: clang/lib/AST/DeclCXX.cpp:3026
CXXRecordDecl *ConstructorUsingShadowDecl::getNominatedBaseClass() const {
- return getUsingDecl()->getQualifier()->getAsRecordDecl();
+ return cast<UsingDecl>(getIntroducer())->getQualifier()->getAsRecordDecl();
}
----------------
With the additional `ConstructorUsingShadowDecl::getIntroducer()` method suggested elsewhere, the cast won't be necessary here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101777/new/
https://reviews.llvm.org/D101777
More information about the cfe-commits
mailing list