From 69740a60b688d49edbd3c8aa33ff9fc99ba8c072 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 6 Apr 2008 06:03:03 +0000 Subject: minor simplification llvm-svn: 49267 --- clang/lib/Parse/ParseExprCXX.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'clang/lib/Parse/ParseExprCXX.cpp') diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index c98a7f91f8b..a71eb4807b2 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/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); } -- cgit v1.2.3