]> granicus.if.org Git - clang/commitdiff
convert driver over to use Token::is/isNot APIs. fwew, all done.
authorChris Lattner <sabre@nondot.org>
Tue, 9 Oct 2007 18:03:42 +0000 (18:03 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 9 Oct 2007 18:03:42 +0000 (18:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42800 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/DiagChecker.cpp
Driver/PrintPreprocessedOutput.cpp
Driver/clang.cpp

index e73bed6a748f4c9243367f86e7b54e58509c4a55..3e276d7fa3818a23ec63bc536e56cc4f25b20552 100644 (file)
@@ -104,7 +104,7 @@ static void FindExpectedDiags(Preprocessor &PP, unsigned MainFileID,
   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 @@ static void FindExpectedDiags(Preprocessor &PP, unsigned MainFileID,
       FindDiagnostics(Comment, ExpectedWarnings, PP.getSourceManager(),
                       Tok.getLocation(), ExpectedWarnStr);
     }
-  } while (Tok.getKind() != tok::eof);
+  } while (Tok.isNot(tok::eof));
 
   PP.SetCommentRetentionState(false, false);
 }
index 1cfadb35aa3dcc6181aa476ade7c8e6b31df6941..3c6faa100537b4660fa8dcfcb325373e117740e8 100644 (file)
@@ -308,7 +308,7 @@ void PrintPPOutputPPCallbacks::HandleFirstTokOnLine(Token &Tok) {
   // 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 @@ struct UnknownPragmaHandler : public PragmaHandler {
     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 @@ bool PrintPPOutputPPCallbacks::AvoidConcat(const Token &PrevTok,
 
   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 @@ bool PrintPPOutputPPCallbacks::AvoidConcat(const Token &PrevTok,
   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 @@ bool PrintPPOutputPPCallbacks::AvoidConcat(const Token &PrevTok,
       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 @@ void clang::DoPrintPreprocessedInput(unsigned MainFileID, Preprocessor &PP,
       OutputString(&S[0], S.size());
     }
     Callbacks->SetEmittedTokensOnThisLine();
-  } while (Tok.getKind() != tok::eof);
+  } while (Tok.isNot(tok::eof));
   OutputChar('\n');
   
   CleanupOutputBuffer();
index cbce35a9583e705fb1f69f7e032cc0fb6ed376db..90412cd0266af9334022c1bfdf9142ae760dd2ad 100644 (file)
@@ -791,7 +791,7 @@ static unsigned InitializePreprocessor(Preprocessor &PP,
   // 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 @@ static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID,
       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 @@ static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID,
     PP.EnterSourceFile(MainFileID, 0, true);
     do {
       PP.Lex(Tok);
-    } while (Tok.getKind() != tok::eof);
+    } while (Tok.isNot(tok::eof));
     ClearSourceMgr = true;
     break;
   }