summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2019-01-28 21:44:35 +0000
committerAdrian Prantl <aprantl@apple.com>2019-01-28 21:44:35 +0000
commit2a56e97f741bf8fefa68692304a29c64f37c65b7 (patch)
treea2d623c9221d10d9087496e40315fa65df19b790 /lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
parent390ac61b930e745c4a7130a20ede62aa2370ffc0 (diff)
downloadbcm5719-llvm-2a56e97f741bf8fefa68692304a29c64f37c65b7.tar.gz
bcm5719-llvm-2a56e97f741bf8fefa68692304a29c64f37c65b7.zip
Revert "Make Type::GetByteSize optional (NFC)"
This reverts commit r352394 because it broke three windows-specific tests. llvm-svn: 352434
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 9125bbb8942..c136b1eddef 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -264,7 +264,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
const char *mangled_name_cstr = NULL;
ConstString type_name_const_str;
Type::ResolveState resolve_state = Type::eResolveStateUnresolved;
- llvm::Optional<uint64_t> byte_size;
+ uint64_t byte_size = 0;
Declaration decl;
Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID;
@@ -386,7 +386,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
case DW_TAG_base_type:
resolve_state = Type::eResolveStateFull;
clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize(
- type_name_cstr, encoding, byte_size.getValueOr(0) * 8);
+ type_name_cstr, encoding, byte_size * 8);
break;
case DW_TAG_pointer_type:
@@ -535,6 +535,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
case DW_TAG_class_type: {
// Set a bit that lets us know that we are currently parsing this
dwarf->GetDIEToType()[die.GetDIE()] = DIE_IS_BEING_PARSED;
+ bool byte_size_valid = false;
LanguageType class_language = eLanguageTypeUnknown;
bool is_complete_objc_class = false;
@@ -568,6 +569,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
case DW_AT_byte_size:
byte_size = form_value.Unsigned();
+ byte_size_valid = true;
break;
case DW_AT_accessibility:
@@ -627,7 +629,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
if (dwarf->GetUniqueDWARFASTTypeMap().Find(
unique_typename, die, unique_decl,
- byte_size ? *byte_size : -1, *unique_ast_entry_ap)) {
+ byte_size_valid ? byte_size : -1, *unique_ast_entry_ap)) {
type_sp = unique_ast_entry_ap->m_type_sp;
if (type_sp) {
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
@@ -652,7 +654,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
default_accessibility = eAccessPrivate;
}
- if (byte_size && *byte_size == 0 && type_name_cstr &&
+ if (byte_size_valid && byte_size == 0 && type_name_cstr &&
!die.HasChildren() &&
sc.comp_unit->GetLanguage() == eLanguageTypeObjC) {
// Work around an issue with clang at the moment where forward
@@ -855,7 +857,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
unique_ast_entry_ap->m_type_sp = type_sp;
unique_ast_entry_ap->m_die = die;
unique_ast_entry_ap->m_declaration = unique_decl;
- unique_ast_entry_ap->m_byte_size = byte_size.getValueOr(0);
+ unique_ast_entry_ap->m_byte_size = byte_size;
dwarf->GetUniqueDWARFASTTypeMap().Insert(unique_typename,
*unique_ast_entry_ap);
@@ -1082,10 +1084,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
}
if (!enumerator_clang_type) {
- if (byte_size) {
+ if (byte_size > 0) {
enumerator_clang_type =
m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize(
- NULL, DW_ATE_signed, *byte_size * 8);
+ NULL, DW_ATE_signed, byte_size * 8);
} else {
enumerator_clang_type = m_ast.GetBasicType(eBasicTypeInt);
}
@@ -1113,7 +1115,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
bool is_signed = false;
enumerator_clang_type.IsIntegerType(is_signed);
ParseChildEnumerators(cu_sc, clang_type, is_signed,
- type_sp->GetByteSize().getValueOr(0), die);
+ type_sp->GetByteSize(), die);
}
ClangASTContext::CompleteTagDeclarationDefinition(clang_type);
} else {
@@ -1651,10 +1653,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
}
}
}
- type_sp.reset(new Type(die.GetID(), dwarf, type_name_const_str,
- llvm::None, NULL, LLDB_INVALID_UID,
- Type::eEncodingIsUID, &decl, clang_type,
- Type::eResolveStateFull));
+ type_sp.reset(new Type(die.GetID(), dwarf, type_name_const_str, 0, NULL,
+ LLDB_INVALID_UID, Type::eEncodingIsUID, &decl,
+ clang_type, Type::eResolveStateFull));
assert(type_sp.get());
} break;
@@ -1738,7 +1739,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
bit_stride = array_info->bit_stride;
}
if (byte_stride == 0 && bit_stride == 0)
- byte_stride = element_type->GetByteSize().getValueOr(0);
+ byte_stride = element_type->GetByteSize();
CompilerType array_element_type =
element_type->GetForwardCompilerType();
@@ -2311,7 +2312,7 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die,
!layout_info.base_offsets.empty() ||
!layout_info.vbase_offsets.empty()) {
if (type)
- layout_info.bit_size = type->GetByteSize().getValueOr(0) * 8;
+ layout_info.bit_size = type->GetByteSize() * 8;
if (layout_info.bit_size == 0)
layout_info.bit_size =
die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
@@ -2395,8 +2396,8 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die,
SymbolContext sc(die.GetLLDBCompileUnit());
bool is_signed = false;
clang_type.IsIntegerType(is_signed);
- ParseChildEnumerators(sc, clang_type, is_signed,
- type->GetByteSize().getValueOr(0), die);
+ ParseChildEnumerators(sc, clang_type, is_signed, type->GetByteSize(),
+ die);
}
ClangASTContext::CompleteTagDeclarationDefinition(clang_type);
}
@@ -2720,7 +2721,7 @@ bool DWARFASTParserClang::ParseChildMembers(
AccessType accessibility = eAccessNone;
uint32_t member_byte_offset =
(parent_die.Tag() == DW_TAG_union_type) ? 0 : UINT32_MAX;
- llvm::Optional<uint64_t> byte_size;
+ size_t byte_size = 0;
int64_t bit_offset = 0;
uint64_t data_bit_offset = UINT64_MAX;
size_t bit_size = 0;
@@ -2863,7 +2864,7 @@ bool DWARFASTParserClang::ParseChildMembers(
// with a crash if we try to use this type in an expression when clang
// becomes unhappy with its recycled debug info.
- if (byte_size.getValueOr(0) == 0 && bit_offset < 0) {
+ if (byte_size == 0 && bit_offset < 0) {
bit_size = 0;
bit_offset = 0;
}
@@ -2925,12 +2926,12 @@ bool DWARFASTParserClang::ParseChildMembers(
if (data_bit_offset != UINT64_MAX) {
this_field_info.bit_offset = data_bit_offset;
} else {
- if (!byte_size)
+ if (byte_size == 0)
byte_size = member_type->GetByteSize();
ObjectFile *objfile = die.GetDWARF()->GetObjectFile();
if (objfile->GetByteOrder() == eByteOrderLittle) {
- this_field_info.bit_offset += byte_size.getValueOr(0) * 8;
+ this_field_info.bit_offset += byte_size * 8;
this_field_info.bit_offset -= (bit_offset + bit_size);
} else {
this_field_info.bit_offset += bit_offset;
OpenPOWER on IntegriCloud