================ @@ -23,6 +23,55 @@ namespace clang { +inline CXXRecordDecl *Type::getAsCXXRecordDecl() const { + const auto *TT = dyn_cast<TagType>(CanonicalType); + if (!isa_and_present<RecordType, InjectedClassNameType>(TT)) + return nullptr; + auto *TD = TT->getOriginalDecl(); + if (!isa<InjectedClassNameType>(TT) && !isa<CXXRecordDecl>(TD)) + return nullptr; ---------------- mizvekov wrote:
For an InjectedClassNameType, we already know the declaration must be a CXXRecordDecl, so we can skip the check and go straight for the cast. https://github.com/llvm/llvm-project/pull/155051 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits