| 1 |
// Most likely platform specific sed differences |
| 2 |
// UNSUPPORTED: system-windows |
| 3 |
|
| 4 |
// This test verifies modules that are entirely comprised from stable directory inputs are captured in |
| 5 |
// dependency information. |
| 6 |
|
| 7 |
// The first compilation verifies that transitive dependencies on local input are captured. |
| 8 |
// The second compilation verifies that external paths are resolved when a |
| 9 |
// vfsoverlay for determining is-in-stable-directories. |
| 10 |
|
| 11 |
// RUN: rm -rf %t |
| 12 |
// RUN: split-file %s %t |
| 13 |
// RUN: sed -e "s|DIR|%/t|g" %t/compile-commands.json.in > %t/compile-commands.json |
| 14 |
// RUN: sed -e "s|DIR|%/t|g" %t/overlay.json.template > %t/overlay.json |
| 15 |
// RUN: clang-scan-deps -compilation-database %t/compile-commands.json \ |
| 16 |
// RUN: -j 1 -format experimental-full > %t/deps.db |
| 17 |
// RUN: cat %t/deps.db | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t |
| 18 |
|
| 19 |
// CHECK: "modules": [ |
| 20 |
// CHECK-NEXT: { |
| 21 |
// CHECK: "is-in-stable-directories": true, |
| 22 |
// CHECK: "name": "A" |
| 23 |
|
| 24 |
// Verify that there are no more occurances of sysroot. |
| 25 |
// CHECK-NOT: "is-in-stable-directories" |
| 26 |
|
| 27 |
// CHECK: "name": "A" |
| 28 |
// CHECK: "USE_VFS" |
| 29 |
// CHECK: "name": "B" |
| 30 |
// CHECK: "name": "C" |
| 31 |
// CHECK: "name": "D" |
| 32 |
// CHECK: "name": "NotInSDK" |
| 33 |
|
| 34 |
//--- compile-commands.json.in |
| 35 |
[ |
| 36 |
{ |
| 37 |
"directory": "DIR", |
| 38 |
"command": "clang -c DIR/client.c -isysroot DIR/Sysroot -IDIR/Sysroot/usr/include -IDIR/BuildDir -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps", |
| 39 |
"file": "DIR/client.c" |
| 40 |
}, |
| 41 |
{ |
| 42 |
"directory": "DIR", |
| 43 |
"command": "clang -c DIR/client.c -isysroot DIR/Sysroot -IDIR/Sysroot/usr/include -ivfsoverlay DIR/overlay.json -DUSE_VFS -IDIR/BuildDir -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps", |
| 44 |
"file": "DIR/client.c" |
| 45 |
} |
| 46 |
] |
| 47 |
|
| 48 |
//--- overlay.json.template |
| 49 |
{ |
| 50 |
"version": 0, |
| 51 |
"case-sensitive": "false", |
| 52 |
"roots": [ |
| 53 |
{ |
| 54 |
"external-contents": "DIR/SysrootButNotReally/A/A_vfs.h", |
| 55 |
"name": "DIR/Sysroot/usr/include/A/A_vfs.h", |
| 56 |
"type": "file" |
| 57 |
} |
| 58 |
] |
| 59 |
} |
| 60 |
|
| 61 |
//--- Sysroot/usr/include/A/module.modulemap |
| 62 |
module A { |
| 63 |
umbrella "." |
| 64 |
} |
| 65 |
|
| 66 |
//--- Sysroot/usr/include/A/A.h |
| 67 |
#ifdef USE_VFS |
| 68 |
#include <A/A_vfs.h> |
| 69 |
#endif |
| 70 |
typedef int A_t; |
| 71 |
|
| 72 |
//--- SysrootButNotReally/A/A_vfs.h |
| 73 |
typedef int typeFromVFS; |
| 74 |
|
| 75 |
//--- Sysroot/usr/include/B/module.modulemap |
| 76 |
module B [system] { |
| 77 |
umbrella "." |
| 78 |
} |
| 79 |
|
| 80 |
//--- Sysroot/usr/include/B/B.h |
| 81 |
#include <C/C.h> |
| 82 |
typedef int B_t; |
| 83 |
|
| 84 |
//--- Sysroot/usr/include/C/module.modulemap |
| 85 |
module C [system] { |
| 86 |
umbrella "." |
| 87 |
} |
| 88 |
|
| 89 |
//--- Sysroot/usr/include/C/C.h |
| 90 |
#include <D/D.h> |
| 91 |
|
| 92 |
//--- Sysroot/usr/include/D/module.modulemap |
| 93 |
module D [system] { |
| 94 |
umbrella "." |
| 95 |
} |
| 96 |
|
| 97 |
// Simulate a header that will be resolved in a local directory, from a sysroot header. |
| 98 |
//--- Sysroot/usr/include/D/D.h |
| 99 |
#include <HeaderNotFoundInSDK.h> |
| 100 |
|
| 101 |
//--- BuildDir/module.modulemap |
| 102 |
module NotInSDK [system] { |
| 103 |
umbrella "." |
| 104 |
} |
| 105 |
|
| 106 |
//--- BuildDir/HeaderNotFoundInSDK.h |
| 107 |
typedef int local_t; |
| 108 |
|
| 109 |
//--- client.c |
| 110 |
#include <A/A.h> |
| 111 |
#include <B/B.h> |