]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/enum-debug-tagged.rs
Enable emission of alignment attrs for pointer params
[rust.git] / src / test / codegen / enum-debug-tagged.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // This test depends on a patch that was committed to upstream LLVM
12 // before 7.0, then backported to the Rust LLVM fork.  It tests that
13 // debug info for tagged (ordinary) enums is properly emitted.
14
15 // ignore-tidy-linelength
16 // ignore-windows
17 // min-system-llvm-version 7.0
18
19 // compile-flags: -g -C no-prepopulate-passes
20
21 // CHECK-LABEL: @main
22 // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "E",{{.*}}
23 // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}discriminator:{{.*}}
24 // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "A",{{.*}}extraData:{{.*}}
25 // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "A",{{.*}}
26 // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "__0",{{.*}}
27 // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "B",{{.*}}extraData:{{.*}}
28 // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "B",{{.*}}
29 // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "__0",{{.*}}
30 // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}flags: DIFlagArtificial{{.*}}
31
32 #![allow(dead_code)]
33 #![allow(unused_variables)]
34 #![allow(unused_assignments)]
35
36 enum E { A(u32), B(u32) }
37
38 pub fn main() {
39     let e = E::A(23);
40 }