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 | 517523014d61dfd796dffd8768ec37c40dc98420 (patch) | |
| tree | 8584d67227f26ad5c70060c469e21bed27d0aeb5 /clang/lib/Lex | |
| parent | 2b76c66fd63659be42698094d63a0431ce20a6dc (diff) | |
| download | bcm5719-llvm-517523014d61dfd796dffd8768ec37c40dc98420.tar.gz bcm5719-llvm-517523014d61dfd796dffd8768ec37c40dc98420.zip | |
In MeasureTokenLength, the FileLoc supplied to the lexer must point to the start of the buffer, or we risk overflow.
llvm-svn: 115117
Diffstat (limited to 'clang/lib/Lex')
| -rw-r--r-- | clang/lib/Lex/Lexer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 917829be47c..519dd82285c 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/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); |

