summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite/Frontend
diff options
context:
space:
mode:
authorLubos Lunak <l.lunak@centrum.cz>2014-05-01 21:10:08 +0000
committerLubos Lunak <l.lunak@centrum.cz>2014-05-01 21:10:08 +0000
commit72cad68b302d113d739566112c960e6ff60d1b96 (patch)
tree78496d41f98560fe142c4f3a2eef4a61730b4f76 /clang/lib/Rewrite/Frontend
parentbf8a9ac768ec0bcf72a5e425954ad033e10a45eb (diff)
downloadbcm5719-llvm-72cad68b302d113d739566112c960e6ff60d1b96.tar.gz
bcm5719-llvm-72cad68b302d113d739566112c960e6ff60d1b96.zip
do not use "1" for line marker for the predefines "file" either
Similar to r207764. llvm-svn: 207794
Diffstat (limited to 'clang/lib/Rewrite/Frontend')
-rw-r--r--clang/lib/Rewrite/Frontend/InclusionRewriter.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp b/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp
index ad8328e7ca1..d6a434d80ad 100644
--- a/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp
+++ b/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp
@@ -250,6 +250,10 @@ void InclusionRewriter::CommentOutDirective(Lexer &DirectiveLex,
do {
DirectiveLex.LexFromRawLexer(DirectiveToken);
} while (!DirectiveToken.is(tok::eod) && DirectiveToken.isNot(tok::eof));
+ if (&FromFile == PredefinesBuffer) {
+ // OutputContentUpTo() would not output anything anyway.
+ return;
+ }
OS << "#if 0 /* expanded by -frewrite-includes */" << EOL;
OutputContentUpTo(FromFile, NextToWrite,
SM.getFileOffset(DirectiveToken.getLocation()) + DirectiveToken.getLength(),
@@ -353,7 +357,7 @@ bool InclusionRewriter::Process(FileID FileId,
StringRef EOL = DetectEOL(FromFile);
// Per the GNU docs: "1" indicates entering a new file.
- if (FileId == SM.getMainFileID())
+ if (FileId == SM.getMainFileID() || FileId == PP.getPredefinesFileID())
WriteLineInfo(FileName, 1, FileType, EOL, "");
else
WriteLineInfo(FileName, 1, FileType, EOL, " 1");
OpenPOWER on IntegriCloud