[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / ExtractAPI / relative_include.m
bloba1483a36921d95c4a942c2490d95b8e6bce7423a
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
4 // Setup framework root
5 // RUN: mkdir -p %t/Frameworks/MyFramework.framework/Headers
6 // RUN: cp %t/MyFramework.h %t/Frameworks/MyFramework.framework/Headers/
7 // RUN: cp %t/MyHeader.h %t/Frameworks/MyFramework.framework/Headers/
9 // RUN: sed -e "s@SRCROOT@%{/t:regex_replacement}@g" \
10 // RUN: %t/reference.output.json.in >> %t/reference.output.json
12 // Headermap maps headers to the source root SRCROOT
13 // RUN: sed -e "s@SRCROOT@%{/t:regex_replacement}@g" \
14 // RUN: %t/headermap.hmap.json.in >> %t/headermap.hmap.json
15 // RUN: %hmaptool write %t/headermap.hmap.json %t/headermap.hmap
17 // Input headers use paths to the framework root/DSTROOT
18 // RUN: %clang_cc1 -extract-api -v --product-name=MyFramework \
19 // RUN: -triple arm64-apple-macosx \
20 // RUN: -iquote%t -I%t/headermap.hmap -F%t/Frameworks \
21 // RUN: -x objective-c-header \
22 // RUN: %t/Frameworks/MyFramework.framework/Headers/MyFramework.h \
23 // RUN: %t/Frameworks/MyFramework.framework/Headers/MyHeader.h \
24 // RUN: %t/QuotedHeader.h \
25 // RUN: -o %t/output.json 2>&1 -verify | FileCheck -allow-empty %s
27 // Generator version is not consistent across test runs, normalize it.
28 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
29 // RUN: %t/output.json >> %t/output-normalized.json
30 // RUN: diff %t/reference.output.json %t/output-normalized.json
32 // CHECK:      <extract-api-includes>:
33 // CHECK-NEXT: #import <MyFramework/MyFramework.h>
34 // CHECK-NEXT: #import <MyFramework/MyHeader.h>
35 // CHECK-NEXT: #import "QuotedHeader.h"
37 //--- headermap.hmap.json.in
39   "mappings" :
40     {
41      "MyFramework/MyHeader.h" : "SRCROOT/MyHeader.h"
42     }
45 //--- MyFramework.h
46 // Umbrella for MyFramework
47 #import <MyFramework/MyHeader.h>
48 // expected-no-diagnostics
50 //--- MyHeader.h
51 #import <OtherFramework/OtherHeader.h>
52 int MyInt;
53 // expected-no-diagnostics
55 //--- QuotedHeader.h
56 char MyChar;
57 // expected-no-diagnostics
59 //--- Frameworks/OtherFramework.framework/Headers/OtherHeader.h
60 int OtherInt;
61 // expected-no-diagnostics
63 //--- reference.output.json.in
65   "metadata": {
66     "formatVersion": {
67       "major": 0,
68       "minor": 5,
69       "patch": 3
70     },
71     "generator": "?"
72   },
73   "module": {
74     "name": "MyFramework",
75     "platform": {
76       "architecture": "arm64",
77       "operatingSystem": {
78         "minimumVersion": {
79           "major": 11,
80           "minor": 0,
81           "patch": 0
82         },
83         "name": "macosx"
84       },
85       "vendor": "apple"
86     }
87   },
88   "relationships": [],
89   "symbols": [
90     {
91       "accessLevel": "public",
92       "declarationFragments": [
93         {
94           "kind": "typeIdentifier",
95           "preciseIdentifier": "c:I",
96           "spelling": "int"
97         },
98         {
99           "kind": "text",
100           "spelling": " "
101         },
102         {
103           "kind": "identifier",
104           "spelling": "MyInt"
105         }
106       ],
107       "identifier": {
108         "interfaceLanguage": "objective-c",
109         "precise": "c:@MyInt"
110       },
111       "kind": {
112         "displayName": "Global Variable",
113         "identifier": "objective-c.var"
114       },
115       "location": {
116         "position": {
117           "character": 5,
118           "line": 2
119         },
120         "uri": "file://SRCROOT/MyHeader.h"
121       },
122       "names": {
123         "navigator": [
124           {
125             "kind": "identifier",
126             "spelling": "MyInt"
127           }
128         ],
129         "subHeading": [
130           {
131             "kind": "identifier",
132             "spelling": "MyInt"
133           }
134         ],
135         "title": "MyInt"
136       },
137       "pathComponents": [
138         "MyInt"
139       ]
140     },
141     {
142       "accessLevel": "public",
143       "declarationFragments": [
144         {
145           "kind": "typeIdentifier",
146           "preciseIdentifier": "c:C",
147           "spelling": "char"
148         },
149         {
150           "kind": "text",
151           "spelling": " "
152         },
153         {
154           "kind": "identifier",
155           "spelling": "MyChar"
156         }
157       ],
158       "identifier": {
159         "interfaceLanguage": "objective-c",
160         "precise": "c:@MyChar"
161       },
162       "kind": {
163         "displayName": "Global Variable",
164         "identifier": "objective-c.var"
165       },
166       "location": {
167         "position": {
168           "character": 6,
169           "line": 1
170         },
171         "uri": "file://SRCROOT/QuotedHeader.h"
172       },
173       "names": {
174         "navigator": [
175           {
176             "kind": "identifier",
177             "spelling": "MyChar"
178           }
179         ],
180         "subHeading": [
181           {
182             "kind": "identifier",
183             "spelling": "MyChar"
184           }
185         ],
186         "title": "MyChar"
187       },
188       "pathComponents": [
189         "MyChar"
190       ]
191     }
192   ]