summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2018-11-29 13:50:30 +0000
committerRaphael Isemann <teemperor@gmail.com>2018-11-29 13:50:30 +0000
commitddedf0f9bbbc1a584df057da313d5642c2661d68 (patch)
treee47953b8f5d0634e439cf3e58edccdf824b52354
parent6bb80512db29c02ea149f63512d05be0939aaae7 (diff)
downloadbcm5719-llvm-ddedf0f9bbbc1a584df057da313d5642c2661d68.tar.gz
bcm5719-llvm-ddedf0f9bbbc1a584df057da313d5642c2661d68.zip
Set MustBuildLookupTable on PrimaryContext in ExternalASTMerger
Summary: `MustBuildLookupTable` must always be called on a primary context as we otherwise trigger an assert, but we don't ensure that this will always happen in our code right now. This patch explicitly requests the primary context when doing this call as this shouldn't break anything (as calling `getPrimaryContext` on a context which is its own primary context is a no-op) but will catch these rare cases where we somehow operate on a declaration context that is not its own primary context. See also D54863. Reviewers: martong, a.sidorin, shafik Reviewed By: martong Subscribers: davide, rnkovacs, cfe-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D54898 llvm-svn: 347863
-rw-r--r--clang/lib/AST/ExternalASTMerger.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/AST/ExternalASTMerger.cpp b/clang/lib/AST/ExternalASTMerger.cpp
index e7ca3ac1459..12e6bfc041a 100644
--- a/clang/lib/AST/ExternalASTMerger.cpp
+++ b/clang/lib/AST/ExternalASTMerger.cpp
@@ -144,14 +144,14 @@ public:
}
if (auto *ToTag = dyn_cast<TagDecl>(To)) {
ToTag->setHasExternalLexicalStorage();
- ToTag->setMustBuildLookupTable();
+ ToTag->getPrimaryContext()->setMustBuildLookupTable();
assert(Parent.CanComplete(ToTag));
} else if (auto *ToNamespace = dyn_cast<NamespaceDecl>(To)) {
ToNamespace->setHasExternalVisibleStorage();
assert(Parent.CanComplete(ToNamespace));
} else if (auto *ToContainer = dyn_cast<ObjCContainerDecl>(To)) {
ToContainer->setHasExternalLexicalStorage();
- ToContainer->setMustBuildLookupTable();
+ ToContainer->getPrimaryContext()->setMustBuildLookupTable();
assert(Parent.CanComplete(ToContainer));
}
return To;
OpenPOWER on IntegriCloud