Objective-C. Recover from missing interface decl.

and checking on availability of method declaration
instead of crashing. // rdar://18059669

llvm-svn: 216191
This commit is contained in:
Fariborz Jahanian 2014-08-21 17:06:57 +00:00
parent 7050e0b194
commit 38c53fbf1f
2 changed files with 29 additions and 1 deletions

View File

@ -13634,5 +13634,6 @@ AvailabilityResult Sema::getCurContextAvailability() const {
dyn_cast<ObjCImplementationDecl>(D)) {
D = ID->getClassInterface();
}
return D->getAvailability();
// Recover from user error.
return D ? D->getAvailability() : AR_Available;
}

View File

@ -60,3 +60,30 @@ void f(A *a, B *b) {
}
@end
// rdar://18059669
@class NSMutableArray;
@interface NSDictionary
+ (instancetype)dictionaryWithObjectsAndKeys:(id)firstObject, ... __attribute__((sentinel(0,1)));
@end
@class NSString;
extern NSString *NSNibTopLevelObjects __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.8,message="" )));
id NSNibOwner, topNibObjects;
@interface AppDelegate (SIEImport) // expected-error {{cannot find interface declaration for 'AppDelegate'}}
-(void)__attribute__((ibaction))importFromSIE:(id)sender;
@end
@implementation AppDelegate (SIEImport) // expected-error {{cannot find interface declaration for 'AppDelegate'}}
-(void)__attribute__((ibaction))importFromSIE:(id)sender {
NSMutableArray *topNibObjects;
NSDictionary *nibLoadDict = [NSDictionary dictionaryWithObjectsAndKeys:self, NSNibOwner, topNibObjects, NSNibTopLevelObjects, ((void *)0)];
}
@end