60 lines · c
1// RUN: rm -rf %t2// RUN: split-file %s %t3 4//--- tu.m5#include "first.h"6 7//--- first/module.modulemap8module first { header "first.h" }9//--- first/first.h10#include "second.h"11 12//--- second/module.modulemap13module second { header "second.h" }14//--- second/second.h15#include "third.h"16 17//--- third/module.modulemap18module third { header "third.h" }19//--- third/third.h20// empty21 22//--- cdb.json.template23[{24 "file": "DIR/tu.c",25 "directory": "DIR",26 "command": "clang -I DIR/first -I DIR/second -I DIR/third -fmodules -fmodules-cache-path=DIR/cache -c DIR/tu.m -o DIR/tu.o"27}]28 29// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json30// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json31// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t32 33// CHECK: {34// CHECK-NEXT: "modules": [35// CHECK-NEXT: {36// CHECK-NEXT: "clang-module-deps": [37// CHECK-NEXT: {38// CHECK-NEXT: "context-hash": "{{.*}}",39// CHECK-NEXT: "module-name": "second"40// CHECK-NEXT: }41// CHECK-NEXT: ],42// CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/first/module.modulemap",43// CHECK-NEXT: "command-line": [44// CHECK-NEXT: "-cc1",45// CHECK-NOT: "-fmodule-map-file=[[PREFIX]]/third/module.modulemap"46// CHECK: "-fmodule-map-file=[[PREFIX]]/second/module.modulemap"47// CHECK-NOT: "-fmodule-map-file=[[PREFIX]]/third/module.modulemap"48// CHECK: ],49// CHECK-NEXT: "context-hash": "{{.*}}",50// CHECK-NEXT: "file-deps": [51// CHECK-NEXT: "[[PREFIX]]/first/module.modulemap",52// CHECK-NEXT: "[[PREFIX]]/first/first.h",53// CHECK-NEXT: "[[PREFIX]]/second/module.modulemap"54// CHECK-NEXT: ],55// CHECK-NEXT: "link-libraries": [],56// CHECK-NEXT: "name": "first"57// CHECK-NEXT: }58// CHECK: ]59// CHECK: }60