Skip to content

Commit 2172c66

Browse files
committed
Fix tests failure on MacOS by query SymbolFileDWARFDebugMap first to get the shared underlying SymbolFile when calling GetForwardDeclCompilerTypeToDIE
1 parent d6de8d9 commit 2172c66

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,13 @@ static ConstString GetDWARFMachOSegmentName() {
481481
return g_dwarf_section_name;
482482
}
483483

484+
llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> &
485+
SymbolFileDWARF::GetForwardDeclCompilerTypeToDIE() {
486+
if (SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile())
487+
return debug_map_symfile->GetForwardDeclCompilerTypeToDIE();
488+
return m_forward_decl_compiler_type_to_die;
489+
}
490+
484491
UniqueDWARFASTTypeMap &SymbolFileDWARF::GetUniqueDWARFASTTypeMap() {
485492
SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
486493
if (debug_map_symfile)

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,8 @@ class SymbolFileDWARF : public SymbolFileCommon {
335335

336336
virtual DIEToTypePtr &GetDIEToType() { return m_die_to_type; }
337337

338-
typedef llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef>
339-
CompilerTypeToDIE;
340-
341-
virtual CompilerTypeToDIE &GetForwardDeclCompilerTypeToDIE() {
342-
return m_forward_decl_compiler_type_to_die;
343-
}
338+
virtual llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> &
339+
GetForwardDeclCompilerTypeToDIE();
344340

345341
typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::VariableSP>
346342
DIEToVariableSP;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ class SymbolFileDWARFDebugMap : public SymbolFileCommon {
284284
lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(
285285
const DWARFDIE &die, ConstString type_name, bool must_be_implementation);
286286

287+
llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> &
288+
GetForwardDeclCompilerTypeToDIE() {
289+
return m_forward_decl_compiler_type_to_die;
290+
}
291+
287292
UniqueDWARFASTTypeMap &GetUniqueDWARFASTTypeMap() {
288293
return m_unique_ast_type_map;
289294
}
@@ -321,6 +326,10 @@ class SymbolFileDWARFDebugMap : public SymbolFileCommon {
321326
std::vector<uint32_t> m_func_indexes; // Sorted by address
322327
std::vector<uint32_t> m_glob_indexes;
323328
std::map<std::pair<ConstString, llvm::sys::TimePoint<>>, OSOInfoSP> m_oso_map;
329+
// A map from CompilerType to the struct/class/union/enum DIE (might be a
330+
// declaration or a definition) that is used to construct it.
331+
llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef>
332+
m_forward_decl_compiler_type_to_die;
324333
UniqueDWARFASTTypeMap m_unique_ast_type_map;
325334
LazyBool m_supports_DW_AT_APPLE_objc_complete_type;
326335
DebugMap m_debug_map;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ SymbolFileDWARF::DIEToVariableSP &SymbolFileDWARFDwo::GetDIEToVariable() {
110110
return GetBaseSymbolFile().GetDIEToVariable();
111111
}
112112

113-
SymbolFileDWARF::CompilerTypeToDIE &
113+
llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> &
114114
SymbolFileDWARFDwo::GetForwardDeclCompilerTypeToDIE() {
115115
return GetBaseSymbolFile().GetForwardDeclCompilerTypeToDIE();
116116
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class SymbolFileDWARFDwo : public SymbolFileDWARF {
7272

7373
DIEToVariableSP &GetDIEToVariable() override;
7474

75-
CompilerTypeToDIE &GetForwardDeclCompilerTypeToDIE() override;
75+
llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> &
76+
GetForwardDeclCompilerTypeToDIE() override;
7677

7778
UniqueDWARFASTTypeMap &GetUniqueDWARFASTTypeMap() override;
7879

0 commit comments

Comments
 (0)