]> granicus.if.org Git - clang/commitdiff
[ASTImporter] Fix missing implict CXXRecordDecl
authorGabor Marton <martongabesz@gmail.com>
Thu, 17 May 2018 09:46:07 +0000 (09:46 +0000)
committerGabor Marton <martongabesz@gmail.com>
Thu, 17 May 2018 09:46:07 +0000 (09:46 +0000)
Summary:
Implicit CXXRecordDecl is not added to its DeclContext during import, but in
the original AST it is. This patch fixes this.

Reviewers: xazax.hun, a.sidorin, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

Differential Revision: https://reviews.llvm.org/D46958

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332588 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTImporter.cpp
unittests/AST/ASTImporterTest.cpp

index 254eb7643d4ec8a9c76abe32c449096409e265b8..6fa4617cf0614bec377dd9e6d50ac882e4422ff4 100644 (file)
@@ -2110,7 +2110,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {
       D2 = D2CXX;
       D2->setAccess(D->getAccess());
       D2->setLexicalDeclContext(LexicalDC);
-      if (!DCXX->getDescribedClassTemplate())
+      if (!DCXX->getDescribedClassTemplate() || DCXX->isImplicit())
         LexicalDC->addDeclInternal(D2);
 
       Importer.Imported(D, D2);
index 9eec1d20bac688166bc2a767ed41808277666288..a4c823008d96619c63927e6191f607c80186af21 100644 (file)
@@ -1348,7 +1348,7 @@ TEST_P(ASTImporterTestBase,
       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"(