[NFCI] Simplify TypeCategoryImpl for-each callbacks.
authorJorge Gorbe Moya <jgorbe@google.com>
Fri, 16 Sep 2022 22:58:19 +0000 (15:58 -0700)
committerJorge Gorbe Moya <jgorbe@google.com>
Thu, 6 Oct 2022 19:11:27 +0000 (12:11 -0700)
commitdee9c7f5d7e53aa6a9e7f85cdf9935341ba7e636
treebc0bcbe470f842433f929825e0c98a88a8cb3128
parent323ed2308a0cbedddf816700eda3b94d2b9f5495
[NFCI] Simplify TypeCategoryImpl for-each callbacks.

The callback system to iterate over every formatter of a given kind in
a TypeCategoryImpl is only used in one place (the implementation of
`type {formatter_kind} list`), and it's too convoluted for the sake of
unused flexibility.

This change changes it so that only one callback is passed to `ForEach`
(instead of a callback for exact matches and another one for regex
matches), and moves the iteration logic to `TieredFormatterContainer`
to avoid duplication.

If in the future we need different logic in the callback depending on
exact/regex match, the callback can get the type of formatter matching
used from the TypeMatcher argument anyway.

Differential Revision: https://reviews.llvm.org/D134771
lldb/include/lldb/DataFormatters/TypeCategory.h
lldb/source/Commands/CommandObjectType.cpp