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 --pretty-sgf -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",
112 "interfaceLanguage": "objective-c",
113 "precise": "c:@MyInt"
116 "displayName": "Global Variable",
117 "identifier": "objective-c.var"
124 "uri": "file://SRCROOT/MyHeader.h"
129 "kind": "identifier",
135 "kind": "identifier",
146 "accessLevel": "public",
147 "declarationFragments": [
149 "kind": "typeIdentifier",
150 "preciseIdentifier": "c:C",
158 "kind": "identifier",
167 "interfaceLanguage": "objective-c",
168 "precise": "c:@MyChar"
171 "displayName": "Global Variable",
172 "identifier": "objective-c.var"
179 "uri": "file://SRCROOT/QuotedHeader.h"
184 "kind": "identifier",
190 "kind": "identifier",