diff options
author | Konrad Kleine <kkleine@redhat.com> | 2019-05-23 11:14:47 +0000 |
---|---|---|
committer | Konrad Kleine <kkleine@redhat.com> | 2019-05-23 11:14:47 +0000 |
commit | 248a13057a4adbdb8d511b1458daf39d01a4b520 (patch) | |
tree | 1209fb0822f0c14237eb9935e30da465014a6eda /lldb/source/Expression | |
parent | 32d976bac194d78656974e3e05bf52997a06f509 (diff) | |
download | bcm5719-llvm-248a13057a4adbdb8d511b1458daf39d01a4b520.tar.gz bcm5719-llvm-248a13057a4adbdb8d511b1458daf39d01a4b520.zip |
[lldb] NFC modernize codebase with modernize-use-nullptr
Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]
This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.
This is the command I ran and I to fix and format the code base:
```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```
NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.
NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.
Reviewers: martong, espindola, shafik, #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits
Tags: #lldb, #llvm
Differential Revision: https://reviews.llvm.org/D61847
llvm-svn: 361484
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r-- | lldb/source/Expression/DWARFExpression.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Expression/ExpressionVariable.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Expression/FunctionCaller.cpp | 21 | ||||
-rw-r--r-- | lldb/source/Expression/IRExecutionUnit.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Expression/IRInterpreter.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Expression/IRMemoryMap.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Expression/LLVMUserExpression.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Expression/UserExpression.cpp | 6 |
8 files changed, 28 insertions, 29 deletions
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 45c42dfad81..c86def753d9 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -649,7 +649,7 @@ static bool ReadRegisterValueAsScalar(RegisterContext *reg_ctx, lldb::RegisterKind reg_kind, uint32_t reg_num, Status *error_ptr, Value &value) { - if (reg_ctx == NULL) { + if (reg_ctx == nullptr) { if (error_ptr) error_ptr->SetErrorStringWithFormat("No register context in frame.\n"); } else { @@ -1249,7 +1249,7 @@ bool DWARFExpression::Evaluate(ExecutionContext *exe_ctx, if (IsLocationList()) { lldb::offset_t offset = 0; addr_t pc; - StackFrame *frame = NULL; + StackFrame *frame = nullptr; if (reg_ctx) pc = reg_ctx->GetPC(); else { @@ -1323,14 +1323,14 @@ bool DWARFExpression::Evaluate( } std::vector<Value> stack; - Process *process = NULL; - StackFrame *frame = NULL; + Process *process = nullptr; + StackFrame *frame = nullptr; if (exe_ctx) { process = exe_ctx->GetProcessPtr(); frame = exe_ctx->GetFramePtr(); } - if (reg_ctx == NULL && frame) + if (reg_ctx == nullptr && frame) reg_ctx = frame->GetRegisterContext().get(); if (initial_value_ptr) @@ -3166,7 +3166,7 @@ void DWARFExpression::PrintDWARFLocationList( s.Indent(); if (cu) s.AddressRange(start_addr + base_addr, end_addr + base_addr, - cu->GetAddressByteSize(), NULL, ": "); + cu->GetAddressByteSize(), nullptr, ": "); uint32_t loc_length = debug_loc_data.GetU16(&offset); DataExtractor locationData(debug_loc_data, offset, loc_length); diff --git a/lldb/source/Expression/ExpressionVariable.cpp b/lldb/source/Expression/ExpressionVariable.cpp index faac977cde9..97305dcf5a0 100644 --- a/lldb/source/Expression/ExpressionVariable.cpp +++ b/lldb/source/Expression/ExpressionVariable.cpp @@ -25,7 +25,7 @@ uint8_t *ExpressionVariable::GetValueBytes() { return const_cast<uint8_t *>( m_frozen_sp->GetDataExtractor().GetDataStart()); } - return NULL; + return nullptr; } PersistentExpressionState::~PersistentExpressionState() {} diff --git a/lldb/source/Expression/FunctionCaller.cpp b/lldb/source/Expression/FunctionCaller.cpp index 5f5e3b86ccd..618c1a13212 100644 --- a/lldb/source/Expression/FunctionCaller.cpp +++ b/lldb/source/Expression/FunctionCaller.cpp @@ -35,10 +35,9 @@ FunctionCaller::FunctionCaller(ExecutionContextScope &exe_scope, const Address &functionAddress, const ValueList &arg_value_list, const char *name) - : Expression(exe_scope, eKindFunctionCaller), - m_execution_unit_sp(), m_parser(), - m_jit_module_wp(), m_name(name ? name : "<unknown>"), - m_function_ptr(NULL), m_function_addr(functionAddress), + : Expression(exe_scope, eKindFunctionCaller), m_execution_unit_sp(), + m_parser(), m_jit_module_wp(), m_name(name ? name : "<unknown>"), + m_function_ptr(nullptr), m_function_addr(functionAddress), m_function_return_type(return_type), m_wrapper_function_name("__lldb_caller_function"), m_wrapper_struct_name("__lldb_caller_struct"), m_wrapper_args_addrs(), @@ -138,7 +137,7 @@ bool FunctionCaller::WriteFunctionArguments( Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) return return_value; lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock()); @@ -239,11 +238,11 @@ lldb::ThreadPlanSP FunctionCaller::GetThreadPlanToCallFunction( // FIXME: Use the errors Stream for better error reporting. Thread *thread = exe_ctx.GetThreadPtr(); - if (thread == NULL) { + if (thread == nullptr) { diagnostic_manager.PutString( eDiagnosticSeverityError, "Can't call a function without a valid thread."); - return NULL; + return nullptr; } // Okay, now run the function: @@ -279,7 +278,7 @@ bool FunctionCaller::FetchFunctionResults(ExecutionContext &exe_ctx, Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) return false; lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock()); @@ -326,7 +325,7 @@ lldb::ExpressionResults FunctionCaller::ExecuteFunction( lldb::addr_t args_addr; - if (args_addr_ptr != NULL) + if (args_addr_ptr != nullptr) args_addr = *args_addr_ptr; else args_addr = LLDB_INVALID_ADDRESS; @@ -376,7 +375,7 @@ lldb::ExpressionResults FunctionCaller::ExecuteFunction( if (exe_ctx.GetProcessPtr()) exe_ctx.GetProcessPtr()->SetRunningUserExpression(false); - if (args_addr_ptr != NULL) + if (args_addr_ptr != nullptr) *args_addr_ptr = args_addr; if (return_value != lldb::eExpressionCompleted) @@ -384,7 +383,7 @@ lldb::ExpressionResults FunctionCaller::ExecuteFunction( FetchFunctionResults(exe_ctx, args_addr, results); - if (args_addr_ptr == NULL) + if (args_addr_ptr == nullptr) DeallocateFunctionResults(exe_ctx, args_addr); return lldb::eExpressionCompleted; diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index 7c0379cdee8..34a3488578c 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -165,8 +165,8 @@ Status IRExecutionUnit::DisassembleFunction(Stream &stream, ArchSpec arch(target->GetArchitecture()); - const char *plugin_name = NULL; - const char *flavor_string = NULL; + const char *plugin_name = nullptr; + const char *flavor_string = nullptr; lldb::DisassemblerSP disassembler_sp = Disassembler::FindPlugin(arch, flavor_string, plugin_name); @@ -251,7 +251,7 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr, std::string s; llvm::raw_string_ostream oss(s); - m_module->print(oss, NULL); + m_module->print(oss, nullptr); oss.flush(); @@ -839,7 +839,7 @@ lldb::addr_t IRExecutionUnit::FindInSymbols( }; if (sc.module_sp) { - sc.module_sp->FindFunctions(spec.name, NULL, spec.mask, + sc.module_sp->FindFunctions(spec.name, nullptr, spec.mask, true, // include_symbols false, // include_inlines true, // append diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index 85eb78f539d..24a3cd24fdd 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -654,7 +654,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, std::string s; raw_string_ostream oss(s); - module.print(oss, NULL); + module.print(oss, nullptr); oss.flush(); diff --git a/lldb/source/Expression/IRMemoryMap.cpp b/lldb/source/Expression/IRMemoryMap.cpp index a8bf6733d8d..70e62ac12b0 100644 --- a/lldb/source/Expression/IRMemoryMap.cpp +++ b/lldb/source/Expression/IRMemoryMap.cpp @@ -263,7 +263,7 @@ ExecutionContextScope *IRMemoryMap::GetBestExecutionContextScope() const { if (target_sp) return target_sp.get(); - return NULL; + return nullptr; } IRMemoryMap::Allocation::Allocation(lldb::addr_t process_alloc, diff --git a/lldb/source/Expression/LLVMUserExpression.cpp b/lldb/source/Expression/LLVMUserExpression.cpp index 6f5972b32bb..5a1b750318c 100644 --- a/lldb/source/Expression/LLVMUserExpression.cpp +++ b/lldb/source/Expression/LLVMUserExpression.cpp @@ -50,7 +50,7 @@ LLVMUserExpression::LLVMUserExpression(ExecutionContextScope &exe_scope, m_allow_objc(false), m_transformed_text(), m_execution_unit_sp(), m_materializer_up(), m_jit_module_wp(), m_enforce_valid_object(true), m_in_cplusplus_method(false), m_in_objectivec_method(false), - m_in_static_method(false), m_needs_object_ptr(false), m_target(NULL), + m_in_static_method(false), m_needs_object_ptr(false), m_target(nullptr), m_can_interpret(false), m_materialized_address(LLDB_INVALID_ADDRESS) {} LLVMUserExpression::~LLVMUserExpression() { @@ -181,7 +181,7 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, if (execution_result == lldb::eExpressionInterrupted || execution_result == lldb::eExpressionHitBreakpoint) { - const char *error_desc = NULL; + const char *error_desc = nullptr; if (call_plan_sp) { lldb::StopInfoSP real_stop_info_sp = call_plan_sp->GetRealStopInfo(); diff --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp index 47aadba3578..a72e2a07599 100644 --- a/lldb/source/Expression/UserExpression.cpp +++ b/lldb/source/Expression/UserExpression.cpp @@ -174,7 +174,7 @@ lldb::ExpressionResults UserExpression::Evaluate( Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL || process->GetState() != lldb::eStateStopped) { + if (process == nullptr || process->GetState() != lldb::eStateStopped) { if (execution_policy == eExecutionPolicyAlways) { if (log) log->Printf("== [UserExpression::Evaluate] Expression may not run, but " @@ -186,7 +186,7 @@ lldb::ExpressionResults UserExpression::Evaluate( } } - if (process == NULL || !process->CanJIT()) + if (process == nullptr || !process->CanJIT()) execution_policy = eExecutionPolicyNever; // We need to set the expression execution thread here, turns out parse can @@ -375,7 +375,7 @@ lldb::ExpressionResults UserExpression::Evaluate( return lldb::eExpressionInterrupted; } - if (result_valobj_sp.get() == NULL) { + if (result_valobj_sp.get() == nullptr) { result_valobj_sp = ValueObjectConstResult::Create( exe_ctx.GetBestExecutionContextScope(), error); } |