summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-03-29 17:03:23 +0000
committerGreg Clayton <gclayton@apple.com>2013-03-29 17:03:23 +0000
commit7d2ef16cb360dbd95e276b80b85c6ff9ce69dc23 (patch)
treee1d681ff60ad960801919058aea6efd7f3103ed7 /lldb/source/Interpreter/CommandObjectRegexCommand.cpp
parent6036f581aab3db3a1436cc5acd80f8a5b4cfb1f6 (diff)
downloadbcm5719-llvm-7d2ef16cb360dbd95e276b80b85c6ff9ce69dc23.tar.gz
bcm5719-llvm-7d2ef16cb360dbd95e276b80b85c6ff9ce69dc23.zip
<rdar://problem/12022060>
Enable tab completion for regular expression commands. llvm-svn: 178348
Diffstat (limited to 'lldb/source/Interpreter/CommandObjectRegexCommand.cpp')
-rw-r--r--lldb/source/Interpreter/CommandObjectRegexCommand.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/lldb/source/Interpreter/CommandObjectRegexCommand.cpp b/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
index 05d6e09b6b1..25b02baf54a 100644
--- a/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
+++ b/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
@@ -30,11 +30,13 @@ CommandObjectRegexCommand::CommandObjectRegexCommand
const char *name,
const char *help,
const char *syntax,
- uint32_t max_matches
+ uint32_t max_matches,
+ uint32_t completion_type_mask
) :
CommandObjectRaw (interpreter, name, help, syntax),
m_max_matches (max_matches),
- m_entries ()
+ m_entries (),
+ m_completion_type_mask (completion_type_mask)
{
}
@@ -114,3 +116,33 @@ CommandObjectRegexCommand::AddRegexCommand (const char *re_cstr, const char *com
m_entries.pop_back();
return false;
}
+
+int
+CommandObjectRegexCommand::HandleCompletion (Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
+{
+ if (m_completion_type_mask)
+ {
+ std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
+ CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
+ m_completion_type_mask,
+ completion_str.c_str(),
+ match_start_point,
+ max_return_elements,
+ NULL,
+ word_complete,
+ matches);
+ return matches.GetSize();
+ }
+ else
+ {
+ matches.Clear();
+ word_complete = false;
+ }
+ return 0;
+}
OpenPOWER on IntegriCloud