forked from OSchip/llvm-project
[modules] Don't accidentally trigger deserialization from DeclContext::noload_lookup.
llvm-svn: 228475
This commit is contained in:
parent
e7e2abe6a2
commit
a3271c1390
|
@ -1672,7 +1672,7 @@ private:
|
|||
|
||||
template<decl_iterator (DeclContext::*Begin)() const,
|
||||
decl_iterator (DeclContext::*End)() const>
|
||||
void buildLookupImpl(DeclContext *DCtx);
|
||||
void buildLookupImpl(DeclContext *DCtx, bool Internal);
|
||||
void makeDeclVisibleInContextWithFlags(NamedDecl *D, bool Internal,
|
||||
bool Rediscoverable);
|
||||
void makeDeclVisibleInContextImpl(NamedDecl *D, bool Internal);
|
||||
|
|
|
@ -1251,7 +1251,7 @@ StoredDeclsMap *DeclContext::buildLookup() {
|
|||
collectAllContexts(Contexts);
|
||||
for (unsigned I = 0, N = Contexts.size(); I != N; ++I)
|
||||
buildLookupImpl<&DeclContext::decls_begin,
|
||||
&DeclContext::decls_end>(Contexts[I]);
|
||||
&DeclContext::decls_end>(Contexts[I], false);
|
||||
|
||||
// We no longer have any lazy decls.
|
||||
LookupPtr.setInt(false);
|
||||
|
@ -1264,7 +1264,7 @@ StoredDeclsMap *DeclContext::buildLookup() {
|
|||
/// nested within it.
|
||||
template<DeclContext::decl_iterator (DeclContext::*Begin)() const,
|
||||
DeclContext::decl_iterator (DeclContext::*End)() const>
|
||||
void DeclContext::buildLookupImpl(DeclContext *DCtx) {
|
||||
void DeclContext::buildLookupImpl(DeclContext *DCtx, bool Internal) {
|
||||
for (decl_iterator I = (DCtx->*Begin)(), E = (DCtx->*End)();
|
||||
I != E; ++I) {
|
||||
Decl *D = *I;
|
||||
|
@ -1282,14 +1282,14 @@ void DeclContext::buildLookupImpl(DeclContext *DCtx) {
|
|||
(!ND->isFromASTFile() ||
|
||||
(isTranslationUnit() &&
|
||||
!getParentASTContext().getLangOpts().CPlusPlus)))
|
||||
makeDeclVisibleInContextImpl(ND, false);
|
||||
makeDeclVisibleInContextImpl(ND, Internal);
|
||||
|
||||
// If this declaration is itself a transparent declaration context
|
||||
// or inline namespace, add the members of this declaration of that
|
||||
// context (recursively).
|
||||
if (DeclContext *InnerCtx = dyn_cast<DeclContext>(D))
|
||||
if (InnerCtx->isTransparentContext() || InnerCtx->isInlineNamespace())
|
||||
buildLookupImpl<Begin, End>(InnerCtx);
|
||||
buildLookupImpl<Begin, End>(InnerCtx, Internal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1369,7 +1369,7 @@ DeclContext::noload_lookup(DeclarationName Name) {
|
|||
collectAllContexts(Contexts);
|
||||
for (unsigned I = 0, N = Contexts.size(); I != N; ++I)
|
||||
buildLookupImpl<&DeclContext::noload_decls_begin,
|
||||
&DeclContext::noload_decls_end>(Contexts[I]);
|
||||
&DeclContext::noload_decls_end>(Contexts[I], true);
|
||||
|
||||
// We no longer have any lazy decls.
|
||||
LookupPtr.setInt(false);
|
||||
|
@ -1555,7 +1555,7 @@ void DeclContext::makeDeclVisibleInContextImpl(NamedDecl *D, bool Internal) {
|
|||
return;
|
||||
}
|
||||
|
||||
else if (DeclNameEntries.isNull()) {
|
||||
if (DeclNameEntries.isNull()) {
|
||||
DeclNameEntries.setOnlyValue(D);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
namespace N { int f(int); }
|
|
@ -0,0 +1,6 @@
|
|||
namespace N { template<typename T> struct A { friend int f(A); }; }
|
||||
namespace N { int f(int); }
|
||||
namespace N { int f(int); }
|
||||
#include "a.h"
|
||||
namespace N { int f(int); }
|
||||
inline int g() { return f(N::A<int>()); }
|
|
@ -0,0 +1,2 @@
|
|||
module a { header "a.h" export * }
|
||||
module b { header "b.h" export * }
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/deferred-lookup -verify %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
namespace N { int f(int); }
|
||||
#include "b.h"
|
Loading…
Reference in New Issue