summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/ModuleList.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-04-06 18:09:43 +0000
committerGreg Clayton <gclayton@apple.com>2012-04-06 18:09:43 +0000
commit780af51505a1fedb4e3ced8e0b5832c4d4952a27 (patch)
treedeb67fa43d7f70d793ab568e723201f36db79651 /lldb/source/Core/ModuleList.cpp
parent2b54db7664d430f377fa04662b88211c0a5c101f (diff)
downloadbcm5719-llvm-780af51505a1fedb4e3ced8e0b5832c4d4952a27.tar.gz
bcm5719-llvm-780af51505a1fedb4e3ced8e0b5832c4d4952a27.zip
Fixed ModuleList::FindTypes() so that when a symbol context is supplied that contains a valid module, it will search that module first, then if we are still looking for matches (we have found less that "max_matches"), search in all of the other modules as well.
llvm-svn: 154186
Diffstat (limited to 'lldb/source/Core/ModuleList.cpp')
-rw-r--r--lldb/source/Core/ModuleList.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 21f192e80bc..69245fb1a95 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -358,14 +358,37 @@ ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool na
uint32_t total_matches = 0;
collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos)
+ if (sc.module_sp)
{
- if (sc.module_sp.get() == NULL || sc.module_sp.get() == (*pos).get())
- total_matches += (*pos)->FindTypes (sc, name, name_is_fully_qualified, max_matches, types);
+ // The symbol context "sc" contains a module so we want to search that
+ // one first if it is in our list...
+ for (pos = m_modules.begin(); pos != end; ++pos)
+ {
+ if (sc.module_sp.get() == (*pos).get())
+ {
+ total_matches += (*pos)->FindTypes (sc, name, name_is_fully_qualified, max_matches, types);
- if (total_matches >= max_matches)
- break;
+ if (total_matches >= max_matches)
+ break;
+ }
+ }
}
+
+ if (total_matches < max_matches)
+ {
+ for (pos = m_modules.begin(); pos != end; ++pos)
+ {
+ // Search the module if the module is not equal to the one in the symbol
+ // context "sc". If "sc" contains a empty module shared pointer, then
+ // the comparisong will always be true (valid_module_ptr != NULL).
+ if (sc.module_sp.get() != (*pos).get())
+ total_matches += (*pos)->FindTypes (sc, name, name_is_fully_qualified, max_matches, types);
+
+ if (total_matches >= max_matches)
+ break;
+ }
+ }
+
return total_matches;
}
OpenPOWER on IntegriCloud