summaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py
diff options
context:
space:
mode:
authorVictor Campos <victor.campos@arm.com>2023-06-13 14:22:15 +0100
committerVictor Campos <victor.campos@arm.com>2023-08-16 10:45:01 +0100
commitd77cba6d474ab8ce5ece126499522de414c8089c (patch)
tree4f3e838cd97b71ad5c486ac304430df25aae2549 /lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py
parent51eaee3b42f057fc2cc3fae7ec71d44fa1b82057 (diff)
[Clang][DebugInfo] Emit narrower base types for structured binding declarations that bind to struct bitfields
In cases where a structured binding declaration is made to a struct with bitfields: struct A { unsigned int x : 16; unsigned int y : 16; } g; auto [a, b] = g; // structured binding declaration Clang assigns the 'unsigned int' DWARF base type to 'a' and 'b' because this is their deduced C++ type in the structured binding declaration. However, their actual type in memory is 'unsigned short' as they have 16 bits allocated for each. This is a problem for debug information consumers: if the debug information for 'a' has the 'unsigned int' base type, a debugger will assume it has 4 bytes, whereas it actually has a length of 2, resulting in a read (or write) past its length. This patch mimics GCC's behaviour: in case of structured bindings to bitfields, the binding declaration's DWARF base type is of the target's integer type with the same bitwidth as the bitfield. If no suitable integer type is found in the target, no debug information is emitted anymore in order to prevent wrong debug output. Reviewed By: tmatheson Differential Revision: https://reviews.llvm.org/D157479
Diffstat (limited to 'lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py')
0 files changed, 0 insertions, 0 deletions