[cfe-commits] r126269 - in /cfe/trunk: lib/Parse/Parser.cpp test/Parser/method-def-in-class.m

Fariborz Jahanian fjahanian at apple.com
Tue Feb 22 16:11:21 PST 2011


Author: fjahanian
Date: Tue Feb 22 18:11:21 2011
New Revision: 126269

URL: http://llvm.org/viewvc/llvm-project?rev=126269&view=rev
Log:
Better parser recovery when method is
errornously defined inside an objc class. 
// rdar://7029784

Added:
    cfe/trunk/test/Parser/method-def-in-class.m
Modified:
    cfe/trunk/lib/Parse/Parser.cpp

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=126269&r1=126268&r2=126269&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Tue Feb 22 18:11:21 2011
@@ -296,6 +296,10 @@
     case tok::wide_string_literal:
       ConsumeStringToken();
       break;
+        
+    case tok::at:
+      return false;
+      
     case tok::semi:
       if (StopAtSemi)
         return false;

Added: cfe/trunk/test/Parser/method-def-in-class.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/method-def-in-class.m?rev=126269&view=auto
==============================================================================
--- cfe/trunk/test/Parser/method-def-in-class.m (added)
+++ cfe/trunk/test/Parser/method-def-in-class.m Tue Feb 22 18:11:21 2011
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://7029784
+
+ at interface A
+-(id) f0 { // expected-error {{expected ';' after method prototype}}
+  assert(0);
+}
+ at end
+
+ at interface B
+-(id) f0 { // expected-error {{expected ';' after method prototype}}
+  assert(0);
+ at end
+
+ at interface C
+- (id) f0 { // expected-error {{expected ';' after method prototype}}
+    assert(0);
+};
+ at end
+
+ at interface D
+- (id) f0 { // expected-error {{expected ';' after method prototype}}
+  assert(0);
+ at property int P;
+ at end





More information about the cfe-commits mailing list