diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-24 17:56:10 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-24 17:56:10 +0000 |
commit | 63e5fb76ecfed3434252868d8cf07d676f979f2f (patch) | |
tree | 349d6bd303f53aa57b988dee284c7f264404a8fc /lldb/source/Host/macosx/objcxx | |
parent | 2bf871be4c35d70db080dde789cf9bb334c04057 (diff) | |
download | bcm5719-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/Host/macosx/objcxx')
-rw-r--r-- | lldb/source/Host/macosx/objcxx/Host.mm | 43 | ||||
-rw-r--r-- | lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm | 5 |
2 files changed, 21 insertions, 27 deletions
diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index 12d7ba0285e..82b3383bc01 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -363,10 +363,9 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec, CFCReleaser<CFURLRef> file_URL(::CFURLCreateWithFileSystemPath( NULL, file_cfstr.get(), kCFURLPOSIXPathStyle, false)); - if (log) - log->Printf( - "Sending source file: \"%s\" and line: %d to external editor.\n", - file_path, line_no); + LLDB_LOGF(log, + "Sending source file: \"%s\" and line: %d to external editor.\n", + file_path, line_no); long error; BabelAESelInfo file_and_line_info = { @@ -385,8 +384,7 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec, &(file_and_line_desc.descContent)); if (error != noErr) { - if (log) - log->Printf("Error creating AEDesc: %ld.\n", error); + LLDB_LOGF(log, "Error creating AEDesc: %ld.\n", error); return false; } @@ -403,8 +401,7 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec, char *external_editor = ::getenv("LLDB_EXTERNAL_EDITOR"); if (external_editor) { - if (log) - log->Printf("Looking for external editor \"%s\".\n", external_editor); + LLDB_LOGF(log, "Looking for external editor \"%s\".\n", external_editor); if (g_app_name.empty() || strcmp(g_app_name.c_str(), external_editor) != 0) { @@ -415,10 +412,9 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec, // If we found the app, then store away the name so we don't have to // re-look it up. if (error != noErr) { - if (log) - log->Printf( - "Could not find External Editor application, error: %ld.\n", - error); + LLDB_LOGF(log, + "Could not find External Editor application, error: %ld.\n", + error); return false; } } @@ -434,8 +430,7 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec, AEDisposeDesc(&(file_and_line_desc.descContent)); if (error != noErr) { - if (log) - log->Printf("LSOpenURLsWithRole failed, error: %ld.\n", error); + LLDB_LOGF(log, "LSOpenURLsWithRole failed, error: %ld.\n", error); return false; } @@ -1434,12 +1429,12 @@ llvm::Expected<HostThread> Host::StartMonitoringChildProcess( DISPATCH_SOURCE_TYPE_PROC, pid, mask, ::dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)); - if (log) - log->Printf("Host::StartMonitoringChildProcess " - "(callback, pid=%i, monitor_signals=%i) " - "source = %p\n", - static_cast<int>(pid), monitor_signals, - reinterpret_cast<void *>(source)); + LLDB_LOGF(log, + "Host::StartMonitoringChildProcess " + "(callback, pid=%i, monitor_signals=%i) " + "source = %p\n", + static_cast<int>(pid), monitor_signals, + reinterpret_cast<void *>(source)); if (source) { Host::MonitorChildProcessCallback callback_copy = callback; @@ -1473,10 +1468,10 @@ llvm::Expected<HostThread> Host::StartMonitoringChildProcess( status_cstr = "???"; } - if (log) - log->Printf("::waitpid (pid = %llu, &status, 0) => pid = %i, status " - "= 0x%8.8x (%s), signal = %i, exit_status = %i", - pid, wait_pid, status, status_cstr, signal, exit_status); + LLDB_LOGF(log, + "::waitpid (pid = %llu, &status, 0) => pid = %i, status " + "= 0x%8.8x (%s), signal = %i, exit_status = %i", + pid, wait_pid, status, status_cstr, signal, exit_status); if (callback_copy) cancel = callback_copy(pid, exited, signal, exit_status); diff --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm index f13cd9dfc2e..506c722ccc1 100644 --- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm +++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm @@ -142,9 +142,8 @@ bool HostInfoMacOSX::ComputeSupportExeDirectory(FileSpec &file_spec) { FileSystem::Instance().Resolve(support_dir_spec); if (!FileSystem::Instance().IsDirectory(support_dir_spec)) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); - if (log) - log->Printf("HostInfoMacOSX::%s(): failed to find support directory", - __FUNCTION__); + LLDB_LOGF(log, "HostInfoMacOSX::%s(): failed to find support directory", + __FUNCTION__); return false; } |