diff options
author | Alp Toker <alp@nuanti.com> | 2013-12-05 03:41:20 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2013-12-05 03:41:20 +0000 |
commit | f580a3cc057d6b7d2f1a2f672ea4c4e9ddbe209a (patch) | |
tree | 8b823b3b9694c55dacbee2324315351e37230240 /clang/lib/Rewrite/Frontend | |
parent | 4655681c27f3fdf9619dede260d1e7a719d9f13f (diff) | |
download | bcm5719-llvm-f580a3cc057d6b7d2f1a2f672ea4c4e9ddbe209a.tar.gz bcm5719-llvm-f580a3cc057d6b7d2f1a2f672ea4c4e9ddbe209a.zip |
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
Diffstat (limited to 'clang/lib/Rewrite/Frontend')
-rw-r--r-- | clang/lib/Rewrite/Frontend/InclusionRewriter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp b/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp index 176ea3f79dc..16c6d86f739 100644 --- a/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp +++ b/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp @@ -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; |