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 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: +// MS: {{^$}} // MS: Note: including file: {{[^ ]*test3.h}} // MS: Note: including file: {{[^ ]*test.h}} // MS: Note: including file: {{[^ ]*test2.h}}