about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorWesley Wiser <wesleywiser@microsoft.com>2021-05-13 16:39:19 -0400
committerWesley Wiser <wesleywiser@microsoft.com>2021-06-02 10:23:10 -0400
commit141546c355f2de7501c1df75dd97229ed350eeb3 (patch)
tree8e375f460f557ef3e9e8c3253a503d1dbf6289d0 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent2a025c1a765a593030fc6e80a45f4f1053f15aae (diff)
downloadrust-141546c355f2de7501c1df75dd97229ed350eeb3.tar.gz
rust-141546c355f2de7501c1df75dd97229ed350eeb3.zip
Generate better debuginfo for niche-layout enums
Previously, we would generate a single struct with the layout of the
dataful variant plus an extra field whose name contained the value of
the niche (this would only really work for things like `Option<&_>`
where we can determine that the `None` case maps to `0` but for enums
that have multiple tag only variants, this doesn't work).

Now, we generate a union of two structs, one which is the layout of the
dataful variant and one which just has a way of reading the
discriminant. We also generate an enum which maps the discriminant value
to the tag only variants.

We also encode information about the range of values which correspond to
the dataful variant in the type name and then use natvis to determine
which union field we should display to the user.

As a result of this change, all niche-layout enums render correctly in
WinDbg and Visual Studio!
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions