Skip to content

Commit eff752e

Browse files
authored
Merge pull request #11585 from hjyamauchi/stable/21.x-cas2
Cherry pick CAS windows patches into stable
2 parents 011cb90 + 29c5214 commit eff752e

File tree

78 files changed

+1444
-770
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1444
-770
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8932,6 +8932,7 @@ def fsycl_is_host : Flag<["-"], "fsycl-is-host">,
89328932
// Driver CAS options.
89338933
def fdepscan_EQ : Joined<["-"], "fdepscan=">,
89348934
Group<f_Group>,
8935+
Visibility<[ClangOption, CLOption]>,
89358936
HelpText<"Scan for dependencies ahead of compiling, generating a"
89368937
" pruned CAS tree to send to -fcas-fs. Values are"
89378938
" 'auto',"
@@ -8985,6 +8986,7 @@ def fdepscan_daemon_EQ : Joined<["-"], "fdepscan-daemon=">, Group<f_Group>,
89858986
" parent processes.">;
89868987

89878988
def fdepscan_include_tree : Flag<["-"], "fdepscan-include-tree">,
8989+
Visibility<[ClangOption, CLOption]>,
89888990
Group<f_Group>, HelpText<"Set dep-scanner to produce the include tree">;
89898991

89908992
// CAS prefix map options.

clang/lib/Driver/Driver.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6367,7 +6367,11 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
63676367
// Output to a temporary file?
63686368
if ((!AtTopLevel && !isSaveTempsEnabled() &&
63696369
!C.getArgs().hasArg(options::OPT__SLASH_Fo)) ||
6370-
CCGenDiagnostics) {
6370+
CCGenDiagnostics ||
6371+
// Use a temp file for the depscan reponse file in CL mode
6372+
// (even with a /Fo flag).
6373+
(!AtTopLevel && isa<DepscanJobAction>(JA) &&
6374+
JA.getType() == types::TY_ResponseFile && IsCLMode())) {
63716375
StringRef Name = llvm::sys::path::filename(BaseInput);
63726376
std::pair<StringRef, StringRef> Split = Name.split('.');
63736377
const char *Suffix =

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4813,7 +4813,9 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
48134813
addDebugPrefixMapArg(D, TC, Args, CmdArgs);
48144814

48154815
// Add the output path to the object file for CodeView debug infos.
4816-
if (EmitCodeView && Output.isFilename())
4816+
// Skip this for temp depscan reponse file name.
4817+
if (EmitCodeView && Output.isFilename() &&
4818+
Output.getType() != types::TY_ResponseFile)
48174819
addDebugObjectName(Args, CmdArgs, DebugCompilationDir,
48184820
Output.getFilename());
48194821
}

clang/test/ClangScanDeps/cas-case-sensitivity.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
// RUN: sed -e 's/^.*llvmcas/llvmcas/' -e 's/ for.*$//' %t/result1.txt > %t/casid1
1111
// RUN: sed -e 's/^.*llvmcas/llvmcas/' -e 's/ for.*$//' %t/result2.txt > %t/casid2
1212

13-
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/casid1 | FileCheck -check-prefix=TREE %s -DPREFIX=%/t
14-
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/casid2 | FileCheck -check-prefix=TREE %s -DPREFIX=%/t
13+
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/casid1 | FileCheck -check-prefix=TREE %s -DPREFIX=%{t-tree-/}
14+
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/casid2 | FileCheck -check-prefix=TREE %s -DPREFIX=%{t-tree-/}
1515

1616
// asdf: FileCheck -check-prefix=TREE %s -input-file %t/result1.txt -DPREFIX=%/t
1717

18-
// TREE: file llvmcas://{{.*}} [[PREFIX]]/Header.h
19-
// TREE: syml llvmcas://{{.*}} [[PREFIX]]/header.h -> Header
20-
// TREE: file llvmcas://{{.*}} [[PREFIX]]/t{{[12]}}.c
18+
// TREE: file llvmcas://{{.*}} [[PREFIX]]{{/|\\}}Header.h
19+
// TREE: syml llvmcas://{{.*}} [[PREFIX]]{{/|\\}}header.h -> Header
20+
// TREE: file llvmcas://{{.*}} [[PREFIX]]{{/|\\}}t{{[12]}}.c
2121

2222
//--- cdb1.json.template
2323
[
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// REQUIRES: ondisk_cas
2+
3+
// RUN: rm -rf %t
4+
// RUN: split-file %s %t
5+
6+
// RUN: %clang_cl -c /clang:-fdepscan=inline /clang:-fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas -Xclang -Rcompile-job-cache -- %t/test.c 2>&1 | FileCheck %s -check-prefix=CACHE-MISS
7+
// RUN: %clang_cl -c /clang:-fdepscan=inline /clang:-fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas -Xclang -Rcompile-job-cache -- %t/test.c 2>&1 | FileCheck %s -check-prefix=CACHE-HIT
8+
9+
// In debug mode
10+
// RUN: %clang_cl -c /clang:-fdepscan=inline /clang:-fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas -Xclang -Rcompile-job-cache /Z7 -- %t/test.c 2>&1 | FileCheck %s -check-prefix=CACHE-MISS
11+
// RUN: %clang_cl -c /clang:-fdepscan=inline /clang:-fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas -Xclang -Rcompile-job-cache /Z7 -- %t/test.c 2>&1 | FileCheck %s -check-prefix=CACHE-HIT
12+
13+
// CACHE-HIT: remark: compile job cache hit
14+
// CACHE-MISS: remark: compile job cache miss
15+
16+
//--- test.c
17+
int main() { return 0; }

clang/test/ClangScanDeps/cas-fs-multiple-commands.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
// RUN: cat %t/deps.0.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
2121

22-
// RUN: CLANG_CACHE_USE_CASFS_DEPSCAN=1 c-index-test core -scan-deps -working-dir %t -cas-path %t/cas -output-dir %t/modules -- \
22+
// RUN: env CLANG_CACHE_USE_CASFS_DEPSCAN=1 c-index-test core -scan-deps -working-dir %t -cas-path %t/cas -output-dir %t/modules -- \
2323
// RUN: %clang -target x86_64-apple-darwin -c %t/tu.c -save-temps=obj -o %t/tu.o \
2424
// RUN: -fmodules -fimplicit-modules -fimplicit-module-maps -fmodules-cache-path=%t/cache \
2525
// RUN: > %t/deps.txt

clang/test/ClangScanDeps/cas-fs-prefix-mapping.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,40 @@
44
// REQUIRES: ondisk_cas
55
// RUN: rm -rf %t
66
// RUN: split-file %s %t
7-
// RUN: sed -e "s|DIR|%t|g" -e "s|CLANG|%clang|g" -e "s|SDK|%S/Inputs/SDK|g" %t/cdb.json.template > %t/cdb.json
7+
// RUN: sed -e "s|DIR|%/t|g" -e "s|CLANG|%/ncclang|g" -e "s|SDK|%/S/Inputs/SDK|g" %t/cdb.json.template > %t/cdb.json
88

99
// == Tree
1010
// Ensure the filesystem has the mapped paths.
1111

1212
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-tree -cas-path %t/cas \
13-
// RUN: -prefix-map=%t=/^src -prefix-map-sdk=/^sdk -prefix-map-toolchain=/^tc \
13+
// RUN: -prefix-map=%t=%/root^src -prefix-map-sdk=%/root^sdk -prefix-map-toolchain=%/root^tc \
1414
// RUN: | sed -E 's/tree ([^ ]+) for.*/\1/' > %t/tree_id.txt
1515
// RUN: llvm-cas -cas %t/cas -ls-tree-recursive @%t/tree_id.txt > %t/tree_result.txt
16-
// RUN: FileCheck %s -input-file %t/tree_result.txt -check-prefix=FILES
16+
// RUN: FileCheck %s -input-file %t/tree_result.txt -DROOT=%{/roott} -check-prefix=FILES
1717

18-
// FILES: file llvmcas://{{.*}} /^sdk/usr/include/stdlib.h
19-
// FILES: file llvmcas://{{.*}} /^src/t.c
20-
// FILES: file llvmcas://{{.*}} /^src/top.h
21-
// FILES: file llvmcas://{{.*}} /^tc/lib/clang/{{.*}}/include/stdarg.h
18+
// FILES: file llvmcas://{{.*}} [[ROOT]]^sdk/usr/include/stdlib.h
19+
// FILES: file llvmcas://{{.*}} [[ROOT]]^src/t.c
20+
// FILES: file llvmcas://{{.*}} [[ROOT]]^src/top.h
21+
// FILES: file llvmcas://{{.*}} [[ROOT]]^tc/lib/clang/{{.*}}/include/stdarg.h
2222

2323
// == Full Tree
2424
// This should have the same filesystem as above, and we also check the command-
2525
// line.
2626

2727
// RUN: cat %t/tree_id.txt > %t/full_tree_result.txt
2828
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-tree-full -cas-path %t/cas \
29-
// RUN: -prefix-map=%t=/^src -prefix-map-sdk=/^sdk -prefix-map-toolchain=/^tc \
29+
// RUN: -prefix-map=%t=%/root^src -prefix-map-sdk=%/root^sdk -prefix-map-toolchain=%/root^tc \
3030
// RUN: >> %t/full_tree_result.txt
31-
// RUN: FileCheck %s -input-file %t/full_tree_result.txt -DPREFIX=%t -DSDK_PREFIX=%S/Inputs/SDK
31+
// RUN: cat %t/full_tree_result.txt | %PathSanitizingFileCheck --sanitize PREFIX=%/t --sanitize SDK_PREFIX=%/S/Inputs/SDK --sanitize ROOT^=%/root^ --enable-yaml-compatibility %s
3232

3333
// == Full
3434
// Same as full tree.
3535

3636
// RUN: cat %t/tree_id.txt > %t/full_result.txt
3737
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -cas-path %t/cas \
38-
// RUN: -prefix-map=%t=/^src -prefix-map-sdk=/^sdk -prefix-map-toolchain=/^tc \
38+
// RUN: -prefix-map=%t=%/root^src -prefix-map-sdk=%/root^sdk -prefix-map-toolchain=%/root^tc \
3939
// RUN: >> %t/full_result.txt
40-
// RUN: FileCheck %s -input-file %t/full_result.txt -DPREFIX=%t -DSDK_PREFIX=%S/Inputs/SDK
40+
// RUN: cat %t/full_result.txt | %PathSanitizingFileCheck --sanitize PREFIX=%/t --sanitize SDK_PREFIX=%/S/Inputs/SDK --sanitize ROOT^=%/root^ --enable-yaml-compatibility %s
4141

4242
// CHECK: [[MAPPED_FS_ID:llvmcas://[[:xdigit:]]+]]
4343
// CHECK: "modules": []
@@ -49,36 +49,36 @@
4949
// CHECK: "clang-module-deps": []
5050
// CHECK: "command-line": [
5151
// CHECK: "-fcas-path"
52-
// CHECK-NEXT: "[[PREFIX]]/cas"
52+
// CHECK-NEXT: "PREFIX{{/|\\\\}}cas"
5353
// CHECK: "-fcas-fs"
5454
// CHECK-NEXT: "[[MAPPED_FS_ID]]"
5555
// CHECK: "-fcas-fs-working-directory"
56-
// CHECK-NEXT: "/^src"
56+
// CHECK-NEXT: "ROOT^src"
5757
// CHECK: "-x"
5858
// CHECK-NEXT: "c"
59-
// CHECK-NEXT: "/^src/t.c"
59+
// CHECK-NEXT: "ROOT^src{{/|\\\\}}t.c"
6060
// CHECK: "-isysroot"
61-
// CHECK-NEXT: "/^sdk"
61+
// CHECK-NEXT: "ROOT^sdk"
6262
// CHECK: "-resource-dir"
63-
// CHECK-NEXT: "/^tc/lib/clang/{{.*}}"
63+
// CHECK-NEXT: "ROOT^tc{{/|\\\\}}lib{{/|\\\\}}clang{{/|\\\\}}{{.*}}"
6464
// CHECK: "-isystem"
65-
// CHECK-NEXT: "/^sdk/usr/local/include
65+
// CHECK-NEXT: "ROOT^sdk{{/|\\\\}}usr{{/|\\\\}}local{{/|\\\\}}include
6666
// CHECK: "-isystem"
67-
// CHECK-NEXT: "/^tc/lib/clang/{{.*}}/include"
67+
// CHECK-NEXT: "ROOT^tc{{/|\\\\}}lib{{/|\\\\}}clang{{/|\\\\}}{{.*}}{{/|\\\\}}include"
6868
// CHECK: "-internal-externc-isystem"
69-
// CHECK-NEXT: "/^sdk/usr/include"
70-
// CHECK: "-fdebug-compilation-dir=/^src"
71-
// CHECK: "-fcoverage-compilation-dir=/^src"
72-
// CHECK-NOT: [[PREFIX]]
73-
// CHECK-NOT: [[SDK_PREFIX]]
69+
// CHECK-NEXT: "ROOT^sdk{{/|\\\\}}usr{{/|\\\\}}include"
70+
// CHECK: "-fdebug-compilation-dir=ROOT^src"
71+
// CHECK: "-fcoverage-compilation-dir=ROOT^src"
72+
// CHECK-NOT: PREFIX
73+
// CHECK-NOT: SDK_PREFIX
7474
// CHECK: ]
7575
// CHECK: "file-deps": [
76-
// CHECK: "[[PREFIX]]/t.c"
77-
// CHECK: "[[PREFIX]]/top.h"
78-
// CHECK: "{{.*}}include/stdarg.h"
79-
// CHECK: "[[SDK_PREFIX]]/usr/include/stdlib.h"
76+
// CHECK: "PREFIX{{/|\\\\}}t.c"
77+
// CHECK: "PREFIX{{/|\\\\}}top.h"
78+
// CHECK: "{{.*}}include{{/|\\\\}}stdarg.h"
79+
// CHECK: "SDK_PREFIX{{/|\\\\}}usr{{/|\\\\}}include{{/|\\\\}}stdlib.h"
8080
// CHECK: ]
81-
// CHECK: "input-file": "[[PREFIX]]/t.c"
81+
// CHECK: "input-file": "PREFIX{{/|\\\\}}t.c"
8282

8383
//--- cdb.json.template
8484
[

clang/test/ClangScanDeps/cas-trees.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
// RUN: clang-scan-deps -compilation-database %t/cdb.json -cas-path %t/cas -format experimental-tree -mode preprocess-dependency-directives > %t/result1.txt
77
// RUN: clang-scan-deps -compilation-database %t/cdb.json -cas-path %t/cas -format experimental-tree -mode preprocess > %t/result2.txt
88
// RUN: diff -u %t/result1.txt %t/result2.txt
9-
// RUN: FileCheck %s -input-file %t/result1.txt -DPREFIX=%/t
9+
// RUN: cat %t/result1.txt | %PathSanitizingFileCheck --sanitize PREFIX=%/t %s
1010

11-
// CHECK: tree {{.*}} for '[[PREFIX]]/t1.c'
12-
// CHECK-NEXT: tree {{.*}} for '[[PREFIX]]/t2.c'
11+
// CHECK: tree {{.*}} for 'PREFIX{{/|\\}}t1.c'
12+
// CHECK-NEXT: tree {{.*}} for 'PREFIX{{/|\\}}t2.c'
1313

1414
// RUN: clang-scan-deps -compilation-database %t/cdb.json -cas-path %t/cas -format experimental-tree-full -mode preprocess > %t/full_result.json
15-
// RUN: cat %t/full_result.json | FileCheck %s -DPREFIX=%/t --check-prefix=FULL-TREE
15+
// RUN: cat %t/full_result.json | %PathSanitizingFileCheck --sanitize PREFIX=%/t --enable-yaml-compatibility %s --check-prefix=FULL-TREE
1616

1717
// FULL-TREE: {
1818
// FULL-TREE-NEXT: "modules": [],
@@ -24,17 +24,17 @@
2424
// FULL-TREE-NEXT: "clang-module-deps": [],
2525
// FULL-TREE-NEXT: "command-line": [
2626
// FULL-TREE: "-fcas-path"
27-
// FULL-TREE-NEXT: "[[PREFIX]]{{.}}cas"
27+
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}cas"
2828
// FULL-TREE: "-fcas-fs"
2929
// FULL-TREE-NEXT: "[[T1_ROOT_ID]]"
3030
// FULL-TREE: "-fcache-compile-job"
3131
// FULL-TREE: ],
3232
// FULL-TREE: "file-deps": [
33-
// FULL-TREE-NEXT: "[[PREFIX]]/t1.c",
34-
// FULL-TREE-NEXT: "[[PREFIX]]/top.h",
35-
// FULL-TREE-NEXT: "[[PREFIX]]/n1.h"
33+
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}t1.c",
34+
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}top.h",
35+
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}n1.h"
3636
// FULL-TREE-NEXT: ],
37-
// FULL-TREE-NEXT: "input-file": "[[PREFIX]]/t1.c"
37+
// FULL-TREE-NEXT: "input-file": "PREFIX{{/|\\\\}}t1.c"
3838
// FULL-TREE-NEXT: }
3939
// FULL-TREE: {
4040
// FULL-TREE: "cache-key": "[[T2_CACHE_KEY:llvmcas://[[:xdigit:]]+]]"
@@ -43,16 +43,16 @@
4343
// FULL-TREE-NEXT: "clang-module-deps": [],
4444
// FULL-TREE-NEXT: "command-line": [
4545
// FULL-TREE: "-fcas-path"
46-
// FULL-TREE-NEXT: "[[PREFIX]]{{.}}cas"
46+
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}cas"
4747
// FULL-TREE: "-fcas-fs"
4848
// FULL-TREE-NEXT: "[[T2_ROOT_ID]]"
4949
// FULL-TREE: "-fcache-compile-job"
5050
// FULL-TREE: ],
5151
// FULL-TREE: "file-deps": [
52-
// FULL-TREE-NEXT: "[[PREFIX]]/t2.c",
53-
// FULL-TREE-NEXT: "[[PREFIX]]/n1.h"
52+
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}t2.c",
53+
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}n1.h"
5454
// FULL-TREE-NEXT: ],
55-
// FULL-TREE-NEXT: "input-file": "[[PREFIX]]/t2.c"
55+
// FULL-TREE-NEXT: "input-file": "PREFIX{{/|\\\\}}t2.c"
5656
// FULL-TREE-NEXT: }
5757

5858
// Build with caching
@@ -83,20 +83,20 @@
8383
// COMBINED: remark: compile job cache miss for '[[T1_CACHE_KEY]]'
8484
// COMBINED-NEXT: remark: compile job cache miss for '[[T2_CACHE_KEY]]'
8585

86-
// RUN: clang-scan-deps -compilation-database %t/cdb.json -cas-path %t/cas -format experimental-tree -emit-cas-compdb | FileCheck %s -DPREFIX=%/t -DCLANG=%clang -check-prefix=COMPDB
86+
// RUN: clang-scan-deps -compilation-database %t/cdb.json -cas-path %t/cas -format experimental-tree -emit-cas-compdb | %PathSanitizingFileCheck --sanitize PREFIX=%/t --sanitize CLANG=%/clang --enable-yaml-compatibility %s -check-prefix=COMPDB
8787
// COMPDB: [
8888
// COMPDB: {
89-
// COMPDB: "file": "[[PREFIX]]/t1.c",
90-
// COMPDB: "directory": "[[PREFIX]]",
89+
// COMPDB: "file": "PREFIX{{/|\\\\}}t1.c",
90+
// COMPDB: "directory": "PREFIX",
9191
// COMPDB: "arguments": [
92-
// COMPDB: "[[CLANG]]",
92+
// COMPDB: "CLANG",
9393
// COMPDB: "-cc1",
9494
// COMPDB: "-fcas-path",
95-
// COMPDB: "[[PREFIX]]/cas",
95+
// COMPDB: "PREFIX{{/|\\\\}}cas",
9696
// COMPDB: "-fcas-fs",
9797
// COMPDB: {
98-
// COMPDB: "file": "[[PREFIX]]/t2.c",
99-
// COMPDB: "directory": "[[PREFIX]]",
98+
// COMPDB: "file": "PREFIX{{/|\\\\}}t2.c",
99+
// COMPDB: "directory": "PREFIX",
100100
// COMPDB: "arguments": [
101101

102102

clang/test/ClangScanDeps/include-tree-prefix-mapping-pch-remap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// REQUIRES: ondisk_cas
22
// RUN: rm -rf %t
33
// RUN: split-file %s %t
4-
// RUN: sed -e "s|DIR|%t|g" %t/cdb.json.template > %t/cdb.json
4+
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
55

66
// RUN: clang-scan-deps -compilation-database %t/cdb.json \
77
// RUN: -format experimental-include-tree-full -cas-path %t/cas \
8-
// RUN: -prefix-map=%t=/^src -prefix-map-sdk=/^sdk -prefix-map-toolchain=/^tc > %t/deps.json
8+
// RUN: -prefix-map=%t=%/root^src -prefix-map-sdk=%/root^sdk -prefix-map-toolchain=%/root^tc > %t/deps.json
99

1010
//--- cdb.json.template
1111
[{

clang/test/ClangScanDeps/include-tree-prefix-mapping.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
// REQUIRES: ondisk_cas
22
// RUN: rm -rf %t
33
// RUN: split-file %s %t
4-
// RUN: sed -e "s|DIR|%t|g" -e "s|CLANG|%clang|g" -e "s|SDK|%S/Inputs/SDK|g" %t/cdb.json.template > %t/cdb.json
4+
// RUN: sed -e "s|DIR|%/t|g" -e "s|CLANG|%/ncclang|g" -e "s|SDK|%/S/Inputs/SDK|g" %t/cdb.json.template > %t/cdb.json
55

66
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-include-tree -cas-path %t/cas \
7-
// RUN: -prefix-map=%t=/^src -prefix-map-sdk=/^sdk -prefix-map-toolchain=/^tc > %t/result.txt
8-
// RUN: FileCheck %s -input-file %t/result.txt -DPREFIX=%t -DSDK_PREFIX=%S/Inputs/SDK
7+
// RUN: -prefix-map=%t=%/root^src -prefix-map-sdk=%/root^sdk -prefix-map-toolchain=%/root^tc > %t/result.txt
8+
// RUN: cat %t/result.txt | %PathSanitizingFileCheck --sanitize PREFIX=%/t --sanitize SDK_PREFIX=%/S/Inputs/SDK --sanitize ROOT^=%/root^ %s
99

10-
// CHECK: {{.*}} - [[PREFIX]]/t.c
11-
// CHECK-NOT: [[PREFIX]]
12-
// CHECK-NOT: [[SDK_PREFIX]]
13-
// CHECK: /^src{{[/\\]}}t.c
14-
// CHECK: /^src{{[/\\]}}top.h
15-
// CHECK: /^tc{{[/\\]}}lib{{[/\\]}}clang{{[/\\]}}{{.*}}{{[/\\]}}include{{[/\\]}}stdarg.h
16-
// CHECK: /^sdk{{[/\\]}}usr{{[/\\]}}include{{[/\\]}}stdlib.h
10+
// CHECK: {{.*}} - PREFIX{{/|\\}}t.c
11+
// CHECK-NOT: PREFIX
12+
// CHECK-NOT: SDK_PREFIX
13+
// CHECK: ROOT^src{{[/\\]}}t.c
14+
// CHECK: ROOT^src{{[/\\]}}top.h
15+
// CHECK: ROOT^tc{{[/\\]}}lib{{[/\\]}}clang{{[/\\]}}{{.*}}{{[/\\]}}include{{[/\\]}}stdarg.h
16+
// CHECK: ROOT^sdk{{[/\\]}}usr{{[/\\]}}include{{[/\\]}}stdlib.h
1717

1818
// RUN: clang-scan-deps -compilation-database %t/cdb.json \
1919
// RUN: -format experimental-include-tree-full -cas-path %t/cas \
20-
// RUN: -prefix-map=%t=/^src -prefix-map-sdk=/^sdk -prefix-map-toolchain=/^tc > %t/deps.json
20+
// RUN: -prefix-map=%t=%/root^src -prefix-map-sdk=%/root^sdk -prefix-map-toolchain=%/root^tc > %t/deps.json
2121

2222
// RUN: cat %t/result.txt > %t/full.txt
2323
// RUN: echo "FULL DEPS START" >> %t/full.txt
24-
// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' >> %t/full.txt
24+
// RUN: cat %t/deps.json >> %t/full.txt
2525

26-
// RUN: FileCheck %s -DPREFIX=%/t -DSDK_PREFIX=%S/Inputs/SDK -check-prefix=FULL -input-file %t/full.txt
26+
// RUN: cat %t/full.txt | %PathSanitizingFileCheck --sanitize PREFIX=%/t --sanitize SDK_PREFIX=%/S/Inputs/SDK --sanitize ROOT^=%/root^ --enable-yaml-compatibility %s -check-prefix=FULL
2727

2828
// Capture the tree id from experimental-include-tree ; ensure that it matches
2929
// the result from experimental-full.
30-
// FULL: [[TREE_ID:llvmcas://[[:xdigit:]]+]] - [[PREFIX]]/t.c
30+
// FULL: [[TREE_ID:llvmcas://[[:xdigit:]]+]] - PREFIX{{/|\\}}t.c
3131
// FULL: FULL DEPS START
3232

3333
// FULL-NEXT: {
@@ -40,7 +40,7 @@
4040
// FULL: "command-line": [
4141
// FULL-NEXT: "-cc1"
4242
// FULL: "-fcas-path"
43-
// FULL-NEXT: "[[PREFIX]]/cas"
43+
// FULL-NEXT: "PREFIX{{/|\\\\}}cas"
4444
// FULL: "-disable-free"
4545
// FULL: "-fcas-include-tree"
4646
// FULL-NEXT: "[[TREE_ID]]"
@@ -49,15 +49,15 @@
4949
// FULL: "-x"
5050
// FULL-NEXT: "c"
5151
// FULL: "-isysroot"
52-
// FULL-NEXT: "/^sdk"
52+
// FULL-NEXT: "ROOT^sdk"
5353
// FULL: ]
5454
// FULL: "file-deps": [
55-
// FULL-DAG: "[[PREFIX]]/t.c"
56-
// FULL-DAG: "[[PREFIX]]/top.h"
57-
// FULL-DAG: "{{.*}}/stdarg.h"
58-
// FULL-DAG: "[[SDK_PREFIX]]/usr/include/stdlib.h"
55+
// FULL-DAG: "PREFIX{{/|\\\\}}t.c"
56+
// FULL-DAG: "PREFIX{{/|\\\\}}top.h"
57+
// FULL-DAG: "{{.*}}{{/|\\\\}}stdarg.h"
58+
// FULL-DAG: "SDK_PREFIX{{/|\\\\}}usr{{/|\\\\}}include{{/|\\\\}}stdlib.h"
5959
// FULL: ]
60-
// FULL: "input-file": "[[PREFIX]]/t.c"
60+
// FULL: "input-file": "PREFIX{{/|\\\\}}t.c"
6161
// FULL: }
6262
// FULL: ]
6363
// FULL: }

0 commit comments

Comments
 (0)