|
| 1 | +// only-cdb |
| 2 | +// ignore-tidy-linelength |
| 3 | +// compile-flags:-g |
| 4 | + |
| 5 | +// cdb-command: g |
| 6 | + |
| 7 | +// Note: The natvis used to visualize niche-layout enums don't work correctly in cdb |
| 8 | +// so the best we can do is to make sure we are generating the right debuginfo |
| 9 | + |
| 10 | +// cdb-command: dx -r2 a,! |
| 11 | +// cdb-check:a,! [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>] |
| 12 | +// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::Some] |
| 13 | +// cdb-check: [+0x000] __0 : Low (0x2) [Type: msvc_pretty_enums::CStyleEnum] |
| 14 | +// cdb-check: [+0x000] discriminant : 0x2 [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::Discriminant$] |
| 15 | + |
| 16 | +// cdb-command: dx -r2 b,! |
| 17 | +// cdb-check:b,! [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>] |
| 18 | +// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::Some] |
| 19 | +// cdb-check: [+0x000] __0 : 0x11 [Type: msvc_pretty_enums::CStyleEnum] |
| 20 | +// cdb-check: [+0x000] discriminant : None (0x11) [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum>>, 2, 16, Some>::Discriminant$] |
| 21 | + |
| 22 | +// cdb-command: dx -r2 c,! |
| 23 | +// cdb-check:c,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>] |
| 24 | +// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data] |
| 25 | +// cdb-check: [+0x000] my_data : 0x11 [Type: msvc_pretty_enums::CStyleEnum] |
| 26 | +// cdb-check: [+0x000] discriminant : Tag1 (0x11) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Discriminant$] |
| 27 | + |
| 28 | +// cdb-command: dx -r2 d,! |
| 29 | +// cdb-check:d,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>] |
| 30 | +// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data] |
| 31 | +// cdb-check: [+0x000] my_data : High (0x10) [Type: msvc_pretty_enums::CStyleEnum] |
| 32 | +// cdb-check: [+0x000] discriminant : 0x10 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Discriminant$] |
| 33 | + |
| 34 | +// cdb-command: dx -r2 e,! |
| 35 | +// cdb-check:e,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>] |
| 36 | +// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data] |
| 37 | +// cdb-check: [+0x000] my_data : 0x13 [Type: msvc_pretty_enums::CStyleEnum] |
| 38 | +// cdb-check: [+0x000] discriminant : Tag2 (0x13) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Discriminant$] |
| 39 | + |
| 40 | +// cdb-command: dx -r2 f,! |
| 41 | +// cdb-check:f,! [Type: enum$<core::option::Option<u32*>, 1, [...], Some>] |
| 42 | +// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<u32*>, 1, [...], Some>::Some] |
| 43 | +// cdb-check: [+0x000] __0 : 0x[...] : 0x1 [Type: unsigned int *] |
| 44 | +// cdb-check: [+0x000] discriminant : 0x[...] [Type: enum$<core::option::Option<u32*>, 1, [...], Some>::Discriminant$] |
| 45 | + |
| 46 | +// cdb-command: dx -r2 g,! |
| 47 | +// cdb-check:g,! [Type: enum$<core::option::Option<u32*>, 1, [...], Some>] |
| 48 | +// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<u32*>, 1, [...], Some>::Some] |
| 49 | +// cdb-check: [+0x000] __0 : 0x0 [Type: unsigned int *] |
| 50 | +// cdb-check: [+0x000] discriminant : None (0x0) [Type: enum$<core::option::Option<u32*>, 1, [...], Some>::Discriminant$] |
| 51 | + |
| 52 | +// cdb-command: dx h |
| 53 | +// cdb-check:h : Some [Type: enum$<core::option::Option<u32>>] |
| 54 | +// cdb-check: [+0x000] variant$ : Some (0x1) [Type: core::option::Option] |
| 55 | +// cdb-check: [+0x004] __0 : 0xc [Type: unsigned int] |
| 56 | + |
| 57 | +// cdb-command: dx i |
| 58 | +// cdb-check:i : None [Type: enum$<core::option::Option<u32>>] |
| 59 | +// cdb-check: [+0x000] variant$ : None (0x0) [Type: core::option::Option] |
| 60 | + |
| 61 | +// cdb-command: dx j |
| 62 | +// cdb-check:j : High (0x10) [Type: msvc_pretty_enums::CStyleEnum] |
| 63 | + |
| 64 | +// cdb-command: dx -r2 k,! |
| 65 | +// cdb-check:k,! [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>] |
| 66 | +// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>::Some] |
| 67 | +// cdb-check: [+0x000] __0 [Type: alloc::string::String] |
| 68 | +// cdb-check: [+0x000] discriminant : 0x[...] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>::Discriminant$] |
| 69 | + |
| 70 | +pub enum CStyleEnum { |
| 71 | + Low = 2, |
| 72 | + High = 16, |
| 73 | +} |
| 74 | + |
| 75 | +pub enum NicheLayoutEnum { |
| 76 | + Tag1, |
| 77 | + Data { my_data: CStyleEnum }, |
| 78 | + Tag2, |
| 79 | +} |
| 80 | + |
| 81 | +fn main() { |
| 82 | + let a = Some(CStyleEnum::Low); |
| 83 | + let b = Option::<CStyleEnum>::None; |
| 84 | + let c = NicheLayoutEnum::Tag1; |
| 85 | + let d = NicheLayoutEnum::Data { my_data: CStyleEnum::High }; |
| 86 | + let e = NicheLayoutEnum::Tag2; |
| 87 | + let f = Some(&1u32); |
| 88 | + let g = Option::<&'static u32>::None; |
| 89 | + let h = Some(12u32); |
| 90 | + let i = Option::<u32>::None; |
| 91 | + let j = CStyleEnum::High; |
| 92 | + let k = Some("IAMA optional string!".to_string()); |
| 93 | + |
| 94 | + zzz(); // #break |
| 95 | +} |
| 96 | + |
| 97 | +fn zzz() { () } |
0 commit comments