[cfe-commits] r68568 - in /cfe/trunk: lib/Parse/ParseObjc.cpp test/SemaObjC/exception-go-boom.m

Steve Naroff snaroff at apple.com
Tue Apr 7 15:56:59 PDT 2009


Author: snaroff
Date: Tue Apr  7 17:56:58 2009
New Revision: 68568

URL: http://llvm.org/viewvc/llvm-project?rev=68568&view=rev
Log:
Fix <rdar://problem/6764172> [sema] crash on invalid.

Added:
    cfe/trunk/test/SemaObjC/exception-go-boom.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=68568&r1=68567&r2=68568&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Tue Apr  7 17:56:58 2009
@@ -1294,8 +1294,14 @@
           FirstPart = Actions.ActOnParamDeclarator(CurScope, ParmDecl);
         } else
           ConsumeToken(); // consume '...'
-        SourceLocation RParenLoc = ConsumeParen();
+          
+        SourceLocation RParenLoc;
         
+        if (Tok.is(tok::r_paren))
+          RParenLoc = ConsumeParen();
+        else // Skip over garbage, until we get to ')'.  Eat the ')'.
+          SkipUntil(tok::r_paren, true, false);
+
         OwningStmtResult CatchBody(Actions, true);
         if (Tok.is(tok::l_brace))
           CatchBody = ParseCompoundStatementBody();

Added: cfe/trunk/test/SemaObjC/exception-go-boom.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/exception-go-boom.m?rev=68568&view=auto

==============================================================================
--- cfe/trunk/test/SemaObjC/exception-go-boom.m (added)
+++ cfe/trunk/test/SemaObjC/exception-go-boom.m Tue Apr  7 17:56:58 2009
@@ -0,0 +1,9 @@
+// RUN: clang-cc %s -verify -fsyntax-only
+
+// Note: NSException is not declared.
+void f0(id x) {
+  @try {
+  } @catch (NSException *x) { // expected-warning{{type specifier missing, defaults to 'int'}} expected-error{{@catch parameter is not an Objective-C class type}}
+  }
+}
+





More information about the cfe-commits mailing list