r332588 - [ASTImporter] Fix missing implict CXXRecordDecl
Gabor Marton via cfe-commits
cfe-commits at lists.llvm.org
Thu May 17 02:46:07 PDT 2018
Author: martong
Date: Thu May 17 02:46:07 2018
New Revision: 332588
URL: http://llvm.org/viewvc/llvm-project?rev=332588&view=rev
Log:
[ASTImporter] Fix missing implict CXXRecordDecl
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
Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/unittests/AST/ASTImporterTest.cpp
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=332588&r1=332587&r2=332588&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Thu May 17 02:46:07 2018
@@ -2110,7 +2110,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(R
D2 = D2CXX;
D2->setAccess(D->getAccess());
D2->setLexicalDeclContext(LexicalDC);
- if (!DCXX->getDescribedClassTemplate())
+ if (!DCXX->getDescribedClassTemplate() || DCXX->isImplicit())
LexicalDC->addDeclInternal(D2);
Importer.Imported(D, D2);
Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTImporterTest.cpp?rev=332588&r1=332587&r2=332588&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/ASTImporterTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTImporterTest.cpp Thu May 17 02:46:07 2018
@@ -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"(
More information about the cfe-commits
mailing list