1 // REQUIRES: system-windows
2 // RUN: %clang -E -fno-file-reproducible -target x86_64-pc-win32 -ffile-prefix-map=%p=A:\UNLIKELY_PATH\empty -c -o - %s | FileCheck %s
3 // RUN: %clang -E -fno-file-reproducible -target x86_64-pc-win32 -fmacro-prefix-map=%p=A:\UNLIKELY_PATH\empty -c -o - %s | FileCheck %s
4 // RUN: %clang -E -fno-file-reproducible -target x86_64-pc-win32 -fmacro-prefix-map=%p=A:\UNLIKELY_PATH=empty -c -o - %s | FileCheck %s -check-prefix CHECK-EVIL
5 // RUN: %clang -E -fno-file-reproducible -target x86_64-pc-win32 -fmacro-prefix-map=%p/iNPUTS\=A:\UNLIKELY_PATH_INC\ -fmacro-prefix-map=%p/=A:\UNLIKELY_PATH_BASE\ -c -o - %s | FileCheck %s -check-prefix CHECK-CASE
6 // RUN: %clang -E -fno-file-reproducible -target x86_64-pc-win32 -fmacro-prefix-map=%p\= -c -o - %s | FileCheck %s --check-prefix CHECK-REMOVE
8 // RUN: %clang -E -target x86_64-pc-win32 -ffile-prefix-map=%p=A:\UNLIKELY_PATH\empty -c -o - %s | FileCheck %s --check-prefix CHECK-REPRODUCIBLE
9 // RUN: %clang -E -target x86_64-pc-win32 -fmacro-prefix-map=%p=A:\UNLIKELY_PATH\empty -c -o - %s | FileCheck %s --check-prefix CHECK-REPRODUCIBLE
10 // RUN: %clang -E -target x86_64-pc-win32 -fmacro-prefix-map=%p=A:\UNLIKELY_PATH=empty -c -o - %s | FileCheck %s -check-prefix CHECK-EVIL-REPRODUCIBLE
11 // RUN: %clang -E -target x86_64-pc-win32 -fmacro-prefix-map=%p/iNPUTS\=A:\UNLIKELY_PATH_INC\ -fmacro-prefix-map=%p/=A:\UNLIKELY_PATH_BASE\ -c -o - %s | FileCheck %s -check-prefix CHECK-CASE-REPRODUCIBLE
12 // RUN: %clang -E -target x86_64-pc-win32 -fmacro-prefix-map=%p\= -c -o - %s | FileCheck %s --check-prefix CHECK-REMOVE-REPRODUCIBLE
14 // RUN: %clang -E -target x86_64-pc-linux-gnu -fmacro-prefix-map=%p\= -c -o - %s | FileCheck %s --check-prefix CHECK-REMOVE
15 // RUN: %clang -E -target x86_64-pc-linux-gnu -ffile-prefix-map=%p\= -c -o - %s | FileCheck %s --check-prefix CHECK-REMOVE
17 // Clang defaults to forward slashes for the non-prefix portion of the path even if the build environment is Windows.
18 // RUN: %clang -E -fno-file-reproducible -target x86_64-pc-linux-gnu -fmacro-prefix-map=%p\= -c -o - %s | FileCheck %s --check-prefix CHECK-REMOVE
19 // RUN: %clang -E -fno-file-reproducible -target x86_64-pc-linux-gnu -ffile-prefix-map=%p\= -c -o - %s | FileCheck %s --check-prefix CHECK-REMOVE
21 // RUN: %clang -E -ffile-reproducible -target x86_64-pc-win32 -c -o - %s | FileCheck %s --check-prefix CHECK-WINDOWS-FULL
22 // RUN: %clang -E -ffile-reproducible -target x86_64-pc-linux-gnu -c -o - %s | FileCheck %s --check-prefix CHECK-LINUX-FULL
25 #include "Inputs/include-file-test/file_test.h"
27 // CHECK: filename: "A:\\UNLIKELY_PATH\\empty\\file_test_windows.c"
28 // CHECK: filename: "A:\\UNLIKELY_PATH\\empty\\Inputs/include-file-test/file_test.h"
29 // CHECK: basefile: "A:\\UNLIKELY_PATH\\empty\\file_test_windows.c"
30 // CHECK-NOT: filename:
32 // CHECK-EVIL: filename: "A:\\UNLIKELY_PATH=empty\\file_test_windows.c"
33 // CHECK-EVIL: filename: "A:\\UNLIKELY_PATH=empty\\Inputs/include-file-test/file_test.h"
34 // CHECK-EVIL: basefile: "A:\\UNLIKELY_PATH=empty\\file_test_windows.c"
35 // CHECK-EVIL-NOT: filename:
37 // CHECK-CASE: filename: "A:\\UNLIKELY_PATH_BASE\\file_test_windows.c"
38 // CHECK-CASE: filename: "A:\\UNLIKELY_PATH_INC\\include-file-test/file_test.h"
39 // CHECK-CASE: basefile: "A:\\UNLIKELY_PATH_BASE\\file_test_windows.c"
40 // CHECK-CASE-NOT: filename:
42 // CHECK-REMOVE: filename: "file_test_windows.c"
43 // CHECK-REMOVE: filename: "Inputs/include-file-test/file_test.h"
44 // CHECK-REMOVE: basefile: "file_test_windows.c"
45 // CHECK-REMOVE-NOT: filename:
47 // CHECK-REPRODUCIBLE: filename: "A:\\UNLIKELY_PATH\\empty\\file_test_windows.c"
48 // CHECK-REPRODUCIBLE: filename: "A:\\UNLIKELY_PATH\\empty\\Inputs\\include-file-test\\file_test.h"
49 // CHECK-REPRODUCIBLE: basefile: "A:\\UNLIKELY_PATH\\empty\\file_test_windows.c"
50 // CHECK-REPRODUCIBLE-NOT: filename:
52 // CHECK-EVIL-REPRODUCIBLE: filename: "A:\\UNLIKELY_PATH=empty\\file_test_windows.c"
53 // CHECK-EVIL-REPRODUCIBLE: filename: "A:\\UNLIKELY_PATH=empty\\Inputs\\include-file-test\\file_test.h"
54 // CHECK-EVIL-REPRODUCIBLE: basefile: "A:\\UNLIKELY_PATH=empty\\file_test_windows.c"
55 // CHECK-EVIL-REPRODUCIBLE-NOT: filename:
57 // CHECK-CASE-REPRODUCIBLE: filename: "A:\\UNLIKELY_PATH_BASE\\file_test_windows.c"
58 // CHECK-CASE-REPRODUCIBLE: filename: "A:\\UNLIKELY_PATH_INC\\include-file-test\\file_test.h"
59 // CHECK-CASE-REPRODUCIBLE: basefile: "A:\\UNLIKELY_PATH_BASE\\file_test_windows.c"
60 // CHECK-CASE-REPRODUCIBLE-NOT: filename:
62 // CHECK-REMOVE-REPRODUCIBLE: filename: "file_test_windows.c"
63 // CHECK-REMOVE-REPRODUCIBLE: filename: "Inputs\\include-file-test\\file_test.h"
64 // CHECK-REMOVE-REPRODUCIBLE: basefile: "file_test_windows.c"
65 // CHECK-REMOVE-REPRODUCIBLE-NOT: filename:
67 // CHECK-WINDOWS-FULL: filename: "{{[^/]*}}file_test_windows.c"
68 // CHECK-WINDOWS-FULL: filename: "{{[^/]*}}Inputs\\include-file-test\\file_test.h"
69 // CHECK-WINDOWS-FULL: basefile: "{{[^/]*}}file_test_windows.c"
70 // CHECK-WINDOWS-FULL-NOT: filename:
72 // Clang does not modify the prefix for POSIX style, so it may have backslashes.
73 // CHECK-LINUX-FULL: filename: "{{.*}}file_test_windows.c"
74 // CHECK-LINUX-FULL: filename: "{{.*}}Inputs/include-file-test/file_test.h"
75 // CHECK-LINUX-FULL: basefile: "{{.*}}file_test_windows.c"
76 // CHECK-LINUX-FULL-NOT: filename: