1 // Verify debuginfo for async fn:
2 // - Each variant points to the file and line of its yield point
3 // - The generator types and variants are marked artificial
4 // - Captured vars from the source are not marked artificial
6 // ignore-tidy-linelength
7 // compile-flags: -C debuginfo=2 --edition=2018
11 async fn async_fn_test() {
13 let s = String::from("foo");
17 // FIXME: No way to reliably check the filename.
19 // CHECK-DAG: [[ASYNC_FN:!.*]] = !DINamespace(name: "async_fn_test"
20 // CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "generator-0", scope: [[ASYNC_FN]], {{.*}}flags: DIFlagArtificial
21 // CHECK: [[VARIANT:!.*]] = !DICompositeType(tag: DW_TAG_variant_part, scope: [[ASYNC_FN]],
22 // CHECK-SAME: flags: DIFlagArtificial
23 // CHECK-SAME: discriminator: [[DISC:![0-9]*]]
24 // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "0", scope: [[VARIANT]],
25 // CHECK-SAME: file: [[FILE:![0-9]*]], line: 11,
26 // CHECK-SAME: flags: DIFlagArtificial
27 // CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "Unresumed", scope: [[GEN]],
28 // CHECK-SAME: flags: DIFlagArtificial
29 // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "1", scope: [[VARIANT]],
30 // CHECK-SAME: file: [[FILE]], line: 15,
31 // CHECK-SAME: flags: DIFlagArtificial
32 // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "2", scope: [[VARIANT]],
33 // CHECK-SAME: file: [[FILE]], line: 15,
34 // CHECK-SAME: flags: DIFlagArtificial
35 // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "3", scope: [[VARIANT]],
36 // CHECK-SAME: file: [[FILE]], line: 12,
37 // CHECK-SAME: flags: DIFlagArtificial
38 // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "4", scope: [[VARIANT]],
39 // CHECK-SAME: file: [[FILE]], line: 14,
40 // CHECK-SAME: flags: DIFlagArtificial
41 // CHECK: [[S1:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend1", scope: [[GEN]],
42 // CHECK-SAME: flags: DIFlagArtificial
43 // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "s", scope: [[S1]]
44 // CHECK-NOT: flags: DIFlagArtificial
46 // CHECK: [[DISC]] = !DIDerivedType(tag: DW_TAG_member, name: "__state", scope: [[ASYNC_FN]],
47 // CHECK-SAME: flags: DIFlagArtificial
50 let _dummy = async_fn_test();