From 63e5fb76ecfed3434252868d8cf07d676f979f2f Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 24 Jul 2019 17:56:10 +0000 Subject: [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 --- lldb/source/Symbol/ObjectFile.cpp | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'lldb/source/Symbol/ObjectFile.cpp') diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index 172d2b3f01e..35510a25495 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -271,13 +271,13 @@ ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp, if (data_sp) m_data.SetData(data_sp, data_offset, length); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) - log->Printf("%p ObjectFile::ObjectFile() module = %p (%s), file = %s, " - "file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, - static_cast(this), static_cast(module_sp.get()), - module_sp->GetSpecificationDescription().c_str(), - m_file ? m_file.GetPath().c_str() : "", m_file_offset, - m_length); + LLDB_LOGF(log, + "%p ObjectFile::ObjectFile() module = %p (%s), file = %s, " + "file_offset = 0x%8.8" PRIx64 ", size = %" PRIu64, + static_cast(this), static_cast(module_sp.get()), + module_sp->GetSpecificationDescription().c_str(), + m_file ? m_file.GetPath().c_str() : "", m_file_offset, + m_length); } ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp, @@ -290,18 +290,17 @@ ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp, if (header_data_sp) m_data.SetData(header_data_sp, 0, header_data_sp->GetByteSize()); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) - log->Printf("%p ObjectFile::ObjectFile() module = %p (%s), process = %p, " - "header_addr = 0x%" PRIx64, - static_cast(this), static_cast(module_sp.get()), - module_sp->GetSpecificationDescription().c_str(), - static_cast(process_sp.get()), m_memory_addr); + LLDB_LOGF(log, + "%p ObjectFile::ObjectFile() module = %p (%s), process = %p, " + "header_addr = 0x%" PRIx64, + static_cast(this), static_cast(module_sp.get()), + module_sp->GetSpecificationDescription().c_str(), + static_cast(process_sp.get()), m_memory_addr); } ObjectFile::~ObjectFile() { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) - log->Printf("%p ObjectFile::~ObjectFile ()\n", static_cast(this)); + LLDB_LOGF(log, "%p ObjectFile::~ObjectFile ()\n", static_cast(this)); } bool ObjectFile::SetModulesArchitecture(const ArchSpec &new_arch) { @@ -595,10 +594,9 @@ void ObjectFile::ClearSymtab() { if (module_sp) { std::lock_guard guard(module_sp->GetMutex()); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) - log->Printf("%p ObjectFile::ClearSymtab () symtab = %p", - static_cast(this), - static_cast(m_symtab_up.get())); + LLDB_LOGF(log, "%p ObjectFile::ClearSymtab () symtab = %p", + static_cast(this), + static_cast(m_symtab_up.get())); m_symtab_up.reset(); } } -- cgit v1.2.3