[Lldb-commits] [lldb] [lldb][Formatters] Do not recursively dereference pointer type when creating formatter candicates list. (PR #124048)

via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 23 11:22:13 PST 2025


jimingham wrote:

> > How does this patch fit with the:
> > ```
> >    -p ( --skip-pointers )
> >         Don't use this format for pointers-to-type objects.
> > 
> >    -r ( --skip-references )
> >         Don't use this format for references-to-type objects.
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > settings in `type <formatter> add`? It seems like we let the formatters control whether they should also apply to pointers and references to those types. Shouldn't that be what controls whether formatters also apply to pointers?
> > And if a formatter says it can handle pointers, it's up to the formatter to do that right.
> 
> This has no impact for reference. For pointers, if `-p` is set in `type <formatter> add`, the new formatter will apply only the type T and this patch has no impact for that. This patch changes the behaviour when `-p` is not set. Currently, lldb apply the new formatter to `T`, `T*`, `T**` and so on if `-p` is not set. This change let lldb only apply the formatter to `T` and `T*`.

If you write the formatter knowing that you've asked all for a match against all the pointers to this type, it's up to the formatter to not assume it's only being passed T or T*.  I still don't see why we should be cutting this off in lldb.  If I have a std::vector variable, I want to see its size in the local view, regardless of whether the handle to it is a pointer, or a pointer to a pointer.  It seems artificial to cut that off for me.

https://github.com/llvm/llvm-project/pull/124048


More information about the lldb-commits mailing list