[PATCH] D82882: [ASTImporter] Fix AST import crash for a friend decl

Vince Bridgers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 30 11:24:40 PDT 2020


vabridgers updated this revision to Diff 274542.
vabridgers added a comment.

fix pre-merge checks


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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82882.274542.patch
Type: text/x-patch
Size: 853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200630/df3e9844/attachment-0001.bin>


More information about the cfe-commits mailing list