convert driver over to use Token::is/isNot APIs. fwew, all done.

llvm-svn: 42800
This commit is contained in:
Chris Lattner 2007-10-09 18:03:42 +00:00
parent 98c1f7cfde
commit 3c69f12cbc
3 changed files with 14 additions and 15 deletions

View 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);
}

View 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();

View 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;
}