minor simplification

llvm-svn: 49267
This commit is contained in:
Chris Lattner 2008-04-06 06:03:03 +00:00
parent 65dd843cb4
commit 69740a60b6
1 changed files with 2 additions and 4 deletions

View File

@ -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);
}