aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandCompletions.cpp
diff options
context:
space:
mode:
authorAlex Langford <alangford@apple.com>2023-05-04 18:19:15 -0700
committerAlex Langford <alangford@apple.com>2023-05-05 11:19:21 -0700
commite9eaf7b430ee69e8ef145884cbc8fa3ef8bd3237 (patch)
tree54729f00ee50f97d280b5a0e7b8b14b2b6c878d3 /lldb/source/Commands/CommandCompletions.cpp
parent9c377c53da4771389fbd65e99e1615d99c257bdf (diff)
downloadllvm-e9eaf7b430ee69e8ef145884cbc8fa3ef8bd3237.zip
llvm-e9eaf7b430ee69e8ef145884cbc8fa3ef8bd3237.tar.gz
llvm-e9eaf7b430ee69e8ef145884cbc8fa3ef8bd3237.tar.bz2
Re-land "[lldb] Expose a const iterator for SymbolContextList"
Re-lands 04aa943be8ed5c03092e2a90112ac638360ec253 with modifications to fix tests. I originally reverted this because it caused a test to fail on Linux. The problem was that I inverted a condition on accident.
Diffstat (limited to 'lldb/source/Commands/CommandCompletions.cpp')
-rw-r--r--lldb/source/Commands/CommandCompletions.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp
index 53a3f96..a3c9cf7 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -220,18 +220,15 @@ public:
function_options.include_inlines = true;
context.module_sp->FindFunctions(m_regex, function_options, sc_list);
- SymbolContext sc;
// Now add the functions & symbols to the list - only add if unique:
- for (uint32_t i = 0; i < sc_list.GetSize(); i++) {
- if (sc_list.GetContextAtIndex(i, sc)) {
- ConstString func_name = sc.GetFunctionName(Mangled::ePreferDemangled);
- // Ensure that the function name matches the regex. This is more than
- // a sanity check. It is possible that the demangled function name
- // does not start with the prefix, for example when it's in an
- // anonymous namespace.
- if (!func_name.IsEmpty() && m_regex.Execute(func_name.GetStringRef()))
- m_match_set.insert(func_name);
- }
+ for (const SymbolContext &sc : sc_list) {
+ ConstString func_name = sc.GetFunctionName(Mangled::ePreferDemangled);
+ // Ensure that the function name matches the regex. This is more than
+ // a sanity check. It is possible that the demangled function name
+ // does not start with the prefix, for example when it's in an
+ // anonymous namespace.
+ if (!func_name.IsEmpty() && m_regex.Execute(func_name.GetStringRef()))
+ m_match_set.insert(func_name);
}
}
return Searcher::eCallbackReturnContinue;