diff options
| -rw-r--r-- | clang/lib/AST/DeclBase.cpp | 10 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/lookup-assert/Base.h | 4 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/lookup-assert/Derive.h | 3 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/lookup-assert/H3.h | 1 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/lookup-assert/module.map | 4 | ||||
| -rw-r--r-- | clang/test/Modules/lookup-assert.m | 10 |
6 files changed, 4 insertions, 28 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?"); diff --git a/clang/test/Modules/Inputs/lookup-assert/Base.h b/clang/test/Modules/Inputs/lookup-assert/Base.h deleted file mode 100644 index 8d5e06b4363..00000000000 --- a/clang/test/Modules/Inputs/lookup-assert/Base.h +++ /dev/null @@ -1,4 +0,0 @@ -@interface BaseInterface -- (void) test; -@end - diff --git a/clang/test/Modules/Inputs/lookup-assert/Derive.h b/clang/test/Modules/Inputs/lookup-assert/Derive.h deleted file mode 100644 index 313a96188d2..00000000000 --- a/clang/test/Modules/Inputs/lookup-assert/Derive.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "Base.h" -@interface DerivedInterface : BaseInterface -@end diff --git a/clang/test/Modules/Inputs/lookup-assert/H3.h b/clang/test/Modules/Inputs/lookup-assert/H3.h deleted file mode 100644 index 3d8f878905d..00000000000 --- a/clang/test/Modules/Inputs/lookup-assert/H3.h +++ /dev/null @@ -1 +0,0 @@ -#include "Base.h" diff --git a/clang/test/Modules/Inputs/lookup-assert/module.map b/clang/test/Modules/Inputs/lookup-assert/module.map deleted file mode 100644 index e8a89eb095a..00000000000 --- a/clang/test/Modules/Inputs/lookup-assert/module.map +++ /dev/null @@ -1,4 +0,0 @@ -module X { - header "H3.h" - export * -} diff --git a/clang/test/Modules/lookup-assert.m b/clang/test/Modules/lookup-assert.m deleted file mode 100644 index 2697fb15d01..00000000000 --- a/clang/test/Modules/lookup-assert.m +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/lookup-assert %s -verify -// expected-no-diagnostics - -#include "Derive.h" -#import <H3.h> -@implementation DerivedInterface -- (void)test { -} -@end |

