A raw lexer in its initial state is guaranteed to be on line number one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196461
91177308-0d34-0410-b5e6-
96231b3b80d8
if (SM.getFileIDSize(FileId) == 0)
return false;
+ SourceLocation StartLoc = RawLex.getSourceLocation();
// The next byte to be copied from the source file, which may be non-zero if
// the lexer handled a BOM.
- unsigned NextToWrite = SM.getFileOffset(RawLex.getSourceLocation());
+ unsigned NextToWrite = SM.getFileOffset(StartLoc);
+ assert(SM.getPresumedLoc(StartLoc).getLine() == 1);
int Line = 1; // The current input file line number.
Token RawToken;