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 | 7d2f5c4a913604938467a865659b3e75cf672e42 (patch) | |
tree | 7cb17376cc512e052be189d6f2fd10a78b6beae6 /clang/lib/AST/DeclBase.cpp | |
parent | 36efbfa6d81b3d15144bb2d5683f654a6b4246d4 (diff) | |
download | bcm5719-llvm-7d2f5c4a913604938467a865659b3e75cf672e42.tar.gz bcm5719-llvm-7d2f5c4a913604938467a865659b3e75cf672e42.zip |
Modules: revert r280728.
In post-commit review, Richard suggested a better way to fix this.
rdar://27926200
llvm-svn: 281078
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 4d4e725dbdd..cea511b5118 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/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?"); |