From: Alp Toker Date: Thu, 5 Dec 2013 17:28:42 +0000 (+0000) Subject: Check the initial line number without going through PresumedLoc X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6909a5a3b8c0d14000cca30dfb5b31502c802a4;p=clang Check the initial line number without going through PresumedLoc No practical difference in this case and would return 1 either way, but this is more self-explanatory. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196511 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Rewrite/Frontend/InclusionRewriter.cpp b/lib/Rewrite/Frontend/InclusionRewriter.cpp index 16c6d86f73..a2e0db6961 100644 --- a/lib/Rewrite/Frontend/InclusionRewriter.cpp +++ b/lib/Rewrite/Frontend/InclusionRewriter.cpp @@ -363,11 +363,10 @@ 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(StartLoc); - assert(SM.getPresumedLoc(StartLoc).getLine() == 1); + unsigned NextToWrite = SM.getFileOffset(RawLex.getSourceLocation()); + assert(SM.getLineNumber(FileId, NextToWrite) == 1); int Line = 1; // The current input file line number. Token RawToken;