| 1 |
// This test checks that we don't report non-affecting system module maps. |
| 2 |
// More specifically, we check that explicitly-specified module map file is not |
| 3 |
// being shadowed in explicit build by a module map file found during implicit |
| 4 |
// module map search. |
| 5 |
|
| 6 |
// RUN: rm -rf %t |
| 7 |
// RUN: split-file %s %t |
| 8 |
|
| 9 |
//--- tu.m |
| 10 |
@import first; |
| 11 |
|
| 12 |
//--- zeroth/module.modulemap |
| 13 |
module X {} |
| 14 |
|
| 15 |
//--- first/module.modulemap |
| 16 |
module first { header "first.h" } |
| 17 |
//--- first/first.h |
| 18 |
@import third; |
| 19 |
//--- second/module.modulemap |
| 20 |
module X {} |
| 21 |
//--- third/module.modulemap |
| 22 |
module third {} |
| 23 |
|
| 24 |
//--- cdb.json.template |
| 25 |
[{ |
| 26 |
"file": "DIR/tu.m", |
| 27 |
"directory": "DIR", |
| 28 |
"command": "clang -fmodules -fmodules-cache-path=DIR/cache -fmodule-name=X -fmodule-map-file=DIR/zeroth/module.modulemap -isystem DIR/first -isystem DIR/second -isystem DIR/third -c DIR/tu.m -o DIR/tu.o" |
| 29 |
}] |
| 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 |
// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t |
| 34 |
// CHECK: { |
| 35 |
// CHECK-NEXT: "modules": [ |
| 36 |
// CHECK-NEXT: { |
| 37 |
// CHECK-NEXT: "clang-module-deps": [ |
| 38 |
// CHECK-NEXT: { |
| 39 |
// CHECK-NEXT: "context-hash": "{{.*}}", |
| 40 |
// CHECK-NEXT: "module-name": "third" |
| 41 |
// CHECK-NEXT: } |
| 42 |
// CHECK-NEXT: ], |
| 43 |
// CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/first/module.modulemap", |
| 44 |
// CHECK-NEXT: "command-line": [ |
| 45 |
// CHECK: ], |
| 46 |
// CHECK-NEXT: "context-hash": "{{.*}}", |
| 47 |
// CHECK-NEXT: "file-deps": [ |
| 48 |
// CHECK-NEXT: [[PREFIX]]/first/module.modulemap", |
| 49 |
// CHECK-NEXT: [[PREFIX]]/first/first.h", |
| 50 |
// CHECK-NEXT: [[PREFIX]]/third/module.modulemap" |
| 51 |
// CHECK-NEXT: ], |
| 52 |
// CHECK-NEXT: "link-libraries": [], |
| 53 |
// CHECK-NEXT: "name": "first" |
| 54 |
// CHECK-NEXT: } |
| 55 |
// CHECK: ] |
| 56 |
// CHECK: } |
| 57 |
|
| 58 |
// RUN: %deps-to-rsp %t/result.json --module-name=third > %t/third.cc1.rsp |
| 59 |
// RUN: %deps-to-rsp %t/result.json --module-name=first > %t/first.cc1.rsp |
| 60 |
// RUN: %clang @%t/third.cc1.rsp |
| 61 |
// RUN: %clang @%t/first.cc1.rsp |