diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-24 17:04:48 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-24 17:04:48 +0000 |
commit | f919bfe282b8a94d956290dc9812b456fa2b447e (patch) | |
tree | d35a84945559ca819e5269b11f508c6f3c70deda /lib/Parse/ParseStmt.cpp | |
parent | 615c5d4674355ba830b9978f462ca7a8c5d15f85 (diff) |
random cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67624 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index fe83247082..1d2e82eae3 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -98,29 +98,32 @@ Parser::ParseStatementOrDeclaration(bool OnlyStatement) { } // PASS THROUGH. - default: + default: { if ((getLang().CPlusPlus || !OnlyStatement) && isDeclarationStatement()) { SourceLocation DeclStart = Tok.getLocation(); DeclTy *Decl = ParseDeclaration(Declarator::BlockContext); // FIXME: Pass in the right location for the end of the declstmt. return Actions.ActOnDeclStmt(Decl, DeclStart, DeclStart); - } else if (Tok.is(tok::r_brace)) { + } + + if (Tok.is(tok::r_brace)) { Diag(Tok, diag::err_expected_statement); return StmtError(); - } else { - // expression[opt] ';' - OwningExprResult Expr(ParseExpression()); - if (Expr.isInvalid()) { - // If the expression is invalid, skip ahead to the next semicolon. Not - // doing this opens us up to the possibility of infinite loops if - // ParseExpression does not consume any tokens. - SkipUntil(tok::semi); - return StmtError(); - } - // Otherwise, eat the semicolon. - ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr); - return Actions.ActOnExprStmt(move(Expr)); } + + // expression[opt] ';' + OwningExprResult Expr(ParseExpression()); + if (Expr.isInvalid()) { + // If the expression is invalid, skip ahead to the next semicolon. Not + // doing this opens us up to the possibility of infinite loops if + // ParseExpression does not consume any tokens. + SkipUntil(tok::semi); + return StmtError(); + } + // Otherwise, eat the semicolon. + ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr); + return Actions.ActOnExprStmt(move(Expr)); + } case tok::kw_case: // C99 6.8.1: labeled-statement return ParseCaseStatement(); |