diff options
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 31 | ||||
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h | 1 | 
2 files changed, 26 insertions, 6 deletions
| diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 82e9d86..63b2dc4 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -450,6 +450,10 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE &die) {        byte_size = form_value.Unsigned();        break; +    case DW_AT_bit_size: +      data_bit_size = form_value.Unsigned(); +      break; +      case DW_AT_alignment:        alignment = form_value.Unsigned();        break; @@ -810,13 +814,18 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,      // there...      [[fallthrough]]; -  case DW_TAG_base_type: +  case DW_TAG_base_type: {      resolve_state = Type::ResolveState::Full; +    // If a builtin type's size isn't a multiple of a byte, DWARF producers may +    // add a precise bit-size to the type. Use the most precise bit-size +    // possible. +    const uint64_t bit_size = attrs.data_bit_size +                                  ? *attrs.data_bit_size +                                  : attrs.byte_size.value_or(0) * 8;      clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize( -        attrs.name.GetStringRef(), attrs.encoding, -        attrs.byte_size.value_or(0) * 8); +        attrs.name.GetStringRef(), attrs.encoding, bit_size);      break; - +  }    case DW_TAG_pointer_type:      encoding_data_type = Type::eEncodingIsPointerUID;      break; @@ -1901,6 +1910,17 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc,          m_ast.CreateClassTemplateSpecializationDecl(              containing_decl_ctx, GetOwningClangModule(die), class_template_decl,              tag_decl_kind, template_param_infos); +    if (!class_specialization_decl) { +      if (log) { +        dwarf->GetObjectFile()->GetModule()->LogMessage( +            log, +            "SymbolFileDWARF({0:p}) - Failed to create specialization for " +            "clang::ClassTemplateDecl({1}, {2:p}).", +            this, llvm::StringRef(attrs.name), class_template_decl); +      } +      return TypeSP(); +    } +      clang_type =          m_ast.CreateClassTemplateSpecializationType(class_specialization_decl); @@ -2032,11 +2052,10 @@ static std::optional<clang::APValue> MakeAPValue(const clang::ASTContext &ast,    if (is_integral)      return clang::APValue(apint); -  uint32_t count;    bool is_complex;    // FIXME: we currently support a limited set of floating point types.    // E.g., 16-bit floats are not supported. -  if (!clang_type.IsFloatingPointType(count, is_complex)) +  if (!clang_type.IsFloatingPointType(is_complex))      return std::nullopt;    return clang::APValue(llvm::APFloat( diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h index da58f4c..f5f7071 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h @@ -574,6 +574,7 @@ struct ParsedDWARFTypeAttributes {    lldb_private::plugin::dwarf::DWARFFormValue type;    lldb::LanguageType class_language = lldb::eLanguageTypeUnknown;    std::optional<uint64_t> byte_size; +  std::optional<uint64_t> data_bit_size;    std::optional<uint64_t> alignment;    size_t calling_convention = llvm::dwarf::DW_CC_normal;    uint32_t bit_stride = 0; | 
