diff options
author | Manman Ren <manman.ren@gmail.com> | 2016-09-09 19:03:07 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2016-09-09 19:03:07 +0000 |
commit | 02a8764a3d4b6df5657eb12a2a8fdf920c724d18 (patch) | |
tree | 2af0b52e2a758f9f94f676936ce9d8bea3d87a72 /lib/AST/DeclBase.cpp | |
parent | 27f089e8b25206731c445d5cb8f5fa00d3b83c67 (diff) |
Modules: revert r280728.
In post-commit review, Richard suggested a better way to fix this.
rdar://27926200
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r-- | lib/AST/DeclBase.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 4d4e725dbd..cea511b511 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -1413,6 +1413,10 @@ DeclContext::lookup(DeclarationName Name) const { assert(DeclKind != Decl::LinkageSpec && DeclKind != Decl::Export && "should not perform lookups into transparent contexts"); + const DeclContext *PrimaryContext = getPrimaryContext(); + if (PrimaryContext != this) + return PrimaryContext->lookup(Name); + // If we have an external source, ensure that any later redeclarations of this // context have been loaded, since they may add names to the result of this // lookup (or add external visible storage). @@ -1420,12 +1424,6 @@ DeclContext::lookup(DeclarationName Name) const { if (Source) (void)cast<Decl>(this)->getMostRecentDecl(); - // getMostRecentDecl can change the result of getPrimaryContext. Call - // getPrimaryContext afterwards. - const DeclContext *PrimaryContext = getPrimaryContext(); - if (PrimaryContext != this) - return PrimaryContext->lookup(Name); - if (hasExternalVisibleStorage()) { assert(Source && "external visible storage but no external source?"); |