| 1 |
// Check that we get the right file dependencies and not the declared paths from |
| 2 |
// line directives. |
| 3 |
|
| 4 |
// RUN: rm -rf %t |
| 5 |
// RUN: split-file %s %t |
| 6 |
// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json |
| 7 |
|
| 8 |
// RUN: clang-scan-deps -compilation-database %t/cdb.json \ |
| 9 |
// RUN: -mode preprocess-dependency-directives -format experimental-full > %t/deps.json |
| 10 |
|
| 11 |
// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t |
| 12 |
|
| 13 |
// CHECK: "file-deps": [ |
| 14 |
// CHECK-NEXT: "[[PREFIX]]/tu.c" |
| 15 |
// CHECK-NEXT: "[[PREFIX]]/header.h" |
| 16 |
// CHECK-NEXT: ] |
| 17 |
|
| 18 |
//--- cdb.json.template |
| 19 |
[{ |
| 20 |
"file": "DIR/tu.c", |
| 21 |
"directory": "DIR", |
| 22 |
"command": "clang -fsyntax-only DIR/tu.c" |
| 23 |
}] |
| 24 |
|
| 25 |
//--- other.h |
| 26 |
|
| 27 |
//--- other.c |
| 28 |
|
| 29 |
//--- header.h |
| 30 |
#line 100 "other.h" |
| 31 |
|
| 32 |
//--- tu.c |
| 33 |
#include "header.h" |
| 34 |
#line 100 "other.c" |