47 lines · c
1// Ensure that the spelling of a path seen outside a module (e.g. header via2// symlink) does not leak into the compilation of that module unnecessarily.3// Note: the spelling of the modulemap path still depends on the includer, since4// that is the only source of information about it.5 6// Needs symlinks7// UNSUPPORTED: system-windows8 9// RUN: rm -rf %t10// RUN: split-file %s %t11// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json12// RUN: ln -s A.h %t/Z.h13 14// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 -format experimental-full \15// RUN: -mode preprocess-dependency-directives > %t/output16// RUN: FileCheck %s < %t/output17 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.in29[{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.modulemap36module A { header "A.h" }37module B { header "B.h" }38module C { header "C.h" }39 40//--- A.h41 42//--- B.h43#include "Z.h"44 45//--- tu.c46#include "B.h"47