From: Chris Lattner Date: Tue, 9 Oct 2007 18:03:42 +0000 (+0000) Subject: convert driver over to use Token::is/isNot APIs. fwew, all done. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=057aaf6304a5f59bcafa7b46c19625bb779af1d1;p=clang convert driver over to use Token::is/isNot APIs. fwew, all done. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42800 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/DiagChecker.cpp b/Driver/DiagChecker.cpp index e73bed6a74..3e276d7fa3 100644 --- a/Driver/DiagChecker.cpp +++ b/Driver/DiagChecker.cpp @@ -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); } diff --git a/Driver/PrintPreprocessedOutput.cpp b/Driver/PrintPreprocessedOutput.cpp index 1cfadb35aa..3c6faa1005 100644 --- a/Driver/PrintPreprocessedOutput.cpp +++ b/Driver/PrintPreprocessedOutput.cpp @@ -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(); diff --git a/Driver/clang.cpp b/Driver/clang.cpp index cbce35a958..90412cd026 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -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; }