@@ -100,34 +100,42 @@ typedef uintptr_t SwiftUInt;
100100// and Swift could import the underlying pointee type instead. We need to be
101101// careful that the interface we expose remains consistent regardless of
102102// PURE_BRIDGING_MODE.
103- #define BRIDGING_WRAPPER_IMPL (Node, Name, Nullability ) \
103+ #define BRIDGING_WRAPPER_IMPL (Node, Name, Qualifier, Nullability ) \
104104 class Bridged ##Name { \
105- Node * Nullability Ptr; \
105+ Qualifier Node *Nullability Ptr; \
106106 \
107107 public: \
108108 SWIFT_UNAVAILABLE (" Use init(raw:) instead" ) \
109- Bridged##Name(Node * Nullability ptr) : Ptr(ptr) {} \
109+ Bridged##Name(Qualifier Node *Nullability ptr) : Ptr(ptr) {} \
110110 \
111111 SWIFT_UNAVAILABLE (" Use '.raw' instead" ) \
112- Node * Nullability unbridged () const { return Ptr; } \
112+ Qualifier Node *Nullability unbridged () const { return Ptr; } \
113113 }; \
114114 \
115115 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) { \
117118 return bridged.unbridged (); \
118119 } \
119120 \
120121 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); \
123125 }
124126
125127// 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)
128130
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)
131139
132140void assertFail(const char * _Nonnull msg, const char * _Nonnull file,
133141 SwiftUInt line, const char * _Nonnull function);
0 commit comments