[Lldb-commits] [PATCH] D77970: 2/2: [nfc] [lldb] DWARF callbacks: DIERef -> DWARFDIE

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 20 08:05:23 PDT 2020

labath added a comment.

Looks pretty good, I just think the std::function solution is too smart for its own good.

Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h:82
+  /// The object will remain valid during the whole call statement:
+  /// Function(name, DIERefCallback({callback, name}));
+  struct DIERefCallbackArgs {
jankratochvil wrote:
> This calling with curly brackets is a bit tricky but I found it the least worst option.
I think it would be much simpler to make this a callable object instead (though I'm not sure we need to worry about optimizing to this level of detail):
class ResultProcessor (?) {
  ResultProcessor(callback, name);
  bool operator()(DIERef ref);

Comment at: lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp:186
+  auto dierefcallback = DIERefCallback({callback, class_name.GetStringRef()});
   for (DIERef ref : incomplete_types)
dangling `DIERefCallbackArgs` here.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list