]> granicus.if.org Git - clang/commitdiff
clang-cl: Add a test for the interaction of /Yc and /showIncludes.
authorNico Weber <nicolasweber@gmx.de>
Sat, 12 Mar 2016 19:55:59 +0000 (19:55 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sat, 12 Mar 2016 19:55:59 +0000 (19:55 +0000)
We almost get this right, but not completely (see FIXME).  It looks like /FI
headers generally aren't included in /showIncludes yet, but they should be.
But it seems good to have test coverage for the bits that already work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263344 91177308-0d34-0410-b5e6-96231b3b80d8

test/Driver/Inputs/header1.h [new file with mode: 0644]
test/Driver/Inputs/header2.h [new file with mode: 0644]
test/Driver/Inputs/header3.h [new file with mode: 0644]
test/Driver/cl-pch-showincludes.cpp [new file with mode: 0644]

diff --git a/test/Driver/Inputs/header1.h b/test/Driver/Inputs/header1.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/Driver/Inputs/header2.h b/test/Driver/Inputs/header2.h
new file mode 100644 (file)
index 0000000..243468d
--- /dev/null
@@ -0,0 +1 @@
+#include "header1.h"
diff --git a/test/Driver/Inputs/header3.h b/test/Driver/Inputs/header3.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/Driver/cl-pch-showincludes.cpp b/test/Driver/cl-pch-showincludes.cpp
new file mode 100644 (file)
index 0000000..1fe25c0
--- /dev/null
@@ -0,0 +1,22 @@
+// Note: %s and %S must be preceded by --, otherwise it may be interpreted as a
+// command-line option, e.g. on Mac where %s is commonly under /Users.
+
+// Tests interaction of /Yc / /Yu with /showIncludes
+
+#include "header3.h"
+
+// When building the pch, header1.h (included by header2.h), header2.h (the pch
+// input itself) and header3.h (included directly, above) should be printed.
+// RUN: %clang_cl -Werror /showIncludes /I%S/Inputs /Ycheader2.h /FIheader2.h /Fp%t.pch /c -- %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-YC %s
+// FIXME: clang-cl doesn't print "header2.h" yet, next line shouldn't say -NOT
+// CHECK-YC-NOT: Note: including file: {{.*header2.h}}
+// CHECK-YC: Note: including file: {{.*header1.h}}
+// CHECK-YC: Note: including file: {{.*header3.h}}
+
+// When using the pch, only the direct include is printed.
+// RUN: %clang_cl -Werror /showIncludes /I%S/Inputs /Yuheader2.h /FIheader2.h /Fp%t.pch /c -- %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-YU %s
+// CHECK-YU-NOT: Note: including file: {{.*header1.h}}
+// CHECK-YU-NOT: Note: including file: {{.*header2.h}}
+// CHECK-YU: Note: including file: {{.*header3.h}}