forked from OSchip/llvm-project
[lldb] Revert refactorization from: Move non-DWARF code: DWARFUnit -> SymbolFileDWARF
Reverting part of commit 789beeeca3
.
Its DWARFDebugInfoEntry::GetDWARFDeclContext() refactorization for
return value is now adding it in opposite order.
This commit is contained in:
parent
6fb544d1d2
commit
6dd0163502
|
@ -726,7 +726,8 @@ TypeSP DWARFASTParserClang::ParseEnum(const SymbolContext &sc,
|
||||||
if (type_sp)
|
if (type_sp)
|
||||||
return type_sp;
|
return type_sp;
|
||||||
|
|
||||||
DWARFDeclContext die_decl_ctx = SymbolFileDWARF::GetDWARFDeclContext(die);
|
DWARFDeclContext die_decl_ctx;
|
||||||
|
SymbolFileDWARF::GetDWARFDeclContext(die, die_decl_ctx);
|
||||||
|
|
||||||
type_sp = dwarf->FindDefinitionTypeForDWARFDeclContext(die_decl_ctx);
|
type_sp = dwarf->FindDefinitionTypeForDWARFDeclContext(die_decl_ctx);
|
||||||
|
|
||||||
|
@ -1514,7 +1515,8 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc,
|
||||||
if (type_sp)
|
if (type_sp)
|
||||||
return type_sp;
|
return type_sp;
|
||||||
|
|
||||||
DWARFDeclContext die_decl_ctx = SymbolFileDWARF::GetDWARFDeclContext(die);
|
DWARFDeclContext die_decl_ctx;
|
||||||
|
SymbolFileDWARF::GetDWARFDeclContext(die, die_decl_ctx);
|
||||||
|
|
||||||
// type_sp = FindDefinitionTypeForDIE (dwarf_cu, die,
|
// type_sp = FindDefinitionTypeForDIE (dwarf_cu, die,
|
||||||
// type_name_const_str);
|
// type_name_const_str);
|
||||||
|
@ -2323,9 +2325,10 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(CompileUnit &comp_unit,
|
||||||
unsigned type_quals = 0;
|
unsigned type_quals = 0;
|
||||||
std::vector<CompilerType> param_types;
|
std::vector<CompilerType> param_types;
|
||||||
std::vector<clang::ParmVarDecl *> param_decls;
|
std::vector<clang::ParmVarDecl *> param_decls;
|
||||||
|
DWARFDeclContext decl_ctx;
|
||||||
StreamString sstr;
|
StreamString sstr;
|
||||||
|
|
||||||
DWARFDeclContext decl_ctx = SymbolFileDWARF::GetDWARFDeclContext(die);
|
SymbolFileDWARF::GetDWARFDeclContext(die, decl_ctx);
|
||||||
sstr << decl_ctx.GetQualifiedName();
|
sstr << decl_ctx.GetQualifiedName();
|
||||||
|
|
||||||
clang::DeclContext *containing_decl_ctx =
|
clang::DeclContext *containing_decl_ctx =
|
||||||
|
|
|
@ -868,20 +868,19 @@ void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DWARFDeclContext DWARFDebugInfoEntry::GetDWARFDeclContext(DWARFUnit *cu) const {
|
void DWARFDebugInfoEntry::GetDWARFDeclContext(
|
||||||
DWARFDeclContext dwarf_decl_ctx;
|
DWARFUnit *cu, DWARFDeclContext &dwarf_decl_ctx) const {
|
||||||
const dw_tag_t tag = Tag();
|
const dw_tag_t tag = Tag();
|
||||||
if (tag != DW_TAG_compile_unit && tag != DW_TAG_partial_unit) {
|
if (tag != DW_TAG_compile_unit && tag != DW_TAG_partial_unit) {
|
||||||
|
dwarf_decl_ctx.AppendDeclContext(tag, GetName(cu));
|
||||||
DWARFDIE parent_decl_ctx_die = GetParentDeclContextDIE(cu);
|
DWARFDIE parent_decl_ctx_die = GetParentDeclContextDIE(cu);
|
||||||
if (parent_decl_ctx_die && parent_decl_ctx_die.GetDIE() != this) {
|
if (parent_decl_ctx_die && parent_decl_ctx_die.GetDIE() != this) {
|
||||||
if (parent_decl_ctx_die.Tag() != DW_TAG_compile_unit &&
|
if (parent_decl_ctx_die.Tag() != DW_TAG_compile_unit &&
|
||||||
parent_decl_ctx_die.Tag() != DW_TAG_partial_unit)
|
parent_decl_ctx_die.Tag() != DW_TAG_partial_unit)
|
||||||
dwarf_decl_ctx = parent_decl_ctx_die.GetDIE()->GetDWARFDeclContext(
|
parent_decl_ctx_die.GetDIE()->GetDWARFDeclContext(
|
||||||
parent_decl_ctx_die.GetCU());
|
parent_decl_ctx_die.GetCU(), dwarf_decl_ctx);
|
||||||
}
|
}
|
||||||
dwarf_decl_ctx.AppendDeclContext(tag, GetName(cu));
|
|
||||||
}
|
}
|
||||||
return dwarf_decl_ctx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DWARFDIE
|
DWARFDIE
|
||||||
|
|
|
@ -158,7 +158,8 @@ public:
|
||||||
return HasChildren() ? this + 1 : nullptr;
|
return HasChildren() ? this + 1 : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWARFDeclContext GetDWARFDeclContext(DWARFUnit *cu) const;
|
void GetDWARFDeclContext(DWARFUnit *cu,
|
||||||
|
DWARFDeclContext &dwarf_decl_ctx) const;
|
||||||
|
|
||||||
DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu) const;
|
DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu) const;
|
||||||
DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu,
|
DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu,
|
||||||
|
|
|
@ -2956,8 +2956,8 @@ TypeSP SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (try_resolving_type) {
|
if (try_resolving_type) {
|
||||||
DWARFDeclContext type_dwarf_decl_ctx =
|
DWARFDeclContext type_dwarf_decl_ctx;
|
||||||
GetDWARFDeclContext(type_die);
|
GetDWARFDeclContext(type_die, type_dwarf_decl_ctx);
|
||||||
|
|
||||||
if (log) {
|
if (log) {
|
||||||
GetObjectFile()->GetModule()->LogMessage(
|
GetObjectFile()->GetModule()->LogMessage(
|
||||||
|
@ -3374,10 +3374,12 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const SymbolContext &sc,
|
||||||
// declaration context.
|
// declaration context.
|
||||||
if ((parent_tag == DW_TAG_compile_unit ||
|
if ((parent_tag == DW_TAG_compile_unit ||
|
||||||
parent_tag == DW_TAG_partial_unit) &&
|
parent_tag == DW_TAG_partial_unit) &&
|
||||||
Language::LanguageIsCPlusPlus(GetLanguage(*die.GetCU())))
|
Language::LanguageIsCPlusPlus(GetLanguage(*die.GetCU()))) {
|
||||||
mangled = GetDWARFDeclContext(die)
|
DWARFDeclContext decl_ctx;
|
||||||
.GetQualifiedNameAsConstString()
|
|
||||||
.GetCString();
|
GetDWARFDeclContext(die, decl_ctx);
|
||||||
|
mangled = decl_ctx.GetQualifiedNameAsConstString().GetCString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == DW_TAG_formal_parameter)
|
if (tag == DW_TAG_formal_parameter)
|
||||||
|
@ -3979,13 +3981,14 @@ SymbolFileDWARF::GetContainingDeclContext(const DWARFDIE &die) {
|
||||||
return CompilerDeclContext();
|
return CompilerDeclContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
DWARFDeclContext SymbolFileDWARF::GetDWARFDeclContext(const DWARFDIE &die) {
|
void SymbolFileDWARF::GetDWARFDeclContext(const DWARFDIE &die,
|
||||||
if (!die.IsValid())
|
DWARFDeclContext &dwarf_decl_ctx) {
|
||||||
return {};
|
if (!die.IsValid()) {
|
||||||
DWARFDeclContext dwarf_decl_ctx =
|
dwarf_decl_ctx.Clear();
|
||||||
die.GetDIE()->GetDWARFDeclContext(die.GetCU());
|
return;
|
||||||
|
}
|
||||||
dwarf_decl_ctx.SetLanguage(GetLanguage(*die.GetCU()));
|
dwarf_decl_ctx.SetLanguage(GetLanguage(*die.GetCU()));
|
||||||
return dwarf_decl_ctx;
|
die.GetDIE()->GetDWARFDeclContext(die.GetCU(), dwarf_decl_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
LanguageType SymbolFileDWARF::LanguageTypeFromDWARF(uint64_t val) {
|
LanguageType SymbolFileDWARF::LanguageTypeFromDWARF(uint64_t val) {
|
||||||
|
|
|
@ -315,7 +315,8 @@ public:
|
||||||
static lldb_private::CompilerDeclContext
|
static lldb_private::CompilerDeclContext
|
||||||
GetContainingDeclContext(const DWARFDIE &die);
|
GetContainingDeclContext(const DWARFDIE &die);
|
||||||
|
|
||||||
static DWARFDeclContext GetDWARFDeclContext(const DWARFDIE &die);
|
static void GetDWARFDeclContext(const DWARFDIE &die,
|
||||||
|
DWARFDeclContext &dwarf_decl_ctx);
|
||||||
|
|
||||||
static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val);
|
static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue