Skip to content

Commit 3d30c14

Browse files
committed
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.
1 parent 3f0969d commit 3d30c14

File tree

5 files changed

+41
-46
lines changed

5 files changed

+41
-46
lines changed

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,42 @@ static bool IsClangModuleFwdDecl(const DWARFDIE &Die) {
135135
return false;
136136
}
137137

138+
static DWARFDIE GetContainingClangModuleDIE(const DWARFDIE &die) {
139+
if (die.IsValid()) {
140+
DWARFDIE top_module_die;
141+
// Now make sure this DIE is scoped in a DW_TAG_module tag and return true
142+
// if so
143+
for (DWARFDIE parent = die.GetParent(); parent.IsValid();
144+
parent = parent.GetParent()) {
145+
const dw_tag_t tag = parent.Tag();
146+
if (tag == DW_TAG_module)
147+
top_module_die = parent;
148+
else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
149+
break;
150+
}
151+
152+
return top_module_die;
153+
}
154+
return DWARFDIE();
155+
}
156+
157+
static lldb::ModuleSP GetContainingClangModule(const DWARFDIE &die) {
158+
if (die.IsValid()) {
159+
DWARFDIE clang_module_die = GetContainingClangModuleDIE(die);
160+
161+
if (clang_module_die) {
162+
const char *module_name = clang_module_die.GetName();
163+
if (module_name)
164+
return die.GetDWARF()->GetExternalModule(
165+
lldb_private::ConstString(module_name));
166+
}
167+
}
168+
return lldb::ModuleSP();
169+
}
170+
138171
TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const DWARFDIE &die,
139172
Log *log) {
140-
ModuleSP dwo_module_sp = die.GetContainingDWOModule();
173+
ModuleSP dwo_module_sp = GetContainingClangModule(die);
141174
if (!dwo_module_sp)
142175
return TypeSP();
143176

@@ -873,7 +906,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
873906
if (class_type) {
874907
bool alternate_defn = false;
875908
if (class_type->GetID() != decl_ctx_die.GetID() ||
876-
decl_ctx_die.GetContainingDWOModuleDIE()) {
909+
GetContainingClangModuleDIE(decl_ctx_die)) {
877910
alternate_defn = true;
878911

879912
// We uniqued the parent class of this function to another
@@ -887,11 +920,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
887920
CopyUniqueClassMethodTypes(decl_ctx_die, class_type_die,
888921
class_type, failures);
889922

890-
// FIXME do something with these failures that's smarter
891-
// than
892-
// just dropping them on the ground. Unfortunately classes
893-
// don't like having stuff added to them after their
894-
// definitions are complete...
923+
// FIXME do something with these failures that's
924+
// smarter than just dropping them on the ground.
925+
// Unfortunately classes don't like having stuff added
926+
// to them after their definitions are complete...
895927

896928
type_ptr = dwarf->GetDIEToType()[die.GetDIE()];
897929
if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) {

lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -406,39 +406,6 @@ bool DWARFDIE::IsMethod() const {
406406
return false;
407407
}
408408

409-
DWARFDIE
410-
DWARFDIE::GetContainingDWOModuleDIE() const {
411-
if (IsValid()) {
412-
DWARFDIE top_module_die;
413-
// Now make sure this DIE is scoped in a DW_TAG_module tag and return true
414-
// if so
415-
for (DWARFDIE parent = GetParent(); parent.IsValid();
416-
parent = parent.GetParent()) {
417-
const dw_tag_t tag = parent.Tag();
418-
if (tag == DW_TAG_module)
419-
top_module_die = parent;
420-
else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
421-
break;
422-
}
423-
424-
return top_module_die;
425-
}
426-
return DWARFDIE();
427-
}
428-
429-
lldb::ModuleSP DWARFDIE::GetContainingDWOModule() const {
430-
if (IsValid()) {
431-
DWARFDIE dwo_module_die = GetContainingDWOModuleDIE();
432-
433-
if (dwo_module_die) {
434-
const char *module_name = dwo_module_die.GetName();
435-
if (module_name)
436-
return GetDWARF()->GetDWOModule(lldb_private::ConstString(module_name));
437-
}
438-
}
439-
return lldb::ModuleSP();
440-
}
441-
442409
bool DWARFDIE::GetDIENamesAndRanges(
443410
const char *&name, const char *&mangled, DWARFRangeList &ranges,
444411
int &decl_file, int &decl_line, int &decl_column, int &call_file,

lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ class DWARFDIE : public DWARFBaseDIE {
2222
bool IsMethod() const;
2323

2424
// Accessors
25-
lldb::ModuleSP GetContainingDWOModule() const;
26-
27-
DWARFDIE
28-
GetContainingDWOModuleDIE() const;
2925

3026
// Accessing information about a DIE
3127
const char *GetMangledName() const;

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ bool SymbolFileDWARF::GetFunction(const DWARFDIE &die, SymbolContext &sc) {
15111511
return false;
15121512
}
15131513

1514-
lldb::ModuleSP SymbolFileDWARF::GetDWOModule(ConstString name) {
1514+
lldb::ModuleSP SymbolFileDWARF::GetExternalModule(ConstString name) {
15151515
UpdateExternalModuleListIfNeeded();
15161516
const auto &pos = m_external_type_modules.find(name);
15171517
if (pos != m_external_type_modules.end())

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
254254
virtual lldb_private::DWARFExpression::LocationListFormat
255255
GetLocationListFormat() const;
256256

257-
lldb::ModuleSP GetDWOModule(lldb_private::ConstString name);
257+
lldb::ModuleSP GetExternalModule(lldb_private::ConstString name);
258258

259259
typedef std::map<lldb_private::ConstString, lldb::ModuleSP>
260260
ExternalTypeModuleMap;

0 commit comments

Comments
 (0)