Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -8932,6 +8932,7 @@ def fsycl_is_host : Flag<["-"], "fsycl-is-host">,
// Driver CAS options.
def fdepscan_EQ : Joined<["-"], "fdepscan=">,
Group<f_Group>,
Visibility<[ClangOption, CLOption]>,
HelpText<"Scan for dependencies ahead of compiling, generating a"
" pruned CAS tree to send to -fcas-fs. Values are"
" 'auto',"
Expand Down Expand Up @@ -8985,6 +8986,7 @@ def fdepscan_daemon_EQ : Joined<["-"], "fdepscan-daemon=">, Group<f_Group>,
" parent processes.">;

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

// CAS prefix map options.
Expand Down
6 changes: 5 additions & 1 deletion clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6367,7 +6367,11 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
// Output to a temporary file?
if ((!AtTopLevel && !isSaveTempsEnabled() &&
!C.getArgs().hasArg(options::OPT__SLASH_Fo)) ||
CCGenDiagnostics) {
CCGenDiagnostics ||
// Use a temp file for the depscan reponse file in CL mode
// (even with a /Fo flag).
(!AtTopLevel && isa<DepscanJobAction>(JA) &&
JA.getType() == types::TY_ResponseFile && IsCLMode())) {
StringRef Name = llvm::sys::path::filename(BaseInput);
std::pair<StringRef, StringRef> Split = Name.split('.');
const char *Suffix =
Expand Down
4 changes: 3 additions & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4813,7 +4813,9 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
addDebugPrefixMapArg(D, TC, Args, CmdArgs);

// Add the output path to the object file for CodeView debug infos.
if (EmitCodeView && Output.isFilename())
// Skip this for temp depscan reponse file name.
if (EmitCodeView && Output.isFilename() &&
Output.getType() != types::TY_ResponseFile)
addDebugObjectName(Args, CmdArgs, DebugCompilationDir,
Output.getFilename());
}
Expand Down
10 changes: 5 additions & 5 deletions clang/test/ClangScanDeps/cas-case-sensitivity.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
// RUN: sed -e 's/^.*llvmcas/llvmcas/' -e 's/ for.*$//' %t/result1.txt > %t/casid1
// RUN: sed -e 's/^.*llvmcas/llvmcas/' -e 's/ for.*$//' %t/result2.txt > %t/casid2

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

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

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

//--- cdb1.json.template
[
Expand Down
17 changes: 17 additions & 0 deletions clang/test/ClangScanDeps/cas-clang-cl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// REQUIRES: ondisk_cas

// RUN: rm -rf %t
// RUN: split-file %s %t

// 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
// 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

// In debug mode
// 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
// 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

// CACHE-HIT: remark: compile job cache hit
// CACHE-MISS: remark: compile job cache miss

//--- test.c
int main() { return 0; }
2 changes: 1 addition & 1 deletion clang/test/ClangScanDeps/cas-fs-multiple-commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

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

// RUN: CLANG_CACHE_USE_CASFS_DEPSCAN=1 c-index-test core -scan-deps -working-dir %t -cas-path %t/cas -output-dir %t/modules -- \
// 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 -- \
// RUN: %clang -target x86_64-apple-darwin -c %t/tu.c -save-temps=obj -o %t/tu.o \
// RUN: -fmodules -fimplicit-modules -fimplicit-module-maps -fmodules-cache-path=%t/cache \
// RUN: > %t/deps.txt
Expand Down
56 changes: 28 additions & 28 deletions clang/test/ClangScanDeps/cas-fs-prefix-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,40 @@
// REQUIRES: ondisk_cas
// RUN: rm -rf %t
// RUN: split-file %s %t
// 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
// 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

// == Tree
// Ensure the filesystem has the mapped paths.

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

// FILES: file llvmcas://{{.*}} /^sdk/usr/include/stdlib.h
// FILES: file llvmcas://{{.*}} /^src/t.c
// FILES: file llvmcas://{{.*}} /^src/top.h
// FILES: file llvmcas://{{.*}} /^tc/lib/clang/{{.*}}/include/stdarg.h
// FILES: file llvmcas://{{.*}} [[ROOT]]^sdk/usr/include/stdlib.h
// FILES: file llvmcas://{{.*}} [[ROOT]]^src/t.c
// FILES: file llvmcas://{{.*}} [[ROOT]]^src/top.h
// FILES: file llvmcas://{{.*}} [[ROOT]]^tc/lib/clang/{{.*}}/include/stdarg.h

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

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

// == Full
// Same as full tree.

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

// CHECK: [[MAPPED_FS_ID:llvmcas://[[:xdigit:]]+]]
// CHECK: "modules": []
Expand All @@ -49,36 +49,36 @@
// CHECK: "clang-module-deps": []
// CHECK: "command-line": [
// CHECK: "-fcas-path"
// CHECK-NEXT: "[[PREFIX]]/cas"
// CHECK-NEXT: "PREFIX{{/|\\\\}}cas"
// CHECK: "-fcas-fs"
// CHECK-NEXT: "[[MAPPED_FS_ID]]"
// CHECK: "-fcas-fs-working-directory"
// CHECK-NEXT: "/^src"
// CHECK-NEXT: "ROOT^src"
// CHECK: "-x"
// CHECK-NEXT: "c"
// CHECK-NEXT: "/^src/t.c"
// CHECK-NEXT: "ROOT^src{{/|\\\\}}t.c"
// CHECK: "-isysroot"
// CHECK-NEXT: "/^sdk"
// CHECK-NEXT: "ROOT^sdk"
// CHECK: "-resource-dir"
// CHECK-NEXT: "/^tc/lib/clang/{{.*}}"
// CHECK-NEXT: "ROOT^tc{{/|\\\\}}lib{{/|\\\\}}clang{{/|\\\\}}{{.*}}"
// CHECK: "-isystem"
// CHECK-NEXT: "/^sdk/usr/local/include
// CHECK-NEXT: "ROOT^sdk{{/|\\\\}}usr{{/|\\\\}}local{{/|\\\\}}include
// CHECK: "-isystem"
// CHECK-NEXT: "/^tc/lib/clang/{{.*}}/include"
// CHECK-NEXT: "ROOT^tc{{/|\\\\}}lib{{/|\\\\}}clang{{/|\\\\}}{{.*}}{{/|\\\\}}include"
// CHECK: "-internal-externc-isystem"
// CHECK-NEXT: "/^sdk/usr/include"
// CHECK: "-fdebug-compilation-dir=/^src"
// CHECK: "-fcoverage-compilation-dir=/^src"
// CHECK-NOT: [[PREFIX]]
// CHECK-NOT: [[SDK_PREFIX]]
// CHECK-NEXT: "ROOT^sdk{{/|\\\\}}usr{{/|\\\\}}include"
// CHECK: "-fdebug-compilation-dir=ROOT^src"
// CHECK: "-fcoverage-compilation-dir=ROOT^src"
// CHECK-NOT: PREFIX
// CHECK-NOT: SDK_PREFIX
// CHECK: ]
// CHECK: "file-deps": [
// CHECK: "[[PREFIX]]/t.c"
// CHECK: "[[PREFIX]]/top.h"
// CHECK: "{{.*}}include/stdarg.h"
// CHECK: "[[SDK_PREFIX]]/usr/include/stdlib.h"
// CHECK: "PREFIX{{/|\\\\}}t.c"
// CHECK: "PREFIX{{/|\\\\}}top.h"
// CHECK: "{{.*}}include{{/|\\\\}}stdarg.h"
// CHECK: "SDK_PREFIX{{/|\\\\}}usr{{/|\\\\}}include{{/|\\\\}}stdlib.h"
// CHECK: ]
// CHECK: "input-file": "[[PREFIX]]/t.c"
// CHECK: "input-file": "PREFIX{{/|\\\\}}t.c"

//--- cdb.json.template
[
Expand Down
40 changes: 20 additions & 20 deletions clang/test/ClangScanDeps/cas-trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
// RUN: clang-scan-deps -compilation-database %t/cdb.json -cas-path %t/cas -format experimental-tree -mode preprocess-dependency-directives > %t/result1.txt
// RUN: clang-scan-deps -compilation-database %t/cdb.json -cas-path %t/cas -format experimental-tree -mode preprocess > %t/result2.txt
// RUN: diff -u %t/result1.txt %t/result2.txt
// RUN: FileCheck %s -input-file %t/result1.txt -DPREFIX=%/t
// RUN: cat %t/result1.txt | %PathSanitizingFileCheck --sanitize PREFIX=%/t %s

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

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

// FULL-TREE: {
// FULL-TREE-NEXT: "modules": [],
Expand All @@ -24,17 +24,17 @@
// FULL-TREE-NEXT: "clang-module-deps": [],
// FULL-TREE-NEXT: "command-line": [
// FULL-TREE: "-fcas-path"
// FULL-TREE-NEXT: "[[PREFIX]]{{.}}cas"
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}cas"
// FULL-TREE: "-fcas-fs"
// FULL-TREE-NEXT: "[[T1_ROOT_ID]]"
// FULL-TREE: "-fcache-compile-job"
// FULL-TREE: ],
// FULL-TREE: "file-deps": [
// FULL-TREE-NEXT: "[[PREFIX]]/t1.c",
// FULL-TREE-NEXT: "[[PREFIX]]/top.h",
// FULL-TREE-NEXT: "[[PREFIX]]/n1.h"
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}t1.c",
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}top.h",
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}n1.h"
// FULL-TREE-NEXT: ],
// FULL-TREE-NEXT: "input-file": "[[PREFIX]]/t1.c"
// FULL-TREE-NEXT: "input-file": "PREFIX{{/|\\\\}}t1.c"
// FULL-TREE-NEXT: }
// FULL-TREE: {
// FULL-TREE: "cache-key": "[[T2_CACHE_KEY:llvmcas://[[:xdigit:]]+]]"
Expand All @@ -43,16 +43,16 @@
// FULL-TREE-NEXT: "clang-module-deps": [],
// FULL-TREE-NEXT: "command-line": [
// FULL-TREE: "-fcas-path"
// FULL-TREE-NEXT: "[[PREFIX]]{{.}}cas"
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}cas"
// FULL-TREE: "-fcas-fs"
// FULL-TREE-NEXT: "[[T2_ROOT_ID]]"
// FULL-TREE: "-fcache-compile-job"
// FULL-TREE: ],
// FULL-TREE: "file-deps": [
// FULL-TREE-NEXT: "[[PREFIX]]/t2.c",
// FULL-TREE-NEXT: "[[PREFIX]]/n1.h"
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}t2.c",
// FULL-TREE-NEXT: "PREFIX{{/|\\\\}}n1.h"
// FULL-TREE-NEXT: ],
// FULL-TREE-NEXT: "input-file": "[[PREFIX]]/t2.c"
// FULL-TREE-NEXT: "input-file": "PREFIX{{/|\\\\}}t2.c"
// FULL-TREE-NEXT: }

// Build with caching
Expand Down Expand Up @@ -83,20 +83,20 @@
// COMBINED: remark: compile job cache miss for '[[T1_CACHE_KEY]]'
// COMBINED-NEXT: remark: compile job cache miss for '[[T2_CACHE_KEY]]'

// 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
// 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
// COMPDB: [
// COMPDB: {
// COMPDB: "file": "[[PREFIX]]/t1.c",
// COMPDB: "directory": "[[PREFIX]]",
// COMPDB: "file": "PREFIX{{/|\\\\}}t1.c",
// COMPDB: "directory": "PREFIX",
// COMPDB: "arguments": [
// COMPDB: "[[CLANG]]",
// COMPDB: "CLANG",
// COMPDB: "-cc1",
// COMPDB: "-fcas-path",
// COMPDB: "[[PREFIX]]/cas",
// COMPDB: "PREFIX{{/|\\\\}}cas",
// COMPDB: "-fcas-fs",
// COMPDB: {
// COMPDB: "file": "[[PREFIX]]/t2.c",
// COMPDB: "directory": "[[PREFIX]]",
// COMPDB: "file": "PREFIX{{/|\\\\}}t2.c",
// COMPDB: "directory": "PREFIX",
// COMPDB: "arguments": [


Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// REQUIRES: ondisk_cas
// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: sed -e "s|DIR|%t|g" %t/cdb.json.template > %t/cdb.json
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json

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

//--- cdb.json.template
[{
Expand Down
42 changes: 21 additions & 21 deletions clang/test/ClangScanDeps/include-tree-prefix-mapping.c
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
// REQUIRES: ondisk_cas
// RUN: rm -rf %t
// RUN: split-file %s %t
// 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
// 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

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

// CHECK: {{.*}} - [[PREFIX]]/t.c
// CHECK-NOT: [[PREFIX]]
// CHECK-NOT: [[SDK_PREFIX]]
// CHECK: /^src{{[/\\]}}t.c
// CHECK: /^src{{[/\\]}}top.h
// CHECK: /^tc{{[/\\]}}lib{{[/\\]}}clang{{[/\\]}}{{.*}}{{[/\\]}}include{{[/\\]}}stdarg.h
// CHECK: /^sdk{{[/\\]}}usr{{[/\\]}}include{{[/\\]}}stdlib.h
// CHECK: {{.*}} - PREFIX{{/|\\}}t.c
// CHECK-NOT: PREFIX
// CHECK-NOT: SDK_PREFIX
// CHECK: ROOT^src{{[/\\]}}t.c
// CHECK: ROOT^src{{[/\\]}}top.h
// CHECK: ROOT^tc{{[/\\]}}lib{{[/\\]}}clang{{[/\\]}}{{.*}}{{[/\\]}}include{{[/\\]}}stdarg.h
// CHECK: ROOT^sdk{{[/\\]}}usr{{[/\\]}}include{{[/\\]}}stdlib.h

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

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

// RUN: FileCheck %s -DPREFIX=%/t -DSDK_PREFIX=%S/Inputs/SDK -check-prefix=FULL -input-file %t/full.txt
// 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

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

// FULL-NEXT: {
Expand All @@ -40,7 +40,7 @@
// FULL: "command-line": [
// FULL-NEXT: "-cc1"
// FULL: "-fcas-path"
// FULL-NEXT: "[[PREFIX]]/cas"
// FULL-NEXT: "PREFIX{{/|\\\\}}cas"
// FULL: "-disable-free"
// FULL: "-fcas-include-tree"
// FULL-NEXT: "[[TREE_ID]]"
Expand All @@ -49,15 +49,15 @@
// FULL: "-x"
// FULL-NEXT: "c"
// FULL: "-isysroot"
// FULL-NEXT: "/^sdk"
// FULL-NEXT: "ROOT^sdk"
// FULL: ]
// FULL: "file-deps": [
// FULL-DAG: "[[PREFIX]]/t.c"
// FULL-DAG: "[[PREFIX]]/top.h"
// FULL-DAG: "{{.*}}/stdarg.h"
// FULL-DAG: "[[SDK_PREFIX]]/usr/include/stdlib.h"
// FULL-DAG: "PREFIX{{/|\\\\}}t.c"
// FULL-DAG: "PREFIX{{/|\\\\}}top.h"
// FULL-DAG: "{{.*}}{{/|\\\\}}stdarg.h"
// FULL-DAG: "SDK_PREFIX{{/|\\\\}}usr{{/|\\\\}}include{{/|\\\\}}stdlib.h"
// FULL: ]
// FULL: "input-file": "[[PREFIX]]/t.c"
// FULL: "input-file": "PREFIX{{/|\\\\}}t.c"
// FULL: }
// FULL: ]
// FULL: }
Expand Down
2 changes: 1 addition & 1 deletion clang/test/ClangScanDeps/include-tree-preserve-pch-path.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// RUN: %deps-to-rsp %t/deps_tu.json --tu-index 0 > %t/tu.rsp
// RUN: %clang @%t/tu.rsp

// RUN: cat %t/tu.ll | FileCheck %s -check-prefix=LLVMIR -DPREFIX=%/t
// RUN: cat %t/tu.ll | %PathSanitizingFileCheck --sanitize PREFIX=%/t --enable-yaml-compatibility %s -check-prefix=LLVMIR
// LLVMIR: !DICompileUnit({{.*}}, splitDebugFilename: "prefix.pch"

// Extract include-tree casid
Expand Down
Loading