[Windows] Add test coverage for line endings when rewriting includes
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>
Tue, 6 Apr 2021 19:35:17 +0000 (15:35 -0400)
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>
Tue, 6 Apr 2021 19:38:19 +0000 (15:38 -0400)
Validate that we're properly generating a single line ending on Windows when
using -frewrite-includes. Otherwise we're breaking split-line macros. The test
fails before 23929af383f27a6ddf23704192a25591481152b3.

See discussion in https://reviews.llvm.org/D96363#2650460 and D99426

Differential Revision: https://reviews.llvm.org/D99973

clang/test/Frontend/rewrite-includes-macros.cpp [new file with mode: 0644]

diff --git a/clang/test/Frontend/rewrite-includes-macros.cpp b/clang/test/Frontend/rewrite-includes-macros.cpp
new file mode 100644 (file)
index 0000000..4a2de54
--- /dev/null
@@ -0,0 +1,14 @@
+// REQUIRES: system-windows\r
+// RUN: %clang_cl /E -Xclang -frewrite-includes %s | %clang_cl /c -Xclang -verify /Tp -\r
+// expected-no-diagnostics\r
+\r
+int foo();\r
+int bar();\r
+#define HELLO \\r
+  foo(); \\r
+  bar();\r
+\r
+int main() {\r
+  HELLO\r
+  return 0;\r
+}\r