| 1 |
// Check that the scanner can adjust arguments by reading .rsp files in advance. |
| 2 |
|
| 3 |
// RUN: rm -rf %t |
| 4 |
// RUN: split-file %s %t |
| 5 |
|
| 6 |
// First run the tests with a .cdb |
| 7 |
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json |
| 8 |
// RUN: sed -e "s|DIR|%/t|g" %t/args_nested.template > %t/args_nested.rsp |
| 9 |
|
| 10 |
// RUN: cp %t/args_compilation.rsp %t/args.rsp |
| 11 |
// RUN: clang-scan-deps --compilation-database %t/cdb.json > %t/deps.json |
| 12 |
// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s |
| 13 |
|
| 14 |
// RUN: cp %t/args_preprocess.rsp %t/args.rsp |
| 15 |
// RUN: clang-scan-deps --compilation-database %t/cdb.json > %t/deps.json |
| 16 |
// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s |
| 17 |
|
| 18 |
|
| 19 |
// Now run the tests again with a in-place compilation database |
| 20 |
// RUN: cd %t |
| 21 |
|
| 22 |
// RUN: cp args_compilation.rsp args.rsp |
| 23 |
// RUN: clang-scan-deps -o deps.json -- %clang_cl @args.rsp |
| 24 |
// RUN: cat deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s |
| 25 |
|
| 26 |
// RUN: cp args_preprocess.rsp args.rsp |
| 27 |
// RUN: clang-scan-deps -o deps.json -- %clang_cl @args.rsp |
| 28 |
// RUN: cat deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s |
| 29 |
|
| 30 |
// Here we ensure that we got a qualified .obj with its full path, since that's what we're passing with /Fo |
| 31 |
// CHECK: [[PREFIX]]/tu.obj: |
| 32 |
|
| 33 |
//--- cdb.json.template |
| 34 |
[{ |
| 35 |
"file": "DIR/tu.cpp", |
| 36 |
"directory": "DIR", |
| 37 |
"command": "clang-cl @DIR/args.rsp" |
| 38 |
}] |
| 39 |
|
| 40 |
//--- args_compilation.rsp |
| 41 |
@args_nested.rsp |
| 42 |
/c |
| 43 |
|
| 44 |
//--- args_preprocess.rsp |
| 45 |
@args_nested.rsp |
| 46 |
/E |
| 47 |
|
| 48 |
//--- args_nested.template |
| 49 |
/I include |
| 50 |
tu.cpp |
| 51 |
/FoDIR/tu.obj |
| 52 |
|
| 53 |
//--- include/header.h |
| 54 |
|
| 55 |
//--- tu.cpp |
| 56 |
#include "header.h" |