summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2013-01-09 03:16:42 +0000
committerEli Friedman <eli.friedman@gmail.com>2013-01-09 03:16:42 +0000
commitc52435b4a254af96128c19e473071ec30cfb51f2 (patch)
tree6004c6cb005bae3a6c52fe6fce0e74c9d7a3f6f1
parentd7678c6af510b224795d36acca83afc7396f8f7c (diff)
downloadbcm5719-llvm-c52435b4a254af96128c19e473071ec30cfb51f2.tar.gz
bcm5719-llvm-c52435b4a254af96128c19e473071ec30cfb51f2.zip
Make sure clang puts tokens from different files on separate lines in "-E -P" mode. <rdar://problem/12774044>
llvm-svn: 171944
-rw-r--r--clang/lib/Frontend/PrintPreprocessedOutput.cpp5
-rw-r--r--clang/test/Preprocessor/print_line_include.c6
-rw-r--r--clang/test/Preprocessor/print_line_include.h1
3 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index afad0a9f5ff..02da71bbbe8 100644
--- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -268,7 +268,10 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc,
Lexer::Stringify(CurFilename);
FileType = NewFileType;
- if (DisableLineMarkers) return;
+ if (DisableLineMarkers) {
+ startNewLineIfNeeded(/*ShouldUpdateCurrentLine=*/false);
+ return;
+ }
if (!Initialized) {
WriteLineInfo(CurLine);
diff --git a/clang/test/Preprocessor/print_line_include.c b/clang/test/Preprocessor/print_line_include.c
new file mode 100644
index 00000000000..d65873cb736
--- /dev/null
+++ b/clang/test/Preprocessor/print_line_include.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -E -P %s | FileCheck %s
+// CHECK: int x;
+// CHECK-NEXT: int x;
+
+#include "print_line_include.h"
+#include "print_line_include.h"
diff --git a/clang/test/Preprocessor/print_line_include.h b/clang/test/Preprocessor/print_line_include.h
new file mode 100644
index 00000000000..6d1a0d47b7f
--- /dev/null
+++ b/clang/test/Preprocessor/print_line_include.h
@@ -0,0 +1 @@
+int x;
OpenPOWER on IntegriCloud