summaryrefslogtreecommitdiffstats
path: root/lib/Rewrite
diff options
context:
space:
mode:
authorLubos Lunak <l.lunak@centrum.cz>2014-05-01 13:50:44 +0000
committerLubos Lunak <l.lunak@centrum.cz>2014-05-01 13:50:44 +0000
commit9de1702d31ae13c59ba9427343ec867fe7da3427 (patch)
tree8f6bd17d9ac4dfa4c402b00802539bd140d87c4d /lib/Rewrite
parent02a0ec22e7a838ac2a13eda15ceb840511186a3c (diff)
do not use "1" for line marker for the main file
"1" means entering a new file (from a different one), but the main file is not included from anything (and this would e.g. confuse -Wunused-macros to not report unused macros in the main file, see pr15610, or also see pr18948). The line marker is still useful e.g. if the resulting file is renamed or used via a pipe. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207764 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite')
-rw-r--r--lib/Rewrite/Frontend/InclusionRewriter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Rewrite/Frontend/InclusionRewriter.cpp b/lib/Rewrite/Frontend/InclusionRewriter.cpp
index 4a7d69c26a..ad8328e7ca 100644
--- a/lib/Rewrite/Frontend/InclusionRewriter.cpp
+++ b/lib/Rewrite/Frontend/InclusionRewriter.cpp
@@ -352,8 +352,11 @@ bool InclusionRewriter::Process(FileID FileId,
StringRef EOL = DetectEOL(FromFile);
- // Per the GNU docs: "1" indicates the start of a new file.
- WriteLineInfo(FileName, 1, FileType, EOL, " 1");
+ // Per the GNU docs: "1" indicates entering a new file.
+ if (FileId == SM.getMainFileID())
+ WriteLineInfo(FileName, 1, FileType, EOL, "");
+ else
+ WriteLineInfo(FileName, 1, FileType, EOL, " 1");
if (SM.getFileIDSize(FileId) == 0)
return false;