}
void ObjcForCollectionStmt::EmitImpl(Serializer& S) const {
- S.Emit(ForCollectionLoc);
+ S.Emit(ForLoc);
S.EmitOwnedPtr(getElement());
S.EmitOwnedPtr(getCollection());
S.EmitOwnedPtr(getBody());
}
ObjcForCollectionStmt* ObjcForCollectionStmt::CreateImpl(Deserializer& D) {
- SourceLocation ForCollectionLoc = SourceLocation::ReadVal(D);
+ SourceLocation ForLoc = SourceLocation::ReadVal(D);
Stmt* Element = D.ReadOwnedPtr<Stmt>();
Expr* Collection = D.ReadOwnedPtr<Expr>();
Stmt* Body = D.ReadOwnedPtr<Stmt>();
- return new ObjcForCollectionStmt(Element,Collection,Body,ForCollectionLoc);
+ return new ObjcForCollectionStmt(Element,Collection,Body,ForLoc);
}
void GotoStmt::EmitImpl(Serializer& S) const {
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);
/// 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
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)
if (Tok.is(tok::semi)) {
ConsumeToken();
}
- else if ((foreach = isObjCForCollectionInKW())) {
+ else if ((foreach = isTokIdentifier_in())) {
ConsumeToken(); // consume 'in'
Value = ParseExpression();
if (!Value.isInvalid)
class ObjcForCollectionStmt : public Stmt {
enum { ELEM, COLLECTION, BODY, END_EXPR };
Stmt* SubExprs[END_EXPR]; // SubExprs[ELEM] is an expression or declstmt.
- SourceLocation ForCollectionLoc;
+ SourceLocation ForLoc;
public:
ObjcForCollectionStmt(Stmt *Elem, Expr *Collect, Stmt *Body,
SourceLocation FCL)
SubExprs[ELEM] = Elem;
SubExprs[COLLECTION] = reinterpret_cast<Stmt*>(Collect);
SubExprs[BODY] = Body;
- ForCollectionLoc = FCL;
+ ForLoc = FCL;
}
Stmt *getElement() { return SubExprs[ELEM]; }
const Stmt *getBody() const { return SubExprs[BODY]; }
virtual SourceRange getSourceRange() const {
- return SourceRange(ForCollectionLoc, SubExprs[BODY]->getLocEnd());
+ return SourceRange(ForLoc, SubExprs[BODY]->getLocEnd());
}
static bool classof(const Stmt *T) {
return T->getStmtClass() == ObjcForCollectionStmtClass;
bool isObjCPropertyAttribute();
IdentifierInfo *ObjCForCollectionInKW;
- bool isObjCForCollectionInKW();
+ bool isTokIdentifier_in() const;
TypeTy *ParseObjCTypeName(ObjcDeclSpec &DS);
void ParseObjCMethodRequirement();