summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-07-24 17:56:10 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-07-24 17:56:10 +0000
commit63e5fb76ecfed3434252868d8cf07d676f979f2f (patch)
tree349d6bd303f53aa57b988dee284c7f264404a8fc /lldb/source/Interpreter/CommandInterpreter.cpp
parent2bf871be4c35d70db080dde789cf9bb334c04057 (diff)
downloadbcm5719-llvm-63e5fb76ecfed3434252868d8cf07d676f979f2f.tar.gz
bcm5719-llvm-63e5fb76ecfed3434252868d8cf07d676f979f2f.zip
[Logging] Replace Log::Printf with LLDB_LOG macro (NFC)
This patch replaces explicit calls to log::Printf with the new LLDB_LOGF macro. The macro is similar to LLDB_LOG but supports printf-style format strings, instead of formatv-style format strings. So instead of writing: if (log) log->Printf("%s\n", str); You'd write: LLDB_LOG(log, "%s\n", str); This change was done mechanically with the command below. I replaced the spurious if-checks with vim, since I know how to do multi-line replacements with it. find . -type f -name '*.cpp' -exec \ sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" + Differential revision: https://reviews.llvm.org/D65128 llvm-svn: 366936
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 8948037a630..4610a44fd8c 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1628,8 +1628,7 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
llvm::PrettyStackTraceFormat stack_trace("HandleCommand(command = \"%s\")",
command_line);
- if (log)
- log->Printf("Processing command: %s", command_line);
+ LLDB_LOGF(log, "Processing command: %s", command_line);
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat, "Handling command: %s.", command_line);
@@ -1735,13 +1734,13 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
// "br s -n main", command_string is now "breakpoint set -n main".
if (log) {
llvm::StringRef command_name = cmd_obj ? cmd_obj->GetCommandName() : "<not found>";
- log->Printf("HandleCommand, cmd_obj : '%s'", command_name.str().c_str());
- log->Printf("HandleCommand, (revised) command_string: '%s'",
- command_string.c_str());
+ LLDB_LOGF(log, "HandleCommand, cmd_obj : '%s'", command_name.str().c_str());
+ LLDB_LOGF(log, "HandleCommand, (revised) command_string: '%s'",
+ command_string.c_str());
const bool wants_raw_input =
(cmd_obj != nullptr) ? cmd_obj->WantsRawCommandString() : false;
- log->Printf("HandleCommand, wants_raw_input:'%s'",
- wants_raw_input ? "True" : "False");
+ LLDB_LOGF(log, "HandleCommand, wants_raw_input:'%s'",
+ wants_raw_input ? "True" : "False");
}
// Phase 2.
@@ -1771,17 +1770,15 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
if (pos != 0 && pos != std::string::npos)
remainder.erase(0, pos);
- if (log)
- log->Printf(
- "HandleCommand, command line after removing command name(s): '%s'",
- remainder.c_str());
+ LLDB_LOGF(
+ log, "HandleCommand, command line after removing command name(s): '%s'",
+ remainder.c_str());
cmd_obj->Execute(remainder.c_str(), result);
}
- if (log)
- log->Printf("HandleCommand, command %s",
- (result.Succeeded() ? "succeeded" : "did not succeed"));
+ LLDB_LOGF(log, "HandleCommand, command %s",
+ (result.Succeeded() ? "succeeded" : "did not succeed"));
return result.Succeeded();
}
OpenPOWER on IntegriCloud