Skip to content

Commit ffcfbfd

Browse files
committed
[Backtracing] Mark withCurrentContext() as @_transparent.
The `withCurrentContext()` methods on the `Context` structs need to be inlined, even in debug builds, otherwise we would need to skip an extra frame at the top of the backtrace. This fixes test failures in debug stdlib builds. rdar://106276227
1 parent 75995f0 commit ffcfbfd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

stdlib/public/Backtracing/Context.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,9 @@ extension arm_gprs {
275275
}
276276
#elseif arch(x86_64)
277277
@_silgen_name("_swift_get_cpu_context")
278-
static func _swift_get_cpu_context() -> X86_64Context
278+
public static func _swift_get_cpu_context() -> X86_64Context
279279

280+
@_transparent
280281
public static func withCurrentContext<T>(fn: (X86_64Context) throws -> T) rethrows -> T {
281282
return try fn(_swift_get_cpu_context())
282283
}
@@ -430,8 +431,9 @@ extension arm_gprs {
430431
}
431432
#elseif arch(i386)
432433
@_silgen_name("_swift_get_cpu_context")
433-
static func _swift_get_cpu_context() -> I386Context
434+
public static func _swift_get_cpu_context() -> I386Context
434435

436+
@_transparent
435437
public static func withCurrentContext<T>(fn: (I386Context) throws -> T) rethrows -> T {
436438
return try fn(_swift_get_cpu_context())
437439
}
@@ -631,8 +633,9 @@ extension arm_gprs {
631633
}
632634
#elseif arch(arm64) || arch(arm64_32)
633635
@_silgen_name("_swift_get_cpu_context")
634-
static func _swift_get_cpu_context() -> ARM64Context
636+
public static func _swift_get_cpu_context() -> ARM64Context
635637

638+
@_transparent
636639
public static func withCurrentContext<T>(fn: (ARM64Context) throws -> T) rethrows -> T {
637640
return try fn(_swift_get_cpu_context())
638641
}
@@ -770,8 +773,9 @@ extension arm_gprs {
770773
}
771774
#elseif arch(arm)
772775
@_silgen_name("_swift_get_cpu_context")
773-
static func _swift_get_cpu_context() -> ARMContext
776+
public static func _swift_get_cpu_context() -> ARMContext
774777

778+
@_transparent
775779
public static func withCurrentContext<T>(fn: (ARMContext) throws -> T) rethrows -> T {
776780
return try fn(_swift_get_cpu_context())
777781
}

0 commit comments

Comments
 (0)