[lldb-dev] Should MyType's synthetic provider be instantiated for MyType* and MyType** ?

2021-07-19 Thread Vadim Chugunov via lldb-dev
Hi,
I am observing that if I bind a synthetic provider to MyType, it will also
be instantiated for MyType*, MyType**, etc, and the object passed into the
constructor will be *of the pointer type*.I'd have expected the
synthetic to either not be instantiated for pointers, or to be constructed
on the pointee object directly.

Is this a bug or done this way on purpose?
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Should MyType's synthetic provider be instantiated for MyType* and MyType** ?

2021-07-19 Thread Jim Ingham via lldb-dev
You can control whether you want data-formatters on "class Foo" to also match 
"class Foo *" and "class Foo &" using the --skip-pointers and --skip-references 
options respectively.
So this part is clearly is by design.

As for what the formatter gets passed, your formatter has chosen to see values 
that are pointers to the type by not passing --skip-pointers, so it makes sense 
to pass it 
the pointer - which it after all asked for.  I can't see a strong enough 
argument either way to want to change the way it currently works, since we 
might break other people's uses of it.

Jim



> On Jul 19, 2021, at 5:12 PM, Vadim Chugunov via lldb-dev 
>  wrote:
> 
> Hi,
> I am observing that if I bind a synthetic provider to MyType, it will also be 
> instantiated for MyType*, MyType**, etc, and the object passed into the 
> constructor will be of the pointer type.I'd have expected the synthetic 
> to either not be instantiated for pointers, or to be constructed on the 
> pointee object directly.
> 
> Is this a bug or done this way on purpose?   
> 
> ___
> lldb-dev mailing list
> lldb-dev@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

___
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Should MyType's synthetic provider be instantiated for MyType* and MyType** ?

2021-07-19 Thread Vadim Chugunov via lldb-dev
On Mon, Jul 19, 2021 at 6:02 PM Jim Ingham  wrote:

> You can control whether you want data-formatters on "class Foo" to also
> match "class Foo *" and "class Foo &" using the --skip-pointers and
> --skip-references options respectively.
> So this part is clearly is by design.
>
> As for what the formatter gets passed, your formatter has chosen to see
> values that are pointers to the type by not passing --skip-pointers, so it
> makes sense to pass it
> the pointer - which it after all asked for.  I can't see a strong enough
> argument either way to want to change the way it currently works, since we
> might break other people's uses of it.
>

Certainly.  I just wish the documentation were more explicit about this
quirk.  This behavior is especially confusing because the single
indirection case usually works, since pointer.GetChildMemberWithName('...')
transparently dereferences.   It starts breaking only at
pointer-to-pointer-to-type.
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev