diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2020-06-23 16:23:01 -0700 |
|---|---|---|
| committer | Tyler Mandry <tmandry@gmail.com> | 2020-06-24 15:08:59 -0700 |
| commit | 2d652d9d735f10402803318351f7a8ee91fc4c47 (patch) | |
| tree | b735f452cb92d3e5d437601790c66c8360c96b7b /src/librustc_codegen_llvm | |
| parent | 477ecc51caea03c22eb6c7dedcf5656593b71fb0 (diff) | |
| download | rust-2d652d9d735f10402803318351f7a8ee91fc4c47.tar.gz rust-2d652d9d735f10402803318351f7a8ee91fc4c47.zip | |
Add generator-debug test for MSVC
..which doesn't use variant types.
Diffstat (limited to 'src/librustc_codegen_llvm')
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/metadata.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 0338aff5096..33351c06d27 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -1652,23 +1652,25 @@ impl VariantMemberDescriptionFactory<'ll, 'tcx> { .iter() .enumerate() .map(|(i, &(ref name, ty))| { + // Discriminant is always the first field of our variant + // when using the enum fallback. + let is_artificial_discr = use_enum_fallback(cx) && i == 0; let (size, align) = cx.size_and_align_of(ty); MemberDescription { name: name.to_string(), - type_metadata: if use_enum_fallback(cx) { - match self.tag_type_metadata { - // Discriminant is always the first field of our variant - // when using the enum fallback. - Some(metadata) if i == 0 => metadata, - _ => type_metadata(cx, ty, self.span), - } + type_metadata: if is_artificial_discr { + self.tag_type_metadata.unwrap_or_else(|| type_metadata(cx, ty, self.span)) } else { type_metadata(cx, ty, self.span) }, offset: self.offsets[i], size, align, - flags: DIFlags::FlagZero, + flags: if is_artificial_discr { + DIFlags::FlagArtificial + } else { + DIFlags::FlagZero + }, discriminant: None, source_info: None, } |
