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

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 2 14:06:41 PDT 2020


jankratochvil marked 6 inline comments as done.
jankratochvil added inline comments.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:2014
 
-        if (!method_die_offsets.empty()) {
-          DWARFDebugInfo &debug_info = dwarf->DebugInfo();
----------------
kwk wrote:
> 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.
I did not put an attention to it, thanks for catching it. Personally I think it is OK but when it has been brought up I am fixing this possible performance regression. `SymbolFileDWARF::DebugInfo()` contains some `llvm::call_once(m_info_once_flag` which does have some cost.


================
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);
----------------
kwk wrote:
> Why is the `if` no longer needed?
It will now run `DWARFMappedHash::ExtractDIEArray` on empty array which is cheap, it does nothing.


================
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;
----------------
kwk wrote:
> This looks like a logic change and I wonder if it should go in a separate patch, maybe?
This should be NFC, do I miss something?
From:
```
if (a == b) {
  c;
}
```
The patch changes it to:
```
if (a != b)
  continue;
c;
```



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