summaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
authorAlex Langford <alangford@apple.com>2023-05-10 13:18:23 -0700
committerAlex Langford <alangford@apple.com>2023-05-12 11:58:50 -0700
commit64f1fda29e2dd133c84f23474e29de02d7ed392d (patch)
treefed67f8ca47062663c67c49c00a7fed3d47e6580 /lldb
parent2ee4ddae043946d74a5744fe6590759ae383bb94 (diff)
downloadllvm-64f1fda29e2dd133c84f23474e29de02d7ed392d.tar.gz
[lldb][NFCI] Redefine dw_attr_t typedef with llvm::dwarf::Attribute
Similar to dw_form_t, dw_attr_t is typedef'd to be a uint16_t. LLVM defines their type `llvm::dwarf::Attribute` as an enum backed by a uint16_t. Switching to the LLVM type buys us type checking and the requirement of explicit casts. Differential Revision: https://reviews.llvm.org/D150299
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/Core/dwarf.h2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp2
5 files changed, 8 insertions, 2 deletions
diff --git a/lldb/include/lldb/Core/dwarf.h b/lldb/include/lldb/Core/dwarf.h
index 6fcf2f8cc0c7..e162a090ba7c 100644
--- a/lldb/include/lldb/Core/dwarf.h
+++ b/lldb/include/lldb/Core/dwarf.h
@@ -21,7 +21,7 @@ namespace dwarf {
}
}
-typedef uint16_t dw_attr_t;
+typedef llvm::dwarf::Attribute dw_attr_t;
typedef llvm::dwarf::Form dw_form_t;
typedef llvm::dwarf::Tag dw_tag_t;
typedef uint64_t dw_addr_t; // Dwarf address define that must be big enough for
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 53068823ceac..b8a517100524 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -274,6 +274,8 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE &die) {
if (!attributes.ExtractFormValueAtIndex(i, form_value))
continue;
switch (attr) {
+ default:
+ break;
case DW_AT_abstract_origin:
abstract_origin = form_value;
break;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
index 5bd3b23dc95f..8dd47e6da8d5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
@@ -40,7 +40,7 @@ DWARFAbbreviationDeclaration::extract(const DWARFDataExtractor &data,
m_has_children = data.GetU8(offset_ptr);
while (data.ValidOffset(*offset_ptr)) {
- dw_attr_t attr = data.GetULEB128(offset_ptr);
+ auto attr = static_cast<dw_attr_t>(data.GetULEB128(offset_ptr));
auto form = static_cast<dw_form_t>(data.GetULEB128(offset_ptr));
// This is the last attribute for this abbrev decl, but there may still be
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 91be5e5b7bb6..8e2e04d4176a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -391,6 +391,8 @@ void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) {
if (!attributes.ExtractFormValueAtIndex(i, form_value))
continue;
switch (attr) {
+ default:
+ break;
case DW_AT_loclists_base:
SetLoclistsBase(form_value.Unsigned());
break;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 79cbb1059349..9be005ea06d5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -239,6 +239,8 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
dw_attr_t attr = attributes.AttributeAtIndex(i);
DWARFFormValue form_value;
switch (attr) {
+ default:
+ break;
case DW_AT_name:
if (attributes.ExtractFormValueAtIndex(i, form_value))
name = form_value.AsCString();