[cfe-commits] r67624 - in /cfe/trunk/lib/Parse: ParseDecl.cpp ParseStmt.cpp
Chris Lattner
sabre at nondot.org
Tue Mar 24 10:05:00 PDT 2009
Author: lattner
Date: Tue Mar 24 12:04:48 2009
New Revision: 67624
URL: http://llvm.org/viewvc/llvm-project?rev=67624&view=rev
Log:
random cleanups.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=67624&r1=67623&r2=67624&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Mar 24 12:04:48 2009
@@ -1627,8 +1627,9 @@
// C++ member pointers start with a '::' or a nested-name.
// Member pointers get special handling, since there's no place for the
// scope spec in the generic path below.
- if ((Tok.is(tok::coloncolon) || Tok.is(tok::identifier) ||
- Tok.is(tok::annot_cxxscope)) && getLang().CPlusPlus) {
+ if (getLang().CPlusPlus &&
+ (Tok.is(tok::coloncolon) || Tok.is(tok::identifier) ||
+ Tok.is(tok::annot_cxxscope))) {
CXXScopeSpec SS;
if (ParseOptionalCXXScopeSpecifier(SS)) {
if(Tok.isNot(tok::star)) {
@@ -1659,7 +1660,8 @@
tok::TokenKind Kind = Tok.getKind();
// Not a pointer, C++ reference, or block.
- if (Kind != tok::star && (Kind != tok::amp || !getLang().CPlusPlus) &&
+ if (Kind != tok::star &&
+ (Kind != tok::amp || !getLang().CPlusPlus) &&
// We parse rvalue refs in C++03, because otherwise the errors are scary.
(Kind != tok::ampamp || !getLang().CPlusPlus) &&
(Kind != tok::caret || !getLang().Blocks)) {
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=67624&r1=67623&r2=67624&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Tue Mar 24 12:04:48 2009
@@ -98,29 +98,32 @@
}
// 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();
More information about the cfe-commits
mailing list