r305619 - Call setMustBuildLookupTable on TagDecls in ExternalASTMerger
Lang Hames via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 16 17:12:38 PDT 2017
Author: lhames
Date: Fri Jun 16 19:12:38 2017
New Revision: 305619
URL: http://llvm.org/viewvc/llvm-project?rev=305619&view=rev
Log:
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
Added:
cfe/trunk/test/Import/indirect-struct-member-access/
cfe/trunk/test/Import/indirect-struct-member-access/Inputs/
cfe/trunk/test/Import/indirect-struct-member-access/Inputs/S.c
cfe/trunk/test/Import/indirect-struct-member-access/test.c
Modified:
cfe/trunk/lib/AST/ExternalASTMerger.cpp
Modified: cfe/trunk/lib/AST/ExternalASTMerger.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExternalASTMerger.cpp?rev=305619&r1=305618&r2=305619&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExternalASTMerger.cpp (original)
+++ cfe/trunk/lib/AST/ExternalASTMerger.cpp Fri Jun 16 19:12:38 2017
@@ -41,6 +41,7 @@ public:
Decl *Imported(Decl *From, Decl *To) override {
if (auto ToTag = dyn_cast<TagDecl>(To)) {
ToTag->setHasExternalLexicalStorage();
+ ToTag->setMustBuildLookupTable();
} else if (auto ToNamespace = dyn_cast<NamespaceDecl>(To)) {
ToNamespace->setHasExternalVisibleStorage();
}
Added: cfe/trunk/test/Import/indirect-struct-member-access/Inputs/S.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Import/indirect-struct-member-access/Inputs/S.c?rev=305619&view=auto
==============================================================================
--- cfe/trunk/test/Import/indirect-struct-member-access/Inputs/S.c (added)
+++ cfe/trunk/test/Import/indirect-struct-member-access/Inputs/S.c Fri Jun 16 19:12:38 2017
@@ -0,0 +1,3 @@
+struct S {
+ int a;
+};
Added: cfe/trunk/test/Import/indirect-struct-member-access/test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Import/indirect-struct-member-access/test.c?rev=305619&view=auto
==============================================================================
--- cfe/trunk/test/Import/indirect-struct-member-access/test.c (added)
+++ cfe/trunk/test/Import/indirect-struct-member-access/test.c Fri Jun 16 19:12:38 2017
@@ -0,0 +1,4 @@
+// RUN: clang-import-test -import %S/Inputs/S.c -expression %s
+void expr(struct S *MyS) {
+ MyS->a = 3;
+}
More information about the cfe-commits
mailing list