2 // RUN: split-file %s %t
4 //--- this/module.modulemap
5 module This { header "This.h" }
8 #include "Foo_Private_Excluded.h"
10 //--- modules/module.modulemap
11 module Foo { header "Foo.h" }
12 //--- modules/module.private.modulemap
13 explicit module Foo.Private {
14 header "Foo_Private.h"
15 exclude header "Foo_Private_Excluded.h"
18 //--- modules/Foo_Private.h
19 //--- modules/Foo_Private_Excluded.h
21 //--- cdb.json.template
25 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -I DIR/this -I DIR/modules -c DIR/tu.m -o DIR/tu.o"
31 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
32 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
34 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
36 // CHECK-NEXT: "modules": [
40 // CHECK: "command-line": [
41 // CHECK: "-fmodule-map-file=[[PREFIX]]/modules/module.modulemap",
42 // CHECK-NEXT: "-fmodule-map-file=[[PREFIX]]/modules/module.private.modulemap",
44 // CHECK: "name": "This"
49 // RUN: %deps-to-rsp %t/result.json --module-name=Foo > %t/Foo.cc1.rsp
50 // RUN: %deps-to-rsp %t/result.json --module-name=This > %t/This.cc1.rsp
51 // RUN: %deps-to-rsp %t/result.json --tu-index=0 > %t/tu.rsp
53 // RUN: %clang @%t/Foo.cc1.rsp
54 // RUN: %clang @%t/This.cc1.rsp
55 // RUN: %clang @%t/tu.rsp