Minor changes as suggested by Chris L.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45598 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseDecl.cpp b/Parse/ParseDecl.cpp
index a2a3f3e..dccc00e 100644
--- a/Parse/ParseDecl.cpp
+++ b/Parse/ParseDecl.cpp
@@ -296,7 +296,7 @@
ConsumeToken();
return Actions.FinalizeDeclaratorGroup(CurScope, LastDeclInGroup);
}
- if (D.getContext() == Declarator::ForContext && isObjCForCollectionInKW()) {
+ if (D.getContext() == Declarator::ForContext && isTokIdentifier_in()) {
return Actions.FinalizeDeclaratorGroup(CurScope, LastDeclInGroup);
}
Diag(Tok, diag::err_parse_error);
diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp
index c17e35e..2c6a9ce 100644
--- a/Parse/ParseObjc.cpp
+++ b/Parse/ParseObjc.cpp
@@ -493,15 +493,12 @@
/// objc-for-collection-in: 'in'
///
-bool Parser::isObjCForCollectionInKW() {
+bool Parser::isTokIdentifier_in() const {
// FIXME: May have to do additional look-ahead to only allow for
// valid tokens following an 'in'; such as an identifier, unary operators,
// '[' etc.
- if (getLang().ObjC2 && Tok.is(tok::identifier)) {
- const IdentifierInfo *II = Tok.getIdentifierInfo();
- return II == ObjCForCollectionInKW;
- }
- return false;
+ return (getLang().ObjC2 && Tok.is(tok::identifier) &&
+ Tok.getIdentifierInfo() == ObjCForCollectionInKW);
}
/// ParseObjcTypeQualifierList - This routine parses the objective-c's type
diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp
index 762e499..e55c3f9 100644
--- a/Parse/ParseStmt.cpp
+++ b/Parse/ParseStmt.cpp
@@ -759,7 +759,7 @@
DeclTy *aBlockVarDecl = ParseDeclaration(Declarator::ForContext);
StmtResult stmtResult = Actions.ActOnDeclStmt(aBlockVarDecl);
FirstPart = stmtResult.isInvalid ? 0 : stmtResult.Val;
- if ((foreach = isObjCForCollectionInKW())) {
+ 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 = isObjCForCollectionInKW())) {
+ else if ((foreach = isTokIdentifier_in())) {
ConsumeToken(); // consume 'in'
Value = ParseExpression();
if (!Value.isInvalid)