Should this be using the presumed loc? That gets reset by #line and such. Jordan
On Dec 4, 2013, at 19:41 , Alp Toker <[email protected]> wrote: > Author: alp > Date: Wed Dec 4 21:41:20 2013 > New Revision: 196461 > > URL: http://llvm.org/viewvc/llvm-project?rev=196461&view=rev > Log: > 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. > > Modified: > cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp > > Modified: cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp?rev=196461&r1=196460&r2=196461&view=diff > ============================================================================== > --- cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp (original) > +++ cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp Wed Dec 4 21:41:20 > 2013 > @@ -363,9 +363,11 @@ bool InclusionRewriter::Process(FileID F > 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; > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
