]> granicus.if.org Git - clang/commitdiff
Check the initial line number without going through PresumedLoc
authorAlp Toker <alp@nuanti.com>
Thu, 5 Dec 2013 17:28:42 +0000 (17:28 +0000)
committerAlp Toker <alp@nuanti.com>
Thu, 5 Dec 2013 17:28:42 +0000 (17:28 +0000)
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

lib/Rewrite/Frontend/InclusionRewriter.cpp

index 16c6d86f7399b329d4a9bc6e53ebd28d479dbb3f..a2e0db6961982856c8a1f2cfc88122d79491ae7b 100644 (file)
@@ -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;