diff options
| author | Enrico Granata <egranata@apple.com> | 2015-12-04 19:48:08 +0000 |
|---|---|---|
| committer | Enrico Granata <egranata@apple.com> | 2015-12-04 19:48:08 +0000 |
| commit | 367e2fe123bd62920740ec7536f1801a93868e77 (patch) | |
| tree | 57cb7cc6a64fd763bdafcdc1e952c3ca5da88149 | |
| parent | e557308fb94fee038871b9534b03e1d80d807fbb (diff) | |
| download | bcm5719-llvm-367e2fe123bd62920740ec7536f1801a93868e77.tar.gz bcm5719-llvm-367e2fe123bd62920740ec7536f1801a93868e77.zip | |
Improve the std::list data formatter to not need to calculate indices for every loop iteration
This saves about 5 seconds on a 1500 elements list from my local estimates
llvm-svn: 254757
| -rw-r--r-- | lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp index 2c623d2da98..2035cfcaf20 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp @@ -31,6 +31,9 @@ namespace { class ListEntry { + private: + static const std::initializer_list<size_t> __prev_idx; + static const std::initializer_list<size_t> __next_idx; public: ListEntry() = default; ListEntry (ValueObjectSP entry_sp) : m_entry_sp(entry_sp) {} @@ -42,7 +45,7 @@ namespace { { if (!m_entry_sp) return ListEntry(); - return ListEntry(m_entry_sp->GetChildMemberWithName(ConstString("__next_"), true)); + return ListEntry(m_entry_sp->GetChildAtIndexPath({0,1})); } ListEntry @@ -50,7 +53,7 @@ namespace { { if (!m_entry_sp) return ListEntry(); - return ListEntry(m_entry_sp->GetChildMemberWithName(ConstString("__prev_"), true)); + return ListEntry(m_entry_sp->GetChildAtIndexPath({0,0})); } uint64_t @@ -321,7 +324,7 @@ lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::GetChildAtIndex (size_ ValueObjectSP current_sp(current.advance(idx)); if (!current_sp) return lldb::ValueObjectSP(); - current_sp = current_sp->GetChildMemberWithName(ConstString("__value_"), true); + current_sp = current_sp->GetChildAtIndex(1, true); // get the __value_ child if (!current_sp) return lldb::ValueObjectSP(); // we need to copy current_sp into a new object otherwise we will end up with all items named __value_ |

