diff options
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 3 | ||||
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 5 | ||||
-rw-r--r-- | test/SemaObjC/objc-string-constant.m | 2 | ||||
-rw-r--r-- | test/SemaObjC/try-catch.m | 2 |
4 files changed, 9 insertions, 3 deletions
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 6971df50cb..afd413fcab 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -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'">; diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 158cf1b49b..2e0cd6d0d9 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -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)) { diff --git a/test/SemaObjC/objc-string-constant.m b/test/SemaObjC/objc-string-constant.m index 98239229a2..a4d83854c1 100644 --- a/test/SemaObjC/objc-string-constant.m +++ b/test/SemaObjC/objc-string-constant.m @@ -29,7 +29,7 @@ @end @implementation Subclass -- (NSString *)token; +- (NSString *)token; // expected-warning {{semicolon at start of method definition is ignored}} { NSMutableString *result = nil; diff --git a/test/SemaObjC/try-catch.m b/test/SemaObjC/try-catch.m index 076eff5429..453d80fd59 100644 --- a/test/SemaObjC/try-catch.m +++ b/test/SemaObjC/try-catch.m @@ -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 *) {} |