aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-02-11 22:02:16 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-02-11 22:02:16 +0000
commit8896339a3c654dc44877d52a926eb89ab3ef30b5 (patch)
tree736197d9101bd25aa84f775b87684ec828bb661f /lib/AST/DeclBase.cpp
parenta09cd8103a6a719cb2628cdf0c91682250a17bd2 (diff)
Don't bother reconciling external visible decls against our current set of
declarations if we didn't have a lookup map when the external decls were added. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174906 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r--lib/AST/DeclBase.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index 2073658549..e1f40356e2 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -921,10 +921,7 @@ DeclContext::BuildDeclChain(ArrayRef<Decl*> Decls,
/// built a lookup map. For every name in the map, pull in the new names from
/// the external storage.
void DeclContext::reconcileExternalVisibleStorage() {
- assert(NeedToReconcileExternalVisibleStorage);
- if (!LookupPtr.getPointer())
- return;
-
+ assert(NeedToReconcileExternalVisibleStorage && LookupPtr.getPointer());
NeedToReconcileExternalVisibleStorage = false;
StoredDeclsMap &Map = *LookupPtr.getPointer();
@@ -1148,6 +1145,7 @@ static bool shouldBeHidden(NamedDecl *D) {
StoredDeclsMap *DeclContext::buildLookup() {
assert(this == getPrimaryContext() && "buildLookup called on non-primary DC");
+ // FIXME: Should we keep going if hasExternalVisibleStorage?
if (!LookupPtr.getInt())
return LookupPtr.getPointer();
@@ -1158,6 +1156,7 @@ StoredDeclsMap *DeclContext::buildLookup() {
// We no longer have any lazy decls.
LookupPtr.setInt(false);
+ NeedToReconcileExternalVisibleStorage = false;
return LookupPtr.getPointer();
}
@@ -1166,10 +1165,6 @@ StoredDeclsMap *DeclContext::buildLookup() {
/// DeclContext, a DeclContext linked to it, or a transparent context
/// nested within it.
void DeclContext::buildLookupImpl(DeclContext *DCtx) {
- // FIXME: If buildLookup is supposed to return a complete map, we should not
- // bail out in buildLookup if hasExternalVisibleStorage. If it is not required
- // to include names from PCH and modules, we should use the noload_ iterators
- // here.
for (decl_iterator I = DCtx->decls_begin(), E = DCtx->decls_end();
I != E; ++I) {
Decl *D = *I;
@@ -1200,12 +1195,11 @@ DeclContext::lookup(DeclarationName Name) {
return PrimaryContext->lookup(Name);
if (hasExternalVisibleStorage()) {
- if (NeedToReconcileExternalVisibleStorage)
- reconcileExternalVisibleStorage();
-
StoredDeclsMap *Map = LookupPtr.getPointer();
if (LookupPtr.getInt())
Map = buildLookup();
+ else if (NeedToReconcileExternalVisibleStorage)
+ reconcileExternalVisibleStorage();
if (!Map)
Map = CreateStoredDeclsMap(getParentASTContext());