]> granicus.if.org Git - clang/commitdiff
Minor changes as suggested by Chris L.
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 4 Jan 2008 23:04:08 +0000 (23:04 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 4 Jan 2008 23:04:08 +0000 (23:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45598 91177308-0d34-0410-b5e6-96231b3b80d8

AST/StmtSerialization.cpp
Parse/ParseDecl.cpp
Parse/ParseObjc.cpp
Parse/ParseStmt.cpp
include/clang/AST/Stmt.h
include/clang/Parse/Parser.h

index 53dabbd018a50c47bd60449004ad040de2ec39ed..aa45c62dd32d634d80adbdcbfa484fc3166da94a 100644 (file)
@@ -564,18 +564,18 @@ ForStmt* ForStmt::CreateImpl(Deserializer& D) {
 }
 
 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 {
index a2a3f3e7c0d8582ba00bb3aea66fc65bcccfc532..dccc00e671e1df60767db1b284c049efd3794cda 100644 (file)
@@ -296,7 +296,7 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
     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);
index c17e35e6f4987eb9cfdfb096c6a309a36004faa2..2c6a9ceb94dc4b094a16ff1a52ef54088c351eee 100644 (file)
@@ -493,15 +493,12 @@ bool Parser::isObjCPropertyAttribute() {
 
 ///  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
index 762e499d81274f8ed80dadc6327f22f196c70fff..e55c3f905dc9662cee63483af6e67283f20af096 100644 (file)
@@ -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 = isObjCForCollectionInKW())) {
+    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 = isObjCForCollectionInKW())) {
+    else if ((foreach = isTokIdentifier_in())) {
       ConsumeToken(); // consume 'in'
       Value = ParseExpression();
       if (!Value.isInvalid)
index 58d61f61ccb31ed8189c0376d7990df431a56607..445b8e4844c0cb0a598754b2579f2f19c47f0eaa 100644 (file)
@@ -579,7 +579,7 @@ public:
 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) 
@@ -587,7 +587,7 @@ public:
     SubExprs[ELEM] = Elem;
     SubExprs[COLLECTION] = reinterpret_cast<Stmt*>(Collect);
     SubExprs[BODY] = Body;
-    ForCollectionLoc = FCL;
+    ForLoc = FCL;
   }
     
   Stmt *getElement() { return SubExprs[ELEM]; }
@@ -603,7 +603,7 @@ public:
   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; 
index 40531b68b48f60db84b49c1f6ce33e891346815b..e74c38508fb474fafcf8a7d10bfade2bc9dde3e8 100644 (file)
@@ -294,7 +294,7 @@ private:
   bool isObjCPropertyAttribute();
   
   IdentifierInfo *ObjCForCollectionInKW;
-  bool isObjCForCollectionInKW();
+  bool isTokIdentifier_in() const;
 
   TypeTy *ParseObjCTypeName(ObjcDeclSpec &DS);
   void ParseObjCMethodRequirement();