[Lldb-commits] [lldb] r345733 - [LLDB] - Regroup the switch entries in DWARFFormValue::ExtractValue. NFC.

George Rimar via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 31 09:12:29 PDT 2018


Author: grimar
Date: Wed Oct 31 09:12:29 2018
New Revision: 345733

URL: http://llvm.org/viewvc/llvm-project?rev=345733&view=rev
Log:
[LLDB] - Regroup the switch entries in DWARFFormValue::ExtractValue. NFC.

This is NFC to clean up the `DWARFFormValue::ExtractValue`.
It groups similar `DW_FORM_*` and removes an excessive
assignment of `ref_addr_size` (it was assigned right after in any case).

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp?rev=345733&r1=345732&r2=345733&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Wed Oct 31 09:12:29 2018
@@ -182,8 +182,12 @@ bool DWARFFormValue::ExtractValue(const
     switch (m_form) {
     case DW_FORM_addr:
       assert(m_cu);
-      m_value.value.uval = data.GetMaxU64(
-          offset_ptr, DWARFUnit::GetAddressByteSize(m_cu));
+      m_value.value.uval =
+          data.GetMaxU64(offset_ptr, DWARFUnit::GetAddressByteSize(m_cu));
+      break;
+    case DW_FORM_block1:
+      m_value.value.uval = data.GetU8(offset_ptr);
+      is_block = true;
       break;
     case DW_FORM_block2:
       m_value.value.uval = data.GetU16(offset_ptr);
@@ -193,56 +197,39 @@ bool DWARFFormValue::ExtractValue(const
       m_value.value.uval = data.GetU32(offset_ptr);
       is_block = true;
       break;
-    case DW_FORM_data2:
-      m_value.value.uval = data.GetU16(offset_ptr);
-      break;
-    case DW_FORM_data4:
-      m_value.value.uval = data.GetU32(offset_ptr);
-      break;
-    case DW_FORM_data8:
-      m_value.value.uval = data.GetU64(offset_ptr);
-      break;
     case DW_FORM_data16:
       m_value.value.uval = 16;
       is_block = true;
       break;
-    case DW_FORM_string:
-      m_value.value.cstr = data.GetCStr(offset_ptr);
-      break;
     case DW_FORM_exprloc:
     case DW_FORM_block:
       m_value.value.uval = data.GetULEB128(offset_ptr);
       is_block = true;
       break;
-    case DW_FORM_block1:
-      m_value.value.uval = data.GetU8(offset_ptr);
-      is_block = true;
-      break;
-    case DW_FORM_data1:
-      m_value.value.uval = data.GetU8(offset_ptr);
-      break;
-    case DW_FORM_flag:
-      m_value.value.uval = data.GetU8(offset_ptr);
+    case DW_FORM_string:
+      m_value.value.cstr = data.GetCStr(offset_ptr);
       break;
     case DW_FORM_sdata:
       m_value.value.sval = data.GetSLEB128(offset_ptr);
       break;
     case DW_FORM_strp:
     case DW_FORM_line_strp:
+    case DW_FORM_sec_offset:
       assert(m_cu);
       m_value.value.uval =
           data.GetMaxU64(offset_ptr, DWARFUnit::IsDWARF64(m_cu) ? 8 : 4);
       break;
-    case DW_FORM_addrx:
-    case DW_FORM_strx:
-      m_value.value.uval = data.GetULEB128(offset_ptr);
-      break;
     case DW_FORM_addrx1:
     case DW_FORM_strx1:
+    case DW_FORM_ref1:
+    case DW_FORM_data1:
+    case DW_FORM_flag:
       m_value.value.uval = data.GetU8(offset_ptr);
       break;
     case DW_FORM_addrx2:
     case DW_FORM_strx2:
+    case DW_FORM_ref2:
+    case DW_FORM_data2:
       m_value.value.uval = data.GetU16(offset_ptr);
       break;
     case DW_FORM_addrx3:
@@ -251,61 +238,40 @@ bool DWARFFormValue::ExtractValue(const
       break;
     case DW_FORM_addrx4:
     case DW_FORM_strx4:
+    case DW_FORM_ref4:
+    case DW_FORM_data4:
       m_value.value.uval = data.GetU32(offset_ptr);
       break;
-    //  case DW_FORM_APPLE_db_str:
+    case DW_FORM_data8:
+    case DW_FORM_ref8:
+    case DW_FORM_ref_sig8:
+      m_value.value.uval = data.GetU64(offset_ptr);
+      break;
+    case DW_FORM_addrx:
+    case DW_FORM_strx:
     case DW_FORM_udata:
+    case DW_FORM_ref_udata:
+    case DW_FORM_GNU_str_index:
+    case DW_FORM_GNU_addr_index:
       m_value.value.uval = data.GetULEB128(offset_ptr);
       break;
     case DW_FORM_ref_addr:
       assert(m_cu);
-      ref_addr_size = 4;
       if (m_cu->GetVersion() <= 2)
         ref_addr_size = m_cu->GetAddressByteSize();
       else
         ref_addr_size = m_cu->IsDWARF64() ? 8 : 4;
       m_value.value.uval = data.GetMaxU64(offset_ptr, ref_addr_size);
       break;
-    case DW_FORM_ref1:
-      m_value.value.uval = data.GetU8(offset_ptr);
-      break;
-    case DW_FORM_ref2:
-      m_value.value.uval = data.GetU16(offset_ptr);
-      break;
-    case DW_FORM_ref4:
-      m_value.value.uval = data.GetU32(offset_ptr);
-      break;
-    case DW_FORM_ref8:
-      m_value.value.uval = data.GetU64(offset_ptr);
-      break;
-    case DW_FORM_ref_udata:
-      m_value.value.uval = data.GetULEB128(offset_ptr);
-      break;
     case DW_FORM_indirect:
       m_form = data.GetULEB128(offset_ptr);
       indirect = true;
       break;
-
-    case DW_FORM_sec_offset:
-      assert(m_cu);
-      m_value.value.uval =
-          data.GetMaxU64(offset_ptr, DWARFUnit::IsDWARF64(m_cu) ? 8 : 4);
-      break;
     case DW_FORM_flag_present:
       m_value.value.uval = 1;
       break;
-    case DW_FORM_ref_sig8:
-      m_value.value.uval = data.GetU64(offset_ptr);
-      break;
-    case DW_FORM_GNU_str_index:
-      m_value.value.uval = data.GetULEB128(offset_ptr);
-      break;
-    case DW_FORM_GNU_addr_index:
-      m_value.value.uval = data.GetULEB128(offset_ptr);
-      break;
     default:
       return false;
-      break;
     }
   } while (indirect);
 




More information about the lldb-commits mailing list