[cfe-commits] r117991 - in /cfe/trunk: lib/Parse/ParseObjc.cpp test/Parser/missing-end-2.m

Fariborz Jahanian fjahanian at apple.com
Mon Nov 1 17:44:43 PDT 2010


Author: fjahanian
Date: Mon Nov  1 19:44:43 2010
New Revision: 117991

URL: http://llvm.org/viewvc/llvm-project?rev=117991&view=rev
Log:
Diagnose a coherant message when @interface
does not terminate with @end.
// rdar: //7824372

Added:
    cfe/trunk/test/Parser/missing-end-2.m
Modified:
    cfe/trunk/lib/Parse/ParseObjc.cpp

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=117991&r1=117990&r2=117991&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Mon Nov  1 19:44:43 2010
@@ -402,7 +402,12 @@
       // Skip until we see an '@' or '}' or ';'.
       SkipUntil(tok::r_brace, tok::at);
       break;
-
+        
+    case tok::objc_implementation:
+      Diag(Tok, diag::err_objc_missing_end);
+      ConsumeToken();
+      break;
+        
     case tok::objc_required:
     case tok::objc_optional:
       // This is only valid on protocols.

Added: cfe/trunk/test/Parser/missing-end-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/missing-end-2.m?rev=117991&view=auto
==============================================================================
--- cfe/trunk/test/Parser/missing-end-2.m (added)
+++ cfe/trunk/test/Parser/missing-end-2.m Mon Nov  1 19:44:43 2010
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: //7824372
+
+ at interface A
+-(void) im0;
+
+ at implementation A // expected-error {{missing @end}}
+ at end
+
+ at interface B {
+}
+
+ at implementation B // expected-error {{missing @end}}
+ at end
+
+ at interface C
+ at property int P;
+
+ at implementation C // expected-error 2 {{missing @end}}





More information about the cfe-commits mailing list