summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
-rw-r--r--clang/test/SemaObjC/attr-availability.m27
2 files changed, 29 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index b3e92d765fd..c8c381518b1 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -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;
}
diff --git a/clang/test/SemaObjC/attr-availability.m b/clang/test/SemaObjC/attr-availability.m
index 7990b1202e8..c455bc7acce 100644
--- a/clang/test/SemaObjC/attr-availability.m
+++ b/clang/test/SemaObjC/attr-availability.m
@@ -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
OpenPOWER on IntegriCloud