[PATCH] D46958: [ASTImporter] Fix missing implict CXXRecordDecl
    Gabor Marton via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Wed May 16 08:55:13 PDT 2018
    
    
  
martong created this revision.
martong added reviewers: xazax.hun, a.sidorin, szepet.
Herald added subscribers: cfe-commits, dkrupp, rnkovacs.
Implicit CXXRecordDecl is not added to its DeclContext during import, but in
the original AST it is. This patch fixes this.
Repository:
  rC Clang
https://reviews.llvm.org/D46958
Files:
  lib/AST/ASTImporter.cpp
  unittests/AST/ASTImporterTest.cpp
Index: unittests/AST/ASTImporterTest.cpp
===================================================================
--- unittests/AST/ASTImporterTest.cpp
+++ unittests/AST/ASTImporterTest.cpp
@@ -1348,7 +1348,7 @@
       Verifier.match(To, cxxRecordDecl(hasFieldOrder({"a", "b", "c"}))));
 }
 
-TEST_P(ASTImporterTestBase, DISABLED_ShouldImportImplicitCXXRecordDecl) {
+TEST_P(ASTImporterTestBase, ShouldImportImplicitCXXRecordDecl) {
   Decl *From, *To;
   std::tie(From, To) = getImportedDecl(
       R"(
Index: lib/AST/ASTImporter.cpp
===================================================================
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -2110,7 +2110,7 @@
       D2 = D2CXX;
       D2->setAccess(D->getAccess());
       D2->setLexicalDeclContext(LexicalDC);
-      if (!DCXX->getDescribedClassTemplate())
+      if (!DCXX->getDescribedClassTemplate() || DCXX->isImplicit())
         LexicalDC->addDeclInternal(D2);
 
       Importer.Imported(D, D2);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46958.147107.patch
Type: text/x-patch
Size: 971 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180516/7b979355/attachment.bin>
    
    
More information about the cfe-commits
mailing list