Endilll wrote:

> However, will this actually work in practice in the debugger? If not, perhaps 
> we should limit to just integer and enumeration types for now, leaving the 
> extension for the future.

I composed an example of that:
```cpp
struct A {
  short a1;
  short a2;
};

struct B {
  [[clang::preferred_type(A)]] unsigned b1 : 32 = 0x000F'000C;
};

int main()
{
    B b;
    return b.b1;
}
```
Nightly build of LLDB from apt.llvm.org handles it just fine:
```
Process 2755547 stopped
* thread #1, name = 'test-preferred-', stop reason = step in
    frame #0: 0x0000555555555148 test-preferred-type`main at test.cxx:13:14
   10   int main()
   11   {
   12       B b;
-> 13       return b.b1;
   14   }
(lldb) v -T
(B) b = {
  (A:32) b1 = {
    (short) a1 = 12
    (short) a2 = 15
  }
}
```
@erichkeane Do you still insist on restricting type argument to integral and 
enumeration types?

https://github.com/llvm/llvm-project/pull/69104
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to