| 1 |
// Ensure that the spelling of a path seen outside a module (e.g. header via |
| 2 |
// symlink) does not leak into the compilation of that module unnecessarily. |
| 3 |
// Note: the spelling of the modulemap path still depends on the includer, since |
| 4 |
// that is the only source of information about it. |
| 5 |
|
| 6 |
// Needs symlinks |
| 7 |
// UNSUPPORTED: system-windows |
| 8 |
|
| 9 |
// RUN: rm -rf %t |
| 10 |
// RUN: split-file %s %t |
| 11 |
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json |
| 12 |
// RUN: ln -s A.h %t/Z.h |
| 13 |
|
| 14 |
// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 -format experimental-full \ |
| 15 |
// RUN: -mode preprocess-dependency-directives > %t/output |
| 16 |
// RUN: FileCheck %s < %t/output |
| 17 |
|
| 18 |
// CHECK: "modules": [ |
| 19 |
// CHECK-NEXT: { |
| 20 |
// CHECK: "file-deps": [ |
| 21 |
// CHECK-NEXT: "{{.*}}module.modulemap", |
| 22 |
// CHECK-NEXT: "{{.*}}A.h" |
| 23 |
// CHECK-NEXT: ], |
| 24 |
// CHECK-NEXT: "link-libraries": [], |
| 25 |
// CHECK-NEXT: "name": "A" |
| 26 |
// CHECK-NEXT: } |
| 27 |
|
| 28 |
//--- cdb.json.in |
| 29 |
[{ |
| 30 |
"directory": "DIR", |
| 31 |
"command": "clang -fsyntax-only DIR/tu.c -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps", |
| 32 |
"file": "DIR/tu.c" |
| 33 |
}] |
| 34 |
|
| 35 |
//--- module.modulemap |
| 36 |
module A { header "A.h" } |
| 37 |
module B { header "B.h" } |
| 38 |
module C { header "C.h" } |
| 39 |
|
| 40 |
//--- A.h |
| 41 |
|
| 42 |
//--- B.h |
| 43 |
#include "Z.h" |
| 44 |
|
| 45 |
//--- tu.c |
| 46 |
#include "B.h" |