| 1 |
// Test that -working-directory works even when it differs from the working |
| 2 |
// directory of the filesystem. |
| 3 |
|
| 4 |
// RUN: rm -rf %t |
| 5 |
// RUN: mkdir -p %t/other |
| 6 |
// RUN: split-file %s %t |
| 7 |
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json |
| 8 |
|
| 9 |
// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \ |
| 10 |
// RUN: > %t/deps.json |
| 11 |
|
| 12 |
// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t |
| 13 |
|
| 14 |
// CHECK: "file-deps": [ |
| 15 |
// CHECK-NEXT: "[[PREFIX]]/cwd/t.c" |
| 16 |
// CHECK-NEXT: "[[PREFIX]]/cwd/relative/h1.h" |
| 17 |
// CHECK-NEXT: ] |
| 18 |
// CHECK-NEXT: "input-file": "[[PREFIX]]/cwd/t.c" |
| 19 |
|
| 20 |
//--- cdb.json.template |
| 21 |
[{ |
| 22 |
"directory": "DIR/other", |
| 23 |
"command": "clang -c t.c -I relative -working-directory DIR/cwd", |
| 24 |
"file": "DIR/cwd/t.c" |
| 25 |
}] |
| 26 |
|
| 27 |
//--- cwd/relative/h1.h |
| 28 |
|
| 29 |
//--- cwd/t.c |
| 30 |
#include "h1.h" |