diff options
author | Vince Harron <vince@nethacker.com> | 2015-03-22 05:59:59 +0000 |
---|---|---|
committer | Vince Harron <vince@nethacker.com> | 2015-03-22 05:59:59 +0000 |
commit | a3ea9a4e09ad7339022cff87fe90ed7f9e53f8e3 (patch) | |
tree | 9f39dc47f2b3fadc7966416e10c6f0728f8773c5 /clang/lib/AST | |
parent | 62fa2732b96517c79c00feb9d5f0f544e62d43be (diff) | |
download | bcm5719-llvm-a3ea9a4e09ad7339022cff87fe90ed7f9e53f8e3.tar.gz bcm5719-llvm-a3ea9a4e09ad7339022cff87fe90ed7f9e53f8e3.zip |
Reverting r232793 until some new LLDB failures are discussed
llvm-svn: 232905
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 35 |
2 files changed, 31 insertions, 6 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 57621a7b1f6..89e1d52c643 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -7946,7 +7946,7 @@ static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, while (LexicalContext && !isa<FunctionDecl>(LexicalContext)) LexicalContext = LexicalContext->getLexicalParent(); - // Let the static local variable inherit its linkage from the nearest + // Let the static local variable inherit it's linkage from the nearest // enclosing function. if (LexicalContext) StaticLocalLinkage = diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 0053c3da8bc..a8e151cc937 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -1263,13 +1263,15 @@ 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(); SmallVector<DeclContext *, 2> Contexts; collectAllContexts(Contexts); for (unsigned I = 0, N = Contexts.size(); I != N; ++I) - buildLookupImpl(Contexts[I], hasExternalVisibleStorage()); + buildLookupImpl<&DeclContext::decls_begin, + &DeclContext::decls_end>(Contexts[I], false); // We no longer have any lazy decls. LookupPtr.setInt(false); @@ -1280,8 +1282,13 @@ StoredDeclsMap *DeclContext::buildLookup() { /// declarations contained within DCtx, which will either be this /// DeclContext, a DeclContext linked to it, or a transparent context /// nested within it. +template<DeclContext::decl_iterator (DeclContext::*Begin)() const, + DeclContext::decl_iterator (DeclContext::*End)() const> void DeclContext::buildLookupImpl(DeclContext *DCtx, bool Internal) { - for (Decl *D : DCtx->noload_decls()) { + for (decl_iterator I = (DCtx->*Begin)(), E = (DCtx->*End)(); + I != E; ++I) { + Decl *D = *I; + // Insert this declaration into the lookup structure, but only if // it's semantically within its decl context. Any other decls which // should be found in this context are added eagerly. @@ -1302,7 +1309,7 @@ void DeclContext::buildLookupImpl(DeclContext *DCtx, bool Internal) { // context (recursively). if (DeclContext *InnerCtx = dyn_cast<DeclContext>(D)) if (InnerCtx->isTransparentContext() || InnerCtx->isInlineNamespace()) - buildLookupImpl(InnerCtx, Internal); + buildLookupImpl<Begin, End>(InnerCtx, Internal); } } @@ -1381,8 +1388,26 @@ DeclContext::noload_lookup(DeclarationName Name) { if (PrimaryContext != this) return PrimaryContext->noload_lookup(Name); - // Note that buildLookups does not trigger any deserialization. - StoredDeclsMap *Map = buildLookup(); + StoredDeclsMap *Map = LookupPtr.getPointer(); + if (LookupPtr.getInt()) { + // Carefully build the lookup map, without deserializing anything. + SmallVector<DeclContext *, 2> Contexts; + collectAllContexts(Contexts); + for (unsigned I = 0, N = Contexts.size(); I != N; ++I) + buildLookupImpl<&DeclContext::noload_decls_begin, + &DeclContext::noload_decls_end>(Contexts[I], true); + + // We no longer have any lazy decls. + LookupPtr.setInt(false); + + // There may now be names for which we have local decls but are + // missing the external decls. FIXME: Just set the hasExternalDecls + // flag on those names that have external decls. + NeedToReconcileExternalVisibleStorage = true; + + Map = LookupPtr.getPointer(); + } + if (!Map) return lookup_result(); |