70 lines · c
1// RUN: rm -rf %t2// RUN: split-file %s %t3// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json4// RUN: sed "s|DIR|%/t|g" %t/cdb_without.json.template > %t/cdb_without.json5// RUN: clang-scan-deps -compilation-database %t/cdb.json \6// RUN: -format experimental-full > %t/deps.json7// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s8// RUN: clang-scan-deps -compilation-database %t/cdb.json \9// RUN: -format experimental-full -dependency-target foo > %t/deps_mt1.json10// RUN: cat %t/deps_mt1.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s -check-prefix=DEPS_MT111// RUN: clang-scan-deps -compilation-database %t/cdb.json \12// RUN: -format experimental-full -dependency-target foo -dependency-target bar > %t/deps_mt2.json13// RUN: cat %t/deps_mt2.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s -check-prefix=DEPS_MT214// RUN: clang-scan-deps -compilation-database %t/cdb_without.json \15// RUN: -format experimental-full > %t/deps_without.json16// RUN: cat %t/deps_without.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t -check-prefix=WITHOUT %s17 18// CHECK: {19// CHECK-NEXT: "modules": [20// CHECK-NEXT: {21// CHECK: "command-line": [22// CHECK-NEXT: "-cc1"23// CHECK: "-serialize-diagnostic-file"24// CHECK-NEXT: "[[PREFIX]]{{.*}}Mod{{.*}}.diag"25// CHECK: "-MT"26// CHECK-NEXT: "[[PREFIX]]{{.*}}Mod{{.*}}.pcm"27// CHECK: "-dependency-file"28// CHECK-NEXT: "[[PREFIX]]{{.*}}Mod{{.*}}.d"29// CHECK: ],30 31// DEPS_MT1: "-MT"32// DEPS_MT1-NEXT: "foo"33 34// DEPS_MT2: "-MT"35// DEPS_MT2-NEXT: "foo"36// DEPS_MT2-NEXT: "-MT"37// DEPS_MT2-NEXT: "bar"38 39// WITHOUT: {40// WITHOUT-NEXT: "modules": [41// WITHOUT-NEXT: {42// WITHOUT: "command-line": [43// WITHOUT-NEXT: "-cc1"44// WITHOUT-NOT: "-serialize-diagnostic-file"45// WITHOUT-NOT: "-dependency-file"46// WITHOUT-NOT: "-MT"47// WITHOUT: ],48 49//--- cdb.json.template50[{51 "directory": "DIR",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",53 "file": "DIR/tu.c"54}]55 56//--- cdb_without.json.template57[{58 "directory": "DIR",59 "command": "clang -fsyntax-only DIR/tu.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",60 "file": "DIR/tu.c"61}]62 63//--- module.modulemap64module Mod { header "Mod.h" }65 66//--- Mod.h67 68//--- tu.c69#include "Mod.h"70