[cfe-commits] r142364 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseDecl.cpp test/SemaObjC/iboutletcollection-attr.m
Fariborz Jahanian
fjahanian at apple.com
Tue Oct 18 10:11:10 PDT 2011
Author: fjahanian
Date: Tue Oct 18 12:11:10 2011
New Revision: 142364
URL: http://llvm.org/viewvc/llvm-project?rev=142364&view=rev
Log:
objc: diagnose invalid argument to an
iboutletcollection attribute intead of crashing.
// rdar://10296078
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/SemaObjC/iboutletcollection-attr.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=142364&r1=142363&r2=142364&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Tue Oct 18 12:11:10 2011
@@ -138,7 +138,8 @@
"function definition declared 'typedef'">;
def err_iboutletcollection_builtintype : Error<
"type argument of iboutletcollection attribute cannot be a builtin type">;
-
+def err_iboutletcollection_with_protocol : Error<
+ "invalid argument of iboutletcollection attribute">;
def err_at_defs_cxx : Error<"@defs is not supported in Objective-C++">;
def err_at_in_class : Error<"unexpected '@' in member specification">;
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=142364&r1=142363&r2=142364&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Oct 18 12:11:10 2011
@@ -245,6 +245,13 @@
ConsumeToken(); // Eat the comma, move to the next argument
}
}
+ else if (Tok.is(tok::less) && AttrName->isStr("iboutletcollection")) {
+ if (!ExpectAndConsume(tok::less, diag::err_expected_less_after, "<",
+ tok::greater)) {
+ Diag(Tok, diag::err_iboutletcollection_with_protocol);
+ SkipUntil(tok::r_paren, false, true); // skip until ')'
+ }
+ }
SourceLocation RParen = Tok.getLocation();
if (!ExpectAndConsume(tok::r_paren, diag::err_expected_rparen)) {
Modified: cfe/trunk/test/SemaObjC/iboutletcollection-attr.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/iboutletcollection-attr.m?rev=142364&r1=142363&r2=142364&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/iboutletcollection-attr.m (original)
+++ cfe/trunk/test/SemaObjC/iboutletcollection-attr.m Tue Oct 18 12:11:10 2011
@@ -29,3 +29,13 @@
@property __attribute__((iboutletcollection(BAD))) int prop3; // expected-error {{property with 'iboutletcollection' attribute must be an object type (invalid 'int')}}
@end
+// rdar://10296078
+ at interface ParentRDar10296078 @end
+ at class NSArray;
+ at protocol RDar10296078_Protocol;
+ at class RDar10296078_OtherClass;
+
+ at interface RDar10296078 : ParentRDar10296078
+ at property (nonatomic, strong)
+ __attribute__((iboutletcollection(RDar10296078_OtherClass<RDar10296078_Protocol>))) NSArray *stuff; // expected-error {{invalid argument of iboutletcollection attribute}}
+ at end
More information about the cfe-commits
mailing list