forked from OSchip/llvm-project
Issue warning if method body starts with a semicolon.
Fixes <rdar://problem/7308503> clang should disallow the trailing semicolon in method definitions llvm-svn: 84645
This commit is contained in:
parent
bb4568a37d
commit
040d75d9b6
|
@ -201,6 +201,9 @@ def warn_expected_implementation : Warning<
|
|||
"@end must appear in an @implementation context">;
|
||||
def error_property_ivar_decl : Error<
|
||||
"property synthesize requires specification of an ivar">;
|
||||
def warn_semicolon_before_method_nody : Warning<
|
||||
"semicolon at start of method definition is ignored">,
|
||||
InGroup<DiagGroup<"semicolon-at-method-body">>;
|
||||
|
||||
def err_expected_field_designator : Error<
|
||||
"expected a field designator, such as '.field = 4'">;
|
||||
|
|
|
@ -1371,8 +1371,11 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDefinition() {
|
|||
"parsing Objective-C method");
|
||||
|
||||
// parse optional ';'
|
||||
if (Tok.is(tok::semi))
|
||||
if (Tok.is(tok::semi)) {
|
||||
if (ObjCImpDecl)
|
||||
Diag(Tok, diag::warn_semicolon_before_method_nody);
|
||||
ConsumeToken();
|
||||
}
|
||||
|
||||
// We should have an opening brace now.
|
||||
if (Tok.isNot(tok::l_brace)) {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
@end
|
||||
|
||||
@implementation Subclass
|
||||
- (NSString *)token;
|
||||
- (NSString *)token; // expected-warning {{semicolon at start of method definition is ignored}}
|
||||
{
|
||||
NSMutableString *result = nil;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ typedef struct _NSZone NSZone;
|
|||
@end
|
||||
|
||||
@implementation XCRefactoringTransformation
|
||||
- (NSDictionary *)setUpInfoForTransformKey:(NSString *)transformKey outError:(NSError **)outError; {
|
||||
- (NSDictionary *)setUpInfoForTransformKey:(NSString *)transformKey outError:(NSError **)outError {
|
||||
@try {}
|
||||
// the exception name is optional (weird)
|
||||
@catch (NSException *) {}
|
||||
|
|
Loading…
Reference in New Issue