summaryrefslogtreecommitdiffstats
path: root/clang/Parse/ParseStmt.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-01-04 23:23:46 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-01-04 23:23:46 +0000
commite908cab389410e70d3b80ac9909334afc0d6e804 (patch)
tree81df38b76e64447889b5714862d2c15bdb9c68ac /clang/Parse/ParseStmt.cpp
parentf735409e11bc85d0ba6ee9ee8e726a0451e20905 (diff)
downloadbcm5719-llvm-e908cab389410e70d3b80ac9909334afc0d6e804.tar.gz
bcm5719-llvm-e908cab389410e70d3b80ac9909334afc0d6e804.zip
Added a comment, minor refactoring of foreach parsing code per Chris's suggestion.
llvm-svn: 45601
Diffstat (limited to 'clang/Parse/ParseStmt.cpp')
-rw-r--r--clang/Parse/ParseStmt.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/Parse/ParseStmt.cpp b/clang/Parse/ParseStmt.cpp
index e55c3f905dc..8cccf23888f 100644
--- a/clang/Parse/ParseStmt.cpp
+++ b/clang/Parse/ParseStmt.cpp
@@ -746,7 +746,7 @@ Parser::StmtResult Parser::ParseForStatement() {
StmtTy *FirstPart = 0;
ExprTy *SecondPart = 0;
StmtTy *ThirdPart = 0;
- bool foreach = false;
+ bool ForEach = false;
// Parse the first part of the for specifier.
if (Tok.is(tok::semi)) { // for (;
@@ -759,7 +759,7 @@ Parser::StmtResult Parser::ParseForStatement() {
DeclTy *aBlockVarDecl = ParseDeclaration(Declarator::ForContext);
StmtResult stmtResult = Actions.ActOnDeclStmt(aBlockVarDecl);
FirstPart = stmtResult.isInvalid ? 0 : stmtResult.Val;
- if ((foreach = isTokIdentifier_in())) {
+ if ((ForEach = isTokIdentifier_in())) {
ConsumeToken(); // consume 'in'
Value = ParseExpression();
if (!Value.isInvalid)
@@ -778,7 +778,7 @@ Parser::StmtResult Parser::ParseForStatement() {
if (Tok.is(tok::semi)) {
ConsumeToken();
}
- else if ((foreach = isTokIdentifier_in())) {
+ else if ((ForEach = isTokIdentifier_in())) {
ConsumeToken(); // consume 'in'
Value = ParseExpression();
if (!Value.isInvalid)
@@ -789,7 +789,7 @@ Parser::StmtResult Parser::ParseForStatement() {
SkipUntil(tok::semi);
}
}
- if (!foreach) {
+ if (!ForEach) {
// Parse the second part of the for specifier.
if (Tok.is(tok::semi)) { // for (...;;
// no second part.
@@ -842,12 +842,12 @@ Parser::StmtResult Parser::ParseForStatement() {
if (Body.isInvalid)
return Body;
- return !foreach ? Actions.ActOnForStmt(ForLoc, LParenLoc, FirstPart,
- SecondPart, ThirdPart, RParenLoc,
- Body.Val)
- : Actions.ActOnObjcForCollectionStmt(ForLoc, LParenLoc,
- FirstPart, SecondPart,
- RParenLoc, Body.Val);
+ if (!ForEach)
+ return Actions.ActOnForStmt(ForLoc, LParenLoc, FirstPart,
+ SecondPart, ThirdPart, RParenLoc, Body.Val);
+ else
+ return Actions.ActOnObjcForCollectionStmt(ForLoc, LParenLoc, FirstPart,
+ SecondPart, RParenLoc, Body.Val);
}
/// ParseGotoStatement
OpenPOWER on IntegriCloud