Skip to content

Commit de8bf26

Browse files
committedMay 17, 2018
[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 llvm-svn: 332588
1 parent 6e89528 commit de8bf26

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎clang/lib/AST/ASTImporter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2110,7 +2110,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {
21102110
D2 = D2CXX;
21112111
D2->setAccess(D->getAccess());
21122112
D2->setLexicalDeclContext(LexicalDC);
2113-
if (!DCXX->getDescribedClassTemplate())
2113+
if (!DCXX->getDescribedClassTemplate() || DCXX->isImplicit())
21142114
LexicalDC->addDeclInternal(D2);
21152115

21162116
Importer.Imported(D, D2);

‎clang/unittests/AST/ASTImporterTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ TEST_P(ASTImporterTestBase,
13481348
Verifier.match(To, cxxRecordDecl(hasFieldOrder({"a", "b", "c"}))));
13491349
}
13501350

1351-
TEST_P(ASTImporterTestBase, DISABLED_ShouldImportImplicitCXXRecordDecl) {
1351+
TEST_P(ASTImporterTestBase, ShouldImportImplicitCXXRecordDecl) {
13521352
Decl *From, *To;
13531353
std::tie(From, To) = getImportedDecl(
13541354
R"(

0 commit comments

Comments
 (0)
Please sign in to comment.