Add an assert to make it clear we're on the first line

A raw lexer in its initial state is guaranteed to be on line number one.

llvm-svn: 196461
This commit is contained in:
Alp Toker 2013-12-05 03:41:20 +00:00
parent 4655681c27
commit f580a3cc05
1 changed files with 3 additions and 1 deletions

View File

@ -363,9 +363,11 @@ bool InclusionRewriter::Process(FileID FileId,
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;