summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-05-10 20:02:36 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-05-10 20:02:36 +0000
commit9b4fe3568958993b304c7365a1abc2c6948e27a1 (patch)
tree075a1b77f749bd82af3374d78f4cd9b1d8063038
parent9dd40890e376f4849e06a5ed45faab6c4aa027c0 (diff)
downloadbcm5719-llvm-9b4fe3568958993b304c7365a1abc2c6948e27a1.tar.gz
bcm5719-llvm-9b4fe3568958993b304c7365a1abc2c6948e27a1.zip
Don't crash when using objc boxed expression with parsing error.
rdar://11426994 llvm-svn: 156565
-rw-r--r--clang/lib/Parse/ParseObjc.cpp5
-rw-r--r--clang/test/SemaObjC/boxing-illegal-types.m4
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 0d9a54e638d..9aca5cd5399 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -2598,7 +2598,10 @@ Parser::ParseObjCBoxedExpr(SourceLocation AtLoc) {
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();
diff --git a/clang/test/SemaObjC/boxing-illegal-types.m b/clang/test/SemaObjC/boxing-illegal-types.m
index 130b98fa8ba..777109493df 100644
--- a/clang/test/SemaObjC/boxing-illegal-types.m
+++ b/clang/test/SemaObjC/boxing-illegal-types.m
@@ -15,3 +15,7 @@ void testPointers() {
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'}}
+}
OpenPOWER on IntegriCloud