This revision was automatically updated to reflect the committed changes. Closed by commit rGecae672ac2ac: [ASTImporter] Fix AST import crash for a friend decl (authored by vabridgers, committed by einvbri <vince.a.bridg...@ericsson.com>).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82882/new/ https://reviews.llvm.org/D82882 Files: clang/lib/AST/ASTImporterLookupTable.cpp Index: clang/lib/AST/ASTImporterLookupTable.cpp =================================================================== --- clang/lib/AST/ASTImporterLookupTable.cpp +++ clang/lib/AST/ASTImporterLookupTable.cpp @@ -45,7 +45,11 @@ LT.add(RTy->getAsCXXRecordDecl()); else if (const auto *SpecTy = dyn_cast<TemplateSpecializationType>(Ty)) LT.add(SpecTy->getAsCXXRecordDecl()); - else if (isa<TypedefType>(Ty)) { + else if (const auto *SubstTy = + dyn_cast<SubstTemplateTypeParmType>(Ty)) { + if (SubstTy->getAsCXXRecordDecl()) + LT.add(SubstTy->getAsCXXRecordDecl()); + } else if (isa<TypedefType>(Ty)) { // We do not put friend typedefs to the lookup table because // ASTImporter does not organize typedefs into redecl chains. } else {
Index: clang/lib/AST/ASTImporterLookupTable.cpp =================================================================== --- clang/lib/AST/ASTImporterLookupTable.cpp +++ clang/lib/AST/ASTImporterLookupTable.cpp @@ -45,7 +45,11 @@ LT.add(RTy->getAsCXXRecordDecl()); else if (const auto *SpecTy = dyn_cast<TemplateSpecializationType>(Ty)) LT.add(SpecTy->getAsCXXRecordDecl()); - else if (isa<TypedefType>(Ty)) { + else if (const auto *SubstTy = + dyn_cast<SubstTemplateTypeParmType>(Ty)) { + if (SubstTy->getAsCXXRecordDecl()) + LT.add(SubstTy->getAsCXXRecordDecl()); + } else if (isa<TypedefType>(Ty)) { // We do not put friend typedefs to the lookup table because // ASTImporter does not organize typedefs into redecl chains. } else {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits