Files
swift-mirror/test/IRGen/objc_deprecated_objc_thunks.swift
Doug Gregor 5b3fe49cd0 [SE-0160] Log uses of @objc thunks emitted due to deprecated @objc inference.
Introduce a new runtime entry point,
`swift_objc_swift3ImplicitObjCEntrypoint`, which is called from any
Objective-C method that was generated due to `@objc` inference rules
that were removed by SE-0160. Aside from being a central place where
users can set a breakpoint to catch when this occurs, this operation
provides logging capabilities that can be enabled by setting the
environment variable SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT:

  SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=0 (default): do not log
  SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=1: log failed messages
  SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=2: log failed messages with
  backtrace
  SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT=3: log failed messages with
  backtrace and abort the process.

The log messages look something like:

    ***Swift runtime: entrypoint -[t.MyClass foo] generated by
       implicit @objc inference is deprecated and will be removed in
       Swift 4
2017-03-31 21:22:16 -07:00

15 lines
547 B
Swift

// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil %s -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s
// REQUIRES: CPU=x86_64
// REQUIRES: objc_interop
import Foundation
class ObjCSubclass : NSObject {
func foo() { }
}
// CHECK-LABEL: define hidden void @_T0016objc_deprecated_A7_thunks12ObjCSubclassC3fooyyFTo(%0*, i8*)
// CHECK: entry:
// CHECK: [[SELF:%[0-9]+]] = bitcast %0* %0 to %objc_object*
// CHECK-NEXT: call void @swift_objc_swift3ImplicitObjCEntrypoint(%objc_object* [[SELF]], i8* %1)