Skip to content

Commit 7ed869e

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 7ed869e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

stdlib/public/Backtracing/Context.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,11 @@ extension arm_gprs {
274274
throw NotYetImplemented()
275275
}
276276
#elseif arch(x86_64)
277+
@usableFromInline
277278
@_silgen_name("_swift_get_cpu_context")
278279
static func _swift_get_cpu_context() -> X86_64Context
279280

281+
@_transparent
280282
public static func withCurrentContext<T>(fn: (X86_64Context) throws -> T) rethrows -> T {
281283
return try fn(_swift_get_cpu_context())
282284
}
@@ -429,9 +431,11 @@ extension arm_gprs {
429431
throw NotYetImplemented()
430432
}
431433
#elseif arch(i386)
434+
@usableFromInline
432435
@_silgen_name("_swift_get_cpu_context")
433436
static func _swift_get_cpu_context() -> I386Context
434437

438+
@_transparent
435439
public static func withCurrentContext<T>(fn: (I386Context) throws -> T) rethrows -> T {
436440
return try fn(_swift_get_cpu_context())
437441
}
@@ -630,9 +634,11 @@ extension arm_gprs {
630634
throw NotYetImplemented()
631635
}
632636
#elseif arch(arm64) || arch(arm64_32)
637+
@usableFromInline
633638
@_silgen_name("_swift_get_cpu_context")
634639
static func _swift_get_cpu_context() -> ARM64Context
635640

641+
@_transparent
636642
public static func withCurrentContext<T>(fn: (ARM64Context) throws -> T) rethrows -> T {
637643
return try fn(_swift_get_cpu_context())
638644
}
@@ -769,9 +775,11 @@ extension arm_gprs {
769775
throw NotYetImplemented()
770776
}
771777
#elseif arch(arm)
778+
@usableFromInline
772779
@_silgen_name("_swift_get_cpu_context")
773780
static func _swift_get_cpu_context() -> ARMContext
774781

782+
@_transparent
775783
public static func withCurrentContext<T>(fn: (ARMContext) throws -> T) rethrows -> T {
776784
return try fn(_swift_get_cpu_context())
777785
}

0 commit comments

Comments
 (0)