31 lines · c
1// Test that -working-directory works even when it differs from the working2// directory of the filesystem.3 4// RUN: rm -rf %t5// RUN: mkdir -p %t/other6// RUN: split-file %s %t7// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json8 9// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \10// RUN: > %t/deps.json11 12// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t13 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.template21[{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.h28 29//--- cwd/t.c30#include "h1.h"31