[cfe-commits] r158929 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseObjc.cpp test/SemaObjC/method-prototype-scope.m test/SemaObjC/mismatched-undefined-method.m test/SemaObjC/objc-cstyle-args-in-methods.m test/SemaObjC/protocols.m test/SemaObjC/related-result-type-inference.m
Fariborz Jahanian
fjahanian at apple.com
Thu Jun 21 11:43:08 PDT 2012
Author: fjahanian
Date: Thu Jun 21 13:43:08 2012
New Revision: 158929
URL: http://llvm.org/viewvc/llvm-project?rev=158929&view=rev
Log:
objective-c: deprecated C-like parameters in Objective-C
method declarations.
// rdar://11578353.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/test/SemaObjC/method-prototype-scope.m
cfe/trunk/test/SemaObjC/mismatched-undefined-method.m
cfe/trunk/test/SemaObjC/objc-cstyle-args-in-methods.m
cfe/trunk/test/SemaObjC/protocols.m
cfe/trunk/test/SemaObjC/related-result-type-inference.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=158929&r1=158928&r2=158929&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Thu Jun 21 13:43:08 2012
@@ -339,6 +339,9 @@
"cannot cast 'super' (it isn't an expression)">;
def err_nsnumber_nonliteral_unary : Error<
"@%0 must be followed by a number to form an NSNumber object">;
+def warn_cstyle_param : Warning<
+ "use of C-style parameters in Objective-C method declarations"
+ " is deprecated">, InGroup<DeprecatedDeclarations>;
let CategoryName = "ARC Parse Issue" in {
def err_arc_bridge_retain : Error<
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=158929&r1=158928&r2=158929&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu Jun 21 13:43:08 2012
@@ -1106,7 +1106,7 @@
}
bool isVariadic = false;
-
+ bool cStyleParamWarned = false;
// Parse the (optional) parameter list.
while (Tok.is(tok::comma)) {
ConsumeToken();
@@ -1115,6 +1115,10 @@
ConsumeToken();
break;
}
+ if (!cStyleParamWarned) {
+ Diag(Tok, diag::warn_cstyle_param);
+ cStyleParamWarned = true;
+ }
DeclSpec DS(AttrFactory);
ParseDeclarationSpecifiers(DS);
// Parse the declarator.
@@ -1126,7 +1130,6 @@
ParmDecl.getIdentifierLoc(),
Param,
0));
-
}
// FIXME: Add support for optional parameter list...
Modified: cfe/trunk/test/SemaObjC/method-prototype-scope.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/method-prototype-scope.m?rev=158929&r1=158928&r2=158929&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/method-prototype-scope.m (original)
+++ cfe/trunk/test/SemaObjC/method-prototype-scope.m Thu Jun 21 13:43:08 2012
@@ -7,7 +7,7 @@
@class NSString, NSArray;
@interface Test
-- Func:(int)XXXX, id object;
+- Func:(int)XXXX, id object; // expected-warning {{use of C-style parameters in Objective-C method declarations is deprecated}}
- doSomethingElseWith:(id)object;
@@ -23,7 +23,7 @@
return object; // expected-warning {{incompatible pointer types returning 'NSArray *' from a function with result type 'NSString *'}}
}
-- Func:(int)XXXX, id object { return object; }
+- Func:(int)XXXX, id object { return object; } // expected-warning {{use of C-style parameters in Objective-C method declarations is deprecated}}
- doSomethingElseWith:(id)object { return object; }
Modified: cfe/trunk/test/SemaObjC/mismatched-undefined-method.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/mismatched-undefined-method.m?rev=158929&r1=158928&r2=158929&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/mismatched-undefined-method.m (original)
+++ cfe/trunk/test/SemaObjC/mismatched-undefined-method.m Thu Jun 21 13:43:08 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-declarations -verify %s
// rdar://11460990
typedef unsigned int CGDirectDisplayID;
Modified: cfe/trunk/test/SemaObjC/objc-cstyle-args-in-methods.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc-cstyle-args-in-methods.m?rev=158929&r1=158928&r2=158929&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/objc-cstyle-args-in-methods.m (original)
+++ cfe/trunk/test/SemaObjC/objc-cstyle-args-in-methods.m Thu Jun 21 13:43:08 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-declarations -verify -Wno-objc-root-class %s
@interface Foo
- (id)test:(id)one, id two;
Modified: cfe/trunk/test/SemaObjC/protocols.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocols.m?rev=158929&r1=158928&r2=158929&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/protocols.m (original)
+++ cfe/trunk/test/SemaObjC/protocols.m Thu Jun 21 13:43:08 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-declarations -verify %s
@interface INTF1
@required // expected-error {{directive may only be specified in protocols only}}
Modified: cfe/trunk/test/SemaObjC/related-result-type-inference.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/related-result-type-inference.m?rev=158929&r1=158928&r2=158929&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/related-result-type-inference.m (original)
+++ cfe/trunk/test/SemaObjC/related-result-type-inference.m Thu Jun 21 13:43:08 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -verify -Wno-deprecated-declarations -Wno-objc-root-class %s
@interface Unrelated
@end
More information about the cfe-commits
mailing list