[Lldb-commits] [lldb] r254787 - Reduce memory traffic in ConstString in the std::map formatter
Enrico Granata via lldb-commits
lldb-commits at lists.llvm.org
Fri Dec 4 14:49:28 PST 2015
Author: enrico
Date: Fri Dec 4 16:49:27 2015
New Revision: 254787
URL: http://llvm.org/viewvc/llvm-project?rev=254787&view=rev
Log:
Reduce memory traffic in ConstString in the std::map formatter
Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp?rev=254787&r1=254786&r2=254787&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp Fri Dec 4 16:49:27 2015
@@ -269,14 +269,17 @@ m_iterators()
size_t
lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::CalculateNumChildren ()
{
+ static ConstString g___pair3_("__pair3_");
+ static ConstString g___first_("__first_");
+
if (m_count != UINT32_MAX)
return m_count;
if (m_tree == NULL)
return 0;
- ValueObjectSP m_item(m_tree->GetChildMemberWithName(ConstString("__pair3_"), true));
+ ValueObjectSP m_item(m_tree->GetChildMemberWithName(g___pair3_, true));
if (!m_item)
return 0;
- m_item = m_item->GetChildMemberWithName(ConstString("__first_"), true);
+ m_item = m_item->GetChildMemberWithName(g___first_, true);
if (!m_item)
return 0;
m_count = m_item->GetValueAsUnsigned(0);
@@ -286,6 +289,8 @@ lldb_private::formatters::LibcxxStdMapSy
bool
lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType()
{
+ static ConstString g___value_("__value_");
+
if (m_element_type.GetOpaqueQualType() && m_element_type.GetTypeSystem())
return true;
m_element_type.Clear();
@@ -294,7 +299,7 @@ lldb_private::formatters::LibcxxStdMapSy
deref = m_root_node->Dereference(error);
if (!deref || error.Fail())
return false;
- deref = deref->GetChildMemberWithName(ConstString("__value_"), true);
+ deref = deref->GetChildMemberWithName(g___value_, true);
if (!deref)
return false;
m_element_type = deref->GetCompilerType();
@@ -320,6 +325,7 @@ lldb_private::formatters::LibcxxStdMapSy
{
static ConstString g___cc("__cc");
static ConstString g___nc("__nc");
+ static ConstString g___value_("__value_");
if (idx >= CalculateNumChildren())
@@ -364,7 +370,7 @@ lldb_private::formatters::LibcxxStdMapSy
return lldb::ValueObjectSP();
}
GetValueOffset(iterated_sp);
- iterated_sp = iterated_sp->GetChildMemberWithName(ConstString("__value_"), true);
+ iterated_sp = iterated_sp->GetChildMemberWithName(g___value_, true);
if (!iterated_sp)
{
m_tree = NULL;
@@ -438,14 +444,16 @@ lldb_private::formatters::LibcxxStdMapSy
bool
lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::Update()
{
+ static ConstString g___tree_("__tree_");
+ static ConstString g___begin_node_("__begin_node_");
m_count = UINT32_MAX;
m_tree = m_root_node = NULL;
m_children.clear();
m_iterators.clear();
- m_tree = m_backend.GetChildMemberWithName(ConstString("__tree_"), true).get();
+ m_tree = m_backend.GetChildMemberWithName(g___tree_, true).get();
if (!m_tree)
return false;
- m_root_node = m_tree->GetChildMemberWithName(ConstString("__begin_node_"), true).get();
+ m_root_node = m_tree->GetChildMemberWithName(g___begin_node_, true).get();
return false;
}
More information about the lldb-commits
mailing list