[all-commits] [llvm/llvm-project] f0a61c: Remove `friend` classes from TypeCategoryMap

Jorge Gorbe Moya via All-commits all-commits at lists.llvm.org
Mon May 23 11:32:53 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f0a61c2ce2afec200967c59d45181c7a9fbe2c3f
      https://github.com/llvm/llvm-project/commit/f0a61c2ce2afec200967c59d45181c7a9fbe2c3f
  Author: Jorge Gorbe Moya <jgorbe at google.com>
  Date:   2022-05-23 (Mon, 23 May 2022)

  Changed paths:
    M lldb/include/lldb/DataFormatters/TypeCategoryMap.h

  Log Message:
  -----------
  Remove `friend` classes from TypeCategoryMap

As far as I can tell, the only thing those friend classes access is the
`ValueSP` typedef.

Given that this is a map-ish class, with "Map" in its name, it doesn't
seem like a stretch to make `KeyType`, `ValueType` and `ValueSP` public.
More so when the public methods of the class have `KeyType` and
`ValueSP` arguments and clearly `ValueSP` needs to be accessed from the
outside.

`friend` complicates local reasoning about who can access private
members, which is valuable in a class like this that has every method
locking a mutex to prevent concurrent access.

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




More information about the All-commits mailing list