Added a comment, minor refactoring of foreach parsing code per Chris's suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45601 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp
index e55c3f9..8cccf23 100644
--- a/Parse/ParseStmt.cpp
+++ b/Parse/ParseStmt.cpp
@@ -746,7 +746,7 @@
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 @@
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 @@
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 @@
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 @@
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