From a63af915288ad9d1049d486833fcd085b620dc6d Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Wed, 8 Jan 2020 15:35:21 -0800 Subject: [PATCH] [lldb] Remove various dead Compare functions --- lldb/source/Core/Section.cpp | 23 ------ .../Plugins/SymbolFile/DWARF/DWARFFormValue.cpp | 95 ---------------------- lldb/source/Symbol/Function.cpp | 10 --- lldb/source/Symbol/Type.cpp | 11 --- 4 files changed, 139 deletions(-) diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index 4a9acab..b1d7eee 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -280,29 +280,6 @@ bool Section::ContainsFileAddress(addr_t vm_addr) const { return false; } -int Section::Compare(const Section &a, const Section &b) { - if (&a == &b) - return 0; - - const ModuleSP a_module_sp = a.GetModule(); - const ModuleSP b_module_sp = b.GetModule(); - if (a_module_sp == b_module_sp) { - user_id_t a_sect_uid = a.GetID(); - user_id_t b_sect_uid = b.GetID(); - if (a_sect_uid < b_sect_uid) - return -1; - if (a_sect_uid > b_sect_uid) - return 1; - return 0; - } else { - // The modules are different, just compare the module pointers - if (a_module_sp.get() < b_module_sp.get()) - return -1; - else - return 1; // We already know the modules aren't equal - } -} - void Section::Dump(Stream *s, Target *target, uint32_t depth) const { // s->Printf("%.*p: ", (int)sizeof(void*) * 2, this); s->Indent(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index 5cab4ce..f660cc32 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -602,101 +602,6 @@ bool DWARFFormValue::IsDataForm(const dw_form_t form) { return false; } -int DWARFFormValue::Compare(const DWARFFormValue &a_value, - const DWARFFormValue &b_value) { - dw_form_t a_form = a_value.Form(); - dw_form_t b_form = b_value.Form(); - if (a_form < b_form) - return -1; - if (a_form > b_form) - return 1; - switch (a_form) { - case DW_FORM_addr: - case DW_FORM_addrx: - case DW_FORM_flag: - case DW_FORM_data1: - case DW_FORM_data2: - case DW_FORM_data4: - case DW_FORM_data8: - case DW_FORM_udata: - case DW_FORM_ref_addr: - case DW_FORM_sec_offset: - case DW_FORM_flag_present: - case DW_FORM_ref_sig8: - case DW_FORM_GNU_addr_index: { - uint64_t a = a_value.Unsigned(); - uint64_t b = b_value.Unsigned(); - if (a < b) - return -1; - if (a > b) - return 1; - return 0; - } - - case DW_FORM_sdata: { - int64_t a = a_value.Signed(); - int64_t b = b_value.Signed(); - if (a < b) - return -1; - if (a > b) - return 1; - return 0; - } - - case DW_FORM_string: - case DW_FORM_strp: - case DW_FORM_GNU_str_index: { - const char *a_string = a_value.AsCString(); - const char *b_string = b_value.AsCString(); - if (a_string == b_string) - return 0; - else if (a_string && b_string) - return strcmp(a_string, b_string); - else if (a_string == nullptr) - return -1; // A string is NULL, and B is valid - else - return 1; // A string valid, and B is NULL - } - - case DW_FORM_block: - case DW_FORM_block1: - case DW_FORM_block2: - case DW_FORM_block4: - case DW_FORM_exprloc: { - uint64_t a_len = a_value.Unsigned(); - uint64_t b_len = b_value.Unsigned(); - if (a_len < b_len) - return -1; - if (a_len > b_len) - return 1; - // The block lengths are the same - return memcmp(a_value.BlockData(), b_value.BlockData(), a_value.Unsigned()); - } break; - - case DW_FORM_ref1: - case DW_FORM_ref2: - case DW_FORM_ref4: - case DW_FORM_ref8: - case DW_FORM_ref_udata: { - uint64_t a = a_value.m_value.value.uval; - uint64_t b = b_value.m_value.value.uval; - if (a < b) - return -1; - if (a > b) - return 1; - return 0; - } - - case DW_FORM_indirect: - llvm_unreachable( - "This shouldn't happen after the form has been extracted..."); - - default: - llvm_unreachable("Unhandled DW_FORM"); - } - return -1; -} - bool DWARFFormValue::FormIsSupported(dw_form_t form) { switch (form) { case DW_FORM_addr: diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp index c392317..e92585cc 100644 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -76,16 +76,6 @@ InlineFunctionInfo::InlineFunctionInfo(ConstString name, InlineFunctionInfo::~InlineFunctionInfo() {} -int InlineFunctionInfo::Compare(const InlineFunctionInfo &a, - const InlineFunctionInfo &b) { - - int result = FunctionInfo::Compare(a, b); - if (result) - return result; - // only compare the mangled names if both have them - return Mangled::Compare(a.m_mangled, a.m_mangled); -} - void InlineFunctionInfo::Dump(Stream *s, bool show_fullpaths) const { FunctionInfo::Dump(s, show_fullpaths); if (m_mangled) diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index aeca76f..f194356 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -656,17 +656,6 @@ CompilerType Type::GetForwardCompilerType() { return m_compiler_type; } -int Type::Compare(const Type &a, const Type &b) { - // Just compare the UID values for now... - lldb::user_id_t a_uid = a.GetID(); - lldb::user_id_t b_uid = b.GetID(); - if (a_uid < b_uid) - return -1; - if (a_uid > b_uid) - return 1; - return 0; -} - ConstString Type::GetQualifiedName() { return GetForwardCompilerType().GetConstTypeName(); } -- 2.7.4