Files
swift-mirror/test/TBD/async-function-pointer.swift
Xi Ge 8b40fe02b9 TBDGen: don't skip @_silgen_name computed properties. rdar://189932187
A recent change taught TBD generation to skip @_silgen_name variables that
have no initial value, since such a global is just a forward declaration of
a symbol defined elsewhere. But computed properties never have an initial
value either, so a @_silgen_name computed property, like the ones libraries
keep around to preserve old ABI, lost its accessors and property descriptor
from the TBD even though IRGen still emits them, and TAPI then rejects the
build.

Only treat global storage that way, which matches how SILGen decides a
@_silgen_name variable is a declaration rather than a definition.
2026-10-19 13:50:23 -07:00

26 lines
924 B
Swift

// REQUIRES: VENDOR=apple
// REQUIRES: concurrency
// RUN: %target-swift-frontend -emit-ir %s -target %target-swift-5.1-abi-triple -validate-tbd-against-ir=all -module-name test | %FileCheck %s
// RUN: %target-swift-frontend -emit-ir %s -target %target-swift-5.1-abi-triple -validate-tbd-against-ir=all -module-name test -enable-library-evolution -o /dev/null
// CHECK: @barTu = global %swift.async_func_pointer
@_silgen_name("bar")
public func foo() async {}
// CHECK: @"$s4test1CC1f33_295642D23064661A21CD592AD781409CLLyyYaFTu" = global %swift.async_func_pointer
open class C {
private func f() async { }
}
// A @_silgen_name computed property is a definition, not a forward declaration.
public final class D<T> {
@usableFromInline
@_silgen_name("$s4test1DC6resultxSgvp")
internal var _legacy_result: T? {
@usableFromInline
@_silgen_name("$s4test1DC6resultxSgvg")
get async throws { nil }
}
}