| 1 |
// Check that the scanner can handle a response file input. Uses -verbatim-args |
| 2 |
// to ensure response files are expanded by the scanner library and not the |
| 3 |
// argumeent adjuster in clang-scan-deps. |
| 4 |
|
| 5 |
// RUN: rm -rf %t |
| 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 -verbatim-args -format experimental-full -compilation-database %t/cdb.json > %t/deps.json |
| 10 |
|
| 11 |
// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s |
| 12 |
|
| 13 |
// CHECK: "command-line": [ |
| 14 |
// CHECK: "-fsyntax-only" |
| 15 |
// CHECK: "-x" |
| 16 |
// CHECK-NEXT: "c" |
| 17 |
// CHECK: "tu.c" |
| 18 |
// CHECK: "-I" |
| 19 |
// CHECK-NEXT: "include" |
| 20 |
// CHECK: ], |
| 21 |
// CHECK: "file-deps": [ |
| 22 |
// CHECK-NEXT: "[[PREFIX]]/tu.c" |
| 23 |
// CHECK-NEXT: "[[PREFIX]]/include/header.h" |
| 24 |
// CHECK-NEXT: ] |
| 25 |
|
| 26 |
//--- cdb.json.template |
| 27 |
[{ |
| 28 |
"file": "DIR/t.c", |
| 29 |
"directory": "DIR", |
| 30 |
"command": "clang @DIR/args.txt" |
| 31 |
}] |
| 32 |
|
| 33 |
//--- args.txt |
| 34 |
@args_nested.txt |
| 35 |
-fsyntax-only tu.c |
| 36 |
|
| 37 |
//--- args_nested.txt |
| 38 |
-I include |
| 39 |
|
| 40 |
//--- include/header.h |
| 41 |
|
| 42 |
//--- tu.c |
| 43 |
#include "header.h" |