| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json |
| 4 |
|
| 5 |
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -mode preprocess-dependency-directives > %t/result.txt |
| 6 |
|
| 7 |
// RUN: FileCheck %s -input-file %t/result.txt |
| 8 |
|
| 9 |
// Verify that there's a single version of module A. |
| 10 |
|
| 11 |
// CHECK: "modules": [ |
| 12 |
// CHECK-NEXT: { |
| 13 |
// CHECK: "command-line": [ |
| 14 |
// CHECK-NOT: "-fvisibility=" |
| 15 |
// CHECK-NOT: "-ftype-visibility=" |
| 16 |
// CHECK: ] |
| 17 |
// CHECK: "name": "A" |
| 18 |
// CHECK: } |
| 19 |
// CHECK-NOT: "name": "A" |
| 20 |
// CHECK: "translation-units" |
| 21 |
|
| 22 |
//--- cdb.json.template |
| 23 |
[ |
| 24 |
{ |
| 25 |
"directory": "DIR", |
| 26 |
"command": "clang -Imodules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -fsyntax-only DIR/t1.c", |
| 27 |
"file": "DIR/t1.c" |
| 28 |
}, |
| 29 |
{ |
| 30 |
"directory": "DIR", |
| 31 |
"command": "clang -Imodules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -fvisibility=hidden -fsyntax-only DIR/t2.c", |
| 32 |
"file": "DIR/t2.c" |
| 33 |
}, |
| 34 |
{ |
| 35 |
"directory": "DIR", |
| 36 |
"command": "clang -Imodules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -fimplicit-module-maps -fvisibility=hidden -fvisibility-ms-compat -fsyntax-only DIR/t3.c", |
| 37 |
"file": "DIR/t3.c" |
| 38 |
} |
| 39 |
] |
| 40 |
|
| 41 |
//--- modules/A/module.modulemap |
| 42 |
|
| 43 |
module A { |
| 44 |
umbrella header "A.h" |
| 45 |
} |
| 46 |
|
| 47 |
//--- modules/A/A.h |
| 48 |
|
| 49 |
typedef int A_t; |
| 50 |
extern int a(void); |
| 51 |
|
| 52 |
//--- t1.c |
| 53 |
#include "A.h" |
| 54 |
|
| 55 |
//--- t2.c |
| 56 |
#include "A.h" |
| 57 |
|
| 58 |
//--- t3.c |
| 59 |
#include "A.h" |