Removed the function:

ModuleSP
	Module::GetSP();

Since we are now using intrusive ref counts, we can easily turn any
pointer to a module into a shared pointer just by assigning it.
	

llvm-svn: 139984
This commit is contained in:
Greg Clayton 2011-09-17 07:23:18 +00:00
parent 747bcb03d2
commit a2eee184e0
10 changed files with 25 additions and 40 deletions

View File

@ -102,13 +102,6 @@ public:
virtual
~Module ();
//------------------------------------------------------------------
/// If you have an instance of Module, get its corresponding shared
/// pointer if it has one in the shared module list.
//------------------------------------------------------------------
lldb::ModuleSP
GetSP () const;
//------------------------------------------------------------------
/// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
///

View File

@ -221,9 +221,9 @@ SBAddress::GetModule ()
SBModule sb_module;
if (m_opaque_ap.get())
{
const Module *module = m_opaque_ap->GetModule();
Module *module = m_opaque_ap->GetModule();
if (module)
*sb_module = module->GetSP();
*sb_module = module;
}
return sb_module;
}

View File

@ -2725,7 +2725,7 @@ public:
if (use_global_module_list)
{
module = Module::GetAllocatedModuleAtIndex(image_idx);
module_sp = module->GetSP();
module_sp = module;
}
else
{

View File

@ -737,7 +737,7 @@ Address::CalculateSymbolContext (SymbolContext *sc, uint32_t resolve_scope)
Module *address_module = m_section->GetModule();
if (address_module)
{
sc->module_sp = address_module->GetSP();
sc->module_sp = address_module;
if (sc->module_sp)
return sc->module_sp->ResolveSymbolContextForAddress (*this, resolve_scope, *sc);
}
@ -759,7 +759,7 @@ Address::CalculateSymbolContextCompileUnit ()
if (m_section)
{
SymbolContext sc;
sc.module_sp = m_section->GetModule()->GetSP();
sc.module_sp = m_section->GetModule();
if (sc.module_sp)
{
sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextCompUnit, sc);
@ -775,7 +775,7 @@ Address::CalculateSymbolContextFunction ()
if (m_section)
{
SymbolContext sc;
sc.module_sp = m_section->GetModule()->GetSP();
sc.module_sp = m_section->GetModule();
if (sc.module_sp)
{
sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextFunction, sc);
@ -791,7 +791,7 @@ Address::CalculateSymbolContextBlock ()
if (m_section)
{
SymbolContext sc;
sc.module_sp = m_section->GetModule()->GetSP();
sc.module_sp = m_section->GetModule();
if (sc.module_sp)
{
sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextBlock, sc);
@ -807,7 +807,7 @@ Address::CalculateSymbolContextSymbol ()
if (m_section)
{
SymbolContext sc;
sc.module_sp = m_section->GetModule()->GetSP();
sc.module_sp = m_section->GetModule();
if (sc.module_sp)
{
sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextSymbol, sc);
@ -823,7 +823,7 @@ Address::CalculateSymbolContextLineEntry (LineEntry &line_entry)
if (m_section)
{
SymbolContext sc;
sc.module_sp = m_section->GetModule()->GetSP();
sc.module_sp = m_section->GetModule();
if (sc.module_sp)
{
sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextLineEntry, sc);

View File

@ -128,13 +128,6 @@ Module::~Module()
}
ModuleSP
Module::GetSP () const
{
ModuleSP module_sp(const_cast<Module*>(this));
return module_sp;
}
const lldb_private::UUID&
Module::GetUUID()
{
@ -177,8 +170,8 @@ Module::ParseAllDebugSymbols()
if (num_comp_units == 0)
return;
TargetSP null_target;
SymbolContext sc(null_target, GetSP());
SymbolContext sc;
sc.module_sp = this;
uint32_t cu_idx;
SymbolVendor *symbols = GetSymbolVendor ();
@ -212,7 +205,7 @@ Module::ParseAllDebugSymbols()
void
Module::CalculateSymbolContext(SymbolContext* sc)
{
sc->module_sp = GetSP();
sc->module_sp = this;
}
Module *
@ -282,7 +275,7 @@ Module::ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve
{
// If the section offset based address resolved itself, then this
// is the right module.
sc.module_sp = GetSP();
sc.module_sp = this;
resolved_flags |= eSymbolContextModule;
// Resolve the compile unit, function, block, line table or line
@ -384,7 +377,7 @@ Module::FindCompileUnits (const FileSpec &path,
const uint32_t start_size = sc_list.GetSize();
const uint32_t num_compile_units = GetNumCompileUnits();
SymbolContext sc;
sc.module_sp = GetSP();
sc.module_sp = this;
const bool compare_directory = path.GetDirectory();
for (uint32_t i=0; i<num_compile_units; ++i)
{

View File

@ -401,7 +401,7 @@ SearchFilterByModule::Search (Searcher &searcher)
Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i);
if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0)
{
SymbolContext matchingContext(m_target_sp, module->GetSP());
SymbolContext matchingContext(m_target_sp, ModuleSP(module));
Searcher::CallbackReturn shouldContinue;
shouldContinue = DoModuleIteration(matchingContext, searcher);

View File

@ -1664,7 +1664,7 @@ SymbolFileDWARF::GetFunction (DWARFCompileUnit* curr_cu, const DWARFDebugInfoEnt
{
sc.Clear();
// Check if the symbol vendor already knows about this compile unit?
sc.module_sp = m_obj_file->GetModule()->GetSP();
sc.module_sp = m_obj_file->GetModule();
sc.comp_unit = GetCompUnitForDWARFCompUnit(curr_cu, UINT32_MAX);
sc.function = sc.comp_unit->FindFunctionByUID (func_die->GetOffset()).get();
@ -1969,7 +1969,7 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, bool append, uint
Index ();
SymbolContext sc;
sc.module_sp = m_obj_file->GetModule()->GetSP();
sc.module_sp = m_obj_file->GetModule();
assert (sc.module_sp);
DWARFCompileUnit* dwarf_cu = NULL;
@ -2018,7 +2018,7 @@ SymbolFileDWARF::FindGlobalVariables(const RegularExpression& regex, bool append
Index ();
SymbolContext sc;
sc.module_sp = m_obj_file->GetModule()->GetSP();
sc.module_sp = m_obj_file->GetModule();
assert (sc.module_sp);
DWARFCompileUnit* dwarf_cu = NULL;
@ -2057,7 +2057,7 @@ SymbolFileDWARF::ResolveFunctions (const DIEArray &die_offsets,
const uint32_t sc_list_initial_size = sc_list.GetSize();
SymbolContext sc;
sc.module_sp = m_obj_file->GetModule()->GetSP();
sc.module_sp = m_obj_file->GetModule();
assert (sc.module_sp);
DWARFCompileUnit* dwarf_cu = NULL;
@ -2130,7 +2130,7 @@ SymbolFileDWARF::FindFunctions
return;
SymbolContext sc;
sc.module_sp = m_obj_file->GetModule()->GetSP();
sc.module_sp = m_obj_file->GetModule();
assert (sc.module_sp);
DWARFCompileUnit* dwarf_cu = NULL;
@ -2208,7 +2208,7 @@ SymbolFileDWARF::FindFunctions
return;
SymbolContext sc;
sc.module_sp = m_obj_file->GetModule()->GetSP();
sc.module_sp = m_obj_file->GetModule();
assert (sc.module_sp);
DWARFCompileUnit* dwarf_cu = NULL;

View File

@ -168,8 +168,7 @@ SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_inf
FileSpec oso_file_spec(oso_symbol->GetMangled().GetName().AsCString(), true);
// Don't allow cached .o files since we dress up each .o file with
// new sections. We want them to be in the module list so we can
// always find a shared pointer to the module (in Module::GetSP()),
// but just don't share them.
// always find a shared pointer to the module but just don't share them.
const bool always_create = true;
ModuleList::GetSharedModule (oso_file_spec,
m_obj_file->GetModule()->GetArchitecture(),

View File

@ -359,7 +359,7 @@ Symbol::CalculateSymbolContext (SymbolContext *sc)
Module *module = range->GetBaseAddress().GetModule ();
if (module)
{
sc->module_sp = module->GetSP();
sc->module_sp = module;
return;
}
}

View File

@ -147,7 +147,7 @@ StackFrame::StackFrame
{
if (pc_module)
{
m_sc.module_sp = pc_module->GetSP();
m_sc.module_sp = pc_module;
m_flags.Set (eSymbolContextModule);
}
else
@ -227,7 +227,7 @@ StackFrame::GetFrameCodeAddress()
Module *module = section->GetModule();
if (module)
{
m_sc.module_sp = module->GetSP();
m_sc.module_sp = module;
if (m_sc.module_sp)
m_flags.Set(eSymbolContextModule);
}