diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-05-10 20:02:36 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-05-10 20:02:36 +0000 |
commit | edd27602f9cede4fee2c81c785b8f295c9d28752 (patch) | |
tree | 4bbe93a150db788d7cfabeaa8a76634ca539d977 | |
parent | 36faaddccf519231a3facd26495e895ba5a28776 (diff) |
Don't crash when using objc boxed expression with parsing error.
rdar://11426994
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156565 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 5 | ||||
-rw-r--r-- | test/SemaObjC/boxing-illegal-types.m | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 0d9a54e638..9aca5cd539 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/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/test/SemaObjC/boxing-illegal-types.m b/test/SemaObjC/boxing-illegal-types.m index 130b98fa8b..777109493d 100644 --- a/test/SemaObjC/boxing-illegal-types.m +++ b/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'}} +} |