Skip to content
Snippets Groups Projects
Commit 30060bff authored by Lang Hames's avatar Lang Hames
Browse files

Call setMustBuildLookupTable on TagDecls in ExternalASTMerger

Summary:
setMustBuildLookupTable should be called on imported TagDecls otherwise we may fail
to import their member decls (if they have any).

Not calling the setMustBuildLookupTable method results in a failure in the attached test
case when lookup for the 'x' member fails on struct S, which hasn't had its decls imported
elsewhere. (By contrast the member-in-struct testcase hasn't run into this issue
because the import of its decls is triggered when the struct instance is defined, and the
member access follows this).

Reviewers: spyffe, rsmith

Reviewed By: spyffe, rsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305619 91177308-0d34-0410-b5e6-96231b3b80d8
parent 0c8ec433
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,7 @@ public: ...@@ -41,6 +41,7 @@ public:
Decl *Imported(Decl *From, Decl *To) override { Decl *Imported(Decl *From, Decl *To) override {
if (auto ToTag = dyn_cast<TagDecl>(To)) { if (auto ToTag = dyn_cast<TagDecl>(To)) {
ToTag->setHasExternalLexicalStorage(); ToTag->setHasExternalLexicalStorage();
ToTag->setMustBuildLookupTable();
} else if (auto ToNamespace = dyn_cast<NamespaceDecl>(To)) { } else if (auto ToNamespace = dyn_cast<NamespaceDecl>(To)) {
ToNamespace->setHasExternalVisibleStorage(); ToNamespace->setHasExternalVisibleStorage();
} }
......
struct S {
int a;
};
// RUN: clang-import-test -import %S/Inputs/S.c -expression %s
void expr(struct S *MyS) {
MyS->a = 3;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment