summaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectTarget.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-11-06 19:28:40 +0000
committerSean Callanan <scallanan@apple.com>2013-11-06 19:28:40 +0000
commit5c19eac1c8c95fa0e40fa71da664326d29dcaf18 (patch)
treea3620393bea2552d01d9014a2c1534cb4f644102 /lldb/source/Commands/CommandObjectTarget.cpp
parent5fb3a13ba7523d3a93290bcfa033b835151c19aa (diff)
Added Iterable, a class that vends standard C++
iterators for LLDB's container data structures. Iterable abstracts over the backing data structure, ignoring keys for maps for example. It also provides locking as a service so that the code for (ThreadSP thread_sp : process->Threads()) { // ... use thread_sp } takes the appropriate locks once, without having to do anything else. The salient advantages of this system are: - Much simpler and idiomatic loop code - Lock once instead of each time an element is fetched - Less boilerplate to produce the iterators The intent is that Iterable will replace Get...AtIndex in most places, and that ForEach(), which solves the same problem in a less-idiomatic way, be phased out in favor of this approach. I've added Iterables to ThreadList, TypeList, and Process (which is really just forwarding to ThreadList). llvm-svn: 194159
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index ef431e25c3d4..8e7e68aad39a 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1796,10 +1796,8 @@ LookupTypeInModule (CommandInterpreter &interpreter,
strm.Printf("%zu match%s found in ", num_matches, num_matches > 1 ? "es" : "");
DumpFullpath (strm, &module->GetFileSpec(), 0);
strm.PutCString(":\n");
- const uint32_t num_types = type_list.GetSize();
- for (uint32_t i=0; i<num_types; ++i)
+ for (TypeSP type_sp : type_list.Types())
{
- TypeSP type_sp (type_list.GetTypeAtIndex(i));
if (type_sp)
{
// Resolve the clang type so that any forward references