51 lines · cpp
1// Note: %s and %S must be preceded by --, otherwise it may be interpreted as a2// command-line option, e.g. on Mac where %s is commonly under /Users.3 4// Tests interaction of /Yc / /Yu with /showIncludes5// REQUIRES: x86-registered-target6 7#include "header3.h"8 9// When building the pch, header1.h (included by header2.h), header2.h (the pch10// input itself) and header3.h (included directly, above) should be printed.11// RUN: %clang_cl -Werror --target=x86_64-windows /showIncludes /I%S/Inputs /Ycheader2.h /FIheader2.h /Fp%t.pch /c /Fo%t -- %s \12// RUN: | FileCheck --strict-whitespace -check-prefix=CHECK-YC %s13// CHECK-YC: Note: including file: {{[^ ]*header2.h}}14// CHECK-YC: Note: including file: {{[^ ]*header1.h}}15// CHECK-YC: Note: including file: {{[^ ]*header3.h}}16 17// When using the pch, only the direct include is printed.18// RUN: %clang_cl -Werror --target=x86_64-windows /showIncludes /I%S/Inputs /Yuheader2.h /FIheader2.h /Fp%t.pch /c /Fo%t -- %s \19// RUN: | FileCheck --strict-whitespace -check-prefix=CHECK-YU %s20// CHECK-YU-NOT: Note: including file: {{.*pch}}21// CHECK-YU-NOT: Note: including file: {{.*header1.h}}22// CHECK-YU-NOT: Note: including file: {{.*header2.h}}23// CHECK-YU: Note: including file: {{[^ ]*header3.h}}24 25// When not using pch at all, all the /FI files are printed.26// RUN: %clang_cl -Werror --target=x86_64-windows /showIncludes /I%S/Inputs /FIheader2.h /c /Fo%t -- %s \27// RUN: | FileCheck --strict-whitespace -check-prefix=CHECK-FI %s28// 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.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 \36// RUN: | FileCheck --strict-whitespace -check-prefix=CHECK-YCFI %s37// CHECK-YCFI: Note: including file: {{[^ ]*header0.h}}38// CHECK-YCFI: Note: including file: {{[^ ]*header2.h}}39// CHECK-YCFI: Note: including file: {{[^ ]*header1.h}}40// CHECK-YCFI: Note: including file: {{[^ ]*header4.h}}41// CHECK-YCFI: Note: including file: {{[^ ]*header3.h}}42 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 \44// RUN: | FileCheck --strict-whitespace -check-prefix=CHECK-YUFI %s45// 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}}51