Fixes for Symtab.cpp to take advantage of the new unique C string map
changes that were just submitted. llvm-svn: 139478
This commit is contained in:
parent
c0a87652ba
commit
38e953dda2
|
@ -37,7 +37,11 @@ public:
|
|||
///
|
||||
/// Initializes the string to an empty string.
|
||||
//------------------------------------------------------------------
|
||||
ConstString ();
|
||||
ConstString ():
|
||||
m_string (NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Copy constructor
|
||||
|
@ -48,7 +52,10 @@ public:
|
|||
/// @param[in] rhs
|
||||
/// Another string object to copy.
|
||||
//------------------------------------------------------------------
|
||||
ConstString (const ConstString& rhs);
|
||||
ConstString (const ConstString& rhs) :
|
||||
m_string (rhs.m_string)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with C String value
|
||||
|
@ -99,7 +106,10 @@ public:
|
|||
/// greater than zero, the string will remain in the string pool
|
||||
/// until the last reference is released by other ConstString objects.
|
||||
//------------------------------------------------------------------
|
||||
~ConstString ();
|
||||
~ConstString ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// C string equality function object for CStrings contains in the
|
||||
|
@ -405,7 +415,11 @@ public:
|
|||
/// @see ConstString::StaticMemorySize ()
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
MemorySize () const;
|
||||
MemorySize () const
|
||||
{
|
||||
return sizeof(ConstString);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the size in bytes of the current global string pool.
|
||||
|
|
|
@ -190,27 +190,6 @@ StringPool()
|
|||
return string_pool;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Default constructor
|
||||
//
|
||||
// Initializes the string to an empty string.
|
||||
//----------------------------------------------------------------------
|
||||
ConstString::ConstString () :
|
||||
m_string (NULL)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Copy constructor
|
||||
//
|
||||
// Copies the string value in "rhs" and retains an extra reference
|
||||
// to the string value in the string pool.
|
||||
//----------------------------------------------------------------------
|
||||
ConstString::ConstString (const ConstString& rhs) :
|
||||
m_string (rhs.m_string)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Construct with C String value
|
||||
//
|
||||
|
@ -244,18 +223,6 @@ ConstString::ConstString (const char *cstr, size_t cstr_len) :
|
|||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Destructor
|
||||
//
|
||||
// Decrements the reference count on the contained string, and if
|
||||
// the resulting reference count is zero, then the string is removed
|
||||
// from the string pool. If the reference count is still greater
|
||||
// than zero, the string will remain in the string pool
|
||||
//----------------------------------------------------------------------
|
||||
ConstString::~ConstString ()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ConstString::operator < (const ConstString& rhs) const
|
||||
{
|
||||
|
@ -401,17 +368,6 @@ ConstString::SetTrimmedCStringWithLength (const char *cstr, size_t cstr_len)
|
|||
m_string = StringPool().GetConstTrimmedCStringWithLength (cstr, cstr_len);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Return the size in bytes that this object takes in memory. The
|
||||
// resulting size will not include any of the C string values from
|
||||
// the global string pool (see StaticMemorySize ()).
|
||||
//----------------------------------------------------------------------
|
||||
size_t
|
||||
ConstString::MemorySize() const
|
||||
{
|
||||
return sizeof(ConstString);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Reports the the size in bytes of all shared C string values,
|
||||
// containers and reference count values as a byte size for the
|
||||
|
|
|
@ -462,20 +462,11 @@ Symtab::AppendSymbolIndexesWithName (const ConstString& symbol_name, std::vector
|
|||
Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__);
|
||||
if (symbol_name)
|
||||
{
|
||||
const size_t old_size = indexes.size();
|
||||
const char *symbol_cstr = symbol_name.GetCString();
|
||||
if (!m_name_indexes_computed)
|
||||
InitNameIndexes();
|
||||
|
||||
const char *symbol_cstr = symbol_name.GetCString();
|
||||
const UniqueCStringMap<uint32_t>::Entry *entry_ptr;
|
||||
|
||||
for (entry_ptr = m_name_to_index.FindFirstValueForName (symbol_cstr);
|
||||
entry_ptr!= NULL;
|
||||
entry_ptr = m_name_to_index.FindNextValueForName (symbol_cstr, entry_ptr))
|
||||
{
|
||||
indexes.push_back (entry_ptr->value);
|
||||
}
|
||||
return indexes.size() - old_size;
|
||||
return m_name_to_index.GetValues (symbol_cstr, indexes);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -493,13 +484,13 @@ Symtab::AppendSymbolIndexesWithName (const ConstString& symbol_name, Debug symbo
|
|||
InitNameIndexes();
|
||||
|
||||
const char *symbol_cstr = symbol_name.GetCString();
|
||||
const UniqueCStringMap<uint32_t>::Entry *entry_ptr;
|
||||
for (entry_ptr = m_name_to_index.FindFirstValueForName (symbol_cstr);
|
||||
entry_ptr!= NULL;
|
||||
entry_ptr = m_name_to_index.FindNextValueForName (symbol_cstr, entry_ptr))
|
||||
|
||||
std::vector<uint32_t> all_name_indexes;
|
||||
const size_t name_match_count = m_name_to_index.GetValues (symbol_cstr, all_name_indexes);
|
||||
for (size_t i=0; i<name_match_count; ++i)
|
||||
{
|
||||
if (CheckSymbolAtIndex(entry_ptr->value, symbol_debug_type, symbol_visibility))
|
||||
indexes.push_back (entry_ptr->value);
|
||||
if (CheckSymbolAtIndex(all_name_indexes[i], symbol_debug_type, symbol_visibility))
|
||||
indexes.push_back (all_name_indexes[i]);
|
||||
}
|
||||
return indexes.size() - old_size;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue