r263344 - clang-cl: Add a test for the interaction of /Yc and /showIncludes.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 12 11:56:00 PST 2016


Author: nico
Date: Sat Mar 12 13:55:59 2016
New Revision: 263344

URL: http://llvm.org/viewvc/llvm-project?rev=263344&view=rev
Log:
clang-cl: Add a test for the interaction of /Yc and /showIncludes.

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.

Added:
    cfe/trunk/test/Driver/Inputs/header1.h
    cfe/trunk/test/Driver/Inputs/header2.h
    cfe/trunk/test/Driver/Inputs/header3.h
    cfe/trunk/test/Driver/cl-pch-showincludes.cpp

Added: cfe/trunk/test/Driver/Inputs/header1.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/header1.h?rev=263344&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/header2.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/header2.h?rev=263344&view=auto
==============================================================================
--- cfe/trunk/test/Driver/Inputs/header2.h (added)
+++ cfe/trunk/test/Driver/Inputs/header2.h Sat Mar 12 13:55:59 2016
@@ -0,0 +1 @@
+#include "header1.h"

Added: cfe/trunk/test/Driver/Inputs/header3.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/header3.h?rev=263344&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/cl-pch-showincludes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-pch-showincludes.cpp?rev=263344&view=auto
==============================================================================
--- cfe/trunk/test/Driver/cl-pch-showincludes.cpp (added)
+++ cfe/trunk/test/Driver/cl-pch-showincludes.cpp Sat Mar 12 13:55:59 2016
@@ -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}}




More information about the cfe-commits mailing list