[cfe-commits] r42800 - in /cfe/trunk/Driver: DiagChecker.cpp PrintPreprocessedOutput.cpp clang.cpp

Chris Lattner sabre at nondot.org
Tue Oct 9 11:03:44 PDT 2007


Author: lattner
Date: Tue Oct  9 13:03:42 2007
New Revision: 42800

URL: http://llvm.org/viewvc/llvm-project?rev=42800&view=rev
Log:
convert driver over to use Token::is/isNot APIs.  fwew, all done.

Modified:
    cfe/trunk/Driver/DiagChecker.cpp
    cfe/trunk/Driver/PrintPreprocessedOutput.cpp
    cfe/trunk/Driver/clang.cpp

Modified: cfe/trunk/Driver/DiagChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/DiagChecker.cpp?rev=42800&r1=42799&r2=42800&view=diff

==============================================================================
--- cfe/trunk/Driver/DiagChecker.cpp (original)
+++ cfe/trunk/Driver/DiagChecker.cpp Tue Oct  9 13:03:42 2007
@@ -104,7 +104,7 @@
   do {
     PP.Lex(Tok);
 
-    if (Tok.getKind() == tok::comment) {
+    if (Tok.is(tok::comment)) {
       std::string Comment = PP.getSpelling(Tok);
 
       // Find all expected errors
@@ -115,7 +115,7 @@
       FindDiagnostics(Comment, ExpectedWarnings, PP.getSourceManager(),
                       Tok.getLocation(), ExpectedWarnStr);
     }
-  } while (Tok.getKind() != tok::eof);
+  } while (Tok.isNot(tok::eof));
 
   PP.SetCommentRetentionState(false, false);
 }

Modified: cfe/trunk/Driver/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/PrintPreprocessedOutput.cpp?rev=42800&r1=42799&r2=42800&view=diff

==============================================================================
--- cfe/trunk/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/Driver/PrintPreprocessedOutput.cpp Tue Oct  9 13:03:42 2007
@@ -308,7 +308,7 @@
   // From having the # character end up at column 1, which makes it so it
   // is not handled as a #define next time through the preprocessor if in
   // -fpreprocessed mode.
-  if (ColNo <= 1 && Tok.getKind() == tok::hash)
+  if (ColNo <= 1 && Tok.is(tok::hash))
     OutputChar(' ');
   
   // Otherwise, indent the appropriate number of spaces.
@@ -330,7 +330,7 @@
     OutputString(Prefix, strlen(Prefix));
     
     // Read and print all of the pragma tokens.
-    while (PragmaTok.getKind() != tok::eom) {
+    while (PragmaTok.isNot(tok::eom)) {
       if (PragmaTok.hasLeadingSpace())
         OutputChar(' ');
       std::string TokSpell = PP.getSpelling(PragmaTok);
@@ -430,8 +430,7 @@
 
   if (ConcatInfo & aci_avoid_equal) {
     // If the next token is '=' or '==', avoid concatenation.
-    if (Tok.getKind() == tok::equal ||
-        Tok.getKind() == tok::equalequal)
+    if (Tok.is(tok::equal) || Tok.is(tok::equalequal))
       return true;
     ConcatInfo &= ~aci_avoid_equal;
   }
@@ -464,11 +463,11 @@
   switch (PrevKind) {
   default: assert(0 && "InitAvoidConcatTokenInfo built wrong");
   case tok::identifier:   // id+id or id+number or id+L"foo".
-    if (Tok.getKind() == tok::numeric_constant || Tok.getIdentifierInfo() ||
-        Tok.getKind() == tok::wide_string_literal /* ||
-        Tok.getKind() == tok::wide_char_literal*/)
+    if (Tok.is(tok::numeric_constant) || Tok.getIdentifierInfo() ||
+        Tok.is(tok::wide_string_literal) /* ||
+        Tok.is(tok::wide_char_literal)*/)
       return true;
-    if (Tok.getKind() != tok::char_constant)
+    if (Tok.isNot(tok::char_constant))
       return false;
       
     // FIXME: need a wide_char_constant!
@@ -484,7 +483,7 @@
       return PP.getSpelling(Tok)[0] == 'L';
     }
   case tok::numeric_constant:
-    return isalnum(FirstChar) || Tok.getKind() == tok::numeric_constant ||
+    return isalnum(FirstChar) || Tok.is(tok::numeric_constant) ||
            FirstChar == '+' || FirstChar == '-' || FirstChar == '.';
   case tok::period:          // ..., .*, .1234
     return FirstChar == '.' || FirstChar == '*' || isdigit(FirstChar);
@@ -566,7 +565,7 @@
       OutputString(&S[0], S.size());
     }
     Callbacks->SetEmittedTokensOnThisLine();
-  } while (Tok.getKind() != tok::eof);
+  } while (Tok.isNot(tok::eof));
   OutputChar('\n');
   
   CleanupOutputBuffer();

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=42800&r1=42799&r2=42800&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Tue Oct  9 13:03:42 2007
@@ -791,7 +791,7 @@
   // Lex the file, which will read all the macros.
   Token Tok;
   PP.Lex(Tok);
-  assert(Tok.getKind() == tok::eof && "Didn't read entire file!");
+  assert(Tok.is(tok::eof) && "Didn't read entire file!");
 
   // Once we've read this, we're done.
   return MainFileID;
@@ -821,7 +821,7 @@
       PP.Lex(Tok);
       PP.DumpToken(Tok, true);
       fprintf(stderr, "\n");
-    } while (Tok.getKind() != tok::eof);
+    } while (Tok.isNot(tok::eof));
     ClearSourceMgr = true;
     break;
   }
@@ -831,7 +831,7 @@
     PP.EnterSourceFile(MainFileID, 0, true);
     do {
       PP.Lex(Tok);
-    } while (Tok.getKind() != tok::eof);
+    } while (Tok.isNot(tok::eof));
     ClearSourceMgr = true;
     break;
   }





More information about the cfe-commits mailing list