[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
This commit is contained in:
@@ -235,11 +235,11 @@ bool ObjectFilePECOFF::CreateBinary() {
|
||||
|
||||
auto binary = llvm::object::createBinary(m_file.GetPath());
|
||||
if (!binary) {
|
||||
if (log)
|
||||
log->Printf("ObjectFilePECOFF::CreateBinary() - failed to create binary "
|
||||
"for file (%s): %s",
|
||||
m_file ? m_file.GetPath().c_str() : "<NULL>",
|
||||
errorToErrorCode(binary.takeError()).message().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFilePECOFF::CreateBinary() - failed to create binary "
|
||||
"for file (%s): %s",
|
||||
m_file ? m_file.GetPath().c_str() : "<NULL>",
|
||||
errorToErrorCode(binary.takeError()).message().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -249,15 +249,14 @@ bool ObjectFilePECOFF::CreateBinary() {
|
||||
return false;
|
||||
|
||||
m_owningbin = OWNBINType(std::move(*binary));
|
||||
if (log)
|
||||
log->Printf("%p ObjectFilePECOFF::CreateBinary() module = %p (%s), file = "
|
||||
"%s, binary = %p (Bin = %p)",
|
||||
static_cast<void *>(this),
|
||||
static_cast<void *>(GetModule().get()),
|
||||
GetModule()->GetSpecificationDescription().c_str(),
|
||||
m_file ? m_file.GetPath().c_str() : "<NULL>",
|
||||
static_cast<void *>(m_owningbin.getPointer()),
|
||||
static_cast<void *>(m_owningbin->getBinary()));
|
||||
LLDB_LOGF(log,
|
||||
"%p ObjectFilePECOFF::CreateBinary() module = %p (%s), file = "
|
||||
"%s, binary = %p (Bin = %p)",
|
||||
static_cast<void *>(this), static_cast<void *>(GetModule().get()),
|
||||
GetModule()->GetSpecificationDescription().c_str(),
|
||||
m_file ? m_file.GetPath().c_str() : "<NULL>",
|
||||
static_cast<void *>(m_owningbin.getPointer()),
|
||||
static_cast<void *>(m_owningbin->getBinary()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -911,13 +910,13 @@ uint32_t ObjectFilePECOFF::ParseDependentModules() {
|
||||
return 0;
|
||||
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
|
||||
if (log)
|
||||
log->Printf("%p ObjectFilePECOFF::ParseDependentModules() module = %p "
|
||||
"(%s), binary = %p (Bin = %p)",
|
||||
static_cast<void *>(this), static_cast<void *>(module_sp.get()),
|
||||
module_sp->GetSpecificationDescription().c_str(),
|
||||
static_cast<void *>(m_owningbin.getPointer()),
|
||||
static_cast<void *>(m_owningbin->getBinary()));
|
||||
LLDB_LOGF(log,
|
||||
"%p ObjectFilePECOFF::ParseDependentModules() module = %p "
|
||||
"(%s), binary = %p (Bin = %p)",
|
||||
static_cast<void *>(this), static_cast<void *>(module_sp.get()),
|
||||
module_sp->GetSpecificationDescription().c_str(),
|
||||
static_cast<void *>(m_owningbin.getPointer()),
|
||||
static_cast<void *>(m_owningbin->getBinary()));
|
||||
|
||||
auto COFFObj =
|
||||
llvm::dyn_cast<llvm::object::COFFObjectFile>(m_owningbin->getBinary());
|
||||
@@ -931,10 +930,10 @@ uint32_t ObjectFilePECOFF::ParseDependentModules() {
|
||||
auto ec = entry.getName(dll_name);
|
||||
// Report a bogus entry.
|
||||
if (ec != std::error_code()) {
|
||||
if (log)
|
||||
log->Printf("ObjectFilePECOFF::ParseDependentModules() - failed to get "
|
||||
"import directory entry name: %s",
|
||||
ec.message().c_str());
|
||||
LLDB_LOGF(log,
|
||||
"ObjectFilePECOFF::ParseDependentModules() - failed to get "
|
||||
"import directory entry name: %s",
|
||||
ec.message().c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user