diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-09-30 01:03:03 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2010-09-30 01:03:03 +0000 |
commit | c3526d89ef9c31639ec8b25180cfb22354344241 (patch) | |
tree | 9e7959e1fd8feab21f854cc3409bdfebe98a5db0 /lib/Lex/Lexer.cpp | |
parent | 61238746aac026c5d644bdce4fc54b534b677c2f (diff) |
In MeasureTokenLength, the FileLoc supplied to the lexer must point to the start of the buffer, or we risk overflow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115117 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 917829be47..519dd82285 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -242,7 +242,8 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc, return 0; // Create a lexer starting at the beginning of this token. - Lexer TheLexer(Loc, LangOpts, Buffer.begin(), StrData, Buffer.end()); + Lexer TheLexer(SM.getLocForStartOfFile(LocInfo.first), LangOpts, + Buffer.begin(), StrData, Buffer.end()); TheLexer.SetCommentRetentionState(true); Token TheTok; TheLexer.LexFromRawLexer(TheTok); |