objective-c: deprecated C-like parameters in Objective-C

method declarations.
// rdar://11578353.

llvm-svn: 158929
This commit is contained in:
Fariborz Jahanian 2012-06-21 18:43:08 +00:00
parent f06b731fed
commit 45337f53df
7 changed files with 14 additions and 8 deletions

View File

@ -339,6 +339,9 @@ def err_illegal_super_cast : Error<
"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<

View File

@ -1106,7 +1106,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
}
bool isVariadic = false;
bool cStyleParamWarned = false;
// Parse the (optional) parameter list.
while (Tok.is(tok::comma)) {
ConsumeToken();
@ -1115,6 +1115,10 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
ConsumeToken();
break;
}
if (!cStyleParamWarned) {
Diag(Tok, diag::warn_cstyle_param);
cStyleParamWarned = true;
}
DeclSpec DS(AttrFactory);
ParseDeclarationSpecifiers(DS);
// Parse the declarator.
@ -1126,7 +1130,6 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
ParmDecl.getIdentifierLoc(),
Param,
0));
}
// FIXME: Add support for optional parameter list...

View File

@ -7,7 +7,7 @@ int object;
@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 @@ int object;
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; }

View File

@ -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;

View File

@ -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;

View File

@ -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}}

View File

@ -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