[PATCH] D19881: clang-cl: Print a blank line at the start of /showIncludes (PR27226)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 11:18:46 PDT 2016


hans created this revision.
hans added reviewers: thakis, brad.king.
hans added a subscriber: cfe-commits.

MSVC prints a blank line there, and it turns out CMake (at least currently released versions) expects it to be there.

http://reviews.llvm.org/D19881

Files:
  lib/Frontend/HeaderIncludeGen.cpp
  test/Frontend/print-header-includes.c

Index: test/Frontend/print-header-includes.c
===================================================================
--- test/Frontend/print-header-includes.c
+++ test/Frontend/print-header-includes.c
@@ -8,6 +8,7 @@
 // RUN: %clang_cc1 -I%S -include Inputs/test3.h -E --show-includes -o /dev/null %s | \
 // RUN:     FileCheck --strict-whitespace --check-prefix=MS %s
 // MS-NOT: <command line>
+// MS: {{^$}}
 // MS: Note: including file: {{[^ ]*test3.h}}
 // MS: Note: including file: {{[^ ]*test.h}}
 // MS: Note: including file:  {{[^ ]*test2.h}}
Index: lib/Frontend/HeaderIncludeGen.cpp
===================================================================
--- lib/Frontend/HeaderIncludeGen.cpp
+++ lib/Frontend/HeaderIncludeGen.cpp
@@ -99,6 +99,13 @@
     }
   }
 
+  if (MSStyle) {
+    // MSVC writes a blank line at the start of the output from /showIncludes,
+    // and some tools, such as certain versions of CMake (see PR27226) expect
+    // it to be there.
+    *OutputFile << '\n';
+  }
+
   // Print header info for extra headers, pretending they were discovered by
   // the regular preprocessor. The primary use case is to support proper
   // generation of Make / Ninja file dependencies for implicit includes, such


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19881.56034.patch
Type: text/x-patch
Size: 1231 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160503/70974883/attachment.bin>


More information about the cfe-commits mailing list