llvm-project/lldb/source/DataFormatters
Jorge Gorbe Moya 1f2a21820d [NFCI] Refactor FormatterContainerPair into TieredFormatterContainer.
`FormatterContainerPair` is (as its name indicates) a very thin wrapper
over two formatter containers, one for exact matches and another one for
regex matches. The logic to decide which subcontainer to access is
replicated everywhere `FormatterContainerPair`s are used.

So, for example, when we look for a formatter there's some adhoc code
that does a lookup in the exact match formatter container, and if it
fails it does a lookup in the regex match formatter container. The same
logic is then copied and pasted for summaries, filters, and synthetic
child providers.

This change introduces a new `TieredFormatterContainer` that has two
main characteristics:

- It generalizes `FormatterContainerPair` from 2 to any number of
  subcontainers, that are looked up in priority order.
- It centralizes all the logic to choose which subcontainer to use for
  lookups, add/delete, and indexing.

This allows us to have a single copy of the same logic, templatized for
each kind of formatter. It also simplifies the upcoming addition of a
new tier of callback-based matches. See
https://discourse.llvm.org/t/rfc-python-callback-for-data-formatters-type-matching/64204
for more details about this.

The rest of the change is mostly replacing copy-pasted code with calls
to methods of the relevant `TieredFormatterContainer`, and adding some
methods to the `TypeCategoryImpl` class so we can remove some of this
copy-pasted code from `SBTypeCategory`.

Differential Revision: https://reviews.llvm.org/D133910
2022-09-27 14:28:41 -07:00
..
CMakeLists.txt
CXXFunctionPointer.cpp Set a default number of address bits on Darwin arm64 systems 2021-12-09 22:53:01 -08:00
DataVisualization.cpp [NFCI] Clean up enum FormatCategoryItem. 2022-09-20 10:41:06 -07:00
DumpValueObjectOptions.cpp [lldb] Add setting for max depth of value object printing (NFC) 2022-05-03 10:39:42 -07:00
FormatCache.cpp
FormatClasses.cpp
FormatManager.cpp [lldb] Use std::size instead of llvm::array_lengthof 2022-09-08 14:21:55 -06:00
FormattersHelpers.cpp [lldb] (Partially) enable formatting of utf strings before the program is started 2021-11-18 14:45:17 +01:00
LanguageCategory.cpp
StringPrinter.cpp [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
TypeCategory.cpp [NFCI] Refactor FormatterContainerPair into TieredFormatterContainer. 2022-09-27 14:28:41 -07:00
TypeCategoryMap.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
TypeFormat.cpp [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
TypeSummary.cpp [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
TypeSynthetic.cpp [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
ValueObjectPrinter.cpp [lldb] Add setting for max depth of value object printing (NFC) 2022-05-03 10:39:42 -07:00
VectorType.cpp [LLDB] Applying clang-tidy modernize-use-default-member-init over LLDB 2022-03-14 13:32:03 -07:00