@@ -100,34 +100,42 @@ typedef uintptr_t SwiftUInt;
100
100
// and Swift could import the underlying pointee type instead. We need to be
101
101
// careful that the interface we expose remains consistent regardless of
102
102
// PURE_BRIDGING_MODE.
103
- #define BRIDGING_WRAPPER_IMPL (Node, Name, Nullability ) \
103
+ #define BRIDGING_WRAPPER_IMPL (Node, Name, Qualifier, Nullability ) \
104
104
class Bridged ##Name { \
105
- Node * Nullability Ptr; \
105
+ Qualifier Node *Nullability Ptr; \
106
106
\
107
107
public: \
108
108
SWIFT_UNAVAILABLE (" Use init(raw:) instead" ) \
109
- Bridged##Name(Node * Nullability ptr) : Ptr(ptr) {} \
109
+ Bridged##Name(Qualifier Node *Nullability ptr) : Ptr(ptr) {} \
110
110
\
111
111
SWIFT_UNAVAILABLE (" Use '.raw' instead" ) \
112
- Node * Nullability unbridged () const { return Ptr; } \
112
+ Qualifier Node *Nullability unbridged () const { return Ptr; } \
113
113
}; \
114
114
\
115
115
SWIFT_NAME (" getter:Bridged" #Name " .raw(self:)" ) \
116
- inline void * Nullability Bridged##Name##_getRaw(Bridged##Name bridged) { \
116
+ inline Qualifier void *Nullability Bridged##Name##_getRaw( \
117
+ Bridged##Name bridged) { \
117
118
return bridged.unbridged (); \
118
119
} \
119
120
\
120
121
SWIFT_NAME (" Bridged" #Name " .init(raw:)" ) \
121
- inline Bridged##Name Bridged##Name##_fromRaw(void * Nullability ptr) { \
122
- return static_cast <Node *>(ptr); \
122
+ inline Bridged##Name Bridged##Name##_fromRaw( \
123
+ Qualifier void *Nullability ptr) { \
124
+ return static_cast <Qualifier Node *>(ptr); \
123
125
}
124
126
125
127
// Bridging wrapper macros for convenience.
126
- #define BRIDGING_WRAPPER_NONNULL (Node, Name ) \
127
- BRIDGING_WRAPPER_IMPL (Node, Name, _Nonnull)
128
+ #define BRIDGING_WRAPPER_NONNULL (Node, Name ) \
129
+ BRIDGING_WRAPPER_IMPL (Node, Name, /* unqualified */ , _Nonnull)
128
130
129
- #define BRIDGING_WRAPPER_NULLABLE (Node, Name ) \
130
- BRIDGING_WRAPPER_IMPL (Node, Nullable##Name, _Nullable)
131
+ #define BRIDGING_WRAPPER_NULLABLE (Node, Name ) \
132
+ BRIDGING_WRAPPER_IMPL (Node, Nullable##Name, /* unqualified*/ , _Nullable)
133
+
134
+ #define BRIDGING_WRAPPER_CONST_NONNULL (Node, Name ) \
135
+ BRIDGING_WRAPPER_IMPL (Node, Name, const , _Nonnull)
136
+
137
+ #define BRIDGING_WRAPPER_CONST_NULLABLE (Node, Name ) \
138
+ BRIDGING_WRAPPER_IMPL (Node, Nullable##Name, const , _Nullable)
131
139
132
140
void assertFail(const char * _Nonnull msg, const char * _Nonnull file,
133
141
SwiftUInt line, const char * _Nonnull function);
0 commit comments