1 // Note: %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.
4 // RUN: %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=BUILTIN
5 // BUILTIN: "-internal-isystem" "{{.*lib.*clang.*include}}"
7 // RUN: %clang_cl -nobuiltininc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOBUILTIN
8 // NOBUILTIN-NOT: "-internal-isystem" "{{.*lib.*clang.*include}}"
10 // RUN: env INCLUDE=/my/system/inc env EXTERNAL_INCLUDE=/my/system/inc2 %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=STDINC
11 // STDINC: "-internal-isystem" "/my/system/inc"
12 // STDINC: "-internal-isystem" "/my/system/inc2"
14 // -nostdinc suppresses all of %INCLUDE%, clang resource dirs, and -imsvc dirs.
15 // RUN: env INCLUDE=/my/system/inc env EXTERNAL_INCLUDE=/my/system/inc2 %clang_cl -nostdinc -imsvc /my/other/inc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC
16 // NOSTDINC: argument unused{{.*}}-imsvc
17 // NOSTDINC-NOT: "-internal-isystem" "/my/system/inc"
18 // NOSTDINC-NOT: "-internal-isystem" "/my/system/inc2"
19 // NOSTDINC-NOT: "-internal-isystem" "{{.*lib.*clang.*include}}"
20 // NOSTDINC-NOT: "-internal-isystem" "/my/other/inc"
22 // /X suppresses %INCLUDE% and %EXTERNAL_INCLUDE% but not clang resource dirs, -imsvc dirs, or /external: flags.
23 // RUN: env INCLUDE=/my/system/inc env EXTERNAL_INCLUDE=/my/system/inc2 env FOO=/my/other/inc2 %clang_cl /X -imsvc /my/other/inc /external:env:FOO -### -- %s 2>&1 | FileCheck %s --check-prefix=SLASHX
24 // SLASHX-NOT: "argument unused{{.*}}-imsvc"
25 // SLASHX-NOT: "-internal-isystem" "/my/system/inc"
26 // SLASHX-NOT: "-internal-isystem" "/my/system/inc2"
27 // SLASHX: "-internal-isystem" "{{.*lib.*clang.*include}}"
28 // SLASHX: "-internal-isystem" "/my/other/inc"
29 // SLASHX: "-internal-isystem" "/my/other/inc2"
31 // /winsysroot suppresses %EXTERNAL_INCLUDE% but not -imsvc dirs or /external: flags.
32 // RUN: env env EXTERNAL_INCLUDE=/my/system/inc env FOO=/my/other/inc2 %clang_cl /winsysroot /foo -imsvc /my/other/inc /external:env:FOO -### -- %s 2>&1 | FileCheck %s --check-prefix=SYSROOT
33 // SYSROOT-NOT: "argument unused{{.*}}-imsvc"
34 // SYSROOT-NOT: "argument unused{{.*}}/external:"
35 // SYSROOT-NOT: "/my/system/inc"
36 // SYSROOT: "-internal-isystem" "/my/other/inc"
37 // SYSROOT: "-internal-isystem" "/my/other/inc2"
38 // SYSROOT: "-internal-isystem" "/foo{{.*}}"
40 // RUN: env "FOO=/dir1;/dir2" env "BAR=/dir3" %clang_cl /external:env:FOO /external:env:BAR -### -- %s 2>&1 | FileCheck %s --check-prefix=EXTERNAL_ENV
41 // EXTERNAL_ENV: "-internal-isystem" "/dir1"
42 // EXTERNAL_ENV: "-internal-isystem" "/dir2"
43 // EXTERNAL_ENV: "-internal-isystem" "/dir3"