r347863 - Set MustBuildLookupTable on PrimaryContext in ExternalASTMerger
Raphael Isemann via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 29 05:50:30 PST 2018
Author: teemperor
Date: Thu Nov 29 05:50:30 2018
New Revision: 347863
URL: http://llvm.org/viewvc/llvm-project?rev=347863&view=rev
Log:
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
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=347863&r1=347862&r2=347863&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExternalASTMerger.cpp (original)
+++ cfe/trunk/lib/AST/ExternalASTMerger.cpp Thu Nov 29 05:50:30 2018
@@ -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;
More information about the cfe-commits
mailing list