[cfe-commits] r84645 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseObjc.cpp test/SemaObjC/objc-string-constant.m test/SemaObjC/try-catch.m
Chris Lattner
clattner at apple.com
Tue Oct 20 09:59:35 PDT 2009
On Oct 20, 2009, at 9:39 AM, Fariborz Jahanian wrote:
> Author: fjahanian
> Date: Tue Oct 20 11:39:13 2009
> New Revision: 84645
>
> URL: http://llvm.org/viewvc/llvm-project?rev=84645&view=rev
> Log:
> Issue warning if method body starts with a semicolon.
> Fixes
> <rdar://problem/7308503> clang should disallow the trailing
> semicolon in method definitions
Thanks Fariborz, how about "semicolon before method body is ignored".
I can see confusion around where the 'start' of the definition is.
-Chris
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> cfe/trunk/lib/Parse/ParseObjc.cpp
> cfe/trunk/test/SemaObjC/objc-string-constant.m
> cfe/trunk/test/SemaObjC/try-catch.m
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=84645&r1=84644&r2=84645&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Tue Oct 20
> 11:39:13 2009
> @@ -201,6 +201,9 @@
> "@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'">;
>
> Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=84645&r1=84644&r2=84645&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseObjc.cpp Tue Oct 20 11:39:13 2009
> @@ -1371,8 +1371,11 @@
> "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)) {
>
> Modified: cfe/trunk/test/SemaObjC/objc-string-constant.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc-string-constant.m?rev=84645&r1=84644&r2=84645&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/test/SemaObjC/objc-string-constant.m (original)
> +++ cfe/trunk/test/SemaObjC/objc-string-constant.m Tue Oct 20
> 11:39:13 2009
> @@ -29,7 +29,7 @@
> @end
>
> @implementation Subclass
> -- (NSString *)token;
> +- (NSString *)token; // expected-warning {{semicolon at start of
> method definition is ignored}}
> {
> NSMutableString *result = nil;
>
>
> Modified: cfe/trunk/test/SemaObjC/try-catch.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/try-catch.m?rev=84645&r1=84644&r2=84645&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/test/SemaObjC/try-catch.m (original)
> +++ cfe/trunk/test/SemaObjC/try-catch.m Tue Oct 20 11:39:13 2009
> @@ -30,7 +30,7 @@
> @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 *) {}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list