diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-06 06:03:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-06 06:03:03 +0000 |
commit | 3e3d310a8c74f7e0ccaf2e0a64400d15b8cb5556 (patch) | |
tree | 256568cd493410e5c47eec70d8cda79c1b2c9953 /lib/Parse/ParseExprCXX.cpp | |
parent | 2a2819a0a8e114bfa5a3c4fc4c97fa173155bae9 (diff) |
minor simplification
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49267 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | lib/Parse/ParseExprCXX.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index c98a7f91f8..a71eb4807b 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -83,10 +83,8 @@ Parser::ExprResult Parser::ParseCXXBoolLiteral() { /// 'throw' assignment-expression[opt] Parser::ExprResult Parser::ParseThrowExpression() { assert(Tok.is(tok::kw_throw) && "Not throw!"); - - ExprResult Expr; - SourceLocation ThrowLoc = ConsumeToken(); // Eat the throw token. + // If the current token isn't the start of an assignment-expression, // then the expression is not present. This handles things like: // "C ? throw : (void)42", which is crazy but legal. @@ -100,7 +98,7 @@ Parser::ExprResult Parser::ParseThrowExpression() { return Actions.ActOnCXXThrow(ThrowLoc); default: - Expr = ParseAssignmentExpression(); + ExprResult Expr = ParseAssignmentExpression(); if (Expr.isInvalid) return Expr; return Actions.ActOnCXXThrow(ThrowLoc, Expr.Val); } |