[PATCH] D112765: [AST] injected-class-name is not a redecl, even in template specializations
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 29 12:13:23 PDT 2021
hokein accepted this revision.
hokein added a comment.
looks good, thanks.
================
Comment at: clang/include/clang/AST/RecursiveASTVisitor.h:1685
- // We don't want to visit injected-class-names in this traversal.
- if (cast<CXXRecordDecl>(RD)->isInjectedClassName())
- continue;
----------------
I would add a assertion here: `assert(!cast<CXXRecordDecl>(RD)->isInjectedClassName())`.
================
Comment at: clang/lib/AST/ASTDumper.cpp:94
auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
- if (!Redecl) {
- // Found the injected-class-name for a class template. This will be dumped
----------------
`assert(Redecl)`
================
Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:1910
+ if (IsInjectedClassName)
+ assert(Record->isInjectedClassName() && "Broken injected-class-name");
----------------
sammccall wrote:
> hokein wrote:
> > it is unclear to me what's the intention of the assertion.
> We needed to do a few weird things (and to assume some things about the input) to initialize the injected-class-name, it verifies we got them all right.
>
> (This assertion is also in ActOnStartCXXMemberDeclarations())
ok, I see. didn't know this is derived from `ActOnStartCXXMemberDeclarations`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112765/new/
https://reviews.llvm.org/D112765
More information about the cfe-commits
mailing list