diff options
author | Sean Callanan <scallanan@apple.com> | 2012-10-23 00:50:09 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2012-10-23 00:50:09 +0000 |
commit | d94773972ce5febe7b72003bf6998acbc6d57b5d (patch) | |
tree | 975fc1a85be8184fd9fd8ce140db29d552ade1fd /lldb/source/Interpreter/CommandObject.cpp | |
parent | a302b6d95e9f026f0bf72281342da070176b6680 (diff) | |
download | bcm5719-llvm-d94773972ce5febe7b72003bf6998acbc6d57b5d.tar.gz bcm5719-llvm-d94773972ce5febe7b72003bf6998acbc6d57b5d.zip |
Improved support for language types as command
options:
- added help ("help language") listing the
possible options;
- added the possibility of synonyms for language
names, in this case "ObjC" for "Objective-C";
and
- made matching against language names case
insensitive.
This should improve discoverability.
<rdar://problem/12552359>
llvm-svn: 166457
Diffstat (limited to 'lldb/source/Interpreter/CommandObject.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandObject.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 8d8520d8085..a234640cd0d 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -742,6 +742,33 @@ FormatHelpTextCallback () } static const char * +LanguageTypeHelpTextCallback () +{ + static char* help_text_ptr = NULL; + + if (help_text_ptr) + return help_text_ptr; + + StreamString sstr; + sstr << "One of the following languages:\n"; + + for (LanguageType l = eLanguageTypeUnknown; l < eNumLanguageTypes; ++l) + { + sstr << " " << LanguageRuntime::GetNameForLanguageType(l) << "\n"; + } + + sstr.Flush(); + + std::string data = sstr.GetString(); + + help_text_ptr = new char[data.length()+1]; + + data.copy(help_text_ptr, data.length()); + + return help_text_ptr; +} + +static const char * SummaryStringHelpTextCallback() { return @@ -935,7 +962,7 @@ CommandObject::g_arguments_data[] = { eArgTypeFunctionOrSymbol, "function-or-symbol", CommandCompletions::eNoCompletion, { NULL, false }, "The name of a function or symbol." }, { eArgTypeGDBFormat, "gdb-format", CommandCompletions::eNoCompletion, { GDBFormatHelpTextCallback, true }, NULL }, { eArgTypeIndex, "index", CommandCompletions::eNoCompletion, { NULL, false }, "An index into a list." }, - { eArgTypeLanguage, "language", CommandCompletions::eNoCompletion, { NULL, false }, "A source language name." }, + { eArgTypeLanguage, "language", CommandCompletions::eNoCompletion, { LanguageTypeHelpTextCallback, true }, NULL }, { eArgTypeLineNum, "linenum", CommandCompletions::eNoCompletion, { NULL, false }, "Line number in a source file." }, { eArgTypeLogCategory, "log-category", CommandCompletions::eNoCompletion, { NULL, false }, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." }, { eArgTypeLogChannel, "log-channel", CommandCompletions::eNoCompletion, { NULL, false }, "The name of a log channel, e.g. process.gdb-remote (try \"log list\" to see a list of all channels and their categories)." }, |