forked from OSchip/llvm-project
Remove dead code from SymbolFileDWARF:
lldb::TypeSP SymbolFileDWARF::FindDefinitionTypeForDIE ( DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, const lldb_private::ConstString &type_name); This function isn't used as it has been replaced by: lldb::TypeSP SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext ( const DWARFDeclContext &die_decl_ctx); I am about to change the way we resolve C/C++ class/struct/union types and want to clean up SymbolFileDWARF before I start. llvm-svn: 223376
This commit is contained in:
parent
c5d32d751e
commit
2e644415ba
|
@ -5060,189 +5060,6 @@ SymbolFileDWARF::DIEDeclContextsMatch (DWARFCompileUnit* cu1, const DWARFDebugIn
|
|||
return true;
|
||||
}
|
||||
|
||||
// This function can be used when a DIE is found that is a forward declaration
|
||||
// DIE and we want to try and find a type that has the complete definition.
|
||||
// "cu" and "die" must be from this SymbolFileDWARF
|
||||
TypeSP
|
||||
SymbolFileDWARF::FindDefinitionTypeForDIE (DWARFCompileUnit* cu,
|
||||
const DWARFDebugInfoEntry *die,
|
||||
const ConstString &type_name)
|
||||
{
|
||||
TypeSP type_sp;
|
||||
|
||||
#if defined (LLDB_CONFIGURATION_DEBUG)
|
||||
// You can't and shouldn't call this function with a compile unit from
|
||||
// another SymbolFileDWARF instance.
|
||||
assert (DebugInfo()->ContainsCompileUnit (cu));
|
||||
#endif
|
||||
|
||||
if (cu == NULL || die == NULL || !type_name)
|
||||
return type_sp;
|
||||
|
||||
std::string qualified_name;
|
||||
|
||||
Log *log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION|DWARF_LOG_LOOKUPS));
|
||||
if (log)
|
||||
{
|
||||
die->GetQualifiedName(this, cu, qualified_name);
|
||||
GetObjectFile()->GetModule()->LogMessage (log,
|
||||
"SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x (%s), name='%s')",
|
||||
die->GetOffset(),
|
||||
qualified_name.c_str(),
|
||||
type_name.GetCString());
|
||||
}
|
||||
|
||||
DIEArray die_offsets;
|
||||
|
||||
if (m_using_apple_tables)
|
||||
{
|
||||
if (m_apple_types_ap.get())
|
||||
{
|
||||
const bool has_tag = m_apple_types_ap->GetHeader().header_data.ContainsAtom (DWARFMappedHash::eAtomTypeTag);
|
||||
const bool has_qualified_name_hash = m_apple_types_ap->GetHeader().header_data.ContainsAtom (DWARFMappedHash::eAtomTypeQualNameHash);
|
||||
if (has_tag && has_qualified_name_hash)
|
||||
{
|
||||
if (qualified_name.empty())
|
||||
die->GetQualifiedName(this, cu, qualified_name);
|
||||
|
||||
const uint32_t qualified_name_hash = MappedHash::HashStringUsingDJB (qualified_name.c_str());
|
||||
if (log)
|
||||
GetObjectFile()->GetModule()->LogMessage (log,"FindByNameAndTagAndQualifiedNameHash()");
|
||||
m_apple_types_ap->FindByNameAndTagAndQualifiedNameHash (type_name.GetCString(), die->Tag(), qualified_name_hash, die_offsets);
|
||||
}
|
||||
else if (has_tag)
|
||||
{
|
||||
if (log)
|
||||
GetObjectFile()->GetModule()->LogMessage (log,"FindByNameAndTag()");
|
||||
m_apple_types_ap->FindByNameAndTag (type_name.GetCString(), die->Tag(), die_offsets);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_apple_types_ap->FindByName (type_name.GetCString(), die_offsets);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_indexed)
|
||||
Index ();
|
||||
|
||||
m_type_index.Find (type_name, die_offsets);
|
||||
}
|
||||
|
||||
const size_t num_matches = die_offsets.size();
|
||||
|
||||
const dw_tag_t die_tag = die->Tag();
|
||||
|
||||
DWARFCompileUnit* type_cu = NULL;
|
||||
const DWARFDebugInfoEntry* type_die = NULL;
|
||||
if (num_matches)
|
||||
{
|
||||
DWARFDebugInfo* debug_info = DebugInfo();
|
||||
for (size_t i=0; i<num_matches; ++i)
|
||||
{
|
||||
const dw_offset_t die_offset = die_offsets[i];
|
||||
type_die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &type_cu);
|
||||
|
||||
if (type_die)
|
||||
{
|
||||
bool try_resolving_type = false;
|
||||
|
||||
// Don't try and resolve the DIE we are looking for with the DIE itself!
|
||||
if (type_die != die)
|
||||
{
|
||||
const dw_tag_t type_die_tag = type_die->Tag();
|
||||
// Make sure the tags match
|
||||
if (type_die_tag == die_tag)
|
||||
{
|
||||
// The tags match, lets try resolving this type
|
||||
try_resolving_type = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The tags don't match, but we need to watch our for a
|
||||
// forward declaration for a struct and ("struct foo")
|
||||
// ends up being a class ("class foo { ... };") or
|
||||
// vice versa.
|
||||
switch (type_die_tag)
|
||||
{
|
||||
case DW_TAG_class_type:
|
||||
// We had a "class foo", see if we ended up with a "struct foo { ... };"
|
||||
try_resolving_type = (die_tag == DW_TAG_structure_type);
|
||||
break;
|
||||
case DW_TAG_structure_type:
|
||||
// We had a "struct foo", see if we ended up with a "class foo { ... };"
|
||||
try_resolving_type = (die_tag == DW_TAG_class_type);
|
||||
break;
|
||||
default:
|
||||
// Tags don't match, don't event try to resolve
|
||||
// using this type whose name matches....
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (try_resolving_type)
|
||||
{
|
||||
if (log)
|
||||
{
|
||||
std::string qualified_name;
|
||||
type_die->GetQualifiedName(this, cu, qualified_name);
|
||||
GetObjectFile()->GetModule()->LogMessage (log,
|
||||
"SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x, name='%s') trying die=0x%8.8x (%s)",
|
||||
die->GetOffset(),
|
||||
type_name.GetCString(),
|
||||
type_die->GetOffset(),
|
||||
qualified_name.c_str());
|
||||
}
|
||||
|
||||
// Make sure the decl contexts match all the way up
|
||||
if (DIEDeclContextsMatch(cu, die, type_cu, type_die))
|
||||
{
|
||||
Type *resolved_type = ResolveType (type_cu, type_die, false);
|
||||
if (resolved_type && resolved_type != DIE_IS_BEING_PARSED)
|
||||
{
|
||||
DEBUG_PRINTF ("resolved 0x%8.8" PRIx64 " (cu 0x%8.8" PRIx64 ") from %s to 0x%8.8" PRIx64 " (cu 0x%8.8" PRIx64 ")\n",
|
||||
MakeUserID(die->GetOffset()),
|
||||
MakeUserID(cu->GetOffset()),
|
||||
m_obj_file->GetFileSpec().GetFilename().AsCString(),
|
||||
MakeUserID(type_die->GetOffset()),
|
||||
MakeUserID(type_cu->GetOffset()));
|
||||
|
||||
m_die_to_type[die] = resolved_type;
|
||||
type_sp = resolved_type->shared_from_this();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (log)
|
||||
{
|
||||
std::string qualified_name;
|
||||
type_die->GetQualifiedName(this, cu, qualified_name);
|
||||
GetObjectFile()->GetModule()->LogMessage (log,
|
||||
"SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x, name='%s') ignoring die=0x%8.8x (%s)",
|
||||
die->GetOffset(),
|
||||
type_name.GetCString(),
|
||||
type_die->GetOffset(),
|
||||
qualified_name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_using_apple_tables)
|
||||
{
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_types accelerator table had bad die 0x%8.8x for '%s')\n",
|
||||
die_offset, type_name.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return type_sp;
|
||||
}
|
||||
|
||||
TypeSP
|
||||
SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext (const DWARFDeclContext &dwarf_decl_ctx)
|
||||
|
|
|
@ -421,11 +421,6 @@ protected:
|
|||
const DWARFMappedHash::MemoryTable &memory_table,
|
||||
lldb_private::SymbolContextList& sc_list);
|
||||
|
||||
lldb::TypeSP FindDefinitionTypeForDIE (
|
||||
DWARFCompileUnit* dwarf_cu,
|
||||
const DWARFDebugInfoEntry *die,
|
||||
const lldb_private::ConstString &type_name);
|
||||
|
||||
lldb::TypeSP FindDefinitionTypeForDWARFDeclContext (
|
||||
const DWARFDeclContext &die_decl_ctx);
|
||||
|
||||
|
|
Loading…
Reference in New Issue