[Lldb-commits] [lldb] r154186 - /lldb/trunk/source/Core/ModuleList.cpp
Greg Clayton
gclayton at apple.com
Fri Apr 6 11:09:43 PDT 2012
Author: gclayton
Date: Fri Apr 6 13:09:43 2012
New Revision: 154186
URL: http://llvm.org/viewvc/llvm-project?rev=154186&view=rev
Log:
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.
Modified:
lldb/trunk/source/Core/ModuleList.cpp
Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=154186&r1=154185&r2=154186&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Fri Apr 6 13:09:43 2012
@@ -358,14 +358,37 @@
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;
}
More information about the lldb-commits
mailing list