aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land.
Aside from the cast request, this LGTM, thank you! ================ Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:1841-1842 + /*DelayTypeCreation=*/IsInjectedClassName); + if (IsInjectedClassName) + SemaRef.Context.getTypeDeclType(Record, cast<CXXRecordDecl>(Owner)); ---------------- sammccall wrote: > hokein wrote: > > aaron.ballman wrote: > > > Why is this call needed? (It seems strange to me that we call it and > > > ignore the return value.) > > my understanding is > > - `getTypeDeclType` is more than a getter, it also has a side-effort -- > > if the type of the passed `Record` is empty, it creates a type, and > > propagates the type to `Record->TypeForDecl`; > > - from the above line, we delay the type creation when > > `IsInjectedClassName` is true; > > - so we need to create a type for the `Record` by invoking > > `getTypeDeclType`; > > > > might be worth a comment. > > > That's exactly right. The injected-class-name is an independent decl but > yields the same RecordType, and getTypeDeclType has a hacky interface so we > can force this link. > (It wasn't needed in the old version of the code, because when it was a > redecl getTypeDeclType would yield the same type in any case) > > I should have mentioned this is all derived from the injected-class-name > handling in Sema::ActOnStartCXXMemberDeclarations(). It lacks comments, but > I'll add a few while here. Ah, thank you for the explanation! I think a `(void)` on the result will also help make it clear that we intentionally are ignoring that result despite it looking like a getter. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112765/new/ https://reviews.llvm.org/D112765 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits