|
| 1 | +// This test verifies modules that are entirely comprised from stable directory inputs are captured in |
| 2 | +// dependency information when paths are prefix mapped. |
| 3 | + |
| 4 | +// REQUIRES: shell,ondisk_cas |
| 5 | + |
| 6 | +// RUN: rm -rf %t |
| 7 | +// RUN: split-file %s %t |
| 8 | +// RUN: sed -e "s|DIR|%/t|g" %t/overlay.json.template > %t/overlay.json |
| 9 | +// RUN: sed -e "s|DIR|%/t|g" %t/compile.json.in > %t/compile.json |
| 10 | + |
| 11 | +// RUN: clang-scan-deps -compilation-database %t/compile.json \ |
| 12 | +// RUN: -prefix-map=%t/modules=/^modules -prefix-map=%t=/^src -prefix-map-sdk=/^sdk -prefix-map-toolchain=/^tc \ |
| 13 | +// RUN: -cas-path %t/cas -module-files-dir %t/modules \ |
| 14 | +// RUN: -j 1 -format experimental-full > %t/deps.db |
| 15 | + |
| 16 | +// RUN: cat %t/deps.db | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefix DEP |
| 17 | + |
| 18 | +// DEP: "is-in-stable-directories": true |
| 19 | +// DEP: "name": "A" |
| 20 | + |
| 21 | +// CHECK-NOT: "is-in-stable-directories": true |
| 22 | +// CHECK-NOT: warning: |
| 23 | +// CHECK-NOT: error: |
| 24 | + |
| 25 | +//--- compile.json.in |
| 26 | +[ |
| 27 | +{ |
| 28 | + "directory": "DIR", |
| 29 | + "command": "clang -x c -c DIR/client.c -isysroot DIR/MacOSX.sdk -IDIR/BuildDir -ivfsoverlay DIR/overlay.json -IDIR/MacOSX.sdk/usr/include -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -o DIR/client.c.o", |
| 30 | + "file": "DIR/client.c" |
| 31 | +} |
| 32 | +] |
| 33 | + |
| 34 | +//--- overlay.json.template |
| 35 | +{ |
| 36 | + "version": 0, |
| 37 | + "case-sensitive": "false", |
| 38 | + "roots": [ |
| 39 | + { |
| 40 | + "external-contents": "DIR/BuildDir/B_vfs.h", |
| 41 | + "name": "DIR/MacOSX.sdk/usr/include/B/B_vfs.h", |
| 42 | + "type": "file" |
| 43 | + } |
| 44 | + ] |
| 45 | +} |
| 46 | + |
| 47 | +//--- MacOSX.sdk/usr/include/A/module.modulemap |
| 48 | +module A [system] { |
| 49 | + umbrella "." |
| 50 | +} |
| 51 | + |
| 52 | +//--- MacOSX.sdk/usr/include/A/A.h |
| 53 | +typedef int A_type; |
| 54 | + |
| 55 | +//--- MacOSX.sdk/usr/include/B/module.modulemap |
| 56 | +module B [system] { |
| 57 | + umbrella "." |
| 58 | +} |
| 59 | + |
| 60 | +//--- MacOSX.sdk/usr/include/B/B.h |
| 61 | +#include <B/B_vfs.h> |
| 62 | + |
| 63 | +//--- BuildDir/B_vfs.h |
| 64 | +typedef int local_t; |
| 65 | + |
| 66 | +//--- MacOSX.sdk/usr/include/sys/sys.h |
| 67 | +#include <A/A.h> |
| 68 | +typedef int sys_t_m; |
| 69 | + |
| 70 | +//--- MacOSX.sdk/usr/include/sys/module.modulemap |
| 71 | +module sys [system] { |
| 72 | + umbrella "." |
| 73 | +} |
| 74 | + |
| 75 | +//--- MacOSX.sdk/usr/include/B_transitive/B.h |
| 76 | +#include <B/B.h> |
| 77 | + |
| 78 | +//--- MacOSX.sdk/usr/include/B_transitive/module.modulemap |
| 79 | +module B_transitive [system] { |
| 80 | + umbrella "." |
| 81 | +} |
| 82 | + |
| 83 | +//--- MacOSX.sdk/usr/include/C/module.modulemap |
| 84 | +module C [system] { |
| 85 | + umbrella "." |
| 86 | +} |
| 87 | + |
| 88 | +//--- MacOSX.sdk/usr/include/C/C.h |
| 89 | +#include <B_transitive/B.h> |
| 90 | + |
| 91 | + |
| 92 | +//--- client.c |
| 93 | +#include <A/A.h> |
| 94 | +#include <C/C.h> // This dependency transitively depends on a local header. |
0 commit comments