[cfe-commits] r115117 - /cfe/trunk/lib/Lex/Lexer.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Wed Sep 29 18:03:03 PDT 2010


Author: cornedbee
Date: Wed Sep 29 20:03:03 2010
New Revision: 115117

URL: http://llvm.org/viewvc/llvm-project?rev=115117&view=rev
Log:
In MeasureTokenLength, the FileLoc supplied to the lexer must point to the start of the buffer, or we risk overflow.

Modified:
    cfe/trunk/lib/Lex/Lexer.cpp

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=115117&r1=115116&r2=115117&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Wed Sep 29 20:03:03 2010
@@ -242,7 +242,8 @@
     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);





More information about the cfe-commits mailing list