[Lldb-commits] [lldb] [lldb][Formatters] Do not recursively dereference pointer type when creating formatter candicates list. (PR #124048)
Zequan Wu via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 28 16:59:49 PST 2025
ZequanWu wrote:
> > > I'd rather keep the flexibility, if you don't mind doing the work to add that. For now, it seems okay for the current libc++/libstdc++ ones to declare what they support (which is 1 pointer depth). If someone has a reason to come back and extend these ones in the future, that's fine but a separate piece of work.
> >
> >
> > After rethinking about the option, it will cause some compatibility issues. Currently, --skip-pointers is boolean option and python formatters use the flag lldb.eTypeOptionSkipPointers to disable/enable it. If we switch it to accept a numeric number, we probably need a new SBAPI to specify the parameter, and this will break existing users who use the `lldb.eTypeOptionSkipPointers` flag.
>
> `type summary add` and friends don't have that many options. Adding a "pointer matching depth" option, and having --skip-pointers and `--pointer-match-depth` be in separate option groups so you can't accidentally provide them together would also work.
I find this is tricky because all the flags for data formatters are set with `TypeSummaryImpl::Flags` which is a 4 byte unsigned integer. I could add a new unsigned integer in `TypeSummaryImpl` for that. But for users who use SBAPI to create formatters, they need to do something like `CreateWithSummaryString(..., options)` and then `SetPointerMatchDepth(depth)` to specify the pointer match depth because we cannot break the existing `CreateWithSummaryString` APIs. That looks not desired, or maybe not that bad. What do you think?
https://github.com/llvm/llvm-project/pull/124048
More information about the lldb-commits
mailing list