r216191 - Objective-C. Recover from missing interface decl.
Fariborz Jahanian
fjahanian at apple.com
Thu Aug 21 10:06:57 PDT 2014
Author: fjahanian
Date: Thu Aug 21 12:06:57 2014
New Revision: 216191
URL: http://llvm.org/viewvc/llvm-project?rev=216191&view=rev
Log:
Objective-C. Recover from missing interface decl.
and checking on availability of method declaration
instead of crashing. // rdar://18059669
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaObjC/attr-availability.m
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=216191&r1=216190&r2=216191&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Aug 21 12:06:57 2014
@@ -13634,5 +13634,6 @@ AvailabilityResult Sema::getCurContextAv
dyn_cast<ObjCImplementationDecl>(D)) {
D = ID->getClassInterface();
}
- return D->getAvailability();
+ // Recover from user error.
+ return D ? D->getAvailability() : AR_Available;
}
Modified: cfe/trunk/test/SemaObjC/attr-availability.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-availability.m?rev=216191&r1=216190&r2=216191&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-availability.m (original)
+++ cfe/trunk/test/SemaObjC/attr-availability.m Thu Aug 21 12:06:57 2014
@@ -60,3 +60,30 @@ void f(A *a, B *b) {
}
@end
+// rdar://18059669
+ at class NSMutableArray;
+
+ at interface NSDictionary
++ (instancetype)dictionaryWithObjectsAndKeys:(id)firstObject, ... __attribute__((sentinel(0,1)));
+ at end
+
+ at class NSString;
+
+extern NSString *NSNibTopLevelObjects __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.8,message="" )));
+id NSNibOwner, topNibObjects;
+
+ at interface AppDelegate (SIEImport) // expected-error {{cannot find interface declaration for 'AppDelegate'}}
+
+-(void)__attribute__((ibaction))importFromSIE:(id)sender;
+
+ at end
+
+ at 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)];
+}
+
+ at end
More information about the cfe-commits
mailing list