Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / ClangScanDeps / modules-full-by-mod-name.c
blob7ebd39d0dc1c9e34149699c2a7b66f4d71479ba6
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
4 //--- module.modulemap
5 module root { header "root.h" }
6 module direct { header "direct.h" }
7 module transitive { header "transitive.h" }
8 //--- root.h
9 #include "direct.h"
10 #include "root/textual.h"
11 //--- direct.h
12 #include "transitive.h"
13 //--- transitive.h
14 // empty
16 //--- root/textual.h
17 // This is here to verify that the "root" directory doesn't clash with name of
18 // the "root" module.
20 //--- cdb.json.template
22 "file": "",
23 "directory": "DIR",
24 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -I DIR -x c"
27 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
28 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -module-name=root > %t/result.json
29 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
31 // CHECK: {
32 // CHECK-NEXT: "modules": [
33 // CHECK-NEXT: {
34 // CHECK-NEXT: "clang-module-deps": [
35 // CHECK-NEXT: {
36 // CHECK-NEXT: "context-hash": "{{.*}}",
37 // CHECK-NEXT: "module-name": "transitive"
38 // CHECK-NEXT: }
39 // CHECK-NEXT: ],
40 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
41 // CHECK-NEXT: "command-line": [
42 // CHECK: ],
43 // CHECK-NEXT: "context-hash": "{{.*}}",
44 // CHECK-NEXT: "file-deps": [
45 // CHECK-NEXT: "[[PREFIX]]/direct.h"
46 // CHECK-NEXT: "[[PREFIX]]/module.modulemap"
47 // CHECK-NEXT: ],
48 // CHECK-NEXT: "name": "direct"
49 // CHECK-NEXT: },
50 // CHECK-NEXT: {
51 // CHECK-NEXT: "clang-module-deps": [
52 // CHECK-NEXT: {
53 // CHECK-NEXT: "context-hash": "{{.*}}",
54 // CHECK-NEXT: "module-name": "direct"
55 // CHECK-NEXT: }
56 // CHECK-NEXT: ],
57 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
58 // CHECK-NEXT: "command-line": [
59 // CHECK: ],
60 // CHECK-NEXT: "context-hash": "{{.*}}",
61 // CHECK-NEXT: "file-deps": [
62 // CHECK-NEXT: "[[PREFIX]]/module.modulemap"
63 // CHECK-NEXT: "[[PREFIX]]/root.h"
64 // CHECK-NEXT: "[[PREFIX]]/root/textual.h"
65 // CHECK-NEXT: ],
66 // CHECK-NEXT: "name": "root"
67 // CHECK-NEXT: },
68 // CHECK-NEXT: {
69 // CHECK-NEXT: "clang-module-deps": [],
70 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
71 // CHECK-NEXT: "command-line": [
72 // CHECK: ],
73 // CHECK-NEXT: "context-hash": "{{.*}}",
74 // CHECK-NEXT: "file-deps": [
75 // CHECK-NEXT: "[[PREFIX]]/module.modulemap"
76 // CHECK-NEXT: "[[PREFIX]]/transitive.h"
77 // CHECK-NEXT: ],
78 // CHECK-NEXT: "name": "transitive"
79 // CHECK-NEXT: }
80 // CHECK-NEXT: ],
81 // CHECK-NEXT: "translation-units": []
82 // CHECK-NEXT: }