Modules: revert r280728.

In post-commit review, Richard suggested a better way to fix this.
rdar://27926200

llvm-svn: 281078
This commit is contained in:
Manman Ren 2016-09-09 19:03:07 +00:00
parent 36efbfa6d8
commit 7d2f5c4a91
6 changed files with 4 additions and 28 deletions

View File

@ -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?");

View File

@ -1,4 +0,0 @@
@interface BaseInterface
- (void) test;
@end

View File

@ -1,3 +0,0 @@
#include "Base.h"
@interface DerivedInterface : BaseInterface
@end

View File

@ -1 +0,0 @@
#include "Base.h"

View File

@ -1,4 +0,0 @@
module X {
header "H3.h"
export *
}

View File

@ -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