use simplified Lexer ctor.

llvm-svn: 62416
This commit is contained in:
Chris Lattner 2009-01-17 07:41:36 +00:00
parent f9291cf43c
commit 1db27eefa1
2 changed files with 2 additions and 7 deletions

View File

@ -118,12 +118,9 @@ static void FindExpectedDiags(Preprocessor &PP,
// Create a raw lexer to pull all the comments out of the main file. We don't
// want to look in #include'd headers for expected-error strings.
FileID FID = PP.getSourceManager().getMainFileID();
std::pair<const char*,const char*> File =
PP.getSourceManager().getBufferData(FID);
// Create a lexer to lex all the tokens of the main file in raw mode.
Lexer RawLex(PP.getSourceManager().getLocForStartOfFile(FID),
PP.getLangOptions(), File.first, File.second);
Lexer RawLex(FID, PP.getSourceManager(), PP.getLangOptions());
// Return comments as tokens, this is how we find expected diagnostics.
RawLex.SetCommentRetentionState(true);

View File

@ -61,12 +61,10 @@ static const Token &GetNextRawTok(const std::vector<Token> &RawTokens,
static void LexRawTokensFromMainFile(Preprocessor &PP,
std::vector<Token> &RawTokens) {
SourceManager &SM = PP.getSourceManager();
std::pair<const char*,const char*> File =SM.getBufferData(SM.getMainFileID());
// Create a lexer to lex all the tokens of the main file in raw mode. Even
// though it is in raw mode, it will not return comments.
Lexer RawLex(SM.getLocForStartOfFile(SM.getMainFileID()),
PP.getLangOptions(), File.first, File.second);
Lexer RawLex(SM.getMainFileID(), SM, PP.getLangOptions());
// Switch on comment lexing because we really do want them.
RawLex.SetCommentRetentionState(true);