| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
|
| 4 |
//--- cdb.json.in |
| 5 |
[{ |
| 6 |
"directory": "DIR", |
| 7 |
"command": "clang -c DIR/tu.c -o DIR/tu.o -IDIR/include", |
| 8 |
"file": "DIR/tu.c" |
| 9 |
}] |
| 10 |
//--- include/header1.h |
| 11 |
//--- include/header2.h |
| 12 |
//--- include/header3.h |
| 13 |
//--- include/header4.h |
| 14 |
//--- tu.c |
| 15 |
#if __has_include("header1.h") |
| 16 |
#endif |
| 17 |
|
| 18 |
#if 0 |
| 19 |
#elif __has_include("header2.h") |
| 20 |
#endif |
| 21 |
|
| 22 |
#define H3 __has_include("header3.h") |
| 23 |
#if H3 |
| 24 |
#endif |
| 25 |
|
| 26 |
#define H4 __has_include("header4.h") |
| 27 |
#if 0 |
| 28 |
#elif H4 |
| 29 |
#endif |
| 30 |
|
| 31 |
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json |
| 32 |
// RUN: clang-scan-deps -compilation-database %t/cdb.json -mode preprocess-dependency-directives | FileCheck %s |
| 33 |
// RUN: clang-scan-deps -compilation-database %t/cdb.json -mode preprocess | FileCheck %s |
| 34 |
|
| 35 |
// CHECK: tu.c |
| 36 |
// CHECK-NEXT: header1.h |
| 37 |
// CHECK-NEXT: header2.h |
| 38 |
// CHECK-NEXT: header3.h |
| 39 |
// CHECK-NEXT: header4.h |