[cfe-commits] r171944 - in /cfe/trunk: lib/Frontend/PrintPreprocessedOutput.cpp test/Preprocessor/print_line_include.c test/Preprocessor/print_line_include.h

Eli Friedman eli.friedman at gmail.com
Tue Jan 8 19:16:42 PST 2013


Author: efriedma
Date: Tue Jan  8 21:16:42 2013
New Revision: 171944

URL: http://llvm.org/viewvc/llvm-project?rev=171944&view=rev
Log:
Make sure clang puts tokens from different files on separate lines in "-E -P" mode.  <rdar://problem/12774044>
 

Added:
    cfe/trunk/test/Preprocessor/print_line_include.c
    cfe/trunk/test/Preprocessor/print_line_include.h
Modified:
    cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp

Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=171944&r1=171943&r2=171944&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Tue Jan  8 21:16:42 2013
@@ -268,7 +268,10 @@
   Lexer::Stringify(CurFilename);
   FileType = NewFileType;
 
-  if (DisableLineMarkers) return;
+  if (DisableLineMarkers) {
+    startNewLineIfNeeded(/*ShouldUpdateCurrentLine=*/false);
+    return;
+  }
   
   if (!Initialized) {
     WriteLineInfo(CurLine);

Added: cfe/trunk/test/Preprocessor/print_line_include.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/print_line_include.c?rev=171944&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/print_line_include.c (added)
+++ cfe/trunk/test/Preprocessor/print_line_include.c Tue Jan  8 21:16:42 2013
@@ -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"

Added: cfe/trunk/test/Preprocessor/print_line_include.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/print_line_include.h?rev=171944&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/print_line_include.h (added)
+++ cfe/trunk/test/Preprocessor/print_line_include.h Tue Jan  8 21:16:42 2013
@@ -0,0 +1 @@
+int x;





More information about the cfe-commits mailing list