Module: for ObjectiveC, be consistent when checking hidden decls.

In MatchAllMethodDeclarations, when checking a hidden decl, be sure
to allow hidden when searching for methods.

rdar://28699972

llvm-svn: 283943
This commit is contained in:
Manman Ren 2016-10-11 21:18:20 +00:00
parent bdfc05ff93
commit a58f92f09d
6 changed files with 34 additions and 2 deletions

View File

@ -2741,7 +2741,7 @@ void Sema::MatchAllMethodDeclarations(const SelectorSet &InsMap,
} else {
ObjCMethodDecl *ImpMethodDecl =
IMPDecl->getInstanceMethod(I->getSelector());
assert(CDecl->getInstanceMethod(I->getSelector()) &&
assert(CDecl->getInstanceMethod(I->getSelector(), true/*AllowHidden*/) &&
"Expected to find the method through lookup as well");
// ImpMethodDecl may be null as in a @dynamic property.
if (ImpMethodDecl) {
@ -2767,7 +2767,7 @@ void Sema::MatchAllMethodDeclarations(const SelectorSet &InsMap,
} else {
ObjCMethodDecl *ImpMethodDecl =
IMPDecl->getClassMethod(I->getSelector());
assert(CDecl->getClassMethod(I->getSelector()) &&
assert(CDecl->getClassMethod(I->getSelector(), true/*AllowHidden*/) &&
"Expected to find the method through lookup as well");
// ImpMethodDecl may be null as in a @dynamic property.
if (ImpMethodDecl) {

View File

@ -0,0 +1,7 @@
#include <X.h>
__attribute__((availability(macosx,introduced=1066.0))) __attribute__((availability(ios,introduced=1066.0)))
@interface UnavailableObjCClass : NSObject
- (void)someMethod;
@end

View File

@ -0,0 +1,5 @@
framework module FakeUnavailableObjCFramework {
umbrella header "FakeUnavailableObjCFramework.h"
// Do not export to test hidden decls.
// export *
}

View File

@ -0,0 +1,5 @@
@protocol NSObject
@property (readonly) int hash;
@end
@interface NSObject <NSObject>
@end

View File

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

View File

@ -0,0 +1,11 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fsyntax-only -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/objc-hidden/System -F %S/Inputs/objc-hidden -verify -x objective-c %s
// expected-no-diagnostics
// Make sure we don't crash with hidden decls.
@import FakeUnavailableObjCFramework;
@implementation UnavailableObjCClass
- (void)someMethod { }
@end