[Lldb-commits] [PATCH] D133240: [Formatters][NFCI] Replace 'is_regex' arguments with an enum.
Jorge Gorbe Moya via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 2 18:54:13 PDT 2022
jgorbe added a comment.
This is the first step towards something like this big diff: https://reviews.llvm.org/differential/diff/457740/. It's a pretty simple patch, but I would like some feedback about whether you think it's going in the right direction or I should do something else instead.
Here's some more context for that diff linked above. There is, as you could expect, some amount of plumbing so that at callback matching time we have around pointers to the script interpreter, the type of the value, etc, and we can call the callback. But the biggest problem I've found is that there's some logic that is duplicated for each one of {exact, regex} AND for each kind of formatter (summaries, synthetic child providers...). An example of this is `TypeCategoryImpl::AnyMatches`. Adding a new matching strategy ({exact, regex, callback}) makes the combinatorial problem even worse. So a big chunk of that patch is moving stuff around to try to minimize this problem.
The main refactoring is replacing the existing `FormatterContainerPair` (that has two members that contain exact match formatters and regex formatters, respectively) with a `TieredFormatterContainer` which has an array of containers in priority order. The idea is to sink as much of duplicated logic as possible around `TypeCategoryImpl` (for example, `GetFormatAtIndex`, `GetSummaryAtIndex`, `GetFilterAtIndex`...) into this `TieredFormatterContainer` to reuse the implementation.
I hope this helps understand the general idea a bit better.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133240/new/
https://reviews.llvm.org/D133240
More information about the lldb-commits
mailing list