-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathSwiftNameExtension.swift
34 lines (25 loc) · 1.06 KB
/
SwiftNameExtension.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// REQUIRES: objc_interop
// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// RUN: %target-swift-symbolgraph-extract -sdk %clang-importer-sdk -module-name SwiftName -F %t/frameworks -output-dir %t -pretty-print -v
// RUN: %FileCheck %s --input-file %t/SwiftName.symbols.json
//--- frameworks/SwiftName.framework/Modules/module.modulemap
framework module SwiftName {
umbrella header "SwiftName.h"
export *
module * { export * }
}
//--- frameworks/SwiftName.framework/Headers/SwiftName.h
#import "OtherHeader.h"
typedef struct {
double val;
} MyDouble;
// The swift_name attribute below generates extension decls in both header modules, which trips an
// assertion if they are both added in getDisplayDecls. Make sure that this does not crash when a
// symbol graph is generated.
// CHECK-DAG: "precise": "c:SwiftName.h@MyDoubleFixedValue"
__attribute__((swift_name("MyDouble.FixedValue")))
static double MyDoubleFixedValue = 0.0;
//--- frameworks/SwiftName.framework/Headers/OtherHeader.h
// CHECK-DAG: "precise": "c:OtherHeader.h@myVar"
static int myVar = 0;