[Lldb-commits] [PATCH] D77326: 1/2: [nfc] [lldb] Unindent code

Konrad Wilhelm Kleine via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 2 13:02:06 PDT 2020


kwk added a comment.

Overall looks good to me except for one larger logic change. Maybe a your comment can clarify this. The code was in a very bad shape before, given the countless amounts of shortcuts you could take.



================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:2014
 
-        if (!method_die_offsets.empty()) {
-          DWARFDebugInfo &debug_info = dwarf->DebugInfo();
----------------
I assume this can be removed because you're iterating over `num_matches == 0` when it's empty. But I cannot tell about the `DWARFDebugInfo &debug_info = dwarf->DebugInfo();` and how costly this call is and if it makes sense to run when the offsets are empty.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp:524
   DIEInfoArray die_info_array;
-  if (FindByName(name, die_info_array))
-    DWARFMappedHash::ExtractDIEArray(die_info_array, die_offsets);
+  FindByName(name, die_info_array);
+  DWARFMappedHash::ExtractDIEArray(die_info_array, die_offsets);
----------------
Why is the `if` no longer needed?


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2061
+    if (!die) {
+      m_index->ReportInvalidDIERef(die_ref, name.GetStringRef());
+      continue;
----------------
Nice shortcut.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2943
+        // Make sure the decl contexts match all the way up
+        if (dwarf_decl_ctx != type_dwarf_decl_ctx)
+          continue;
----------------
This looks like a logic change and I wonder if it should go in a separate patch, maybe?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77326





More information about the lldb-commits mailing list