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
41 "MyFramework/MyHeader.h" : "SRCROOT/MyHeader.h"
46 // Umbrella for MyFramework
47 #import <MyFramework/MyHeader.h>
48 // expected-no-diagnostics
51 #import <OtherFramework/OtherHeader.h>
53 // expected-no-diagnostics
57 // expected-no-diagnostics
59 //--- Frameworks/OtherFramework.framework/Headers/OtherHeader.h
61 // expected-no-diagnostics
63 //--- reference.output.json.in
74 "name": "MyFramework",
76 "architecture": "arm64",
91 "accessLevel": "public",
92 "declarationFragments": [
94 "kind": "typeIdentifier",
95 "preciseIdentifier": "c:I",
103 "kind": "identifier",
108 "interfaceLanguage": "objective-c",
109 "precise": "c:@MyInt"
112 "displayName": "Global Variable",
113 "identifier": "objective-c.var"
120 "uri": "file://SRCROOT/MyHeader.h"
125 "kind": "identifier",
131 "kind": "identifier",
142 "accessLevel": "public",
143 "declarationFragments": [
145 "kind": "typeIdentifier",
146 "preciseIdentifier": "c:C",
154 "kind": "identifier",
159 "interfaceLanguage": "objective-c",
160 "precise": "c:@MyChar"
163 "displayName": "Global Variable",
164 "identifier": "objective-c.var"
171 "uri": "file://SRCROOT/QuotedHeader.h"
176 "kind": "identifier",
182 "kind": "identifier",