| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// RUN: sed -e "s|DIR|%/t|g" %t/build/compile-commands.json.in > %t/build/compile-commands.json |
| 4 |
// RUN: sed -e "s|DIR|%/t|g" %t/build/vfsoverlay.yaml.in > %t/build/vfsoverlay.yaml |
| 5 |
// RUN: sed -e "s|DIR|%/t|g" %t/build/vfs.notyaml.in > %t/build/vfs.notyaml |
| 6 |
// RUN: clang-scan-deps -compilation-database %t/build/compile-commands.json \ |
| 7 |
// RUN: -j 1 -format experimental-full --optimize-args=vfs,header-search > %t/deps.db |
| 8 |
|
| 9 |
// RUN: %deps-to-rsp %t/deps.db --module-name=A > %t/A.rsp |
| 10 |
// RUN: cd %t && %clang @%t/A.rsp |
| 11 |
|
| 12 |
// Check that the following edge cases are handled by ivfsoverlay tracking |
| 13 |
// * `-ivfsoverlay` args that depend on earlier `-ivfsoverlay` args. |
| 14 |
|
| 15 |
//--- build/compile-commands.json.in |
| 16 |
|
| 17 |
[ |
| 18 |
{ |
| 19 |
"directory": "DIR", |
| 20 |
"command": "clang -c DIR/0.m -Imodules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps -ivfsoverlay build/vfsoverlay.yaml -ivfsoverlay build/vfs.yaml", |
| 21 |
"file": "DIR/0.m" |
| 22 |
} |
| 23 |
] |
| 24 |
|
| 25 |
//--- build/vfsoverlay.yaml.in |
| 26 |
|
| 27 |
{ |
| 28 |
"version":0, |
| 29 |
"case-sensitive":"false", |
| 30 |
"roots":[ |
| 31 |
{ |
| 32 |
"contents":[ |
| 33 |
{ |
| 34 |
"external-contents":"DIR/build/vfs.notyaml", |
| 35 |
"name":"vfs.yaml", |
| 36 |
"type":"file" |
| 37 |
} |
| 38 |
], |
| 39 |
"name":"DIR/build", |
| 40 |
"type":"directory" |
| 41 |
} |
| 42 |
] |
| 43 |
} |
| 44 |
|
| 45 |
//--- build/vfs.notyaml.in |
| 46 |
|
| 47 |
{ |
| 48 |
"version":0, |
| 49 |
"case-sensitive":"false", |
| 50 |
"roots":[ |
| 51 |
{ |
| 52 |
"contents":[ |
| 53 |
{ |
| 54 |
"external-contents":"DIR/build/module.modulemap", |
| 55 |
"name":"module.modulemap", |
| 56 |
"type":"file" |
| 57 |
}, |
| 58 |
{ |
| 59 |
"external-contents":"DIR/build/A.h", |
| 60 |
"name":"A.h", |
| 61 |
"type":"file" |
| 62 |
} |
| 63 |
], |
| 64 |
"name":"DIR/modules/A", |
| 65 |
"type":"directory" |
| 66 |
} |
| 67 |
] |
| 68 |
} |
| 69 |
|
| 70 |
//--- build/module.modulemap |
| 71 |
|
| 72 |
module A { |
| 73 |
umbrella header "A.h" |
| 74 |
} |
| 75 |
|
| 76 |
//--- build/A.h |
| 77 |
|
| 78 |
typedef int A_t; |
| 79 |
|
| 80 |
//--- 0.m |
| 81 |
|
| 82 |
#include <A.h> |
| 83 |
|
| 84 |
A_t a = 0; |