1// RUN: rm -rf %t
2// RUN: split-file %s %t
3// RUN: sed -e "s@INPUT_DIR@%/t@g" %t/reference.output.json.in >> \
4// RUN: %t/reference.output.json
5// RUN: %clang -extract-api -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  "relationhips": [
49    {
50      "kind": "conformsTo",
51      "source": "c:objc(pl)AnotherProtocol",
52      "target": "c:objc(pl)Protocol"
53    }
54  ],
55  "symbols": [
56    {
57      "declarationFragments": [
58        {
59          "kind": "keyword",
60          "spelling": "@protocol"
61        },
62        {
63          "kind": "text",
64          "spelling": " "
65        },
66        {
67          "kind": "identifier",
68          "spelling": "Protocol"
69        }
70      ],
71      "identifier": {
72        "interfaceLanguage": "objective-c",
73        "precise": "c:objc(pl)Protocol"
74      },
75      "kind": {
76        "displayName": "Protocol",
77        "identifier": "objective-c.protocol"
78      },
79      "location": {
80        "character": 11,
81        "line": 1,
82        "uri": "file://INPUT_DIR/input.h"
83      },
84      "names": {
85        "subHeading": [
86          {
87            "kind": "identifier",
88            "spelling": "Protocol"
89          }
90        ],
91        "title": "Protocol"
92      }
93    },
94    {
95      "declarationFragments": [
96        {
97          "kind": "keyword",
98          "spelling": "@protocol"
99        },
100        {
101          "kind": "text",
102          "spelling": " "
103        },
104        {
105          "kind": "identifier",
106          "spelling": "AnotherProtocol"
107        },
108        {
109          "kind": "text",
110          "spelling": " <"
111        },
112        {
113          "kind": "typeIdentifier",
114          "preciseIdentifier": "c:objc(pl)Protocol",
115          "spelling": "Protocol"
116        },
117        {
118          "kind": "text",
119          "spelling": ">"
120        }
121      ],
122      "identifier": {
123        "interfaceLanguage": "objective-c",
124        "precise": "c:objc(pl)AnotherProtocol"
125      },
126      "kind": {
127        "displayName": "Protocol",
128        "identifier": "objective-c.protocol"
129      },
130      "location": {
131        "character": 11,
132        "line": 4,
133        "uri": "file://INPUT_DIR/input.h"
134      },
135      "names": {
136        "subHeading": [
137          {
138            "kind": "identifier",
139            "spelling": "AnotherProtocol"
140          }
141        ],
142        "title": "AnotherProtocol"
143      }
144    }
145  ]
146}
147