2 // RUN: split-file %s %t
3 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
4 // RUN: sed "s|DIR|%/t|g" %t/cdb_without.json.template > %t/cdb_without.json
5 // RUN: clang-scan-deps -compilation-database %t/cdb.json \
6 // RUN: -format experimental-full > %t/deps.json
7 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
8 // RUN: clang-scan-deps -compilation-database %t/cdb.json \
9 // RUN: -format experimental-full -dependency-target foo > %t/deps_mt1.json
10 // RUN: cat %t/deps_mt1.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s -check-prefix=DEPS_MT1
11 // RUN: clang-scan-deps -compilation-database %t/cdb.json \
12 // RUN: -format experimental-full -dependency-target foo -dependency-target bar > %t/deps_mt2.json
13 // RUN: cat %t/deps_mt2.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s -check-prefix=DEPS_MT2
14 // RUN: clang-scan-deps -compilation-database %t/cdb_without.json \
15 // RUN: -format experimental-full > %t/deps_without.json
16 // RUN: cat %t/deps_without.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t -check-prefix=WITHOUT %s
19 // CHECK-NEXT: "modules": [
21 // CHECK: "command-line": [
23 // CHECK: "-serialize-diagnostic-file"
24 // CHECK-NEXT: "[[PREFIX]]{{.*}}Mod{{.*}}.diag"
26 // CHECK-NEXT: "[[PREFIX]]{{.*}}Mod{{.*}}.pcm"
27 // CHECK: "-dependency-file"
28 // CHECK-NEXT: "[[PREFIX]]{{.*}}Mod{{.*}}.d"
32 // DEPS_MT1-NEXT: "foo"
35 // DEPS_MT2-NEXT: "foo"
36 // DEPS_MT2-NEXT: "-MT"
37 // DEPS_MT2-NEXT: "bar"
40 // WITHOUT-NEXT: "modules": [
42 // WITHOUT: "command-line": [
43 // WITHOUT-NEXT: "-cc1"
44 // WITHOUT-NOT: "-serialize-diagnostic-file"
45 // WITHOUT-NOT: "-dependency-file"
49 //--- cdb.json.template
52 "command": "clang -fsyntax-only DIR/tu.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache -serialize-diagnostics DIR/tu.diag -MD -MT tu -MF DIR/tu.d",
56 //--- cdb_without.json.template
59 "command": "clang -fsyntax-only DIR/tu.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",
63 //--- module.modulemap
64 module Mod
{ header
"Mod.h" }