diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-17 08:03:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-17 08:03:42 +0000 |
commit | c809089b26dd334313b15cef0defa9e4d018a1aa (patch) | |
tree | aa6e49adbddb1c05b8577ed35c5080bcf1352df1 /clang/lib/Lex/Lexer.cpp | |
parent | 8ee1c9f220d0c9b3dab867bf3237d1400b82adfb (diff) | |
download | bcm5719-llvm-c809089b26dd334313b15cef0defa9e4d018a1aa.tar.gz bcm5719-llvm-c809089b26dd334313b15cef0defa9e4d018a1aa.zip |
Change the Lexer ctor used in the non _Pragma case to take a FileID instead
of a SourceLocation. This should speed it up and definitely simplifies it.
llvm-svn: 62422
Diffstat (limited to 'clang/lib/Lex/Lexer.cpp')
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index c379f58b0c6..772a4d9684d 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -94,17 +94,12 @@ void Lexer::InitLexer(const char *BufStart, const char *BufPtr, /// with the specified preprocessor managing the lexing process. This lexer /// assumes that the associated file buffer and Preprocessor objects will /// outlive it, so it doesn't take ownership of either of them. -Lexer::Lexer(SourceLocation fileloc, Preprocessor &PP) -// FIXME: This is really horrible and only needed for _Pragma lexers, split this -// out of the main lexer path! -: PreprocessorLexer(&PP, - PP.getSourceManager().getCanonicalFileID( - PP.getSourceManager().getSpellingLoc(fileloc))), - FileLoc(fileloc), - Features(PP.getLangOptions()) { +Lexer::Lexer(FileID FID, Preprocessor &PP) + : PreprocessorLexer(&PP, FID), + FileLoc(PP.getSourceManager().getLocForStartOfFile(FID)), + Features(PP.getLangOptions()) { - SourceManager &SourceMgr = PP.getSourceManager(); - const llvm::MemoryBuffer *InputFile = SourceMgr.getBuffer(getFileID()); + const llvm::MemoryBuffer *InputFile = PP.getSourceManager().getBuffer(FID); InitLexer(InputFile->getBufferStart(), InputFile->getBufferStart(), InputFile->getBufferEnd()); @@ -124,7 +119,7 @@ Lexer::Lexer(SourceLocation fileloc, Preprocessor &PP, : PreprocessorLexer(&PP, PP.getSourceManager().getCanonicalFileID( PP.getSourceManager().getSpellingLoc(fileloc))), - FileLoc(fileloc), + FileLoc(fileloc), Features(PP.getLangOptions()) { InitLexer(PP.getSourceManager().getBuffer(getFileID())->getBufferStart(), |