[all-commits] [llvm/llvm-project] 77ae06: [lldb][NFC] Remove FormatMap

Raphael Isemann via All-commits all-commits at lists.llvm.org
Thu Jul 23 09:35:33 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 77ae06b8c6c7425c0376dbd526390ba1f48b3db5
      https://github.com/llvm/llvm-project/commit/77ae06b8c6c7425c0376dbd526390ba1f48b3db5
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-07-23 (Thu, 23 Jul 2020)

  Changed paths:
    M lldb/include/lldb/DataFormatters/FormatManager.h
    M lldb/include/lldb/DataFormatters/FormattersContainer.h
    M lldb/include/lldb/DataFormatters/TypeCategory.h
    M lldb/source/DataFormatters/DataVisualization.cpp

  Log Message:
  -----------
  [lldb][NFC] Remove FormatMap

Summary:

FormattersContainer.h has two containers: FormatMap and FormattersContainer
itself. FormatMap is essentially just a SetVector with a listener interface that
is aspiring to be thread-safe as most of its functions lock its member mutex.

FormattersContainer is for the most part just calling the matching functions of
internal FormatMap instance and essentially acts as a wrapper class with some
minor formatter search functionality on top. The only difference is that the
FormattersContainer's public `Get` function is actually searching formatters in
the list of formatters (and for example doing regex-matching) while FormatMap's
`Get` function is just looking up a a format by the type matcher string.

This patch deletes `FormatMap` by just renaming it to `FormattersContainer` and
pulling in the two `Get` functions from the original `FormattersContainer`
class.

The only other user of `FormatMap` was the `NamedSummariesMap` in the
`FormatManager` which I migrated by just making it also a `FormattersContainer`
and replaced the only call to the `Get` function (which now has new semantics)
with `GetExact` (which is FormattersContainer's function that has the semantics
of FormatMap's `Get`). As `NamedSummariesMap` only stores non-regex-based
formatters, both `Get` and `GetExact` would have worked, so this was mostly to
clarify that this is supposed to be NFC.

I also added the missing mutex lock in the `GetCount` function which was
previously missing in the `FormatMap` implementation. Technically not "NFC" but
I anyway had to change the function...

Reviewers: labath, mib

Reviewed By: labath

Subscribers: abidh, JDevlieghere

Differential Revision: https://reviews.llvm.org/D84296




More information about the All-commits mailing list