diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-17 07:42:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-17 07:42:27 +0000 |
commit | fcf6452eb41c898e184b3407ae61a1364bca4ab9 (patch) | |
tree | ff55fe802f063719bae4d277925ed9d557f4d122 /clang/lib/Lex/Lexer.cpp | |
parent | 1db27eefa16cf4bcc4613b34f4e35faf1a0b09e3 (diff) | |
download | bcm5719-llvm-fcf6452eb41c898e184b3407ae61a1364bca4ab9.tar.gz bcm5719-llvm-fcf6452eb41c898e184b3407ae61a1364bca4ab9.zip |
make the verbose raw-lexer ctor fully explicit instead of having
embedded magic.
llvm-svn: 62417
Diffstat (limited to 'clang/lib/Lex/Lexer.cpp')
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 704c4db661a..c5b36fce613 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -124,15 +124,9 @@ Lexer::Lexer(SourceLocation fileloc, Preprocessor &PP, /// suitable for calls to 'LexRawToken'. This lexer assumes that the text /// range will outlive it, so it doesn't take ownership of it. Lexer::Lexer(SourceLocation fileloc, const LangOptions &features, - const char *BufPtr, const char *BufEnd, - const llvm::MemoryBuffer *FromFile) + const char *BufStart, const char *BufPtr, const char *BufEnd) : FileLoc(fileloc), Features(features) { - // If a MemoryBuffer was specified, use its start as BufferStart. This affects - // the source location objects produced by this lexer. - const char *BufStart = BufPtr; - if (FromFile) BufStart = FromFile->getBufferStart(); - InitLexer(BufStart, BufPtr, BufEnd); // We *are* in raw mode. @@ -197,7 +191,7 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc, // all obviously single-char tokens. This could use // Lexer::isObviouslySimpleCharacter for example to handle identifiers or // something. - const char *BufEnd = SM.getBufferData(Loc).second; + std::pair<const char *,const char *> Buffer = SM.getBufferData(Loc); // Create a langops struct and enable trigraphs. This is sufficient for // measuring tokens. @@ -205,7 +199,7 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc, LangOpts.Trigraphs = true; // Create a lexer starting at the beginning of this token. - Lexer TheLexer(Loc, LangOpts, StrData, BufEnd); + Lexer TheLexer(Loc, LangOpts, Buffer.first, StrData, Buffer.second); Token TheTok; TheLexer.LexFromRawLexer(TheTok); return TheTok.getLength(); |