DWARFASTParserClang: Reduce indentation
by two levels via early returns. llvm-svn: 361471
This commit is contained in:
parent
b9889bbacb
commit
691502f61e
|
|
@ -231,13 +231,13 @@ static void CompleteExternalTagDeclType(ClangASTImporter &ast_importer,
|
|||
TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
||||
const DWARFDIE &die, Log *log,
|
||||
bool *type_is_new_ptr) {
|
||||
TypeSP type_sp;
|
||||
|
||||
if (type_is_new_ptr)
|
||||
*type_is_new_ptr = false;
|
||||
|
||||
AccessType accessibility = eAccessNone;
|
||||
if (die) {
|
||||
if (!die)
|
||||
return nullptr;
|
||||
|
||||
SymbolFileDWARF *dwarf = die.GetDWARF();
|
||||
if (log) {
|
||||
DWARFDIE context_die;
|
||||
|
|
@ -245,14 +245,20 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
GetClangDeclContextContainingDIE(die, &context_die);
|
||||
|
||||
dwarf->GetObjectFile()->GetModule()->LogMessage(
|
||||
log, "SymbolFileDWARF::ParseType (die = 0x%8.8x, decl_ctx = %p (die "
|
||||
log,
|
||||
"SymbolFileDWARF::ParseType (die = 0x%8.8x, decl_ctx = %p (die "
|
||||
"0x%8.8x)) %s name = '%s')",
|
||||
die.GetOffset(), static_cast<void *>(context),
|
||||
context_die.GetOffset(), die.GetTagAsCString(), die.GetName());
|
||||
die.GetOffset(), static_cast<void *>(context), context_die.GetOffset(),
|
||||
die.GetTagAsCString(), die.GetName());
|
||||
}
|
||||
|
||||
Type *type_ptr = dwarf->GetDIEToType().lookup(die.GetDIE());
|
||||
if (type_ptr == DIE_IS_BEING_PARSED)
|
||||
return nullptr;
|
||||
if (type_ptr)
|
||||
return type_ptr->shared_from_this();
|
||||
|
||||
TypeList *type_list = dwarf->GetTypeList();
|
||||
if (type_ptr == NULL) {
|
||||
if (type_is_new_ptr)
|
||||
*type_is_new_ptr = true;
|
||||
|
||||
|
|
@ -272,7 +278,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
DWARFFormValue form_value;
|
||||
|
||||
dw_attr_t attr;
|
||||
|
||||
TypeSP type_sp;
|
||||
switch (tag) {
|
||||
case DW_TAG_typedef:
|
||||
case DW_TAG_base_type:
|
||||
|
|
@ -356,8 +362,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
// concrete instances of templates are ever emitted and modules won't
|
||||
// contain those
|
||||
if (encoding_die &&
|
||||
encoding_die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) ==
|
||||
1) {
|
||||
encoding_die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) == 1) {
|
||||
type_sp = ParseTypeFromDWO(die, log);
|
||||
if (type_sp)
|
||||
return type_sp;
|
||||
|
|
@ -412,8 +417,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
break;
|
||||
}
|
||||
|
||||
if (!clang_type &&
|
||||
(encoding_data_type == Type::eEncodingIsPointerUID ||
|
||||
if (!clang_type && (encoding_data_type == Type::eEncodingIsPointerUID ||
|
||||
encoding_data_type == Type::eEncodingIsTypedefUID)) {
|
||||
if (tag == DW_TAG_pointer_type) {
|
||||
DWARFDIE target_die = die.GetReferencedDIE(DW_AT_type);
|
||||
|
|
@ -465,7 +469,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
if (type_name_const_str == g_objc_type_name_id) {
|
||||
if (log)
|
||||
dwarf->GetObjectFile()->GetModule()->LogMessage(
|
||||
log, "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' "
|
||||
log,
|
||||
"SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' "
|
||||
"is Objective-C 'id' built-in type.",
|
||||
die.GetOffset(), die.GetTagAsCString(), die.GetName());
|
||||
clang_type = m_ast.GetBasicType(eBasicTypeObjCID);
|
||||
|
|
@ -476,7 +481,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
} else if (type_name_const_str == g_objc_type_name_Class) {
|
||||
if (log)
|
||||
dwarf->GetObjectFile()->GetModule()->LogMessage(
|
||||
log, "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' "
|
||||
log,
|
||||
"SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' "
|
||||
"is Objective-C 'Class' built-in type.",
|
||||
die.GetOffset(), die.GetTagAsCString(), die.GetName());
|
||||
clang_type = m_ast.GetBasicType(eBasicTypeObjCClass);
|
||||
|
|
@ -486,7 +492,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
} else if (type_name_const_str == g_objc_type_name_selector) {
|
||||
if (log)
|
||||
dwarf->GetObjectFile()->GetModule()->LogMessage(
|
||||
log, "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' "
|
||||
log,
|
||||
"SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s' "
|
||||
"is Objective-C 'selector' built-in type.",
|
||||
die.GetOffset(), die.GetTagAsCString(), die.GetName());
|
||||
clang_type = m_ast.GetBasicType(eBasicTypeObjCSel);
|
||||
|
|
@ -506,11 +513,11 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
if (!strcmp(struct_name, "objc_object")) {
|
||||
if (log)
|
||||
dwarf->GetObjectFile()->GetModule()->LogMessage(
|
||||
log, "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s "
|
||||
log,
|
||||
"SymbolFileDWARF::ParseType (die = 0x%8.8x) %s "
|
||||
"'%s' is 'objc_object*', which we overrode to "
|
||||
"'id'.",
|
||||
die.GetOffset(), die.GetTagAsCString(),
|
||||
die.GetName());
|
||||
die.GetOffset(), die.GetTagAsCString(), die.GetName());
|
||||
clang_type = m_ast.GetBasicType(eBasicTypeObjCID);
|
||||
encoding_data_type = Type::eEncodingIsUID;
|
||||
encoding_uid.Clear();
|
||||
|
|
@ -538,8 +545,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
|
||||
LanguageType class_language = eLanguageTypeUnknown;
|
||||
bool is_complete_objc_class = false;
|
||||
size_t calling_convention
|
||||
= llvm::dwarf::CallingConvention::DW_CC_normal;
|
||||
size_t calling_convention = llvm::dwarf::CallingConvention::DW_CC_normal;
|
||||
|
||||
const size_t num_attributes = die.GetAttributes(attributes);
|
||||
if (num_attributes > 0) {
|
||||
|
|
@ -626,8 +632,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
}
|
||||
|
||||
if (dwarf->GetUniqueDWARFASTTypeMap().Find(
|
||||
unique_typename, die, unique_decl,
|
||||
byte_size ? *byte_size : -1, *unique_ast_entry_up)) {
|
||||
unique_typename, die, unique_decl, byte_size ? *byte_size : -1,
|
||||
*unique_ast_entry_up)) {
|
||||
type_sp = unique_ast_entry_up->m_type_sp;
|
||||
if (type_sp) {
|
||||
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
|
||||
|
|
@ -652,8 +658,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
default_accessibility = eAccessPrivate;
|
||||
}
|
||||
|
||||
if (byte_size && *byte_size == 0 && type_name_cstr &&
|
||||
!die.HasChildren() &&
|
||||
if (byte_size && *byte_size == 0 && type_name_cstr && !die.HasChildren() &&
|
||||
sc.comp_unit->GetLanguage() == eLanguageTypeObjC) {
|
||||
// Work around an issue with clang at the moment where forward
|
||||
// declarations for objective C classes are emitted as:
|
||||
|
|
@ -686,8 +691,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
if (debug_map_symfile) {
|
||||
// We weren't able to find a full declaration in this DWARF,
|
||||
// see if we have a declaration anywhere else...
|
||||
type_sp =
|
||||
debug_map_symfile->FindCompleteObjCDefinitionTypeForDIE(
|
||||
type_sp = debug_map_symfile->FindCompleteObjCDefinitionTypeForDIE(
|
||||
die, type_name_const_str, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -695,11 +699,11 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
if (type_sp) {
|
||||
if (log) {
|
||||
dwarf->GetObjectFile()->GetModule()->LogMessage(
|
||||
log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is an "
|
||||
log,
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is an "
|
||||
"incomplete objc type, complete type is 0x%8.8" PRIx64,
|
||||
static_cast<void *>(this), die.GetOffset(),
|
||||
DW_TAG_value_to_name(tag), type_name_cstr,
|
||||
type_sp->GetID());
|
||||
DW_TAG_value_to_name(tag), type_name_cstr, type_sp->GetID());
|
||||
}
|
||||
|
||||
// We found a real definition for this type elsewhere so lets use
|
||||
|
|
@ -719,7 +723,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
// elsewhere...
|
||||
if (log) {
|
||||
dwarf->GetObjectFile()->GetModule()->LogMessage(
|
||||
log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a "
|
||||
log,
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a "
|
||||
"forward declaration, trying to find complete type",
|
||||
static_cast<void *>(this), die.GetOffset(),
|
||||
DW_TAG_value_to_name(tag), type_name_cstr);
|
||||
|
|
@ -744,8 +749,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
if (debug_map_symfile) {
|
||||
// We weren't able to find a full declaration in this DWARF, see
|
||||
// if we have a declaration anywhere else...
|
||||
type_sp =
|
||||
debug_map_symfile->FindDefinitionTypeForDWARFDeclContext(
|
||||
type_sp = debug_map_symfile->FindDefinitionTypeForDWARFDeclContext(
|
||||
die_decl_ctx);
|
||||
}
|
||||
}
|
||||
|
|
@ -753,7 +757,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
if (type_sp) {
|
||||
if (log) {
|
||||
dwarf->GetObjectFile()->GetModule()->LogMessage(
|
||||
log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a "
|
||||
log,
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a "
|
||||
"forward declaration, complete type is 0x%8.8" PRIx64,
|
||||
static_cast<void *>(this), die.GetOffset(),
|
||||
DW_TAG_value_to_name(tag), type_name_cstr, type_sp->GetID());
|
||||
|
|
@ -762,8 +767,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
// We found a real definition for this type elsewhere so lets use
|
||||
// it and cache the fact that we found a complete type for this die
|
||||
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
|
||||
clang::DeclContext *defn_decl_ctx = GetCachedClangDeclContextForDIE(
|
||||
dwarf->GetDIE(type_sp->GetID()));
|
||||
clang::DeclContext *defn_decl_ctx =
|
||||
GetCachedClangDeclContextForDIE(dwarf->GetDIE(type_sp->GetID()));
|
||||
if (defn_decl_ctx)
|
||||
LinkDeclContextToDIE(defn_decl_ctx, die);
|
||||
return type_sp;
|
||||
|
|
@ -788,8 +793,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
if (accessibility == eAccessNone && decl_ctx) {
|
||||
// Check the decl context that contains this class/struct/union. If
|
||||
// it is a class we must give it an accessibility.
|
||||
const clang::Decl::Kind containing_decl_kind =
|
||||
decl_ctx->getDeclKind();
|
||||
const clang::Decl::Kind containing_decl_kind = decl_ctx->getDeclKind();
|
||||
if (DeclKindIsCXXClass(containing_decl_kind))
|
||||
accessibility = default_accessibility;
|
||||
}
|
||||
|
|
@ -808,7 +812,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
if (!class_template_decl) {
|
||||
if (log) {
|
||||
dwarf->GetObjectFile()->GetModule()->LogMessage(
|
||||
log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" "
|
||||
log,
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" "
|
||||
"clang::ClassTemplateDecl failed to return a decl.",
|
||||
static_cast<void *>(this), die.GetOffset(),
|
||||
DW_TAG_value_to_name(tag), type_name_cstr);
|
||||
|
|
@ -816,8 +821,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
return TypeSP();
|
||||
}
|
||||
|
||||
clang::ClassTemplateSpecializationDecl
|
||||
*class_specialization_decl =
|
||||
clang::ClassTemplateSpecializationDecl *class_specialization_decl =
|
||||
m_ast.CreateClassTemplateSpecializationDecl(
|
||||
decl_ctx, class_template_decl, tag_decl_kind,
|
||||
template_param_infos);
|
||||
|
|
@ -832,9 +836,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
|
||||
if (!clang_type_was_created) {
|
||||
clang_type_was_created = true;
|
||||
clang_type = m_ast.CreateRecordType(decl_ctx, accessibility,
|
||||
type_name_cstr, tag_decl_kind,
|
||||
class_language, &metadata);
|
||||
clang_type =
|
||||
m_ast.CreateRecordType(decl_ctx, accessibility, type_name_cstr,
|
||||
tag_decl_kind, class_language, &metadata);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -842,9 +846,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
// parameters in any class methods need it for the clang types for
|
||||
// function prototypes.
|
||||
LinkDeclContextToDIE(m_ast.GetDeclContextForType(clang_type), die);
|
||||
type_sp = std::make_shared<Type>(
|
||||
die.GetID(), dwarf, type_name_const_str, byte_size, nullptr,
|
||||
LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, clang_type,
|
||||
type_sp = std::make_shared<Type>(die.GetID(), dwarf, type_name_const_str,
|
||||
byte_size, nullptr, LLDB_INVALID_UID,
|
||||
Type::eEncodingIsUID, &decl, clang_type,
|
||||
Type::eResolveStateForward);
|
||||
|
||||
type_sp->SetIsCompleteObjCClass(is_complete_objc_class);
|
||||
|
|
@ -941,8 +945,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] =
|
||||
clang_type.GetOpaqueQualType();
|
||||
dwarf->GetForwardDeclClangTypeToDie()
|
||||
[ClangUtil::RemoveFastQualifiers(clang_type)
|
||||
.GetOpaqueQualType()] = die.GetDIERef();
|
||||
[ClangUtil::RemoveFastQualifiers(clang_type).GetOpaqueQualType()] =
|
||||
die.GetDIERef();
|
||||
m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1037,8 +1041,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
DWARFDeclContext die_decl_ctx;
|
||||
die.GetDWARFDeclContext(die_decl_ctx);
|
||||
|
||||
type_sp =
|
||||
dwarf->FindDefinitionTypeForDWARFDeclContext(die_decl_ctx);
|
||||
type_sp = dwarf->FindDefinitionTypeForDWARFDeclContext(die_decl_ctx);
|
||||
|
||||
if (!type_sp) {
|
||||
SymbolFileDWARFDebugMap *debug_map_symfile =
|
||||
|
|
@ -1046,8 +1049,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
if (debug_map_symfile) {
|
||||
// We weren't able to find a full declaration in this DWARF,
|
||||
// see if we have a declaration anywhere else...
|
||||
type_sp =
|
||||
debug_map_symfile->FindDefinitionTypeForDWARFDeclContext(
|
||||
type_sp = debug_map_symfile->FindDefinitionTypeForDWARFDeclContext(
|
||||
die_decl_ctx);
|
||||
}
|
||||
}
|
||||
|
|
@ -1055,11 +1057,11 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
if (type_sp) {
|
||||
if (log) {
|
||||
dwarf->GetObjectFile()->GetModule()->LogMessage(
|
||||
log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a "
|
||||
log,
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a "
|
||||
"forward declaration, complete type is 0x%8.8" PRIx64,
|
||||
static_cast<void *>(this), die.GetOffset(),
|
||||
DW_TAG_value_to_name(tag), type_name_cstr,
|
||||
type_sp->GetID());
|
||||
DW_TAG_value_to_name(tag), type_name_cstr, type_sp->GetID());
|
||||
}
|
||||
|
||||
// We found a real definition for this type elsewhere so lets use
|
||||
|
|
@ -1067,8 +1069,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
// die
|
||||
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
|
||||
clang::DeclContext *defn_decl_ctx =
|
||||
GetCachedClangDeclContextForDIE(
|
||||
dwarf->GetDIE(type_sp->GetID()));
|
||||
GetCachedClangDeclContextForDIE(dwarf->GetDIE(type_sp->GetID()));
|
||||
if (defn_decl_ctx)
|
||||
LinkDeclContextToDIE(defn_decl_ctx, die);
|
||||
return type_sp;
|
||||
|
|
@ -1079,12 +1080,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
|
||||
CompilerType enumerator_clang_type;
|
||||
clang_type.SetCompilerType(
|
||||
&m_ast,
|
||||
dwarf->GetForwardDeclDieToClangType().lookup(die.GetDIE()));
|
||||
&m_ast, dwarf->GetForwardDeclDieToClangType().lookup(die.GetDIE()));
|
||||
if (!clang_type) {
|
||||
if (encoding_form.IsValid()) {
|
||||
Type *enumerator_type =
|
||||
dwarf->ResolveTypeUID(DIERef(encoding_form));
|
||||
Type *enumerator_type = dwarf->ResolveTypeUID(DIERef(encoding_form));
|
||||
if (enumerator_type)
|
||||
enumerator_clang_type = enumerator_type->GetFullCompilerType();
|
||||
}
|
||||
|
|
@ -1107,8 +1106,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
m_ast.GetEnumerationIntegerType(clang_type.GetOpaqueQualType());
|
||||
}
|
||||
|
||||
LinkDeclContextToDIE(
|
||||
ClangASTContext::GetDeclContextForType(clang_type), die);
|
||||
LinkDeclContextToDIE(ClangASTContext::GetDeclContextForType(clang_type),
|
||||
die);
|
||||
|
||||
type_sp = std::make_shared<Type>(
|
||||
die.GetID(), dwarf, type_name_const_str, byte_size, nullptr,
|
||||
|
|
@ -1332,8 +1331,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
ConstString class_name(objc_method.GetClassName());
|
||||
if (class_name) {
|
||||
TypeSP complete_objc_class_type_sp(
|
||||
dwarf->FindCompleteObjCDefinitionTypeForDIE(
|
||||
DWARFDIE(), class_name, false));
|
||||
dwarf->FindCompleteObjCDefinitionTypeForDIE(DWARFDIE(),
|
||||
class_name, false));
|
||||
|
||||
if (complete_objc_class_type_sp) {
|
||||
CompilerType type_clang_forward_type =
|
||||
|
|
@ -1411,8 +1410,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
// If we have a specification, then the function type should
|
||||
// have been made with the specification and not with this
|
||||
// die.
|
||||
DWARFDIE spec_die = dwarf->DebugInfo()->GetDIE(
|
||||
DIERef(specification_die_form));
|
||||
DWARFDIE spec_die =
|
||||
dwarf->DebugInfo()->GetDIE(DIERef(specification_die_form));
|
||||
clang::DeclContext *spec_clang_decl_ctx =
|
||||
GetClangDeclContextForDIE(spec_die);
|
||||
if (spec_clang_decl_ctx) {
|
||||
|
|
@ -1432,8 +1431,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
// the abstract origin has a valid clang decl context.
|
||||
class_type->GetForwardCompilerType();
|
||||
|
||||
DWARFDIE abs_die = dwarf->DebugInfo()->GetDIE(
|
||||
DIERef(abstract_origin_die_form));
|
||||
DWARFDIE abs_die =
|
||||
dwarf->DebugInfo()->GetDIE(DIERef(abstract_origin_die_form));
|
||||
clang::DeclContext *abs_clang_decl_ctx =
|
||||
GetClangDeclContextForDIE(abs_die);
|
||||
if (abs_clang_decl_ctx) {
|
||||
|
|
@ -1493,8 +1492,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
llvm::PrettyStackTraceFormat stack_trace(
|
||||
"SymbolFileDWARF::ParseType() is adding a method "
|
||||
"%s to class %s in DIE 0x%8.8" PRIx64 " from %s",
|
||||
type_name_cstr,
|
||||
class_type->GetName().GetCString(), die.GetID(),
|
||||
type_name_cstr, class_type->GetName().GetCString(),
|
||||
die.GetID(),
|
||||
dwarf->GetObjectFile()
|
||||
->GetFileSpec()
|
||||
.GetPath()
|
||||
|
|
@ -1511,16 +1510,14 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
m_ast.AddMethodToCXXRecordType(
|
||||
class_opaque_type.GetOpaqueQualType(),
|
||||
type_name_cstr, mangled_name_cstr, clang_type,
|
||||
accessibility, is_virtual, is_static,
|
||||
is_inline, is_explicit, is_attr_used,
|
||||
is_artificial);
|
||||
accessibility, is_virtual, is_static, is_inline,
|
||||
is_explicit, is_attr_used, is_artificial);
|
||||
|
||||
type_handled = cxx_method_decl != NULL;
|
||||
|
||||
if (type_handled) {
|
||||
LinkDeclContextToDIE(
|
||||
ClangASTContext::GetAsDeclContext(
|
||||
cxx_method_decl),
|
||||
ClangASTContext::GetAsDeclContext(cxx_method_decl),
|
||||
die);
|
||||
|
||||
ClangASTMetadata metadata;
|
||||
|
|
@ -1616,8 +1613,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
type_name_cstr, clang_type, storage, is_inline);
|
||||
clang::FunctionTemplateDecl *func_template_decl =
|
||||
m_ast.CreateFunctionTemplateDecl(
|
||||
containing_decl_ctx, template_function_decl,
|
||||
type_name_cstr, template_param_infos);
|
||||
containing_decl_ctx, template_function_decl, type_name_cstr,
|
||||
template_param_infos);
|
||||
m_ast.CreateFunctionTemplateSpecializationInfo(
|
||||
function_decl, func_template_decl, template_param_infos);
|
||||
}
|
||||
|
|
@ -1653,9 +1650,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
}
|
||||
}
|
||||
}
|
||||
type_sp = std::make_shared<Type>(
|
||||
die.GetID(), dwarf, type_name_const_str, llvm::None, nullptr,
|
||||
LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, clang_type,
|
||||
type_sp = std::make_shared<Type>(die.GetID(), dwarf, type_name_const_str,
|
||||
llvm::None, nullptr, LLDB_INVALID_UID,
|
||||
Type::eEncodingIsUID, &decl, clang_type,
|
||||
Type::eResolveStateFull);
|
||||
assert(type_sp.get());
|
||||
} break;
|
||||
|
|
@ -1792,26 +1789,23 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
for (auto pos = array_info->element_orders.rbegin(); pos != end;
|
||||
++pos) {
|
||||
num_elements = *pos;
|
||||
clang_type = m_ast.CreateArrayType(array_element_type,
|
||||
num_elements, is_vector);
|
||||
clang_type = m_ast.CreateArrayType(array_element_type, num_elements,
|
||||
is_vector);
|
||||
array_element_type = clang_type;
|
||||
array_element_bit_stride =
|
||||
num_elements ? array_element_bit_stride * num_elements
|
||||
: array_element_bit_stride;
|
||||
}
|
||||
} else {
|
||||
clang_type =
|
||||
m_ast.CreateArrayType(array_element_type, 0, is_vector);
|
||||
clang_type = m_ast.CreateArrayType(array_element_type, 0, is_vector);
|
||||
}
|
||||
ConstString empty_name;
|
||||
type_sp = std::make_shared<Type>(
|
||||
die.GetID(), dwarf, empty_name, array_element_bit_stride / 8,
|
||||
nullptr, dwarf->GetUID(DIERef(type_die_form)),
|
||||
Type::eEncodingIsUID, &decl, clang_type,
|
||||
Type::eResolveStateFull);
|
||||
nullptr, dwarf->GetUID(DIERef(type_die_form)), Type::eEncodingIsUID,
|
||||
&decl, clang_type, Type::eResolveStateFull);
|
||||
type_sp->SetEncodingType(element_type);
|
||||
m_ast.SetMetadataAsUserID(clang_type.GetOpaqueQualType(),
|
||||
die.GetID());
|
||||
m_ast.SetMetadataAsUserID(clang_type.GetOpaqueQualType(), die.GetID());
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
|
@ -1842,12 +1836,11 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
Type *class_type =
|
||||
dwarf->ResolveTypeUID(DIERef(containing_type_die_form));
|
||||
|
||||
CompilerType pointee_clang_type =
|
||||
pointee_type->GetForwardCompilerType();
|
||||
CompilerType pointee_clang_type = pointee_type->GetForwardCompilerType();
|
||||
CompilerType class_clang_type = class_type->GetLayoutCompilerType();
|
||||
|
||||
clang_type = ClangASTContext::CreateMemberPointerType(
|
||||
class_clang_type, pointee_clang_type);
|
||||
clang_type = ClangASTContext::CreateMemberPointerType(class_clang_type,
|
||||
pointee_clang_type);
|
||||
|
||||
if (llvm::Optional<uint64_t> clang_type_size =
|
||||
clang_type.GetByteSize(nullptr)) {
|
||||
|
|
@ -1870,8 +1863,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
}
|
||||
|
||||
if (type_sp.get()) {
|
||||
DWARFDIE sc_parent_die =
|
||||
SymbolFileDWARF::GetParentSymbolContextDIE(die);
|
||||
DWARFDIE sc_parent_die = SymbolFileDWARF::GetParentSymbolContextDIE(die);
|
||||
dw_tag_t sc_parent_tag = sc_parent_die.Tag();
|
||||
|
||||
SymbolContextScope *symbol_context_scope = NULL;
|
||||
|
|
@ -1895,10 +1887,6 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
|
|||
|
||||
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
|
||||
}
|
||||
} else if (type_ptr != DIE_IS_BEING_PARSED) {
|
||||
type_sp = type_ptr->shared_from_this();
|
||||
}
|
||||
}
|
||||
return type_sp;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue