[cfe-commits] r42796 - in /cfe/trunk/Parse: ParseDecl.cpp ParseDeclCXX.cpp ParseInit.cpp

Chris Lattner sabre at nondot.org
Tue Oct 9 10:33:22 PDT 2007


Author: lattner
Date: Tue Oct  9 12:33:22 2007
New Revision: 42796

URL: http://llvm.org/viewvc/llvm-project?rev=42796&view=rev
Log:
switch some more of the parser over to using Token::is and isNot

Modified:
    cfe/trunk/Parse/ParseDecl.cpp
    cfe/trunk/Parse/ParseDeclCXX.cpp
    cfe/trunk/Parse/ParseInit.cpp

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

==============================================================================
--- cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/Parse/ParseDecl.cpp Tue Oct  9 12:33:22 2007
@@ -73,11 +73,11 @@
 /// a pressing need to implement the 2 token lookahead.
 
 AttributeList *Parser::ParseAttributes() {
-  assert(Tok.getKind() == tok::kw___attribute && "Not an attribute list!");
+  assert(Tok.is(tok::kw___attribute) && "Not an attribute list!");
   
   AttributeList *CurrAttr = 0;
   
-  while (Tok.getKind() == tok::kw___attribute) {
+  while (Tok.is(tok::kw___attribute)) {
     ConsumeToken();
     if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
                          "attribute")) {
@@ -89,10 +89,10 @@
       return CurrAttr;
     }
     // Parse the attribute-list. e.g. __attribute__(( weak, alias("__f") ))
-    while (Tok.getKind() == tok::identifier || isDeclarationSpecifier() ||
-           Tok.getKind() == tok::comma) {
+    while (Tok.is(tok::identifier) || isDeclarationSpecifier() ||
+           Tok.is(tok::comma)) {
            
-      if (Tok.getKind() == tok::comma) { 
+      if (Tok.is(tok::comma)) { 
         // allows for empty/non-empty attributes. ((__vector_size__(16),,,,))
         ConsumeToken();
         continue;
@@ -102,19 +102,19 @@
       SourceLocation AttrNameLoc = ConsumeToken();
       
       // check if we have a "paramterized" attribute
-      if (Tok.getKind() == tok::l_paren) {
+      if (Tok.is(tok::l_paren)) {
         ConsumeParen(); // ignore the left paren loc for now
         
-        if (Tok.getKind() == tok::identifier) {
+        if (Tok.is(tok::identifier)) {
           IdentifierInfo *ParmName = Tok.getIdentifierInfo();
           SourceLocation ParmLoc = ConsumeToken();
           
-          if (Tok.getKind() == tok::r_paren) { 
+          if (Tok.is(tok::r_paren)) { 
             // __attribute__(( mode(byte) ))
             ConsumeParen(); // ignore the right paren loc for now
             CurrAttr = new AttributeList(AttrName, AttrNameLoc, 
                                          ParmName, ParmLoc, 0, 0, CurrAttr);
-          } else if (Tok.getKind() == tok::comma) {
+          } else if (Tok.is(tok::comma)) {
             ConsumeToken();
             // __attribute__(( format(printf, 1, 2) ))
             llvm::SmallVector<ExprTy*, 8> ArgExprs;
@@ -130,11 +130,11 @@
               } else {
                 ArgExprs.push_back(ArgExpr.Val);
               }
-              if (Tok.getKind() != tok::comma)
+              if (Tok.isNot(tok::comma))
                 break;
               ConsumeToken(); // Eat the comma, move to the next argument
             }
-            if (ArgExprsOk && Tok.getKind() == tok::r_paren) {
+            if (ArgExprsOk && Tok.is(tok::r_paren)) {
               ConsumeParen(); // ignore the right paren loc for now
               CurrAttr = new AttributeList(AttrName, AttrNameLoc, ParmName, 
                            ParmLoc, &ArgExprs[0], ArgExprs.size(), CurrAttr);
@@ -142,7 +142,7 @@
           }
         } else { // not an identifier
           // parse a possibly empty comma separated list of expressions
-          if (Tok.getKind() == tok::r_paren) { 
+          if (Tok.is(tok::r_paren)) { 
             // __attribute__(( nonnull() ))
             ConsumeParen(); // ignore the right paren loc for now
             CurrAttr = new AttributeList(AttrName, AttrNameLoc, 
@@ -162,12 +162,12 @@
               } else {
                 ArgExprs.push_back(ArgExpr.Val);
               }
-              if (Tok.getKind() != tok::comma)
+              if (Tok.isNot(tok::comma))
                 break;
               ConsumeToken(); // Eat the comma, move to the next argument
             }
             // Match the ')'.
-            if (ArgExprsOk && Tok.getKind() == tok::r_paren) {
+            if (ArgExprsOk && Tok.is(tok::r_paren)) {
               ConsumeParen(); // ignore the right paren loc for now
               CurrAttr = new AttributeList(AttrName, AttrNameLoc, 0, 
                            SourceLocation(), &ArgExprs[0], ArgExprs.size(), 
@@ -219,7 +219,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)) {
     ConsumeToken();
     return Actions.ParsedFreeStandingDeclSpec(CurScope, DS);
   }
@@ -256,11 +256,11 @@
   // rest of the init-declarator-list.
   while (1) {
     // If a simple-asm-expr is present, parse it.
-    if (Tok.getKind() == tok::kw_asm)
+    if (Tok.is(tok::kw_asm))
       ParseSimpleAsm();
     
     // If attributes are present, parse them.
-    if (Tok.getKind() == tok::kw___attribute)
+    if (Tok.is(tok::kw___attribute))
       D.AddAttributes(ParseAttributes());
 
     // Inform the current actions module that we just parsed this declarator.
@@ -269,7 +269,7 @@
         
     // Parse declarator '=' initializer.
     ExprResult Init;
-    if (Tok.getKind() == tok::equal) {
+    if (Tok.is(tok::equal)) {
       ConsumeToken();
       Init = ParseInitializer();
       if (Init.isInvalid) {
@@ -281,7 +281,7 @@
     
     // If we don't have a comma, it is either the end of the list (a ';') or an
     // error, bail out.
-    if (Tok.getKind() != tok::comma)
+    if (Tok.isNot(tok::comma))
       break;
     
     // Consume the comma.
@@ -292,7 +292,7 @@
     ParseDeclarator(D);
   }
   
-  if (Tok.getKind() == tok::semi) {
+  if (Tok.is(tok::semi)) {
     ConsumeToken();
     return Actions.FinalizeDeclaratorGroup(CurScope, LastDeclInGroup);
   }
@@ -300,7 +300,7 @@
   Diag(Tok, diag::err_parse_error);
   // Skip to end of block or statement
   SkipUntil(tok::r_brace, true, true);
-  if (Tok.getKind() == tok::semi)
+  if (Tok.is(tok::semi))
     ConsumeToken();
   return 0;
 }
@@ -406,7 +406,7 @@
           else { // FIXME: restrict this to "id" and ObjC classnames.
             DS.Range.setEnd(Tok.getLocation());
             ConsumeToken(); // The identifier
-            if (Tok.getKind() == tok::less) {
+            if (Tok.is(tok::less)) {
               llvm::SmallVector<IdentifierInfo *, 8> ProtocolRefs;
               ParseObjCProtocolReferences(ProtocolRefs);
               Actions.ActOnFindProtocolDeclaration(CurScope,
@@ -557,12 +557,11 @@
 bool Parser::ParseTag(DeclTy *&Decl, unsigned TagType, SourceLocation StartLoc){
   AttributeList *Attr = 0;
   // If attributes exist after tag, parse them.
-  if (Tok.getKind() == tok::kw___attribute)
+  if (Tok.is(tok::kw___attribute))
     Attr = ParseAttributes();
   
   // Must have either 'struct name' or 'struct {...}'.
-  if (Tok.getKind() != tok::identifier &&
-      Tok.getKind() != tok::l_brace) {
+  if (Tok.isNot(tok::identifier) && Tok.isNot(tok::l_brace)) {
     Diag(Tok, diag::err_expected_ident_lbrace);
     
     // Skip the rest of this declarator, up until the comma or semicolon.
@@ -573,7 +572,7 @@
   // If an identifier is present, consume and remember it.
   IdentifierInfo *Name = 0;
   SourceLocation NameLoc;
-  if (Tok.getKind() == tok::identifier) {
+  if (Tok.is(tok::identifier)) {
     Name = Tok.getIdentifierInfo();
     NameLoc = ConsumeToken();
   }
@@ -587,9 +586,9 @@
   // struct foo {..};  void bar() { struct foo x; }  <- use of old foo.
   //
   Action::TagKind TK;
-  if (Tok.getKind() == tok::l_brace)
+  if (Tok.is(tok::l_brace))
     TK = Action::TK_Definition;
-  else if (Tok.getKind() == tok::semi)
+  else if (Tok.is(tok::semi))
     TK = Action::TK_Declaration;
   else
     TK = Action::TK_Reference;
@@ -610,10 +609,10 @@
 ///         'union'
 ///
 void Parser::ParseStructUnionSpecifier(DeclSpec &DS) {
-  assert((Tok.getKind() == tok::kw_struct ||
-          Tok.getKind() == tok::kw_union) && "Not a struct/union specifier");
+  assert((Tok.is(tok::kw_struct) || Tok.is(tok::kw_union)) &&
+         "Not a struct/union specifier");
   DeclSpec::TST TagType =
-    Tok.getKind() == tok::kw_union ? DeclSpec::TST_union : DeclSpec::TST_struct;
+    Tok.is(tok::kw_union) ? DeclSpec::TST_union : DeclSpec::TST_struct;
   SourceLocation StartLoc = ConsumeToken();
 
   // Parse the tag portion of this.
@@ -622,7 +621,7 @@
     return;
   
   // If there is a body, parse it and inform the actions module.
-  if (Tok.getKind() == tok::l_brace)
+  if (Tok.is(tok::l_brace))
     ParseStructUnionBody(StartLoc, TagType, TagDecl);
 
   const char *PrevSpec = 0;
@@ -648,7 +647,7 @@
 void Parser::ParseStructDeclaration(DeclTy *TagDecl,
   llvm::SmallVectorImpl<DeclTy*> &FieldDecls) {
   // FIXME: When __extension__ is specified, disable extension diagnostics.
-  if (Tok.getKind() == tok::kw___extension__)
+  if (Tok.is(tok::kw___extension__))
     ConsumeToken();
   
   // Parse the common specifier-qualifiers-list piece.
@@ -659,7 +658,7 @@
   // specified?
   
   // If there are no declarators, issue a warning.
-  if (Tok.getKind() == tok::semi) {
+  if (Tok.is(tok::semi)) {
     Diag(SpecQualLoc, diag::w_no_declarators);
     ConsumeToken();
     return;
@@ -671,11 +670,11 @@
   while (1) {
     /// struct-declarator: declarator
     /// struct-declarator: declarator[opt] ':' constant-expression
-    if (Tok.getKind() != tok::colon)
+    if (Tok.isNot(tok::colon))
       ParseDeclarator(DeclaratorInfo);
     
     ExprTy *BitfieldSize = 0;
-    if (Tok.getKind() == tok::colon) {
+    if (Tok.is(tok::colon)) {
       ConsumeToken();
       ExprResult Res = ParseConstantExpression();
       if (Res.isInvalid) {
@@ -686,7 +685,7 @@
     }
     
     // If attributes exist after the declarator, parse them.
-    if (Tok.getKind() == tok::kw___attribute)
+    if (Tok.is(tok::kw___attribute))
       DeclaratorInfo.AddAttributes(ParseAttributes());
     
     // Install the declarator into the current TagDecl.
@@ -696,7 +695,7 @@
     
     // If we don't have a comma, it is either the end of the list (a ';')
     // or an error, bail out.
-    if (Tok.getKind() != tok::comma)
+    if (Tok.isNot(tok::comma))
       break;
     
     // Consume the comma.
@@ -706,7 +705,7 @@
     DeclaratorInfo.clear();
     
     // Attributes are only allowed on the second declarator.
-    if (Tok.getKind() == tok::kw___attribute)
+    if (Tok.is(tok::kw___attribute))
       DeclaratorInfo.AddAttributes(ParseAttributes());
   }
   return;
@@ -728,28 +727,27 @@
   
   // Empty structs are an extension in C (C99 6.7.2.1p7), but are allowed in
   // C++.
-  if (Tok.getKind() == tok::r_brace)
+  if (Tok.is(tok::r_brace))
     Diag(Tok, diag::ext_empty_struct_union_enum, 
          DeclSpec::getSpecifierName((DeclSpec::TST)TagType));
 
   llvm::SmallVector<DeclTy*, 32> FieldDecls;
   
   // While we still have something to read, read the declarations in the struct.
-  while (Tok.getKind() != tok::r_brace && 
-         Tok.getKind() != tok::eof) {
+  while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
     // Each iteration of this loop reads one struct-declaration.
     
     // Check for extraneous top-level semicolon.
-    if (Tok.getKind() == tok::semi) {
+    if (Tok.is(tok::semi)) {
       Diag(Tok, diag::ext_extra_struct_semi);
       ConsumeToken();
       continue;
     }
     ParseStructDeclaration(TagDecl, FieldDecls);
 
-    if (Tok.getKind() == tok::semi) {
+    if (Tok.is(tok::semi)) {
       ConsumeToken();
-    } else if (Tok.getKind() == tok::r_brace) {
+    } else if (Tok.is(tok::r_brace)) {
       Diag(Tok.getLocation(), diag::ext_expected_semi_decl_list);
       break;
     } else {
@@ -766,7 +764,7 @@
   
   AttributeList *AttrList = 0;
   // If attributes exist after struct contents, parse them.
-  if (Tok.getKind() == tok::kw___attribute)
+  if (Tok.is(tok::kw___attribute))
     AttrList = ParseAttributes(); // FIXME: where should I put them?
 }
 
@@ -780,7 +778,7 @@
 ///         'enum' identifier
 /// [GNU]   'enum' attributes[opt] identifier
 void Parser::ParseEnumSpecifier(DeclSpec &DS) {
-  assert(Tok.getKind() == tok::kw_enum && "Not an enum specifier");
+  assert(Tok.is(tok::kw_enum) && "Not an enum specifier");
   SourceLocation StartLoc = ConsumeToken();
   
   // Parse the tag portion of this.
@@ -788,7 +786,7 @@
   if (ParseTag(TagDecl, DeclSpec::TST_enum, StartLoc))
     return;
   
-  if (Tok.getKind() == tok::l_brace)
+  if (Tok.is(tok::l_brace))
     ParseEnumBody(StartLoc, TagDecl);
   
   // TODO: semantic analysis on the declspec for enums.
@@ -811,7 +809,7 @@
   SourceLocation LBraceLoc = ConsumeBrace();
   
   // C does not allow an empty enumerator-list, C++ does [dcl.enum].
-  if (Tok.getKind() == tok::r_brace && !getLang().CPlusPlus)
+  if (Tok.is(tok::r_brace) && !getLang().CPlusPlus)
     Diag(Tok, diag::ext_empty_struct_union_enum, "enum");
   
   llvm::SmallVector<DeclTy*, 32> EnumConstantDecls;
@@ -819,13 +817,13 @@
   DeclTy *LastEnumConstDecl = 0;
   
   // Parse the enumerator-list.
-  while (Tok.getKind() == tok::identifier) {
+  while (Tok.is(tok::identifier)) {
     IdentifierInfo *Ident = Tok.getIdentifierInfo();
     SourceLocation IdentLoc = ConsumeToken();
     
     SourceLocation EqualLoc;
     ExprTy *AssignedVal = 0;
-    if (Tok.getKind() == tok::equal) {
+    if (Tok.is(tok::equal)) {
       EqualLoc = ConsumeToken();
       ExprResult Res = ParseConstantExpression();
       if (Res.isInvalid)
@@ -842,11 +840,11 @@
     EnumConstantDecls.push_back(EnumConstDecl);
     LastEnumConstDecl = EnumConstDecl;
     
-    if (Tok.getKind() != tok::comma)
+    if (Tok.isNot(tok::comma))
       break;
     SourceLocation CommaLoc = ConsumeToken();
     
-    if (Tok.getKind() != tok::identifier && !getLang().C99)
+    if (Tok.isNot(tok::identifier) && !getLang().C99)
       Diag(CommaLoc, diag::ext_c99_enumerator_list_comma);
   }
   
@@ -858,7 +856,7 @@
   
   DeclTy *AttrList = 0;
   // If attributes exist after the identifier list, parse them.
-  if (Tok.getKind() == tok::kw___attribute)
+  if (Tok.is(tok::kw___attribute))
     AttrList = ParseAttributes(); // FIXME: where do they do?
 }
 
@@ -1104,11 +1102,11 @@
 ///
 void Parser::ParseDirectDeclarator(Declarator &D) {
   // Parse the first direct-declarator seen.
-  if (Tok.getKind() == tok::identifier && D.mayHaveIdentifier()) {
+  if (Tok.is(tok::identifier) && D.mayHaveIdentifier()) {
     assert(Tok.getIdentifierInfo() && "Not an identifier?");
     D.SetIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
     ConsumeToken();
-  } else if (Tok.getKind() == tok::l_paren) {
+  } else if (Tok.is(tok::l_paren)) {
     // direct-declarator: '(' declarator ')'
     // direct-declarator: '(' attributes declarator ')'
     // Example: 'char (*X)'   or 'int (*XX)(void)'
@@ -1127,9 +1125,9 @@
          "Haven't past the location of the identifier yet?");
   
   while (1) {
-    if (Tok.getKind() == tok::l_paren) {
+    if (Tok.is(tok::l_paren)) {
       ParseParenDeclarator(D);
-    } else if (Tok.getKind() == tok::l_square) {
+    } else if (Tok.is(tok::l_square)) {
       ParseBracketDeclarator(D);
     } else {
       break;
@@ -1177,7 +1175,7 @@
       // If this can't be an abstract-declarator, this *must* be a grouping
       // paren, because we haven't seen the identifier yet.
       isGrouping = true;
-    } else if (Tok.getKind() == tok::r_paren ||  // 'int()' is a function.
+    } else if (Tok.is(tok::r_paren) ||           // 'int()' is a function.
                isDeclarationSpecifier()) {       // 'int(int)' is a function.
       // This handles C99 6.7.5.3p11: in "typedef int X; void foo(X)", X is
       // considered to be a type, not a K&R identifier-list.
@@ -1191,7 +1189,7 @@
     // direct-declarator: '(' declarator ')'
     // direct-declarator: '(' attributes declarator ')'
     if (isGrouping) {
-      if (Tok.getKind() == tok::kw___attribute)
+      if (Tok.is(tok::kw___attribute))
         D.AddAttributes(ParseAttributes());
       
       ParseDeclaratorInternal(D);
@@ -1217,11 +1215,11 @@
   llvm::SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo;
   llvm::SmallSet<const IdentifierInfo*, 16> ParamsSoFar;
   
-  if (Tok.getKind() == tok::r_paren) {
+  if (Tok.is(tok::r_paren)) {
     // int() -> no prototype, no '...'.
     IsVariadic   = false;
     HasPrototype = false;
-  } else if (Tok.getKind() == tok::identifier &&
+  } else if (Tok.is(tok::identifier) &&
              // K&R identifier lists can't have typedefs as identifiers, per
              // C99 6.7.5.3p11.
              !Actions.isTypeName(*Tok.getIdentifierInfo(), CurScope)) {
@@ -1241,11 +1239,11 @@
                                                    Tok.getLocation(), 0));
 
     ConsumeToken();
-    while (Tok.getKind() == tok::comma) {
+    while (Tok.is(tok::comma)) {
       // Eat the comma.
       ConsumeToken();
       
-      if (Tok.getKind() != tok::identifier) {
+      if (Tok.isNot(tok::identifier)) {
         Diag(Tok, diag::err_expected_ident);
         ErrorEmitted = true;
         break;
@@ -1281,7 +1279,7 @@
     
     IsVariadic = false;
     while (1) {
-      if (Tok.getKind() == tok::ellipsis) {
+      if (Tok.is(tok::ellipsis)) {
         IsVariadic = true;
 
         // Check to see if this is "void(...)" which is not allowed.
@@ -1307,7 +1305,7 @@
       ParseDeclarator(ParmDecl);
 
       // Parse GNU attributes, if present.
-      if (Tok.getKind() == tok::kw___attribute)
+      if (Tok.is(tok::kw___attribute))
         ParmDecl.AddAttributes(ParseAttributes());
       
       // Verify C99 6.7.5.3p2: The only SCS allowed is 'register'.
@@ -1343,7 +1341,7 @@
         ParmDecl.getIdentifierLoc(), ParamTy.Val, ParmDecl.getInvalidType()));
       
       // If the next token is a comma, consume it and keep reading arguments.
-      if (Tok.getKind() != tok::comma) break;
+      if (Tok.isNot(tok::comma)) break;
       
       // Consume the comma.
       ConsumeToken();
@@ -1362,7 +1360,7 @@
                                                StartLoc));
   
   // If we have the closing ')', eat it and we're done.
-  if (Tok.getKind() == tok::r_paren) {
+  if (Tok.is(tok::r_paren)) {
     ConsumeParen();
   } else {
     // If an error happened earlier parsing something else in the proto, don't
@@ -1384,7 +1382,7 @@
   
   // If valid, this location is the position where we read the 'static' keyword.
   SourceLocation StaticLoc;
-  if (Tok.getKind() == tok::kw_static)
+  if (Tok.is(tok::kw_static))
     StaticLoc = ConsumeToken();
   
   // If there is a type-qualifier-list, read it now.
@@ -1393,20 +1391,20 @@
   
   // If we haven't already read 'static', check to see if there is one after the
   // type-qualifier-list.
-  if (!StaticLoc.isValid() && Tok.getKind() == tok::kw_static)
+  if (!StaticLoc.isValid() && Tok.is(tok::kw_static))
     StaticLoc = ConsumeToken();
   
   // Handle "direct-declarator [ type-qual-list[opt] * ]".
   bool isStar = false;
   ExprResult NumElements(false);
-  if (Tok.getKind() == tok::star) {
+  if (Tok.is(tok::star)) {
     // Remember the '*' token, in case we have to un-get it.
     Token StarTok = Tok;
     ConsumeToken();
 
     // Check that the ']' token is present to avoid incorrectly parsing
     // expressions starting with '*' as [*].
-    if (Tok.getKind() == tok::r_square) {
+    if (Tok.is(tok::r_square)) {
       if (StaticLoc.isValid())
         Diag(StaticLoc, diag::err_unspecified_vla_size_with_static);
       StaticLoc = SourceLocation();  // Drop the static.
@@ -1417,7 +1415,7 @@
       // need to reparse it.  This handles cases like 'X[*p + 4]'
       NumElements = ParseAssignmentExpressionWithLeadingStar(StarTok);
     }
-  } else if (Tok.getKind() != tok::r_square) {
+  } else if (Tok.isNot(tok::r_square)) {
     // Parse the assignment-expression now.
     NumElements = ParseAssignmentExpression();
   }
@@ -1451,11 +1449,11 @@
 ///         typeof ( type-name )
 ///
 void Parser::ParseTypeofSpecifier(DeclSpec &DS) {
-  assert(Tok.getKind() == tok::kw_typeof && "Not a typeof specifier");
+  assert(Tok.is(tok::kw_typeof) && "Not a typeof specifier");
   const IdentifierInfo *BuiltinII = Tok.getIdentifierInfo();
   SourceLocation StartLoc = ConsumeToken();
 
-  if (Tok.getKind() != tok::l_paren) {
+  if (Tok.isNot(tok::l_paren)) {
     Diag(Tok, diag::err_expected_lparen_after, BuiltinII->getName());
     return;
   }
@@ -1466,7 +1464,7 @@
 
     assert(Ty && "Parser::ParseTypeofSpecifier(): missing type");
 
-    if (Tok.getKind() != tok::r_paren) {
+    if (Tok.isNot(tok::r_paren)) {
       MatchRHSPunctuation(tok::r_paren, LParenLoc);
       return;
     }
@@ -1478,7 +1476,7 @@
   } else { // we have an expression.
     ExprResult Result = ParseExpression();
     
-    if (Result.isInvalid || Tok.getKind() != tok::r_paren) {
+    if (Result.isInvalid || Tok.isNot(tok::r_paren)) {
       MatchRHSPunctuation(tok::r_paren, LParenLoc);
       return;
     }

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

==============================================================================
--- cfe/trunk/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/Parse/ParseDeclCXX.cpp Tue Oct  9 12:33:22 2007
@@ -40,31 +40,31 @@
 ///         'namespace' identifier '=' qualified-namespace-specifier ';'
 ///
 Parser::DeclTy *Parser::ParseNamespace(unsigned Context) {
-  assert(Tok.getKind() == tok::kw_namespace && "Not a namespace!");
+  assert(Tok.is(tok::kw_namespace) && "Not a namespace!");
   SourceLocation NamespaceLoc = ConsumeToken();  // eat the 'namespace'.
   
   SourceLocation IdentLoc;
   IdentifierInfo *Ident = 0;
   
-  if (Tok.getKind() == tok::identifier) {
+  if (Tok.is(tok::identifier)) {
     Ident = Tok.getIdentifierInfo();
     IdentLoc = ConsumeToken();  // eat the identifier.
   }
   
   // Read label attributes, if present.
   DeclTy *AttrList = 0;
-  if (Tok.getKind() == tok::kw___attribute)
+  if (Tok.is(tok::kw___attribute))
     // FIXME: save these somewhere.
     AttrList = ParseAttributes();
   
-  if (Tok.getKind() == tok::equal) {
+  if (Tok.is(tok::equal)) {
     // FIXME: Verify no attributes were present.
     // FIXME: parse this.
-  } else if (Tok.getKind() == tok::l_brace) {
+  } else if (Tok.is(tok::l_brace)) {
     SourceLocation LBrace = ConsumeBrace();
     // FIXME: push a scope, push a namespace decl.
     
-    while (Tok.getKind() != tok::r_brace && Tok.getKind() != tok::eof) {
+    while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
       // FIXME capture the decls.
       ParseExternalDeclaration();
     }

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

==============================================================================
--- cfe/trunk/Parse/ParseInit.cpp (original)
+++ cfe/trunk/Parse/ParseInit.cpp Tue Oct  9 12:33:22 2007
@@ -95,7 +95,7 @@
       }
       
       // Handle the gnu array range extension.
-      if (Tok.getKind() == tok::ellipsis) {
+      if (Tok.is(tok::ellipsis)) {
         Diag(Tok, diag::ext_gnu_array_range);
         ConsumeToken();
         
@@ -119,7 +119,7 @@
       ConsumeToken();
       
       // If this is the gross GNU extension, handle it now.
-      if (Tok.getKind() == tok::colon) {
+      if (Tok.is(tok::colon)) {
         Diag(Ident, diag::ext_gnu_old_style_field_designator);
         ConsumeToken();
         return ParseInitializer();
@@ -146,14 +146,14 @@
 ///         initializer-list ',' designation[opt] initializer
 ///
 Parser::ExprResult Parser::ParseInitializer() {
-  if (Tok.getKind() != tok::l_brace)
+  if (Tok.isNot(tok::l_brace))
     return ParseAssignmentExpression();
 
   SourceLocation LBraceLoc = ConsumeBrace();
   
   // We support empty initializers, but tell the user that they aren't using
   // C99-clean code.
-  if (Tok.getKind() == tok::r_brace) {
+  if (Tok.is(tok::r_brace)) {
     Diag(LBraceLoc, diag::ext_gnu_empty_initializer);
     // Match the '}'.
     return Actions.ActOnInitList(LBraceLoc, 0, 0, ConsumeBrace());
@@ -181,15 +181,15 @@
       InitExprs.push_back(SubElt.Val);
       
     // If we don't have a comma continued list, we're done.
-    if (Tok.getKind() != tok::comma) break;
+    if (Tok.isNot(tok::comma)) break;
     
     // FIXME: save comma locations.
     ConsumeToken();
     
     // Handle trailing comma.
-    if (Tok.getKind() == tok::r_brace) break;
+    if (Tok.is(tok::r_brace)) break;
   }
-  if (InitExprsOk && Tok.getKind() == tok::r_brace)
+  if (InitExprsOk && Tok.is(tok::r_brace))
     return Actions.ActOnInitList(LBraceLoc, &InitExprs[0], InitExprs.size(), 
                                  ConsumeBrace());
   // Match the '}'.





More information about the cfe-commits mailing list