[cfe-commits] r156565 - in /cfe/trunk: lib/Parse/ParseObjc.cpp test/SemaObjC/boxing-illegal-types.m

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu May 10 13:02:36 PDT 2012


Author: akirtzidis
Date: Thu May 10 15:02:36 2012
New Revision: 156565

URL: http://llvm.org/viewvc/llvm-project?rev=156565&view=rev
Log:
Don't crash when using objc boxed expression with parsing error.

rdar://11426994

Modified:
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/test/SemaObjC/boxing-illegal-types.m

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=156565&r1=156564&r2=156565&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu May 10 15:02:36 2012
@@ -2598,7 +2598,10 @@
   ExprResult ValueExpr(ParseAssignmentExpression());
   if (T.consumeClose())
     return ExprError();
-  
+
+  if (ValueExpr.isInvalid())
+    return ExprError();
+
   // Wrap the sub-expression in a parenthesized expression, to distinguish
   // a boxed expression from a literal.
   SourceLocation LPLoc = T.getOpenLocation(), RPLoc = T.getCloseLocation();

Modified: cfe/trunk/test/SemaObjC/boxing-illegal-types.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/boxing-illegal-types.m?rev=156565&r1=156564&r2=156565&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/boxing-illegal-types.m (original)
+++ cfe/trunk/test/SemaObjC/boxing-illegal-types.m Thu May 10 15:02:36 2012
@@ -15,3 +15,7 @@
     int numbers[] = { 0, 1, 2 };
     id boxed_numbers = @(numbers);  // expected-error {{illegal type 'int *' used in a boxed expression}}
 }
+
+void testInvalid() {
+  @(not_defined); // expected-error {{use of undeclared identifier 'not_defined'}}
+}





More information about the cfe-commits mailing list