[all-commits] [llvm/llvm-project] dde3f1: [lldb] Fix printing of unsigned enum bitfields whe...
David Spickett via All-commits
all-commits at lists.llvm.org
Wed Jul 3 06:31:09 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: dde3f17026be48c05a5d3876f12db72fdd6422ed
https://github.com/llvm/llvm-project/commit/dde3f17026be48c05a5d3876f12db72fdd6422ed
Author: David Spickett <david.spickett at linaro.org>
Date: 2024-07-03 (Wed, 03 Jul 2024)
Changed paths:
M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
A lldb/test/API/commands/expression/bitfield_enums/Makefile
A lldb/test/API/commands/expression/bitfield_enums/TestBitfieldEnums.py
A lldb/test/API/commands/expression/bitfield_enums/main.cpp
Log Message:
-----------
[lldb] Fix printing of unsigned enum bitfields when they contain the max value (#96202)
While testing register fields I found that if you put the max value into
a bitfield with an underlying type that is an unsigned enum, lldb would
not print the enum name.
This is because the code to match values to names wasn't checking
whether the enum's type was signed, it just assumed it was.
So for example a 2 bit field with value 3 got signed extended to -1,
which didn't match the enumerator value of 3. So lldb just printed the
number instead of the name.
For a value of 1, the top bit was 0 so the sign extend became a zero
extend, and lldb did print the name of the enumerator.
I added a new test because I needed to use C++ to get typed enums. It
checks min, max and an in between value for signed and unsigned enums
applied to a bitfield.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list