[all-commits] [llvm/llvm-project] dee9c7: [NFCI] Simplify TypeCategoryImpl for-each callbacks.

Jorge Gorbe Moya via All-commits all-commits at lists.llvm.org
Thu Oct 6 12:12:02 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dee9c7f5d7e53aa6a9e7f85cdf9935341ba7e636
      https://github.com/llvm/llvm-project/commit/dee9c7f5d7e53aa6a9e7f85cdf9935341ba7e636
  Author: Jorge Gorbe Moya <jgorbe at google.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M lldb/include/lldb/DataFormatters/TypeCategory.h
    M lldb/source/Commands/CommandObjectType.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list