[cfe-commits] r45598 - in /cfe/trunk: AST/StmtSerialization.cpp Parse/ParseDecl.cpp Parse/ParseObjc.cpp Parse/ParseStmt.cpp include/clang/AST/Stmt.h include/clang/Parse/Parser.h

Fariborz Jahanian fjahanian at apple.com
Fri Jan 4 15:04:08 PST 2008


Author: fjahanian
Date: Fri Jan  4 17:04:08 2008
New Revision: 45598

URL: http://llvm.org/viewvc/llvm-project?rev=45598&view=rev
Log:
Minor changes as suggested by Chris L.

Modified:
    cfe/trunk/AST/StmtSerialization.cpp
    cfe/trunk/Parse/ParseDecl.cpp
    cfe/trunk/Parse/ParseObjc.cpp
    cfe/trunk/Parse/ParseStmt.cpp
    cfe/trunk/include/clang/AST/Stmt.h
    cfe/trunk/include/clang/Parse/Parser.h

Modified: cfe/trunk/AST/StmtSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtSerialization.cpp?rev=45598&r1=45597&r2=45598&view=diff

==============================================================================
--- cfe/trunk/AST/StmtSerialization.cpp (original)
+++ cfe/trunk/AST/StmtSerialization.cpp Fri Jan  4 17:04:08 2008
@@ -564,18 +564,18 @@
 }
 
 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 {

Modified: cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseDecl.cpp?rev=45598&r1=45597&r2=45598&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/Parse/ParseDecl.cpp Fri Jan  4 17:04:08 2008
@@ -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);

Modified: cfe/trunk/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseObjc.cpp?rev=45598&r1=45597&r2=45598&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/Parse/ParseObjc.cpp Fri Jan  4 17:04:08 2008
@@ -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

Modified: cfe/trunk/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseStmt.cpp?rev=45598&r1=45597&r2=45598&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/Parse/ParseStmt.cpp Fri Jan  4 17:04:08 2008
@@ -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)

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=45598&r1=45597&r2=45598&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Fri Jan  4 17:04:08 2008
@@ -579,7 +579,7 @@
 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 @@
     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 @@
   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; 

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=45598&r1=45597&r2=45598&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Fri Jan  4 17:04:08 2008
@@ -294,7 +294,7 @@
   bool isObjCPropertyAttribute();
   
   IdentifierInfo *ObjCForCollectionInKW;
-  bool isObjCForCollectionInKW();
+  bool isTokIdentifier_in() const;
 
   TypeTy *ParseObjCTypeName(ObjcDeclSpec &DS);
   void ParseObjCMethodRequirement();





More information about the cfe-commits mailing list