[Lldb-commits] [PATCH] D134771: [NFCI] Simplify TypeCategoryImpl for-each callbacks.

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 28 01:01:56 PDT 2022


labath added inline comments.


================
Comment at: lldb/include/lldb/DataFormatters/TypeCategory.h:136
+  void ForEach(std::function<bool(const TypeMatcher &,
+                                  const std::shared_ptr<FormatterImpl>)>
+                   callback) {
----------------
did you want to add a reference here? A const by-value argument is not particularly useful.


================
Comment at: lldb/include/lldb/DataFormatters/TypeCategory.h:159-162
+  // TypeFilterImpl inherits from SyntheticChildren, so we can't simply overload
+  // ForEach on the type of the callback because it would result in "call to
+  // member function 'ForEach' is ambiguous" errors. Instead we use this
+  // templated struct to hold the formatter type and the callback.
----------------
What if we just embed the type information into the method name? (So we could have a set of `ForEachFormat`,`ForEachSummary`, ... methods instead of a single overloaded ForEach)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134771/new/

https://reviews.llvm.org/D134771



More information about the lldb-commits mailing list