mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The intent for `@inline(always)` is to act as an optimization control. The user can rely on inlining to happen or the compiler will emit an error message. Because function values can be dynamic (closures, protocol/class lookup) this guarantee can only be upheld for direct function references. In cases where the optimizer can resolve dynamic function values the attribute shall be respected. rdar://148608854
23 lines
998 B
Swift
23 lines
998 B
Swift
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name attrs \
|
|
// RUN: -enable-experimental-feature InlineAlways \
|
|
// RUN: -emit-private-module-interface-path %t.private.swiftinterface
|
|
|
|
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name attrs \
|
|
// RUN: -enable-experimental-feature InlineAlways
|
|
// RUN: %target-swift-typecheck-module-from-interface(%t.private.swiftinterface) -module-name attrs \
|
|
// RUN: -enable-experimental-feature InlineAlways
|
|
|
|
// RUN: %FileCheck %s --check-prefixes CHECK --input-file %t.swiftinterface
|
|
// RUN: %FileCheck %s --check-prefixes CHECK --input-file %t.private.swiftinterface
|
|
|
|
// REQUIRES: swift_feature_InlineAlways
|
|
|
|
// CHECK: #if compiler(>=5.3) && $InlineAlways
|
|
// CHECK: @inline(always) @inlinable public func inlineAlwaysFunc() {}
|
|
// CHECK: #else
|
|
// CHECK: @inline(__always) @inlinable public func inlineAlwaysFunc() {}
|
|
// CHECK: #endif
|
|
@inline(always)
|
|
@inlinable
|
|
public func inlineAlwaysFunc() {}
|