Nico Weber | 1f8bad5 | 2016-03-12 19:55:59 +0000 | [diff] [blame] | 1 | // Note: %s and %S must be preceded by --, otherwise it may be interpreted as a |
| 2 | // command-line option, e.g. on Mac where %s is commonly under /Users. |
| 3 | |
| 4 | // Tests interaction of /Yc / /Yu with /showIncludes |
Nico Weber | 627fa8e | 2016-03-13 22:26:26 +0000 | [diff] [blame] | 5 | // REQUIRES: x86-registered-target |
Nico Weber | 1f8bad5 | 2016-03-12 19:55:59 +0000 | [diff] [blame] | 6 | |
| 7 | #include "header3.h" |
| 8 | |
| 9 | // When building the pch, header1.h (included by header2.h), header2.h (the pch |
| 10 | // input itself) and header3.h (included directly, above) should be printed. |
Saleem Abdulrasool | f1d814d | 2018-01-23 17:05:57 +0000 | [diff] [blame] | 11 | // RUN: %clang_cl -Werror --target=x86_64-windows /showIncludes /I%S/Inputs /Ycheader2.h /FIheader2.h /Fp%t.pch /c /Fo%t -- %s \ |
Nico Weber | 149d9522 | 2016-03-23 18:00:22 +0000 | [diff] [blame] | 12 | // RUN: | FileCheck --strict-whitespace -check-prefix=CHECK-YC %s |
| 13 | // CHECK-YC: Note: including file: {{[^ ]*header2.h}} |
Nico Weber | f54146c | 2016-03-23 18:46:57 +0000 | [diff] [blame] | 14 | // CHECK-YC: Note: including file: {{[^ ]*header1.h}} |
Nico Weber | 149d9522 | 2016-03-23 18:00:22 +0000 | [diff] [blame] | 15 | // CHECK-YC: Note: including file: {{[^ ]*header3.h}} |
Nico Weber | 1f8bad5 | 2016-03-12 19:55:59 +0000 | [diff] [blame] | 16 | |
| 17 | // When using the pch, only the direct include is printed. |
Saleem Abdulrasool | f1d814d | 2018-01-23 17:05:57 +0000 | [diff] [blame] | 18 | // RUN: %clang_cl -Werror --target=x86_64-windows /showIncludes /I%S/Inputs /Yuheader2.h /FIheader2.h /Fp%t.pch /c /Fo%t -- %s \ |
Nico Weber | 149d9522 | 2016-03-23 18:00:22 +0000 | [diff] [blame] | 19 | // RUN: | FileCheck --strict-whitespace -check-prefix=CHECK-YU %s |
Nico Weber | deed64e | 2016-03-13 03:04:46 +0000 | [diff] [blame] | 20 | // CHECK-YU-NOT: Note: including file: {{.*pch}} |
Nico Weber | 1f8bad5 | 2016-03-12 19:55:59 +0000 | [diff] [blame] | 21 | // CHECK-YU-NOT: Note: including file: {{.*header1.h}} |
| 22 | // CHECK-YU-NOT: Note: including file: {{.*header2.h}} |
Nico Weber | 149d9522 | 2016-03-23 18:00:22 +0000 | [diff] [blame] | 23 | // CHECK-YU: Note: including file: {{[^ ]*header3.h}} |
Nico Weber | d1728f0 | 2016-03-23 18:17:02 +0000 | [diff] [blame] | 24 | |
| 25 | // When not using pch at all, all the /FI files are printed. |
Saleem Abdulrasool | f1d814d | 2018-01-23 17:05:57 +0000 | [diff] [blame] | 26 | // RUN: %clang_cl -Werror --target=x86_64-windows /showIncludes /I%S/Inputs /FIheader2.h /c /Fo%t -- %s \ |
Nico Weber | d1728f0 | 2016-03-23 18:17:02 +0000 | [diff] [blame] | 27 | // RUN: | FileCheck --strict-whitespace -check-prefix=CHECK-FI %s |
| 28 | // CHECK-FI: Note: including file: {{[^ ]*header2.h}} |
| 29 | // CHECK-FI: Note: including file: {{[^ ]*header1.h}} |
| 30 | // CHECK-FI: Note: including file: {{[^ ]*header3.h}} |
| 31 | |
| 32 | // Also check that /FI arguments before the /Yc / /Yu flags are printed right. |
| 33 | |
| 34 | // /FI flags before the /Yc arg should be printed, /FI flags after it shouldn't. |
Saleem Abdulrasool | f1d814d | 2018-01-23 17:05:57 +0000 | [diff] [blame] | 35 | // RUN: %clang_cl -Werror --target=x86_64-windows /showIncludes /I%S/Inputs /Ycheader2.h /FIheader0.h /FIheader2.h /FIheader4.h /Fp%t.pch /c /Fo%t -- %s \ |
Nico Weber | d1728f0 | 2016-03-23 18:17:02 +0000 | [diff] [blame] | 36 | // RUN: | FileCheck --strict-whitespace -check-prefix=CHECK-YCFI %s |
Nico Weber | d1728f0 | 2016-03-23 18:17:02 +0000 | [diff] [blame] | 37 | // CHECK-YCFI: Note: including file: {{[^ ]*header0.h}} |
Nico Weber | f54146c | 2016-03-23 18:46:57 +0000 | [diff] [blame] | 38 | // CHECK-YCFI: Note: including file: {{[^ ]*header2.h}} |
| 39 | // CHECK-YCFI: Note: including file: {{[^ ]*header1.h}} |
Nico Weber | d1728f0 | 2016-03-23 18:17:02 +0000 | [diff] [blame] | 40 | // CHECK-YCFI: Note: including file: {{[^ ]*header4.h}} |
| 41 | // CHECK-YCFI: Note: including file: {{[^ ]*header3.h}} |
| 42 | |
Saleem Abdulrasool | f1d814d | 2018-01-23 17:05:57 +0000 | [diff] [blame] | 43 | // RUN: %clang_cl -Werror --target=x86_64-windows /showIncludes /I%S/Inputs /Yuheader2.h /FIheader0.h /FIheader2.h /FIheader4.h /Fp%t.pch /c /Fo%t -- %s \ |
Nico Weber | d1728f0 | 2016-03-23 18:17:02 +0000 | [diff] [blame] | 44 | // RUN: | FileCheck --strict-whitespace -check-prefix=CHECK-YUFI %s |
| 45 | // CHECK-YUFI-NOT: Note: including file: {{.*pch}} |
| 46 | // CHECK-YUFI-NOT: Note: including file: {{.*header0.h}} |
| 47 | // CHECK-YUFI-NOT: Note: including file: {{.*header2.h}} |
| 48 | // CHECK-YUFI-NOT: Note: including file: {{.*header1.h}} |
| 49 | // CHECK-YUFI: Note: including file: {{[^ ]*header4.h}} |
| 50 | // CHECK-YUFI: Note: including file: {{[^ ]*header3.h}} |