Debian Codegraph @

clang/test/ExtractAPI/objc_protocol.m

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
4 // RUN: %t/reference.output.json.in >> %t/reference.output.json
5 // RUN: %clang -extract-api --pretty-sgf -x objective-c-header -target arm64-apple-macosx \
6 // RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
7
8 // Generator version is not consistent across test runs, normalize it.
9 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
10 // RUN: %t/output.json >> %t/output-normalized.json
11 // RUN: diff %t/reference.output.json %t/output-normalized.json
12
13 // CHECK-NOT: error:
14 // CHECK-NOT: warning:
15
16 //--- input.h
17 @protocol Protocol
18 @end
19
20 @protocol AnotherProtocol <Protocol>
21 @end
22
23 //--- reference.output.json.in
24 {
25 "metadata": {
26 "formatVersion": {
27 "major": 0,
28 "minor": 5,
29 "patch": 3
30 },
31 "generator": "?"
32 },
33 "module": {
34 "name": "",
35 "platform": {
36 "architecture": "arm64",
37 "operatingSystem": {
38 "minimumVersion": {
39 "major": 11,
40 "minor": 0,
41 "patch": 0
42 },
43 "name": "macosx"
44 },
45 "vendor": "apple"
46 }
47 },
48 "relationships": [
49 {
50 "kind": "conformsTo",
51 "source": "c:objc(pl)AnotherProtocol",
52 "target": "c:objc(pl)Protocol",
53 "targetFallback": "Protocol"
54 }
55 ],
56 "symbols": [
57 {
58 "accessLevel": "public",
59 "declarationFragments": [
60 {
61 "kind": "keyword",
62 "spelling": "@protocol"
63 },
64 {
65 "kind": "text",
66 "spelling": " "
67 },
68 {
69 "kind": "identifier",
70 "spelling": "Protocol"
71 }
72 ],
73 "identifier": {
74 "interfaceLanguage": "objective-c",
75 "precise": "c:objc(pl)Protocol"
76 },
77 "kind": {
78 "displayName": "Protocol",
79 "identifier": "objective-c.protocol"
80 },
81 "location": {
82 "position": {
83 "character": 10,
84 "line": 0
85 },
86 "uri": "file://INPUT_DIR/input.h"
87 },
88 "names": {
89 "navigator": [
90 {
91 "kind": "identifier",
92 "spelling": "Protocol"
93 }
94 ],
95 "subHeading": [
96 {
97 "kind": "identifier",
98 "spelling": "Protocol"
99 }
100 ],
101 "title": "Protocol"
102 },
103 "pathComponents": [
104 "Protocol"
105 ]
106 },
107 {
108 "accessLevel": "public",
109 "declarationFragments": [
110 {
111 "kind": "keyword",
112 "spelling": "@protocol"
113 },
114 {
115 "kind": "text",
116 "spelling": " "
117 },
118 {
119 "kind": "identifier",
120 "spelling": "AnotherProtocol"
121 },
122 {
123 "kind": "text",
124 "spelling": " <"
125 },
126 {
127 "kind": "typeIdentifier",
128 "preciseIdentifier": "c:objc(pl)Protocol",
129 "spelling": "Protocol"
130 },
131 {
132 "kind": "text",
133 "spelling": ">"
134 }
135 ],
136 "identifier": {
137 "interfaceLanguage": "objective-c",
138 "precise": "c:objc(pl)AnotherProtocol"
139 },
140 "kind": {
141 "displayName": "Protocol",
142 "identifier": "objective-c.protocol"
143 },
144 "location": {
145 "position": {
146 "character": 10,
147 "line": 3
148 },
149 "uri": "file://INPUT_DIR/input.h"
150 },
151 "names": {
152 "navigator": [
153 {
154 "kind": "identifier",
155 "spelling": "AnotherProtocol"
156 }
157 ],
158 "subHeading": [
159 {
160 "kind": "identifier",
161 "spelling": "AnotherProtocol"
162 }
163 ],
164 "title": "AnotherProtocol"
165 },
166 "pathComponents": [
167 "AnotherProtocol"
168 ]
169 }
170 ]
171 }