Files
swift-mirror/test/DebugInfo/async-await-no-debug-info-outlined-funcs.swift
Felipe de Azevedo Piovezan 35297b39a4 [DebugInfo] Dont emit info for __swift_async_resume_project_context or __swift_async_resume_get_context
Those functions are effectively outlined functions with an alwaysinline
attribute. By removing their debug info and relying on the inliner to propagate
the call site location to the inlined instructions, we restore the "original"
locations as if the function had never been outlined.

This is technically relying on an implementation detail of the inliner, but it
seems to be the simplest way of addressing this issue.
2024-08-14 09:26:20 -07:00

54 lines
1.3 KiB
Swift

// RUN: %target-swift-frontend %s -emit-irgen -g -o - \
// RUN: -module-name M -disable-availability-checking \
// RUN: -parse-as-library | %FileCheck %s --check-prefix=CHECK
// REQUIRES: concurrency
// Check that all the helper "outlined" functions do not have debug information.
func ASYNC___1___() async -> Int {
return 42
}
func ASYNC___2___() async -> Int {
print("hello")
var x = await ASYNC___1___()
x += await ASYNC___1___()
return x
}
// CHECK-LABEL: define {{.*}} @"$s1M12ASYNC___1___SiyYaF.0"
// CHECK-NOT: !dbg
// CHECK: ret void
// CHECK-NEXT: }
// CHECK-LABEL: define {{.*}} @__swift_async_resume_get_context
// CHECK-NOT: !dbg
// CHECK: ret ptr
// CHECK-NEXT: }
// CHECK-LABEL: define {{.*}} @"$s1M12ASYNC___2___SiyYaF.1"
// CHECK-NOT: !dbg
// CHECK: ret void
// CHECK-NEXT: }
// CHECK-LABEL: define {{.*}} @__swift_async_resume_project_context
// CHECK-NOT: !dbg
// CHECK: ret ptr
// CHECK-NEXT: }
// CHECK-LABEL: define {{.*}} @"$s1M12ASYNC___2___SiyYaF.0"
// CHECK-NOT: !dbg
// CHECK: ret void
// CHECK-NEXT: }
// CHECK-LABEL: define {{.*}} @"$s1M12ASYNC___2___SiyYaF.0.1"
// CHECK-NOT: !dbg
// CHECK: ret void
// CHECK-NEXT: }
// CHECK-LABEL: define {{.*}} @"$s1M12ASYNC___2___SiyYaF.0.2"
// CHECK-NOT: !dbg
// CHECK: ret void
// CHECK-NEXT: }