[Lldb-commits] [lldb] r139478 - in /lldb/trunk: include/lldb/Core/ConstString.h source/Core/ConstString.cpp source/Symbol/Symtab.cpp
Greg Clayton
gclayton at apple.com
Sat Sep 10 17:20:10 PDT 2011
Author: gclayton
Date: Sat Sep 10 19:20:09 2011
New Revision: 139478
URL: http://llvm.org/viewvc/llvm-project?rev=139478&view=rev
Log:
Fixes for Symtab.cpp to take advantage of the new unique C string map
changes that were just submitted.
Modified:
lldb/trunk/include/lldb/Core/ConstString.h
lldb/trunk/source/Core/ConstString.cpp
lldb/trunk/source/Symbol/Symtab.cpp
Modified: lldb/trunk/include/lldb/Core/ConstString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConstString.h?rev=139478&r1=139477&r2=139478&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ConstString.h (original)
+++ lldb/trunk/include/lldb/Core/ConstString.h Sat Sep 10 19:20:09 2011
@@ -37,7 +37,11 @@
///
/// Initializes the string to an empty string.
//------------------------------------------------------------------
- ConstString ();
+ ConstString ():
+ m_string (NULL)
+ {
+ }
+
//------------------------------------------------------------------
/// Copy constructor
@@ -48,7 +52,10 @@
/// @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 @@
/// 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 @@
/// @see ConstString::StaticMemorySize ()
//------------------------------------------------------------------
size_t
- MemorySize () const;
+ MemorySize () const
+ {
+ return sizeof(ConstString);
+ }
+
//------------------------------------------------------------------
/// Get the size in bytes of the current global string pool.
Modified: lldb/trunk/source/Core/ConstString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConstString.cpp?rev=139478&r1=139477&r2=139478&view=diff
==============================================================================
--- lldb/trunk/source/Core/ConstString.cpp (original)
+++ lldb/trunk/source/Core/ConstString.cpp Sat Sep 10 19:20:09 2011
@@ -191,27 +191,6 @@
}
//----------------------------------------------------------------------
-// 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
//
// Constructs this object with a C string by looking to see if the
@@ -244,18 +223,6 @@
{
}
-//----------------------------------------------------------------------
-// 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
{
@@ -402,17 +369,6 @@
}
//----------------------------------------------------------------------
-// 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
// entire string pool.
Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=139478&r1=139477&r2=139478&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Sat Sep 10 19:20:09 2011
@@ -462,20 +462,11 @@
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 @@
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;
}
More information about the lldb-commits
mailing list