Fix some typos (#123506)
[llvm-project.git] / clang / test / ClangScanDeps / link-libraries.c
blobcc2e223102024bbbcf57d8dd8b175c14142577c6
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: mkdir %t/Inputs
4 // RUN: cp -R %S/Inputs/frameworks %t/Inputs/frameworks
5 // RUN: split-file %s %t
7 //--- module.modulemap
8 module root { header "root.h" }
9 module direct { header "direct.h" }
10 module transitive {
11 header "transitive.h"
12 link framework "libTransitive"
14 //--- root.h
15 #include "direct.h"
16 #include "root/textual.h"
17 #include "Framework/Framework.h"
18 //--- direct.h
19 #include "transitive.h"
20 //--- transitive.h
21 // empty
23 //--- root/textual.h
24 // This is here to verify that the "root" directory doesn't clash with name of
25 // the "root" module.
27 //--- cdb.json.template
29 "file": "",
30 "directory": "DIR",
31 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -FDIR/Inputs/frameworks -I DIR -x c"
34 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
35 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -module-name=root > %t/result.json
36 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
38 // CHECK: {
39 // CHECK-NEXT: "modules": [
40 // CHECK-NEXT: {
41 // CHECK-NEXT: "clang-module-deps": [],
42 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Inputs/frameworks/module.modulemap",
43 // CHECK-NEXT: "command-line": [
44 // CHECK: ],
45 // CHECK-NEXT: "context-hash": "{{.*}}",
46 // CHECK-NEXT: "file-deps": [
47 // CHECK-NEXT: "[[PREFIX]]/Inputs/frameworks/module.modulemap",
48 // CHECK-NEXT: "[[PREFIX]]/Inputs/frameworks/Framework.framework/Headers/Framework.h"
49 // CHECK-NEXT: ],
50 // CHECK-NEXT: "link-libraries": [
51 // CHECK-NEXT: {
52 // CHECK-NEXT: "isFramework": true,
53 // CHECK-NEXT: "link-name": "Framework"
54 // CHECK-NEXT: }
55 // CHECK-NEXT: ],
56 // CHECK-NEXT: "name": "Framework"
57 // CHECK-NEXT: },
58 // CHECK-NEXT: {
59 // CHECK-NEXT: "clang-module-deps": [
60 // CHECK-NEXT: {
61 // CHECK-NEXT: "context-hash": "{{.*}}",
62 // CHECK-NEXT: "module-name": "transitive"
63 // CHECK-NEXT: }
64 // CHECK-NEXT: ],
65 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
66 // CHECK-NEXT: "command-line": [
67 // CHECK: ],
68 // CHECK-NEXT: "context-hash": "{{.*}}",
69 // CHECK-NEXT: "file-deps": [
70 // CHECK-NEXT: "[[PREFIX]]/module.modulemap",
71 // CHECK-NEXT: "[[PREFIX]]/direct.h"
72 // CHECK-NEXT: ],
73 // CHECK-NEXT: "link-libraries": [],
74 // CHECK-NEXT: "name": "direct"
75 // CHECK-NEXT: },
76 // CHECK-NEXT: {
77 // CHECK-NEXT: "clang-module-deps": [
78 // CHECK-NEXT: {
79 // CHECK-NEXT: "context-hash": "{{.*}}",
80 // CHECK-NEXT: "module-name": "Framework"
81 // CHECK-NEXT: },
82 // CHECK-NEXT: {
83 // CHECK-NEXT: "context-hash": "{{.*}}",
84 // CHECK-NEXT: "module-name": "direct"
85 // CHECK-NEXT: }
86 // CHECK-NEXT: ],
87 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
88 // CHECK-NEXT: "command-line": [
89 // CHECK: ],
90 // CHECK-NEXT: "context-hash": "{{.*}}",
91 // CHECK-NEXT: "file-deps": [
92 // CHECK-NEXT: "[[PREFIX]]/module.modulemap",
93 // CHECK-NEXT: "[[PREFIX]]/root.h",
94 // CHECK-NEXT: "[[PREFIX]]/root/textual.h",
95 // CHECK-NEXT: "[[PREFIX]]/Inputs/frameworks/module.modulemap"
96 // CHECK-NEXT: ],
97 // CHECK-NEXT: "link-libraries": [],
98 // CHECK-NEXT: "name": "root"
99 // CHECK-NEXT: },
100 // CHECK-NEXT: {
101 // CHECK-NEXT: "clang-module-deps": [],
102 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
103 // CHECK-NEXT: "command-line": [
104 // CHECK: ],
105 // CHECK-NEXT: "context-hash": "{{.*}}",
106 // CHECK-NEXT: "file-deps": [
107 // CHECK-NEXT: "[[PREFIX]]/module.modulemap",
108 // CHECK-NEXT: "[[PREFIX]]/transitive.h"
109 // CHECK-NEXT: ],
110 // CHECK-NEXT: "link-libraries": [
111 // CHECK-NEXT: {
112 // CHECK-NEXT: "isFramework": true,
113 // CHECK-NEXT: "link-name": "libTransitive"
114 // CHECK-NEXT: }
115 // CHECK-NEXT: ],
116 // CHECK-NEXT: "name": "transitive"
117 // CHECK-NEXT: }
118 // CHECK-NEXT: ],
119 // CHECK-NEXT: "translation-units": []
120 // CHECK-NEXT: }