Uploaded image for project: 'Swift'
  1. Swift
  2. SR-5271

Don't emit objc_retainAutoreleasedReturnValue() on non-ObjC targets

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:

      Description

      As per the comment in https://github.com/apple/swift-corelibs-foundation/blob/master/CoreFoundation/Base.subproj/CFRuntime.c#L1702

      For CF functions with 'Get' semantics, the compiler currently assumes that
      the result is autoreleased and must be retained. It does so on all platforms
      by emitting a call to objc_retainAutoreleasedReturnValue. On Darwin, this
      is implemented by the ObjC runtime. On Linux, there is no runtime, and
      therefore we have to stub it out here ourselves. The compiler will eventually
      call swift_release to balance the retain below.
      This is a workaround until the compiler no longer emits this callout on Linux.
      

      The stub just calls swift_retain() but the compiler should be fixed properly so that this workaround can be removed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                spevans Simon Evans
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: