File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -199,8 +199,17 @@ SOURCE(VNODE)
199
199
#endif
200
200
SOURCE (WRITE)
201
201
202
- // See comment in CFFuntime.c explaining why objc_retainAutoreleasedReturnValue is needed.
202
+
203
+ // For CF functions with 'Get' semantics, the compiler currently assumes that
204
+ // the result is autoreleased and must be retained. It does so on all platforms
205
+ // by emitting a call to objc_retainAutoreleasedReturnValue. On Darwin, this is
206
+ // implemented by the ObjC runtime. On Linux, there is no runtime, and therefore
207
+ // we have to stub it out here ourselves. The compiler will eventually call
208
+ // swift_release to balance the retain below. This is a workaround until the
209
+ // compiler no longer emits this callout on Linux.
203
210
extern "C" void swift_retain(void *);
211
+
212
+ SWIFT_CC (swift) DISPATCH_RUNTIME_STDLIB_INTERFACE
204
213
extern "C" void * objc_retainAutoreleasedReturnValue(void *obj) {
205
214
if (obj) {
206
215
swift_retain (obj);
You can’t perform that action at this time.
0 commit comments