[cfe-commits] r42797 - in /cfe/trunk: Parse/ParseExpr.cpp Parse/ParseExprCXX.cpp Parse/ParseStmt.cpp clang.xcodeproj/project.pbxproj

Chris Lattner sabre at nondot.org
Tue Oct 9 10:41:42 PDT 2007


Author: lattner
Date: Tue Oct  9 12:41:39 2007
New Revision: 42797

URL: http://llvm.org/viewvc/llvm-project?rev=42797&view=rev
Log:
switch more code to use Token::is/isNot where possible.

Modified:
    cfe/trunk/Parse/ParseExpr.cpp
    cfe/trunk/Parse/ParseExprCXX.cpp
    cfe/trunk/Parse/ParseStmt.cpp
    cfe/trunk/clang.xcodeproj/project.pbxproj

Modified: cfe/trunk/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseExpr.cpp?rev=42797&r1=42796&r2=42797&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/Parse/ParseExpr.cpp Tue Oct  9 12:41:39 2007
@@ -214,7 +214,7 @@
   // Let the actions module handle the identifier.
   ExprResult Res = Actions.ActOnIdentifierExpr(CurScope, IdTok.getLocation(),
                                                *IdTok.getIdentifierInfo(),
-                                               Tok.getKind() == tok::l_paren);
+                                               Tok.is(tok::l_paren));
   
   // Because we have to parse an entire cast-expression before starting the
   // ParseRHSOfBinaryExpression method (which parses any trailing binops), we
@@ -245,7 +245,7 @@
   // Let the actions module handle the identifier.
   ExprResult Res = Actions.ActOnIdentifierExpr(CurScope, IdTok.getLocation(),
                                                *IdTok.getIdentifierInfo(),
-                                               Tok.getKind() == tok::l_paren);
+                                               Tok.is(tok::l_paren));
   
   // Because we have to parse an entire cast-expression before starting the
   // ParseRHSOfBinaryExpression method (which parses any trailing binops), we
@@ -321,7 +321,7 @@
     // Special case handling for the ternary operator.
     ExprResult TernaryMiddle(true);
     if (NextTokPrec == prec::Conditional) {
-      if (Tok.getKind() != tok::colon) {
+      if (Tok.isNot(tok::colon)) {
         // Handle this production specially:
         //   logical-OR-expression '?' expression ':' conditional-expression
         // In particular, the RHS of the '?' is 'expression', not
@@ -338,7 +338,7 @@
         Diag(Tok, diag::ext_gnu_conditional_expr);
       }
       
-      if (Tok.getKind() != tok::colon) {
+      if (Tok.isNot(tok::colon)) {
         Diag(Tok, diag::err_expected_colon);
         Diag(OpToken, diag::err_matching, "?");
         Actions.DeleteExpr(LHS.Val);
@@ -525,8 +525,7 @@
     // not.
     IdentifierInfo &II = *Tok.getIdentifierInfo();
     SourceLocation L = ConsumeToken();
-    Res = Actions.ActOnIdentifierExpr(CurScope, L, II,
-                                      Tok.getKind() == tok::l_paren);
+    Res = Actions.ActOnIdentifierExpr(CurScope, L, II, Tok.is(tok::l_paren));
     // These can be followed by postfix-expr pieces.
     return ParsePostfixExpressionSuffix(Res);
   }
@@ -584,7 +583,7 @@
     return ParseSizeofAlignofExpression();
   case tok::ampamp: {      // unary-expression: '&&' identifier
     SourceLocation AmpAmpLoc = ConsumeToken();
-    if (Tok.getKind() != tok::identifier) {
+    if (Tok.isNot(tok::identifier)) {
       Diag(Tok, diag::err_expected_ident);
       return ExprResult(true);
     }
@@ -648,7 +647,7 @@
       
       SourceLocation RLoc = Tok.getLocation();
       
-      if (!LHS.isInvalid && !Idx.isInvalid && Tok.getKind() == tok::r_square)
+      if (!LHS.isInvalid && !Idx.isInvalid && Tok.is(tok::r_square))
         LHS = Actions.ActOnArraySubscriptExpr(LHS.Val, Loc, Idx.Val, RLoc);
       else 
         LHS = ExprResult(true);
@@ -664,7 +663,7 @@
       
       Loc = ConsumeParen();
       
-      if (Tok.getKind() != tok::r_paren) {
+      if (Tok.isNot(tok::r_paren)) {
         while (1) {
           ExprResult ArgExpr = ParseAssignmentExpression();
           if (ArgExpr.isInvalid) {
@@ -673,7 +672,7 @@
           } else
             ArgExprs.push_back(ArgExpr.Val);
           
-          if (Tok.getKind() != tok::comma)
+          if (Tok.isNot(tok::comma))
             break;
           // Move to the next argument, remember where the comma was.
           CommaLocs.push_back(ConsumeToken());
@@ -681,7 +680,7 @@
       }
         
       // Match the ')'.
-      if (!LHS.isInvalid && Tok.getKind() == tok::r_paren) {
+      if (!LHS.isInvalid && Tok.is(tok::r_paren)) {
         assert((ArgExprs.size() == 0 || ArgExprs.size()-1 == CommaLocs.size())&&
                "Unexpected number of commas!");
         LHS = Actions.ActOnCallExpr(LHS.Val, Loc, &ArgExprs[0], ArgExprs.size(),
@@ -696,7 +695,7 @@
       tok::TokenKind OpKind = Tok.getKind();
       SourceLocation OpLoc = ConsumeToken();  // Eat the "." or "->" token.
       
-      if (Tok.getKind() != tok::identifier) {
+      if (Tok.isNot(tok::identifier)) {
         Diag(Tok, diag::err_expected_ident);
         return ExprResult(true);
       }
@@ -727,15 +726,14 @@
 /// [GNU]   '__alignof' unary-expression
 /// [GNU]   '__alignof' '(' type-name ')'
 Parser::ExprResult Parser::ParseSizeofAlignofExpression() {
-  assert((Tok.getKind() == tok::kw_sizeof ||
-          Tok.getKind() == tok::kw___alignof) &&
+  assert((Tok.is(tok::kw_sizeof) || Tok.is(tok::kw___alignof)) &&
          "Not a sizeof/alignof expression!");
   Token OpTok = Tok;
   ConsumeToken();
   
   // If the operand doesn't start with an '(', it must be an expression.
   ExprResult Operand;
-  if (Tok.getKind() != tok::l_paren) {
+  if (Tok.isNot(tok::l_paren)) {
     Operand = ParseCastExpression(true);
   } else {
     // If it starts with a '(', we know that it is either a parenthesized
@@ -751,7 +749,7 @@
     // sizeof/alignof a type.  Otherwise, it is sizeof/alignof an expression.
     if (ExprType == CastExpr) {
       return Actions.ActOnSizeOfAlignOfTypeExpr(OpTok.getLocation(),
-                                              OpTok.getKind() == tok::kw_sizeof,
+                                                OpTok.is(tok::kw_sizeof),
                                                 LParenLoc, CastTy, RParenLoc);
     }
   }
@@ -785,7 +783,7 @@
   SourceLocation StartLoc = ConsumeToken();   // Eat the builtin identifier.
 
   // All of these start with an open paren.
-  if (Tok.getKind() != tok::l_paren) {
+  if (Tok.isNot(tok::l_paren)) {
     Diag(Tok, diag::err_expected_lparen_after, BuiltinII->getName());
     return ExprResult(true);
   }
@@ -818,7 +816,7 @@
       return ExprResult(true);
     
     // We must have at least one identifier here.
-    if (Tok.getKind() != tok::identifier) {
+    if (Tok.isNot(tok::identifier)) {
       Diag(Tok, diag::err_expected_ident);
       SkipUntil(tok::r_paren);
       return true;
@@ -833,13 +831,13 @@
     Comps.back().LocStart = Comps.back().LocEnd = ConsumeToken();
 
     while (1) {
-      if (Tok.getKind() == tok::period) {
+      if (Tok.is(tok::period)) {
         // offsetof-member-designator: offsetof-member-designator '.' identifier
         Comps.push_back(Action::OffsetOfComponent());
         Comps.back().isBrackets = false;
         Comps.back().LocStart = ConsumeToken();
         
-        if (Tok.getKind() != tok::identifier) {
+        if (Tok.isNot(tok::identifier)) {
           Diag(Tok, diag::err_expected_ident);
           SkipUntil(tok::r_paren);
           return true;
@@ -847,7 +845,7 @@
         Comps.back().U.IdentInfo = Tok.getIdentifierInfo();
         Comps.back().LocEnd = ConsumeToken();
         
-      } else if (Tok.getKind() == tok::l_square) {
+      } else if (Tok.is(tok::l_square)) {
         // offsetof-member-designator: offsetof-member-design '[' expression ']'
         Comps.push_back(Action::OffsetOfComponent());
         Comps.back().isBrackets = true;
@@ -861,7 +859,7 @@
 
         Comps.back().LocEnd =
           MatchRHSPunctuation(tok::r_square, Comps.back().LocStart);
-      } else if (Tok.getKind() == tok::r_paren) {
+      } else if (Tok.is(tok::r_paren)) {
         Res = Actions.ActOnBuiltinOffsetOf(StartLoc, TypeLoc, Ty, &Comps[0],
                                            Comps.size(), ConsumeParen());
         break;
@@ -894,7 +892,7 @@
       SkipUntil(tok::r_paren);
       return Expr2;
     }    
-    if (Tok.getKind() != tok::r_paren) {
+    if (Tok.isNot(tok::r_paren)) {
       Diag(Tok, diag::err_expected_rparen);
       return ExprResult(true);
     }
@@ -910,7 +908,7 @@
     
     TypeTy *Ty2 = ParseTypeName();
     
-    if (Tok.getKind() != tok::r_paren) {
+    if (Tok.isNot(tok::r_paren)) {
       Diag(Tok, diag::err_expected_rparen);
       return ExprResult(true);
     }
@@ -939,18 +937,18 @@
 Parser::ExprResult Parser::ParseParenExpression(ParenParseOption &ExprType,
                                                 TypeTy *&CastTy,
                                                 SourceLocation &RParenLoc) {
-  assert(Tok.getKind() == tok::l_paren && "Not a paren expr!");
+  assert(Tok.is(tok::l_paren) && "Not a paren expr!");
   SourceLocation OpenLoc = ConsumeParen();
   ExprResult Result(true);
   CastTy = 0;
   
-  if (ExprType >= CompoundStmt && Tok.getKind() == tok::l_brace) {
+  if (ExprType >= CompoundStmt && Tok.is(tok::l_brace)) {
     Diag(Tok, diag::ext_gnu_statement_expr);
     Parser::StmtResult Stmt = ParseCompoundStatement(true);
     ExprType = CompoundStmt;
     
     // If the substmt parsed correctly, build the AST node.
-    if (!Stmt.isInvalid && Tok.getKind() == tok::r_paren)
+    if (!Stmt.isInvalid && Tok.is(tok::r_paren))
       Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.Val, Tok.getLocation());
     
   } else if (ExprType >= CompoundLiteral && isTypeSpecifierQualifier()) {
@@ -958,12 +956,12 @@
     TypeTy *Ty = ParseTypeName();
 
     // Match the ')'.
-    if (Tok.getKind() == tok::r_paren)
+    if (Tok.is(tok::r_paren))
       RParenLoc = ConsumeParen();
     else
       MatchRHSPunctuation(tok::r_paren, OpenLoc);
     
-    if (Tok.getKind() == tok::l_brace) {
+    if (Tok.is(tok::l_brace)) {
       if (!getLang().C99)   // Compound literals don't exist in C90.
         Diag(OpenLoc, diag::ext_c99_compound_literal);
       Result = ParseInitializer();
@@ -984,7 +982,7 @@
   } else {
     Result = ParseExpression();
     ExprType = SimpleExpr;
-    if (!Result.isInvalid && Tok.getKind() == tok::r_paren)
+    if (!Result.isInvalid && Tok.is(tok::r_paren))
       Result = Actions.ActOnParenExpr(OpenLoc, Tok.getLocation(), Result.Val);
   }
   
@@ -992,7 +990,7 @@
   if (Result.isInvalid)
     SkipUntil(tok::r_paren);
   else {
-    if (Tok.getKind() == tok::r_paren)
+    if (Tok.is(tok::r_paren))
       RParenLoc = ConsumeParen();
     else
       MatchRHSPunctuation(tok::r_paren, OpenLoc);

Modified: cfe/trunk/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseExprCXX.cpp?rev=42797&r1=42796&r2=42797&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/Parse/ParseExprCXX.cpp Tue Oct  9 12:41:39 2007
@@ -52,7 +52,7 @@
 
   SourceLocation LParenLoc = Tok.getLocation(), RParenLoc;
 
-  if (Tok.getKind() != tok::l_paren) {
+  if (Tok.isNot(tok::l_paren)) {
     Diag(Tok, diag::err_expected_lparen_after, CastName);
     return ExprResult(true);
   }

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

==============================================================================
--- cfe/trunk/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/Parse/ParseStmt.cpp Tue Oct  9 12:41:39 2007
@@ -107,7 +107,7 @@
   default:
     if (!OnlyStatement && isDeclarationSpecifier()) {
       return Actions.ActOnDeclStmt(ParseDeclaration(Declarator::BlockContext));
-    } else if (Tok.getKind() == tok::r_brace) {
+    } else if (Tok.is(tok::r_brace)) {
       Diag(Tok, diag::err_expected_statement);
       return true;
     } else {
@@ -173,7 +173,7 @@
   }
   
   // If we reached this code, the statement must end in a semicolon.
-  if (Tok.getKind() == tok::semi) {
+  if (Tok.is(tok::semi)) {
     ConsumeToken();
   } else {
     Diag(Tok, diag::err_expected_semi_after, SemiError);
@@ -195,19 +195,19 @@
 ///         expression[opt] ';'
 ///
 Parser::StmtResult Parser::ParseIdentifierStatement(bool OnlyStatement) {
-  assert(Tok.getKind() == tok::identifier && Tok.getIdentifierInfo() &&
+  assert(Tok.is(tok::identifier) && Tok.getIdentifierInfo() &&
          "Not an identifier!");
 
   Token IdentTok = Tok;  // Save the whole token.
   ConsumeToken();  // eat the identifier.
   
   // identifier ':' statement
-  if (Tok.getKind() == tok::colon) {
+  if (Tok.is(tok::colon)) {
     SourceLocation ColonLoc = ConsumeToken();
 
     // Read label attributes, if present.
     DeclTy *AttrList = 0;
-    if (Tok.getKind() == tok::kw___attribute)
+    if (Tok.is(tok::kw___attribute))
       // TODO: save these somewhere.
       AttrList = ParseAttributes();
 
@@ -241,7 +241,7 @@
 
     // C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
     // declaration-specifiers init-declarator-list[opt] ';'
-    if (Tok.getKind() == tok::semi) {
+    if (Tok.is(tok::semi)) {
       // TODO: emit error on 'int;' or 'const enum foo;'.
       // if (!DS.isMissingDeclaratorOk()) Diag(...);
       
@@ -263,7 +263,7 @@
   if (Res.isInvalid) {
     SkipUntil(tok::semi);
     return true;
-  } else if (Tok.getKind() != tok::semi) {
+  } else if (Tok.isNot(tok::semi)) {
     Diag(Tok, diag::err_expected_semi_after, "expression");
     SkipUntil(tok::semi);
     return true;
@@ -282,7 +282,7 @@
 /// Note that this does not parse the 'statement' at the end.
 ///
 Parser::StmtResult Parser::ParseCaseStatement() {
-  assert(Tok.getKind() == tok::kw_case && "Not a case stmt!");
+  assert(Tok.is(tok::kw_case) && "Not a case stmt!");
   SourceLocation CaseLoc = ConsumeToken();  // eat the 'case'.
 
   ExprResult LHS = ParseConstantExpression();
@@ -294,7 +294,7 @@
   // GNU case range extension.
   SourceLocation DotDotDotLoc;
   ExprTy *RHSVal = 0;
-  if (Tok.getKind() == tok::ellipsis) {
+  if (Tok.is(tok::ellipsis)) {
     Diag(Tok, diag::ext_gnu_case_range);
     DotDotDotLoc = ConsumeToken();
     
@@ -306,7 +306,7 @@
     RHSVal = RHS.Val;
   }
   
-  if (Tok.getKind() != tok::colon) {
+  if (Tok.isNot(tok::colon)) {
     Diag(Tok, diag::err_expected_colon_after, "'case'");
     SkipUntil(tok::colon);
     return true;
@@ -315,7 +315,7 @@
   SourceLocation ColonLoc = ConsumeToken();
   
   // Diagnose the common error "switch (X) { case 4: }", which is not valid.
-  if (Tok.getKind() == tok::r_brace) {
+  if (Tok.is(tok::r_brace)) {
     Diag(Tok, diag::err_label_end_of_compound_statement);
     return true;
   }
@@ -336,10 +336,10 @@
 /// Note that this does not parse the 'statement' at the end.
 ///
 Parser::StmtResult Parser::ParseDefaultStatement() {
-  assert(Tok.getKind() == tok::kw_default && "Not a default stmt!");
+  assert(Tok.is(tok::kw_default) && "Not a default stmt!");
   SourceLocation DefaultLoc = ConsumeToken();  // eat the 'default'.
 
-  if (Tok.getKind() != tok::colon) {
+  if (Tok.isNot(tok::colon)) {
     Diag(Tok, diag::err_expected_colon_after, "'default'");
     SkipUntil(tok::colon);
     return true;
@@ -348,7 +348,7 @@
   SourceLocation ColonLoc = ConsumeToken();
   
   // Diagnose the common error "switch (X) {... default: }", which is not valid.
-  if (Tok.getKind() == tok::r_brace) {
+  if (Tok.is(tok::r_brace)) {
     Diag(Tok, diag::err_label_end_of_compound_statement);
     return true;
   }
@@ -389,7 +389,7 @@
 /// [OMP]   flush-directive
 ///
 Parser::StmtResult Parser::ParseCompoundStatement(bool isStmtExpr) {
-  assert(Tok.getKind() == tok::l_brace && "Not a compount stmt!");
+  assert(Tok.is(tok::l_brace) && "Not a compount stmt!");
   
   // Enter a scope to hold everything within the compound stmt.  Compound
   // statements can always hold declarations.
@@ -414,16 +414,16 @@
   // only allowed at the start of a compound stmt regardless of the language.
   
   llvm::SmallVector<StmtTy*, 32> Stmts;
-  while (Tok.getKind() != tok::r_brace && Tok.getKind() != tok::eof) {
+  while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
     StmtResult R;
-    if (Tok.getKind() != tok::kw___extension__) {
+    if (Tok.isNot(tok::kw___extension__)) {
       R = ParseStatementOrDeclaration(false);
     } else {
       // __extension__ can start declarations and it can also be a unary
       // operator for expressions.  Consume multiple __extension__ markers here
       // until we can determine which is which.
       SourceLocation ExtLoc = ConsumeToken();
-      while (Tok.getKind() == tok::kw___extension__)
+      while (Tok.is(tok::kw___extension__))
         ConsumeToken();
       
       // If this is the start of a declaration, parse it as such.
@@ -457,7 +457,7 @@
   }
   
   // We broke out of the while loop because we found a '}' or EOF.
-  if (Tok.getKind() != tok::r_brace) {
+  if (Tok.isNot(tok::r_brace)) {
     Diag(Tok, diag::err_expected_rbrace);
     return 0;
   }
@@ -473,10 +473,10 @@
 ///         'if' '(' expression ')' statement 'else' statement
 ///
 Parser::StmtResult Parser::ParseIfStatement() {
-  assert(Tok.getKind() == tok::kw_if && "Not an if stmt!");
+  assert(Tok.is(tok::kw_if) && "Not an if stmt!");
   SourceLocation IfLoc = ConsumeToken();  // eat the 'if'.
 
-  if (Tok.getKind() != tok::l_paren) {
+  if (Tok.isNot(tok::l_paren)) {
     Diag(Tok, diag::err_expected_lparen_after, "if");
     SkipUntil(tok::semi);
     return true;
@@ -499,7 +499,7 @@
   // C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if
   // there is no compound stmt.  C90 does not have this clause.  We only do this
   // if the body isn't a compound statement to avoid push/pop in common cases.
-  bool NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+  bool NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
   if (NeedsInnerScope) EnterScope(Scope::DeclScope);
   
   // Read the if condition.
@@ -515,14 +515,14 @@
   // If it has an else, parse it.
   SourceLocation ElseLoc;
   StmtResult ElseStmt(false);
-  if (Tok.getKind() == tok::kw_else) {
+  if (Tok.is(tok::kw_else)) {
     ElseLoc = ConsumeToken();
     
     // C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if
     // there is no compound stmt.  C90 does not have this clause.  We only do
     // this if the body isn't a compound statement to avoid push/pop in common
     // cases.
-    NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+    NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
     if (NeedsInnerScope) EnterScope(Scope::DeclScope);
     
     ElseStmt = ParseStatement();
@@ -545,10 +545,10 @@
 ///       switch-statement:
 ///         'switch' '(' expression ')' statement
 Parser::StmtResult Parser::ParseSwitchStatement() {
-  assert(Tok.getKind() == tok::kw_switch && "Not a switch stmt!");
+  assert(Tok.is(tok::kw_switch) && "Not a switch stmt!");
   SourceLocation SwitchLoc = ConsumeToken();  // eat the 'switch'.
 
-  if (Tok.getKind() != tok::l_paren) {
+  if (Tok.isNot(tok::l_paren)) {
     Diag(Tok, diag::err_expected_lparen_after, "switch");
     SkipUntil(tok::semi);
     return true;
@@ -574,7 +574,7 @@
   // C99 6.8.4p3 - In C99, the body of the switch statement is a scope, even if
   // there is no compound stmt.  C90 does not have this clause.  We only do this
   // if the body isn't a compound statement to avoid push/pop in common cases.
-  bool NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+  bool NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
   if (NeedsInnerScope) EnterScope(Scope::DeclScope);
   
   // Read the body statement.
@@ -597,11 +597,11 @@
 ///       while-statement: [C99 6.8.5.1]
 ///         'while' '(' expression ')' statement
 Parser::StmtResult Parser::ParseWhileStatement() {
-  assert(Tok.getKind() == tok::kw_while && "Not a while stmt!");
+  assert(Tok.is(tok::kw_while) && "Not a while stmt!");
   SourceLocation WhileLoc = Tok.getLocation();
   ConsumeToken();  // eat the 'while'.
   
-  if (Tok.getKind() != tok::l_paren) {
+  if (Tok.isNot(tok::l_paren)) {
     Diag(Tok, diag::err_expected_lparen_after, "while");
     SkipUntil(tok::semi);
     return true;
@@ -620,7 +620,7 @@
   // C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if
   // there is no compound stmt.  C90 does not have this clause.  We only do this
   // if the body isn't a compound statement to avoid push/pop in common cases.
-  bool NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+  bool NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
   if (NeedsInnerScope) EnterScope(Scope::DeclScope);
   
   // Read the body statement.
@@ -641,7 +641,7 @@
 ///         'do' statement 'while' '(' expression ')' ';'
 /// Note: this lets the caller parse the end ';'.
 Parser::StmtResult Parser::ParseDoStatement() {
-  assert(Tok.getKind() == tok::kw_do && "Not a do stmt!");
+  assert(Tok.is(tok::kw_do) && "Not a do stmt!");
   SourceLocation DoLoc = ConsumeToken();  // eat the 'do'.
   
   // C99 6.8.5p5 - In C99, the do statement is a block.  This is not
@@ -654,7 +654,7 @@
   // C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if
   // there is no compound stmt.  C90 does not have this clause. We only do this
   // if the body isn't a compound statement to avoid push/pop in common cases.
-  bool NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+  bool NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
   if (NeedsInnerScope) EnterScope(Scope::DeclScope);
   
   // Read the body statement.
@@ -663,7 +663,7 @@
   // Pop the body scope if needed.
   if (NeedsInnerScope) ExitScope();
 
-  if (Tok.getKind() != tok::kw_while) {
+  if (Tok.isNot(tok::kw_while)) {
     ExitScope();
     Diag(Tok, diag::err_expected_while);
     Diag(DoLoc, diag::err_matching, "do");
@@ -672,7 +672,7 @@
   }
   SourceLocation WhileLoc = ConsumeToken();
   
-  if (Tok.getKind() != tok::l_paren) {
+  if (Tok.isNot(tok::l_paren)) {
     ExitScope();
     Diag(Tok, diag::err_expected_lparen_after, "do/while");
     SkipUntil(tok::semi);
@@ -694,10 +694,10 @@
 ///         'for' '(' expr[opt] ';' expr[opt] ';' expr[opt] ')' statement
 ///         'for' '(' declaration expr[opt] ';' expr[opt] ')' statement
 Parser::StmtResult Parser::ParseForStatement() {
-  assert(Tok.getKind() == tok::kw_for && "Not a for stmt!");
+  assert(Tok.is(tok::kw_for) && "Not a for stmt!");
   SourceLocation ForLoc = ConsumeToken();  // eat the 'for'.
   
-  if (Tok.getKind() != tok::l_paren) {
+  if (Tok.isNot(tok::l_paren)) {
     Diag(Tok, diag::err_expected_lparen_after, "for");
     SkipUntil(tok::semi);
     return true;
@@ -718,7 +718,7 @@
   StmtTy *ThirdPart = 0;
   
   // Parse the first part of the for specifier.
-  if (Tok.getKind() == tok::semi) {  // for (;
+  if (Tok.is(tok::semi)) {  // for (;
     // no first part, eat the ';'.
     ConsumeToken();
   } else if (isDeclarationSpecifier()) {  // for (int X = 4;
@@ -738,7 +738,7 @@
         FirstPart = R.Val;
     }
       
-    if (Tok.getKind() == tok::semi) {
+    if (Tok.is(tok::semi)) {
       ConsumeToken();
     } else {
       if (!Value.isInvalid) Diag(Tok, diag::err_expected_semi_for);
@@ -747,7 +747,7 @@
   }
   
   // Parse the second part of the for specifier.
-  if (Tok.getKind() == tok::semi) {  // for (...;;
+  if (Tok.is(tok::semi)) {  // for (...;;
     // no second part.
     Value = ExprResult();
   } else {
@@ -756,7 +756,7 @@
       SecondPart = Value.Val;
   }
   
-  if (Tok.getKind() == tok::semi) {
+  if (Tok.is(tok::semi)) {
     ConsumeToken();
   } else {
     if (!Value.isInvalid) Diag(Tok, diag::err_expected_semi_for);
@@ -764,7 +764,7 @@
   }
   
   // Parse the third part of the for specifier.
-  if (Tok.getKind() == tok::r_paren) {  // for (...;...;)
+  if (Tok.is(tok::r_paren)) {  // for (...;...;)
     // no third part.
     Value = ExprResult();
   } else {
@@ -783,7 +783,7 @@
   // C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if
   // there is no compound stmt.  C90 does not have this clause.  We only do this
   // if the body isn't a compound statement to avoid push/pop in common cases.
-  bool NeedsInnerScope = getLang().C99 && Tok.getKind() != tok::l_brace;
+  bool NeedsInnerScope = getLang().C99 && Tok.isNot(tok::l_brace);
   if (NeedsInnerScope) EnterScope(Scope::DeclScope);
   
   // Read the body statement.
@@ -810,15 +810,15 @@
 /// Note: this lets the caller parse the end ';'.
 ///
 Parser::StmtResult Parser::ParseGotoStatement() {
-  assert(Tok.getKind() == tok::kw_goto && "Not a goto stmt!");
+  assert(Tok.is(tok::kw_goto) && "Not a goto stmt!");
   SourceLocation GotoLoc = ConsumeToken();  // eat the 'goto'.
   
   StmtResult Res;
-  if (Tok.getKind() == tok::identifier) {
+  if (Tok.is(tok::identifier)) {
     Res = Actions.ActOnGotoStmt(GotoLoc, Tok.getLocation(),
                                 Tok.getIdentifierInfo());
     ConsumeToken();
-  } else if (Tok.getKind() == tok::star && !getLang().NoExtensions) {
+  } else if (Tok.is(tok::star) && !getLang().NoExtensions) {
     // GNU indirect goto extension.
     Diag(Tok, diag::ext_gnu_indirect_goto);
     SourceLocation StarLoc = ConsumeToken();
@@ -862,11 +862,11 @@
 ///       jump-statement:
 ///         'return' expression[opt] ';'
 Parser::StmtResult Parser::ParseReturnStatement() {
-  assert(Tok.getKind() == tok::kw_return && "Not a return stmt!");
+  assert(Tok.is(tok::kw_return) && "Not a return stmt!");
   SourceLocation ReturnLoc = ConsumeToken();  // eat the 'return'.
   
   ExprResult R(0);
-  if (Tok.getKind() != tok::semi) {
+  if (Tok.isNot(tok::semi)) {
     R = ParseExpression();
     if (R.isInvalid) {  // Skip to the semicolon, but don't consume it.
       SkipUntil(tok::semi, false, true);
@@ -892,7 +892,7 @@
 ///         asm-clobbers ',' asm-string-literal
 ///
 Parser::StmtResult Parser::ParseAsmStatement() {
-  assert(Tok.getKind() == tok::kw_asm && "Not an asm stmt");
+  assert(Tok.is(tok::kw_asm) && "Not an asm stmt");
   ConsumeToken();
   
   DeclSpec DS;
@@ -908,7 +908,7 @@
   // Remember if this was a volatile asm.
   //bool isVolatile = DS.TypeQualifiers & DeclSpec::TQ_volatile;
   
-  if (Tok.getKind() != tok::l_paren) {
+  if (Tok.isNot(tok::l_paren)) {
     Diag(Tok, diag::err_expected_lparen_after, "asm");
     SkipUntil(tok::r_paren);
     return true;
@@ -924,7 +924,7 @@
   ParseAsmOperandsOpt();
   
   // Parse the clobbers, if present.
-  if (Tok.getKind() == tok::colon) {
+  if (Tok.is(tok::colon)) {
     ConsumeToken();
     
     if (isTokenStringLiteral()) {
@@ -932,7 +932,7 @@
       while (1) {
         ParseAsmStringLiteral();
 
-        if (Tok.getKind() != tok::comma) break;
+        if (Tok.isNot(tok::comma)) break;
         ConsumeToken();
       }
     }
@@ -958,19 +958,19 @@
 ///
 void Parser::ParseAsmOperandsOpt() {
   // Only do anything if this operand is present.
-  if (Tok.getKind() != tok::colon) return;
+  if (Tok.isNot(tok::colon)) return;
   ConsumeToken();
   
   // 'asm-operands' isn't present?
-  if (!isTokenStringLiteral() && Tok.getKind() != tok::l_square)
+  if (!isTokenStringLiteral() && Tok.isNot(tok::l_square))
     return;
   
   while (1) {
     // Read the [id] if present.
-    if (Tok.getKind() == tok::l_square) {
+    if (Tok.is(tok::l_square)) {
       SourceLocation Loc = ConsumeBracket();
       
-      if (Tok.getKind() != tok::identifier) {
+      if (Tok.isNot(tok::identifier)) {
         Diag(Tok, diag::err_expected_ident);
         SkipUntil(tok::r_paren);
         return;
@@ -980,7 +980,7 @@
     
     ParseAsmStringLiteral();
 
-    if (Tok.getKind() != tok::l_paren) {
+    if (Tok.isNot(tok::l_paren)) {
       Diag(Tok, diag::err_expected_lparen_after, "asm operand");
       SkipUntil(tok::r_paren);
       return;
@@ -994,7 +994,7 @@
     }
 
     // Eat the comma and continue parsing if it exists.
-    if (Tok.getKind() != tok::comma) return;
+    if (Tok.isNot(tok::comma)) return;
     ConsumeToken();
   }
 }

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=42797&r1=42796&r2=42797&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Tue Oct  9 12:41:39 2007
@@ -481,16 +481,16 @@
 			isa = PBXGroup;
 			children = (
 				84D9A8870C1A57E100AC7ABC /* AttributeList.cpp */,
+				DE17336D0B068DC20080B521 /* DeclSpec.cpp */,
 				DE3461260AFE68BE00DBC861 /* MinimalAction.cpp */,
 				DE06D42F0A8BB52D0050E87E /* Parser.cpp */,
-				DE3460040AFDCC6500DBC861 /* ParseInit.cpp */,
 				DE34600E0AFDCCCE00DBC861 /* ParseDecl.cpp */,
 				DE2255FB0C8004E600D370A5 /* ParseDeclCXX.cpp */,
 				DE3460120AFDCCDA00DBC861 /* ParseExpr.cpp */,
 				DE06756B0C051CFE00EBBFD8 /* ParseExprCXX.cpp */,
-				DE34600A0AFDCCBF00DBC861 /* ParseStmt.cpp */,
+				DE3460040AFDCC6500DBC861 /* ParseInit.cpp */,
 				DE345FFF0AFDCC1900DBC861 /* ParseObjc.cpp */,
-				DE17336D0B068DC20080B521 /* DeclSpec.cpp */,
+				DE34600A0AFDCCBF00DBC861 /* ParseStmt.cpp */,
 			);
 			name = Parse;
 			sourceTree = "<group>";





More information about the cfe-commits mailing list