diff options
| author | Enrico Granata <egranata@apple.com> | 2013-01-12 01:00:22 +0000 |
|---|---|---|
| committer | Enrico Granata <egranata@apple.com> | 2013-01-12 01:00:22 +0000 |
| commit | 3309d881989abe5fb630631ccd7333daa3c1707a (patch) | |
| tree | e8b0a0483ef8c017bf657ca9dc9acb0cd3b47954 /lldb/source/Core/ValueObject.cpp | |
| parent | 3dd236cdd8e5be401b7d7235c7a1aecb1c7450e0 (diff) | |
| download | bcm5719-llvm-3309d881989abe5fb630631ccd7333daa3c1707a.tar.gz bcm5719-llvm-3309d881989abe5fb630631ccd7333daa3c1707a.zip | |
<rdar://problem/12239827>
Providing a data formatter for libc++ std::wstring
In the process, refactoring the std::string data formatter to be written in C++ so that commonalities between the two can be exploited
Also, providing a new API on the ValueObject to navigate a hierarchy by index-path
Lastly, an appropriate test case is included
llvm-svn: 172282
Diffstat (limited to 'lldb/source/Core/ValueObject.cpp')
| -rw-r--r-- | lldb/source/Core/ValueObject.cpp | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 2a597b344c7..449e49c0720 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -533,6 +533,86 @@ ValueObject::GetChildAtIndex (uint32_t idx, bool can_create) return child_sp; } +ValueObjectSP +ValueObject::GetChildAtIndexPath (const std::initializer_list<uint32_t>& idxs, + uint32_t* index_of_error) +{ + if (idxs.size() == 0) + return GetSP(); + ValueObjectSP root(GetSP()); + for (uint32_t idx : idxs) + { + root = root->GetChildAtIndex(idx, true); + if (!root) + { + if (index_of_error) + *index_of_error = idx; + return root; + } + } + return root; +} + +ValueObjectSP +ValueObject::GetChildAtIndexPath (const std::initializer_list< std::pair<uint32_t, bool> >& idxs, + uint32_t* index_of_error) +{ + if (idxs.size() == 0) + return GetSP(); + ValueObjectSP root(GetSP()); + for (std::pair<uint32_t, bool> idx : idxs) + { + root = root->GetChildAtIndex(idx.first, idx.second); + if (!root) + { + if (index_of_error) + *index_of_error = idx.first; + return root; + } + } + return root; +} + +lldb::ValueObjectSP +ValueObject::GetChildAtIndexPath (const std::vector<uint32_t> &idxs, + uint32_t* index_of_error) +{ + if (idxs.size() == 0) + return GetSP(); + ValueObjectSP root(GetSP()); + for (uint32_t idx : idxs) + { + root = root->GetChildAtIndex(idx, true); + if (!root) + { + if (index_of_error) + *index_of_error = idx; + return root; + } + } + return root; +} + +lldb::ValueObjectSP +ValueObject::GetChildAtIndexPath (const std::vector< std::pair<uint32_t, bool> > &idxs, + uint32_t* index_of_error) +{ + if (idxs.size() == 0) + return GetSP(); + ValueObjectSP root(GetSP()); + for (std::pair<uint32_t, bool> idx : idxs) + { + root = root->GetChildAtIndex(idx.first, idx.second); + if (!root) + { + if (index_of_error) + *index_of_error = idx.first; + return root; + } + } + return root; +} + uint32_t ValueObject::GetIndexOfChildWithName (const ConstString &name) { |

