Skip to content

Commit

Permalink
[ASTImporter] Fix missing implict CXXRecordDecl
Browse files Browse the repository at this point in the history
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
  • Loading branch information
martong committed May 17, 2018
1 parent 6e89528 commit de8bf26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clang/lib/AST/ASTImporter.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion clang/unittests/AST/ASTImporterTest.cpp
Expand Up @@ -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"(
Expand Down

0 comments on commit de8bf26

Please sign in to comment.