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

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 6 19:38:43 PDT 2020


shafik added inline comments.


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp:70
     const dw_tag_t die_tag = die_info_array[i].tag;
-    if (die_tag != 0 && die_tag != DW_TAG_class_type &&
-        die_tag != DW_TAG_structure_type)
+    if (!(die_tag == 0 || die_tag == DW_TAG_class_type ||
+          die_tag == DW_TAG_structure_type))
----------------
I also feel like the previous version was more readable. Is there another gain that I am missing?


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2065
 
-        case DW_TAG_variable: {
-          auto *dwarf_cu = llvm::dyn_cast<DWARFCompileUnit>(die.GetCU());
-          if (!dwarf_cu)
-            continue;
-          sc.comp_unit = GetCompUnitForDWARFCompUnit(*dwarf_cu);
-
-          if (parent_decl_ctx) {
-            if (DWARFASTParser *dwarf_ast = GetDWARFParser(*die.GetCU())) {
-              CompilerDeclContext actual_parent_decl_ctx =
-                  dwarf_ast->GetDeclContextContainingUIDFromDWARF(die);
-              if (!actual_parent_decl_ctx ||
-                  actual_parent_decl_ctx != parent_decl_ctx)
-                continue;
-            }
-          }
+    switch (die.Tag()) {
+    default:
----------------
This whole switch feels overly clever, how about:

```
if (die.Tag() != DW_TAG_variable)
  continue;
```


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