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).
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?");
+++ /dev/null
-// 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