]> granicus.if.org Git - clang/commitdiff
Make sure clang puts tokens from different files on separate lines in "-E -P" mode...
authorEli Friedman <eli.friedman@gmail.com>
Wed, 9 Jan 2013 03:16:42 +0000 (03:16 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 9 Jan 2013 03:16:42 +0000 (03:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171944 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PrintPreprocessedOutput.cpp
test/Preprocessor/print_line_include.c [new file with mode: 0644]
test/Preprocessor/print_line_include.h [new file with mode: 0644]

index afad0a9f5ff39dc810540f1ef23e9c0a52283bce..02da71bbbe85165e7e8e56c665692ac954633e0c 100644 (file)
@@ -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/test/Preprocessor/print_line_include.c b/test/Preprocessor/print_line_include.c
new file mode 100644 (file)
index 0000000..d65873c
--- /dev/null
@@ -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/test/Preprocessor/print_line_include.h b/test/Preprocessor/print_line_include.h
new file mode 100644 (file)
index 0000000..6d1a0d4
--- /dev/null
@@ -0,0 +1 @@
+int x;