Rename clang-module-related *DWO* functions to *ClangModule* (NFC)

This avoids confusing them with fission-related functionality.

I also moved two accessor functions from DWARFDIE into static
functions in DWARFASTParserClang were their only use is located.
This commit is contained in:
Adrian Prantl 2019-11-13 14:05:10 -08:00
parent 3f0969daf9
commit 3d30c142e1
5 changed files with 41 additions and 46 deletions

View File

@ -135,9 +135,42 @@ static bool IsClangModuleFwdDecl(const DWARFDIE &Die) {
return false;
}
static DWARFDIE GetContainingClangModuleDIE(const DWARFDIE &die) {
if (die.IsValid()) {
DWARFDIE top_module_die;
// Now make sure this DIE is scoped in a DW_TAG_module tag and return true
// if so
for (DWARFDIE parent = die.GetParent(); parent.IsValid();
parent = parent.GetParent()) {
const dw_tag_t tag = parent.Tag();
if (tag == DW_TAG_module)
top_module_die = parent;
else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
break;
}
return top_module_die;
}
return DWARFDIE();
}
static lldb::ModuleSP GetContainingClangModule(const DWARFDIE &die) {
if (die.IsValid()) {
DWARFDIE clang_module_die = GetContainingClangModuleDIE(die);
if (clang_module_die) {
const char *module_name = clang_module_die.GetName();
if (module_name)
return die.GetDWARF()->GetExternalModule(
lldb_private::ConstString(module_name));
}
}
return lldb::ModuleSP();
}
TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const DWARFDIE &die,
Log *log) {
ModuleSP dwo_module_sp = die.GetContainingDWOModule();
ModuleSP dwo_module_sp = GetContainingClangModule(die);
if (!dwo_module_sp)
return TypeSP();
@ -873,7 +906,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
if (class_type) {
bool alternate_defn = false;
if (class_type->GetID() != decl_ctx_die.GetID() ||
decl_ctx_die.GetContainingDWOModuleDIE()) {
GetContainingClangModuleDIE(decl_ctx_die)) {
alternate_defn = true;
// We uniqued the parent class of this function to another
@ -887,11 +920,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
CopyUniqueClassMethodTypes(decl_ctx_die, class_type_die,
class_type, failures);
// FIXME do something with these failures that's smarter
// than
// just dropping them on the ground. Unfortunately classes
// don't like having stuff added to them after their
// definitions are complete...
// FIXME do something with these failures that's
// smarter than just dropping them on the ground.
// Unfortunately classes don't like having stuff added
// to them after their definitions are complete...
type_ptr = dwarf->GetDIEToType()[die.GetDIE()];
if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) {

View File

@ -406,39 +406,6 @@ bool DWARFDIE::IsMethod() const {
return false;
}
DWARFDIE
DWARFDIE::GetContainingDWOModuleDIE() const {
if (IsValid()) {
DWARFDIE top_module_die;
// Now make sure this DIE is scoped in a DW_TAG_module tag and return true
// if so
for (DWARFDIE parent = GetParent(); parent.IsValid();
parent = parent.GetParent()) {
const dw_tag_t tag = parent.Tag();
if (tag == DW_TAG_module)
top_module_die = parent;
else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
break;
}
return top_module_die;
}
return DWARFDIE();
}
lldb::ModuleSP DWARFDIE::GetContainingDWOModule() const {
if (IsValid()) {
DWARFDIE dwo_module_die = GetContainingDWOModuleDIE();
if (dwo_module_die) {
const char *module_name = dwo_module_die.GetName();
if (module_name)
return GetDWARF()->GetDWOModule(lldb_private::ConstString(module_name));
}
}
return lldb::ModuleSP();
}
bool DWARFDIE::GetDIENamesAndRanges(
const char *&name, const char *&mangled, DWARFRangeList &ranges,
int &decl_file, int &decl_line, int &decl_column, int &call_file,

View File

@ -22,10 +22,6 @@ public:
bool IsMethod() const;
// Accessors
lldb::ModuleSP GetContainingDWOModule() const;
DWARFDIE
GetContainingDWOModuleDIE() const;
// Accessing information about a DIE
const char *GetMangledName() const;

View File

@ -1511,7 +1511,7 @@ bool SymbolFileDWARF::GetFunction(const DWARFDIE &die, SymbolContext &sc) {
return false;
}
lldb::ModuleSP SymbolFileDWARF::GetDWOModule(ConstString name) {
lldb::ModuleSP SymbolFileDWARF::GetExternalModule(ConstString name) {
UpdateExternalModuleListIfNeeded();
const auto &pos = m_external_type_modules.find(name);
if (pos != m_external_type_modules.end())

View File

@ -254,7 +254,7 @@ public:
virtual lldb_private::DWARFExpression::LocationListFormat
GetLocationListFormat() const;
lldb::ModuleSP GetDWOModule(lldb_private::ConstString name);
lldb::ModuleSP GetExternalModule(lldb_private::ConstString name);
typedef std::map<lldb_private::ConstString, lldb::ModuleSP>
ExternalTypeModuleMap;