diff options
Diffstat (limited to 'source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp')
-rw-r--r-- | source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp b/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp index dd830eb7b9dd6..b3594a455680e 100644 --- a/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp +++ b/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp @@ -1,9 +1,8 @@ //===-- DWARFAttribute.cpp --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -33,41 +32,27 @@ void DWARFAttributes::Append(const DWARFUnit *cu, dw_offset_t attr_die_offset, m_infos.push_back(attr_value); } -bool DWARFAttributes::ContainsAttribute(dw_attr_t attr) const { - return FindAttributeIndex(attr) != UINT32_MAX; -} - -bool DWARFAttributes::RemoveAttribute(dw_attr_t attr) { - uint32_t attr_index = FindAttributeIndex(attr); - if (attr_index != UINT32_MAX) { - m_infos.erase(m_infos.begin() + attr_index); - return true; - } - return false; -} - bool DWARFAttributes::ExtractFormValueAtIndex( uint32_t i, DWARFFormValue &form_value) const { const DWARFUnit *cu = CompileUnitAtIndex(i); - form_value.SetCompileUnit(cu); + form_value.SetUnit(cu); form_value.SetForm(FormAtIndex(i)); lldb::offset_t offset = DIEOffsetAtIndex(i); return form_value.ExtractValue(cu->GetData(), &offset); } -uint64_t DWARFAttributes::FormValueAsUnsigned(dw_attr_t attr, - uint64_t fail_value) const { +DWARFDIE +DWARFAttributes::FormValueAsReference(dw_attr_t attr) const { const uint32_t attr_idx = FindAttributeIndex(attr); if (attr_idx != UINT32_MAX) - return FormValueAsUnsignedAtIndex(attr_idx, fail_value); - return fail_value; + return FormValueAsReferenceAtIndex(attr_idx); + return {}; } -uint64_t -DWARFAttributes::FormValueAsUnsignedAtIndex(uint32_t i, - uint64_t fail_value) const { +DWARFDIE +DWARFAttributes::FormValueAsReferenceAtIndex(uint32_t i) const { DWARFFormValue form_value; if (ExtractFormValueAtIndex(i, form_value)) return form_value.Reference(); - return fail_value; + return {}; } |