| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
|
| 4 |
//--- this/module.modulemap |
| 5 |
module This { header "This.h" } |
| 6 |
//--- this/This.h |
| 7 |
#include "Foo.h" |
| 8 |
#include "Foo_Private_Excluded.h" |
| 9 |
|
| 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" |
| 16 |
} |
| 17 |
//--- modules/Foo.h |
| 18 |
//--- modules/Foo_Private.h |
| 19 |
//--- modules/Foo_Private_Excluded.h |
| 20 |
|
| 21 |
//--- cdb.json.template |
| 22 |
[{ |
| 23 |
"file": "DIR/tu.m", |
| 24 |
"directory": "DIR", |
| 25 |
"command": "clang -fmodules -fmodules-cache-path=DIR/cache -I DIR/this -I DIR/modules -c DIR/tu.m -o DIR/tu.o" |
| 26 |
}] |
| 27 |
|
| 28 |
//--- tu.m |
| 29 |
@import This; |
| 30 |
|
| 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 |
| 33 |
|
| 34 |
// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t |
| 35 |
// CHECK: { |
| 36 |
// CHECK-NEXT: "modules": [ |
| 37 |
// CHECK-NEXT: { |
| 38 |
// CHECK: }, |
| 39 |
// CHECK-NEXT: { |
| 40 |
// CHECK: "command-line": [ |
| 41 |
// CHECK: "-fmodule-map-file=[[PREFIX]]/modules/module.modulemap", |
| 42 |
// CHECK-NEXT: "-fmodule-map-file=[[PREFIX]]/modules/module.private.modulemap", |
| 43 |
// CHECK: ], |
| 44 |
// CHECK: "name": "This" |
| 45 |
// CHECK-NEXT: } |
| 46 |
// CHECK-NEXT: ] |
| 47 |
// CHECK: } |
| 48 |
|
| 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 |
| 52 |
|
| 53 |
// RUN: %clang @%t/Foo.cc1.rsp |
| 54 |
// RUN: %clang @%t/This.cc1.rsp |
| 55 |
// RUN: %clang @%t/tu.rsp |