| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// Unsupported on AIX because we don't support the requisite "__clangast" |
| 4 |
// section in XCOFF yet. |
| 5 |
// UNSUPPORTED: system-windows, target={{.*}}-aix{{.*}} |
| 6 |
|
| 7 |
//--- cdb_pch.json |
| 8 |
[ |
| 9 |
{ |
| 10 |
"directory": "DIR", |
| 11 |
"command": "clang -x c-header DIR/pch.h -fmodules -gmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache -o DIR/pch.h.gch", |
| 12 |
"file": "DIR/pch.h" |
| 13 |
} |
| 14 |
] |
| 15 |
|
| 16 |
//--- cdb_tu.json |
| 17 |
[ |
| 18 |
{ |
| 19 |
"directory": "DIR", |
| 20 |
"command": "clang -c DIR/tu.c -fmodules -gmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache -include DIR/pch.h -o DIR/tu.o", |
| 21 |
"file": "DIR/tu.c" |
| 22 |
} |
| 23 |
] |
| 24 |
|
| 25 |
//--- module.modulemap |
| 26 |
module mod { header "symlink.h" } |
| 27 |
|
| 28 |
//--- pch.h |
| 29 |
#include "symlink.h" |
| 30 |
|
| 31 |
//--- original.h |
| 32 |
// Comment that will be stripped by the minimizer. |
| 33 |
#define MACRO 1 |
| 34 |
|
| 35 |
//--- tu.c |
| 36 |
#include "original.h" |
| 37 |
static int foo = MACRO; // Macro usage that will trigger |
| 38 |
// input file consistency checks. |
| 39 |
|
| 40 |
// RUN: ln -s %t/original.h %t/symlink.h |
| 41 |
|
| 42 |
// RUN: sed -e "s|DIR|%/t|g" %t/cdb_pch.json > %t/cdb.json |
| 43 |
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \ |
| 44 |
// RUN: -module-files-dir %t/build > %t/result_pch.json |
| 45 |
// |
| 46 |
// RUN: %deps-to-rsp %t/result_pch.json --module-name=mod > %t/mod.cc1.rsp |
| 47 |
// RUN: %deps-to-rsp %t/result_pch.json --tu-index=0 > %t/pch.rsp |
| 48 |
// |
| 49 |
// RUN: %clang @%t/mod.cc1.rsp |
| 50 |
// RUN: %clang @%t/pch.rsp |
| 51 |
|
| 52 |
// RUN: sed -e "s|DIR|%/t|g" %t/cdb_tu.json > %t/cdb.json |
| 53 |
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \ |
| 54 |
// RUN: -module-files-dir %t/build > %t/result_tu.json |