[Lldb-commits] [lldb] r368415 - [lldb][NFC] Clean up logging in IRForTarget
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 9 01:54:02 PDT 2019
Author: teemperor
Date: Fri Aug 9 01:54:01 2019
New Revision: 368415
URL: http://llvm.org/viewvc/llvm-project?rev=368415&view=rev
Log:
[lldb][NFC] Clean up logging in IRForTarget
Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp?rev=368415&r1=368414&r2=368415&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Fri Aug 9 01:54:01 2019
@@ -186,8 +186,7 @@ bool IRForTarget::CreateResultVariable(l
}
if (!found_result) {
- if (log)
- log->PutCString("Couldn't find result variable");
+ LLDB_LOG(log, "Couldn't find result variable");
return true;
}
@@ -197,8 +196,7 @@ bool IRForTarget::CreateResultVariable(l
Value *result_value = m_module->getNamedValue(result_name);
if (!result_value) {
- if (log)
- log->PutCString("Result variable had no data");
+ LLDB_LOG(log, "Result variable had no data");
m_error_stream.Format("Internal error [IRForTarget]: Result variable's "
"name ({0}) exists, but not its definition\n",
@@ -207,14 +205,13 @@ bool IRForTarget::CreateResultVariable(l
return false;
}
- LLDB_LOGF(log, "Found result in the IR: \"%s\"",
- PrintValue(result_value, false).c_str());
+ LLDB_LOG(log, "Found result in the IR: \"{0}\"",
+ PrintValue(result_value, false));
GlobalVariable *result_global = dyn_cast<GlobalVariable>(result_value);
if (!result_global) {
- if (log)
- log->PutCString("Result variable isn't a GlobalVariable");
+ LLDB_LOG(log, "Result variable isn't a GlobalVariable");
m_error_stream.Format("Internal error [IRForTarget]: Result variable ({0}) "
"is defined, but is not a global variable\n",
@@ -225,8 +222,7 @@ bool IRForTarget::CreateResultVariable(l
clang::NamedDecl *result_decl = DeclForGlobal(result_global);
if (!result_decl) {
- if (log)
- log->PutCString("Result variable doesn't have a corresponding Decl");
+ LLDB_LOG(log, "Result variable doesn't have a corresponding Decl");
m_error_stream.Format("Internal error [IRForTarget]: Result variable ({0}) "
"does not have a corresponding Clang entity\n",
@@ -241,13 +237,12 @@ bool IRForTarget::CreateResultVariable(l
result_decl->print(decl_desc_stream);
decl_desc_stream.flush();
- LLDB_LOGF(log, "Found result decl: \"%s\"", decl_desc_str.c_str());
+ LLDB_LOG(log, "Found result decl: \"{0}\"", decl_desc_str);
}
clang::VarDecl *result_var = dyn_cast<clang::VarDecl>(result_decl);
if (!result_var) {
- if (log)
- log->PutCString("Result variable Decl isn't a VarDecl");
+ LLDB_LOG(log, "Result variable Decl isn't a VarDecl");
m_error_stream.Format("Internal error [IRForTarget]: Result variable "
"({0})'s corresponding Clang entity isn't a "
@@ -287,8 +282,7 @@ bool IRForTarget::CreateResultVariable(l
lldb_private::ClangASTContext::GetASTContext(
&result_decl->getASTContext()));
} else {
- if (log)
- log->PutCString("Expected result to have pointer type, but it did not");
+ LLDB_LOG(log, "Expected result to have pointer type, but it did not");
m_error_stream.Format("Internal error [IRForTarget]: Lvalue result ({0}) "
"is not a pointer variable\n",
@@ -311,7 +305,7 @@ bool IRForTarget::CreateResultVariable(l
lldb_private::StreamString type_desc_stream;
m_result_type.DumpTypeDescription(&type_desc_stream);
- LLDB_LOGF(log, "Result type has unknown size");
+ LLDB_LOG(log, "Result type has unknown size");
m_error_stream.Printf("Error [IRForTarget]: Size of result type '%s' "
"couldn't be determined\n",
@@ -323,14 +317,13 @@ bool IRForTarget::CreateResultVariable(l
lldb_private::StreamString type_desc_stream;
m_result_type.DumpTypeDescription(&type_desc_stream);
- LLDB_LOGF(log, "Result decl type: \"%s\"", type_desc_stream.GetData());
+ LLDB_LOG(log, "Result decl type: \"{0}\"", type_desc_stream.GetData());
}
m_result_name = lldb_private::ConstString("$RESULT_NAME");
- LLDB_LOGF(log, "Creating a new result global: \"%s\" with size 0x%" PRIx64,
- m_result_name.GetCString(),
- m_result_type.GetByteSize(nullptr).getValueOr(0));
+ LLDB_LOG(log, "Creating a new result global: \"{0}\" with size {1}",
+ m_result_name, m_result_type.GetByteSize(nullptr).getValueOr(0));
// Construct a new result global and set up its metadata
@@ -362,9 +355,8 @@ bool IRForTarget::CreateResultVariable(l
m_module->getNamedMetadata("clang.global.decl.ptrs");
named_metadata->addOperand(persistent_global_md);
- LLDB_LOGF(log, "Replacing \"%s\" with \"%s\"",
- PrintValue(result_global).c_str(),
- PrintValue(new_result_global).c_str());
+ LLDB_LOG(log, "Replacing \"{0}\" with \"{1}\"", PrintValue(result_global),
+ PrintValue(new_result_global));
if (result_global->use_empty()) {
// We need to synthesize a store for this variable, because otherwise
@@ -377,7 +369,7 @@ bool IRForTarget::CreateResultVariable(l
return false;
if (!result_global->hasInitializer()) {
- LLDB_LOGF(log, "Couldn't find initializer for unused variable");
+ LLDB_LOG(log, "Couldn't find initializer for unused variable");
m_error_stream.Format("Internal error [IRForTarget]: Result variable "
"({0}) has no writes and no initializer\n",
@@ -391,8 +383,8 @@ bool IRForTarget::CreateResultVariable(l
StoreInst *synthesized_store =
new StoreInst(initializer, new_result_global, first_entry_instruction);
- LLDB_LOGF(log, "Synthesized result store \"%s\"\n",
- PrintValue(synthesized_store).c_str());
+ LLDB_LOG(log, "Synthesized result store \"{0}\"\n",
+ PrintValue(synthesized_store));
} else {
result_global->replaceAllUsesWith(new_result_global);
}
@@ -437,8 +429,8 @@ bool IRForTarget::RewriteObjCConstString
return false;
}
- LLDB_LOGF(log, "Found CFStringCreateWithBytes at 0x%" PRIx64,
- CFStringCreateWithBytes_addr);
+ LLDB_LOG(log, "Found CFStringCreateWithBytes at {0}",
+ CFStringCreateWithBytes_addr);
// Build the function type:
//
@@ -531,9 +523,7 @@ bool IRForTarget::RewriteObjCConstString
if (!UnfoldConstant(ns_str, nullptr, CFSCWB_Caller, m_entry_instruction_finder,
m_error_stream)) {
- if (log)
- log->PutCString(
- "Couldn't replace the NSString with the result of the call");
+ LLDB_LOG(log, "Couldn't replace the NSString with the result of the call");
m_error_stream.Printf("error [IRForTarget internal]: Couldn't replace an "
"Objective-C constant string with a dynamic "
@@ -563,8 +553,7 @@ bool IRForTarget::RewriteObjCConstString
dyn_cast<GlobalVariable>(nsstring_value);
if (!nsstring_global) {
- if (log)
- log->PutCString("NSString variable is not a GlobalVariable");
+ LLDB_LOG(log, "NSString variable is not a GlobalVariable");
m_error_stream.Printf("Internal error [IRForTarget]: An Objective-C "
"constant string is not a global variable\n");
@@ -573,8 +562,7 @@ bool IRForTarget::RewriteObjCConstString
}
if (!nsstring_global->hasInitializer()) {
- if (log)
- log->PutCString("NSString variable does not have an initializer");
+ LLDB_LOG(log, "NSString variable does not have an initializer");
m_error_stream.Printf("Internal error [IRForTarget]: An Objective-C "
"constant string does not have an initializer\n");
@@ -586,9 +574,8 @@ bool IRForTarget::RewriteObjCConstString
dyn_cast<ConstantStruct>(nsstring_global->getInitializer());
if (!nsstring_struct) {
- if (log)
- log->PutCString(
- "NSString variable's initializer is not a ConstantStruct");
+ LLDB_LOG(log,
+ "NSString variable's initializer is not a ConstantStruct");
m_error_stream.Printf("Internal error [IRForTarget]: An Objective-C "
"constant string is not a structure constant\n");
@@ -606,11 +593,11 @@ bool IRForTarget::RewriteObjCConstString
// };
if (nsstring_struct->getNumOperands() != 4) {
- if (log)
- LLDB_LOGF(log,
- "NSString variable's initializer structure has an "
- "unexpected number of members. Should be 4, is %d",
- nsstring_struct->getNumOperands());
+
+ LLDB_LOG(log,
+ "NSString variable's initializer structure has an "
+ "unexpected number of members. Should be 4, is {0}",
+ nsstring_struct->getNumOperands());
m_error_stream.Printf("Internal error [IRForTarget]: The struct for an "
"Objective-C constant string is not as "
@@ -622,8 +609,7 @@ bool IRForTarget::RewriteObjCConstString
Constant *nsstring_member = nsstring_struct->getOperand(2);
if (!nsstring_member) {
- if (log)
- log->PutCString("NSString initializer's str element was empty");
+ LLDB_LOG(log, "NSString initializer's str element was empty");
m_error_stream.Printf("Internal error [IRForTarget]: An Objective-C "
"constant string does not have a string "
@@ -635,9 +621,8 @@ bool IRForTarget::RewriteObjCConstString
ConstantExpr *nsstring_expr = dyn_cast<ConstantExpr>(nsstring_member);
if (!nsstring_expr) {
- if (log)
- log->PutCString(
- "NSString initializer's str element is not a ConstantExpr");
+ LLDB_LOG(log,
+ "NSString initializer's str element is not a ConstantExpr");
m_error_stream.Printf("Internal error [IRForTarget]: An Objective-C "
"constant string's string initializer is not "
@@ -657,9 +642,8 @@ bool IRForTarget::RewriteObjCConstString
}
if (!cstr_global) {
- if (log)
- log->PutCString(
- "NSString initializer's str element is not a GlobalVariable");
+ LLDB_LOG(log,
+ "NSString initializer's str element is not a GlobalVariable");
m_error_stream.Printf("Internal error [IRForTarget]: Unhandled"
"constant string initializer\n");
@@ -668,9 +652,8 @@ bool IRForTarget::RewriteObjCConstString
}
if (!cstr_global->hasInitializer()) {
- if (log)
- log->PutCString("NSString initializer's str element does not have an "
- "initializer");
+ LLDB_LOG(log, "NSString initializer's str element does not have an "
+ "initializer");
m_error_stream.Printf("Internal error [IRForTarget]: An Objective-C "
"constant string's string initializer doesn't "
@@ -712,21 +695,18 @@ bool IRForTarget::RewriteObjCConstString
ConstantDataArray *cstr_array =
dyn_cast<ConstantDataArray>(cstr_global->getInitializer());
- if (log) {
- if (cstr_array)
- LLDB_LOG(log, "Found NSString constant {0}, which contains \"{1}\"",
- value_name, cstr_array->getAsString());
- else
- LLDB_LOG(log, "Found NSString constant {0}, which contains \"\"",
- value_name);
- }
+ if (cstr_array)
+ LLDB_LOG(log, "Found NSString constant {0}, which contains \"{1}\"",
+ value_name, cstr_array->getAsString());
+ else
+ LLDB_LOG(log, "Found NSString constant {0}, which contains \"\"",
+ value_name);
if (!cstr_array)
cstr_global = nullptr;
if (!RewriteObjCConstString(nsstring_global, cstr_global)) {
- if (log)
- log->PutCString("Error rewriting the constant string");
+ LLDB_LOG(log, "Error rewriting the constant string");
// We don't print an error message here because RewriteObjCConstString
// has done so for us.
@@ -743,9 +723,8 @@ bool IRForTarget::RewriteObjCConstString
GlobalVariable *gv = dyn_cast<GlobalVariable>(value_symbol.second);
if (!gv) {
- if (log)
- log->PutCString(
- "__CFConstantStringClassReference is not a global variable");
+ LLDB_LOG(log,
+ "__CFConstantStringClassReference is not a global variable");
m_error_stream.Printf("Internal error [IRForTarget]: Found a "
"CFConstantStringClassReference, but it is not a "
@@ -833,9 +812,8 @@ bool IRForTarget::RewriteObjCSelector(In
std::string omvn_initializer_string = omvn_initializer_array->getAsString();
- if (log)
- LLDB_LOGF(log, "Found Objective-C selector reference \"%s\"",
- omvn_initializer_string.c_str());
+ LLDB_LOG(log, "Found Objective-C selector reference \"{0}\"",
+ omvn_initializer_string);
// Construct a call to sel_registerName
@@ -849,9 +827,7 @@ bool IRForTarget::RewriteObjCSelector(In
if (sel_registerName_addr == LLDB_INVALID_ADDRESS || missing_weak)
return false;
- if (log)
- LLDB_LOGF(log, "Found sel_registerName at 0x%" PRIx64,
- sel_registerName_addr);
+ LLDB_LOG(log, "Found sel_registerName at {0}", sel_registerName_addr);
// Build the function type: struct objc_selector
// *sel_registerName(uint8_t*)
@@ -919,9 +895,7 @@ bool IRForTarget::RewriteObjCSelectors(B
"static reference to an Objective-C selector to a "
"dynamic reference\n");
- if (log)
- log->PutCString(
- "Couldn't rewrite a reference to an Objective-C selector");
+ LLDB_LOG(log, "Couldn't rewrite a reference to an Objective-C selector");
return false;
}
@@ -997,9 +971,8 @@ bool IRForTarget::RewriteObjCClassRefere
std::string ocn_initializer_string = ocn_initializer_array->getAsString();
- if (log)
- LLDB_LOGF(log, "Found Objective-C class reference \"%s\"",
- ocn_initializer_string.c_str());
+ LLDB_LOG(log, "Found Objective-C class reference \"{0}\"",
+ ocn_initializer_string);
// Construct a call to objc_getClass
@@ -1013,8 +986,7 @@ bool IRForTarget::RewriteObjCClassRefere
if (objc_getClass_addr == LLDB_INVALID_ADDRESS || missing_weak)
return false;
- if (log)
- LLDB_LOGF(log, "Found objc_getClass at 0x%" PRIx64, objc_getClass_addr);
+ LLDB_LOG(log, "Found objc_getClass at {0}", objc_getClass_addr);
// Build the function type: %struct._objc_class *objc_getClass(i8*)
@@ -1076,9 +1048,7 @@ bool IRForTarget::RewriteObjCClassRefere
"static reference to an Objective-C class to a "
"dynamic reference\n");
- if (log)
- log->PutCString(
- "Couldn't rewrite a reference to an Objective-C class");
+ LLDB_LOG(log, "Couldn't rewrite a reference to an Objective-C class");
return false;
}
@@ -1147,9 +1117,8 @@ bool IRForTarget::RewritePersistentAlloc
LoadInst *persistent_load = new LoadInst(persistent_global, "", alloc);
- if (log)
- LLDB_LOGF(log, "Replacing \"%s\" with \"%s\"", PrintValue(alloc).c_str(),
- PrintValue(persistent_load).c_str());
+ LLDB_LOG(log, "Replacing \"{0}\" with \"{1}\"", PrintValue(alloc),
+ PrintValue(persistent_load));
alloc->replaceAllUsesWith(persistent_load);
alloc->eraseFromParent();
@@ -1175,8 +1144,7 @@ bool IRForTarget::RewritePersistentAlloc
if (alloc_name.startswith("$") && !alloc_name.startswith("$__lldb")) {
if (alloc_name.find_first_of("0123456789") == 1) {
- if (log)
- LLDB_LOGF(log, "Rejecting a numeric persistent variable.");
+ LLDB_LOG(log, "Rejecting a numeric persistent variable.");
m_error_stream.Printf("Error [IRForTarget]: Names starting with $0, "
"$1, ... are reserved for use as result "
@@ -1195,9 +1163,7 @@ bool IRForTarget::RewritePersistentAlloc
m_error_stream.Printf("Internal error [IRForTarget]: Couldn't rewrite "
"the creation of a persistent variable\n");
- if (log)
- log->PutCString(
- "Couldn't rewrite the creation of a persistent variable");
+ LLDB_LOG(log, "Couldn't rewrite the creation of a persistent variable");
return false;
}
@@ -1213,9 +1179,8 @@ bool IRForTarget::MaterializeInitializer
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
- if (log && log->GetVerbose())
- LLDB_LOGF(log, " MaterializeInitializer(%p, %s)", (void *)data,
- PrintValue(initializer).c_str());
+ LLDB_LOGV(log, " MaterializeInitializer({0}, {1})", (void *)data,
+ PrintValue(initializer));
Type *initializer_type = initializer->getType();
@@ -1277,9 +1242,7 @@ bool IRForTarget::MaybeHandleVariable(Va
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
- if (log)
- LLDB_LOGF(log, "MaybeHandleVariable (%s)",
- PrintValue(llvm_value_ptr).c_str());
+ LLDB_LOG(log, "MaybeHandleVariable ({0})", PrintValue(llvm_value_ptr));
if (ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(llvm_value_ptr)) {
switch (constant_expr->getOpcode()) {
@@ -1305,9 +1268,8 @@ bool IRForTarget::MaybeHandleVariable(Va
if (!global_variable->hasExternalLinkage())
return true;
- if (log)
- LLDB_LOGF(log, "Found global variable \"%s\" without metadata",
- global_variable->getName().str().c_str());
+ LLDB_LOG(log, "Found global variable \"{0}\" without metadata",
+ global_variable->getName());
return false;
}
@@ -1346,23 +1308,19 @@ bool IRForTarget::MaybeHandleVariable(Va
lldb::offset_t value_alignment =
(compiler_type.GetTypeBitAlign() + 7ull) / 8ull;
- if (log) {
- LLDB_LOG(
- log,
- "Type of \"{0}\" is [clang \"{1}\", llvm \"{2}\"] [size {3}, "
- "align {4}]",
- name,
- lldb_private::ClangUtil::GetQualType(compiler_type).getAsString(),
- PrintType(value_type), *value_size, value_alignment);
- }
+ LLDB_LOG(log,
+ "Type of \"{0}\" is [clang \"{1}\", llvm \"{2}\"] [size {3}, "
+ "align {4}]",
+ name,
+ lldb_private::ClangUtil::GetQualType(compiler_type).getAsString(),
+ PrintType(value_type), *value_size, value_alignment);
if (named_decl)
m_decl_map->AddValueToStruct(named_decl, lldb_private::ConstString(name),
llvm_value_ptr, *value_size,
value_alignment);
} else if (dyn_cast<llvm::Function>(llvm_value_ptr)) {
- if (log)
- LLDB_LOGF(log, "Function pointers aren't handled right now");
+ LLDB_LOG(log, "Function pointers aren't handled right now");
return false;
}
@@ -1381,15 +1339,12 @@ bool IRForTarget::HandleSymbol(Value *sy
m_decl_map->GetSymbolAddress(name, lldb::eSymbolTypeAny);
if (symbol_addr == LLDB_INVALID_ADDRESS) {
- if (log)
- LLDB_LOGF(log, "Symbol \"%s\" had no address", name.GetCString());
+ LLDB_LOG(log, "Symbol \"{0}\" had no address", name);
return false;
}
- if (log)
- LLDB_LOGF(log, "Found \"%s\" at 0x%" PRIx64, name.GetCString(),
- symbol_addr);
+ LLDB_LOG(log, "Found \"{0}\" at {1}", name, symbol_addr);
Type *symbol_type = symbol->getType();
@@ -1398,9 +1353,8 @@ bool IRForTarget::HandleSymbol(Value *sy
Value *symbol_addr_ptr =
ConstantExpr::getIntToPtr(symbol_addr_int, symbol_type);
- if (log)
- LLDB_LOGF(log, "Replacing %s with %s", PrintValue(symbol).c_str(),
- PrintValue(symbol_addr_ptr).c_str());
+ LLDB_LOG(log, "Replacing {0} with {1}", PrintValue(symbol),
+ PrintValue(symbol_addr_ptr));
symbol->replaceAllUsesWith(symbol_addr_ptr);
@@ -1411,8 +1365,7 @@ bool IRForTarget::MaybeHandleCallArgumen
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
- if (log)
- LLDB_LOGF(log, "MaybeHandleCallArguments(%s)", PrintValue(Old).c_str());
+ LLDB_LOG(log, "MaybeHandleCallArguments({0})", PrintValue(Old));
for (unsigned op_index = 0, num_ops = Old->getNumArgOperands();
op_index < num_ops; ++op_index)
@@ -1450,9 +1403,8 @@ bool IRForTarget::HandleObjCClass(Value
lldb::addr_t class_ptr =
m_decl_map->GetSymbolAddress(name_cstr, lldb::eSymbolTypeObjCClass);
- if (log)
- LLDB_LOGF(log, "Found reference to Objective-C class %s (0x%llx)",
- name_cstr.AsCString(), (unsigned long long)class_ptr);
+ LLDB_LOG(log, "Found reference to Objective-C class {0} ({1})", name,
+ (unsigned long long)class_ptr);
if (class_ptr == LLDB_INVALID_ADDRESS)
return false;
@@ -1537,9 +1489,8 @@ bool IRForTarget::ResolveExternals(Funct
for (GlobalVariable &global_var : m_module->globals()) {
llvm::StringRef global_name = global_var.getName();
- if (log)
- LLDB_LOG(log, "Examining {0}, DeclForGlobalValue returns {1}",
- global_name, static_cast<void *>(DeclForGlobal(&global_var)));
+ LLDB_LOG(log, "Examining {0}, DeclForGlobalValue returns {1}", global_name,
+ static_cast<void *>(DeclForGlobal(&global_var)));
if (global_name.startswith("OBJC_IVAR")) {
if (!HandleSymbol(&global_var)) {
@@ -1769,8 +1720,7 @@ bool IRForTarget::ReplaceVariables(Funct
m_decl_map->DoStructLayout();
- if (log)
- LLDB_LOGF(log, "Element arrangement:");
+ LLDB_LOG(log, "Element arrangement:");
uint32_t num_elements;
uint32_t element_index;
@@ -1844,8 +1794,7 @@ bool IRForTarget::ReplaceVariables(Funct
return false;
}
- if (log)
- LLDB_LOG(log, "Arg: \"{0}\"", PrintValue(argument));
+ LLDB_LOG(log, "Arg: \"{0}\"", PrintValue(argument));
BasicBlock &entry_block(llvm_function.getEntryBlock());
Instruction *FirstEntryInstruction(entry_block.getFirstNonPHIOrDbg());
@@ -1882,13 +1831,11 @@ bool IRForTarget::ReplaceVariables(Funct
return false;
}
- if (log)
- LLDB_LOG(log, " \"{0}\" (\"{1}\") placed at %" PRIu64, name,
- decl->getNameAsString(), offset);
+ LLDB_LOG(log, " \"{0}\" (\"{1}\") placed at {2}", name,
+ decl->getNameAsString(), offset);
if (value) {
- if (log)
- LLDB_LOG(log, " Replacing [{0}]", PrintValue(value));
+ LLDB_LOG(log, " Replacing [{0}]", PrintValue(value));
FunctionValueCache body_result_maker(
[this, name, offset_type, offset, argument,
@@ -1937,9 +1884,8 @@ bool IRForTarget::ReplaceVariables(Funct
value->replaceAllUsesWith(
body_result_maker.GetValue(instruction->getParent()->getParent()));
} else {
- if (log)
- LLDB_LOG(log, "Unhandled non-constant type: \"{0}\"",
- PrintValue(value));
+ LLDB_LOG(log, "Unhandled non-constant type: \"{0}\"",
+ PrintValue(value));
return false;
}
@@ -1948,9 +1894,8 @@ bool IRForTarget::ReplaceVariables(Funct
}
}
- if (log)
- LLDB_LOG(log, "Total structure [align {0}, size {1}]", (int64_t)alignment,
- (uint64_t)size);
+ LLDB_LOG(log, "Total structure [align {0}, size {1}]", (int64_t)alignment,
+ (uint64_t)size);
return true;
}
@@ -2002,8 +1947,7 @@ bool IRForTarget::runOnModule(Module &ll
: m_module->getFunction(m_func_name.GetStringRef());
if (!m_func_name.IsEmpty() && !main_function) {
- if (log)
- LLDB_LOG(log, "Couldn't find \"{0}()\" in the module", m_func_name);
+ LLDB_LOG(log, "Couldn't find \"{0}()\" in the module", m_func_name);
m_error_stream.Format("Internal error [IRForTarget]: Couldn't find wrapper "
"'{0}' in the module",
@@ -2014,8 +1958,7 @@ bool IRForTarget::runOnModule(Module &ll
if (main_function) {
if (!FixFunctionLinkage(*main_function)) {
- if (log)
- LLDB_LOGF(log, "Couldn't fix the linkage for the function");
+ LLDB_LOG(log, "Couldn't fix the linkage for the function");
return false;
}
@@ -2035,8 +1978,7 @@ bool IRForTarget::runOnModule(Module &ll
if (main_function) {
if (!CreateResultVariable(*main_function)) {
- if (log)
- LLDB_LOGF(log, "CreateResultVariable() failed");
+ LLDB_LOG(log, "CreateResultVariable() failed");
// CreateResultVariable() reports its own errors, so we don't do so here
@@ -2058,8 +2000,7 @@ bool IRForTarget::runOnModule(Module &ll
for (llvm::Function &function : *m_module) {
for (BasicBlock &bb : function) {
if (!RemoveGuards(bb)) {
- if (log)
- LLDB_LOGF(log, "RemoveGuards() failed");
+ LLDB_LOG(log, "RemoveGuards() failed");
// RemoveGuards() reports its own errors, so we don't do so here
@@ -2067,8 +2008,7 @@ bool IRForTarget::runOnModule(Module &ll
}
if (!RewritePersistentAllocs(bb)) {
- if (log)
- LLDB_LOGF(log, "RewritePersistentAllocs() failed");
+ LLDB_LOG(log, "RewritePersistentAllocs() failed");
// RewritePersistentAllocs() reports its own errors, so we don't do so
// here
@@ -2077,8 +2017,7 @@ bool IRForTarget::runOnModule(Module &ll
}
if (!RemoveCXAAtExit(bb)) {
- if (log)
- LLDB_LOGF(log, "RemoveCXAAtExit() failed");
+ LLDB_LOG(log, "RemoveCXAAtExit() failed");
// RemoveCXAAtExit() reports its own errors, so we don't do so here
@@ -2092,8 +2031,7 @@ bool IRForTarget::runOnModule(Module &ll
//
if (!RewriteObjCConstStrings()) {
- if (log)
- LLDB_LOGF(log, "RewriteObjCConstStrings() failed");
+ LLDB_LOG(log, "RewriteObjCConstStrings() failed");
// RewriteObjCConstStrings() reports its own errors, so we don't do so here
@@ -2103,8 +2041,7 @@ bool IRForTarget::runOnModule(Module &ll
for (llvm::Function &function : *m_module) {
for (llvm::BasicBlock &bb : function) {
if (!RewriteObjCSelectors(bb)) {
- if (log)
- LLDB_LOGF(log, "RewriteObjCSelectors() failed");
+ LLDB_LOG(log, "RewriteObjCSelectors() failed");
// RewriteObjCSelectors() reports its own errors, so we don't do so
// here
@@ -2113,8 +2050,7 @@ bool IRForTarget::runOnModule(Module &ll
}
if (!RewriteObjCClassReferences(bb)) {
- if (log)
- LLDB_LOGF(log, "RewriteObjCClassReferences() failed");
+ LLDB_LOG(log, "RewriteObjCClassReferences() failed");
// RewriteObjCClasses() reports its own errors, so we don't do so here
@@ -2126,8 +2062,7 @@ bool IRForTarget::runOnModule(Module &ll
for (llvm::Function &function : *m_module) {
for (BasicBlock &bb : function) {
if (!ResolveCalls(bb)) {
- if (log)
- LLDB_LOGF(log, "ResolveCalls() failed");
+ LLDB_LOG(log, "ResolveCalls() failed");
// ResolveCalls() reports its own errors, so we don't do so here
@@ -2142,8 +2077,7 @@ bool IRForTarget::runOnModule(Module &ll
if (main_function) {
if (!ResolveExternals(*main_function)) {
- if (log)
- LLDB_LOGF(log, "ResolveExternals() failed");
+ LLDB_LOG(log, "ResolveExternals() failed");
// ResolveExternals() reports its own errors, so we don't do so here
@@ -2151,8 +2085,7 @@ bool IRForTarget::runOnModule(Module &ll
}
if (!ReplaceVariables(*main_function)) {
- if (log)
- LLDB_LOGF(log, "ReplaceVariables() failed");
+ LLDB_LOG(log, "ReplaceVariables() failed");
// ReplaceVariables() reports its own errors, so we don't do so here
More information about the lldb-commits
mailing list