Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / ClangScanDeps / header-search-pruning.cpp
blob0632cccbac643c85924e62d3d511bed3700429d8
1 // RUN: rm -rf %t && mkdir -p %t
2 // RUN: cp -r %S/Inputs/header-search-pruning/* %t
3 // RUN: cp %S/header-search-pruning.cpp %t/header-search-pruning.cpp
4 // RUN: sed -e "s|DIR|%/t|g" -e "s|DEFINES|-DINCLUDE_A|g" %S/Inputs/header-search-pruning/cdb.json > %t/cdb_a.json
5 // RUN: sed -e "s|DIR|%/t|g" -e "s|DEFINES|-DINCLUDE_B|g" %S/Inputs/header-search-pruning/cdb.json > %t/cdb_b.json
6 // RUN: sed -e "s|DIR|%/t|g" -e "s|DEFINES|-DINCLUDE_A -DINCLUDE_B|g" %S/Inputs/header-search-pruning/cdb.json > %t/cdb_ab.json
7 //
8 // RUN: clang-scan-deps -compilation-database %t/cdb_a.json -format experimental-full -optimize-args >> %t/result_a.json
9 // RUN: cat %t/result_a.json | sed 's:\\\\\?:/:g' | FileCheck --check-prefixes=CHECK_A %s
11 // RUN: clang-scan-deps -compilation-database %t/cdb_b.json -format experimental-full -optimize-args >> %t/result_b.json
12 // RUN: cat %t/result_b.json | sed 's:\\\\\?:/:g' | FileCheck --check-prefixes=CHECK_B %s
14 // RUN: clang-scan-deps -compilation-database %t/cdb_ab.json -format experimental-full -optimize-args >> %t/result_ab.json
15 // RUN: cat %t/result_ab.json | sed 's:\\\\\?:/:g' | FileCheck --check-prefixes=CHECK_AB %s
17 #include "mod.h"
19 // CHECK_A: {
20 // CHECK_A-NEXT: "modules": [
21 // CHECK_A-NEXT: {
22 // CHECK_A-NEXT: "clang-module-deps": [],
23 // CHECK_A-NEXT: "clang-modulemap-file": "{{.*}}",
24 // CHECK_A-NEXT: "command-line": [
25 // CHECK_A-NEXT: "-cc1"
26 // CHECK_A: "-I",
27 // CHECK_A-NEXT: "begin",
28 // CHECK_A-NEXT: "-I",
29 // CHECK_A-NEXT: "a",
30 // CHECK_A-NEXT: "-I",
31 // CHECK_A-NEXT: "end"
32 // CHECK_A: ],
33 // CHECK_A-NEXT: "context-hash": "{{.*}}",
34 // CHECK_A-NEXT: "file-deps": [
35 // CHECK_A: ],
36 // CHECK_A-NEXT: "name": "mod"
37 // CHECK_A-NEXT: }
38 // CHECK_A-NEXT: ]
39 // CHECK_A: }
41 // CHECK_B: {
42 // CHECK_B-NEXT: "modules": [
43 // CHECK_B-NEXT: {
44 // CHECK_B-NEXT: "clang-module-deps": [],
45 // CHECK_B-NEXT: "clang-modulemap-file": "{{.*}}",
46 // CHECK_B-NEXT: "command-line": [
47 // CHECK_B-NEXT: "-cc1"
48 // CHECK_B: "-I",
49 // CHECK_B-NEXT: "begin",
50 // CHECK_B-NEXT: "-I",
51 // CHECK_B-NEXT: "b",
52 // CHECK_B-NEXT: "-I",
53 // CHECK_B-NEXT: "end"
54 // CHECK_B: ],
55 // CHECK_B-NEXT: "context-hash": "{{.*}}",
56 // CHECK_B-NEXT: "file-deps": [
57 // CHECK_B: ],
58 // CHECK_B-NEXT: "name": "mod"
59 // CHECK_B-NEXT: }
60 // CHECK_B-NEXT: ]
61 // CHECK_B: }
63 // CHECK_AB: {
64 // CHECK_AB-NEXT: "modules": [
65 // CHECK_AB-NEXT: {
66 // CHECK_AB-NEXT: "clang-module-deps": [],
67 // CHECK_AB-NEXT: "clang-modulemap-file": "{{.*}}",
68 // CHECK_AB-NEXT: "command-line": [
69 // CHECK_AB-NEXT: "-cc1"
70 // CHECK_AB: "-I",
71 // CHECK_AB-NEXT: "begin",
72 // CHECK_AB-NEXT: "-I",
73 // CHECK_AB-NEXT: "a",
74 // CHECK_AB-NEXT: "-I",
75 // CHECK_AB-NEXT: "b",
76 // CHECK_AB-NEXT: "-I",
77 // CHECK_AB-NEXT: "end"
78 // CHECK_AB: ],
79 // CHECK_AB-NEXT: "context-hash": "{{.*}}",
80 // CHECK_AB-NEXT: "file-deps": [
81 // CHECK_AB: ],
82 // CHECK_AB-NEXT: "name": "mod"
83 // CHECK_AB-NEXT: }
84 // CHECK_AB-NEXT: ]
85 // CHECK_AB: }