xref: /llvm-project/clang/test/ClangScanDeps/response-file.c (revision fcab930cd32e6d977816fa7094a0de0bc0d7dd1f)
1 // Check that the scanner can handle a response file input.
2 
3 // RUN: rm -rf %t
4 // RUN: split-file %s %t
5 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
6 
7 // RUN: clang-scan-deps -format experimental-full -compilation-database %t/cdb.json > %t/deps.json
8 
9 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
10 
11 // CHECK:      "command-line": [
12 // CHECK:        "-fsyntax-only"
13 // CHECK:        "-x"
14 // CHECK-NEXT:   "c"
15 // CHECK:        "tu.c"
16 // CHECK:        "-I"
17 // CHECK-NEXT:   "include"
18 // CHECK:      ],
19 // CHECK:      "file-deps": [
20 // CHECK-NEXT:   "[[PREFIX]]/tu.c"
21 // CHECK-NEXT:   "[[PREFIX]]/include/header.h"
22 // CHECK-NEXT: ]
23 
24 //--- cdb.json.template
25 [{
26   "file": "DIR/t.c",
27   "directory": "DIR",
28   "command": "clang @DIR/args.txt"
29 }]
30 
31 //--- args.txt
32 @args_nested.txt
33 -fsyntax-only tu.c
34 
35 //--- args_nested.txt
36 -I include
37 
38 //--- include/header.h
39 
40 //--- tu.c
41 #include "header.h"
42