summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectHelp.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-11-16 21:34:22 +0000
committerZachary Turner <zturner@google.com>2016-11-16 21:34:22 +0000
commita49c2019f14e5ea5de35d6db88da1b081312ea4a (patch)
tree7026e779ac81d0968c96c50d26aabab6763c449a /lldb/source/Commands/CommandObjectHelp.cpp
parentadd6ab50849032b3136a0bb59916159c8c63315b (diff)
downloadbcm5719-llvm-a49c2019f14e5ea5de35d6db88da1b081312ea4a.tar.gz
bcm5719-llvm-a49c2019f14e5ea5de35d6db88da1b081312ea4a.zip
Update GenerateAdditionalHelpAvenues to take StringRef.
llvm-svn: 287155
Diffstat (limited to 'lldb/source/Commands/CommandObjectHelp.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectHelp.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/lldb/source/Commands/CommandObjectHelp.cpp b/lldb/source/Commands/CommandObjectHelp.cpp
index 4a8f01cc752..41da682461a 100644
--- a/lldb/source/Commands/CommandObjectHelp.cpp
+++ b/lldb/source/Commands/CommandObjectHelp.cpp
@@ -25,21 +25,26 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
void CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage(
- Stream *s, const char *command, const char *prefix, const char *subcommand,
+ Stream *s, llvm::StringRef command, llvm::StringRef prefix, llvm::StringRef subcommand,
bool include_apropos, bool include_type_lookup) {
- if (s && command && *command) {
- s->Printf("'%s' is not a known command.\n", command);
- s->Printf("Try '%shelp' to see a current list of commands.\n",
- prefix ? prefix : "");
- if (include_apropos) {
- s->Printf("Try '%sapropos %s' for a list of related commands.\n",
- prefix ? prefix : "", subcommand ? subcommand : command);
- }
- if (include_type_lookup) {
- s->Printf("Try '%stype lookup %s' for information on types, methods, "
- "functions, modules, etc.",
- prefix ? prefix : "", subcommand ? subcommand : command);
- }
+ if (!s || command.empty())
+ return;
+
+ std::string command_str = command.str();
+ std::string prefix_str = prefix.str();
+ std::string subcommand_str = subcommand.str();
+ const std::string &lookup_str = !subcommand_str.empty() ? subcommand_str : command_str;
+ s->Printf("'%s' is not a known command.\n", command_str.c_str());
+ s->Printf("Try '%shelp' to see a current list of commands.\n",
+ prefix.str().c_str());
+ if (include_apropos) {
+ s->Printf("Try '%sapropos %s' for a list of related commands.\n",
+ prefix_str.c_str(), lookup_str.c_str());
+ }
+ if (include_type_lookup) {
+ s->Printf("Try '%stype lookup %s' for information on types, methods, "
+ "functions, modules, etc.",
+ prefix_str.c_str(), lookup_str.c_str());
}
}
@@ -198,7 +203,7 @@ bool CommandObjectHelp::DoExecute(Args &command, CommandReturnObject &result) {
StreamString error_msg_stream;
GenerateAdditionalHelpAvenuesMessage(&error_msg_stream,
command.GetArgumentAtIndex(0),
- m_interpreter.GetCommandPrefix());
+ m_interpreter.GetCommandPrefix(), "");
result.AppendError(error_msg_stream.GetString());
result.SetStatus(eReturnStatusFailed);
}
OpenPOWER on IntegriCloud