From 248a13057a4adbdb8d511b1458daf39d01a4b520 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Thu, 23 May 2019 11:14:47 +0000 Subject: [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 --- .../Plugins/Process/Utility/RegisterContextLLDB.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp') diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index ecda5556e60..4ec8bba0981 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -113,7 +113,7 @@ void RegisterContextLLDB::InitializeZerothFrame() { ExecutionContext exe_ctx(m_thread.shared_from_this()); RegisterContextSP reg_ctx_sp = m_thread.GetRegisterContext(); - if (reg_ctx_sp.get() == NULL) { + if (reg_ctx_sp.get() == nullptr) { m_frame_type = eNotAValidFrame; UnwindLogMsg("frame does not have a register context"); return; @@ -664,7 +664,7 @@ UnwindPlanSP RegisterContextLLDB::GetFastUnwindPlanForFrame() { ModuleSP pc_module_sp(m_current_pc.GetModule()); if (!m_current_pc.IsValid() || !pc_module_sp || - pc_module_sp->GetObjectFile() == NULL) + pc_module_sp->GetObjectFile() == nullptr) return unwind_plan_sp; if (IsFrameZero()) @@ -715,7 +715,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { UnwindPlanSP arch_default_unwind_plan_sp; ExecutionContext exe_ctx(m_thread.shared_from_this()); Process *process = exe_ctx.GetProcessPtr(); - ABI *abi = process ? process->GetABI().get() : NULL; + ABI *abi = process ? process->GetABI().get() : nullptr; if (abi) { arch_default_unwind_plan_sp = std::make_shared(lldb::eRegisterKindGeneric); @@ -743,7 +743,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // This is for jumping to memory regions without any information available. if ((!m_sym_ctx_valid || - (m_sym_ctx.function == NULL && m_sym_ctx.symbol == NULL)) && + (m_sym_ctx.function == nullptr && m_sym_ctx.symbol == nullptr)) && behaves_like_zeroth_frame && m_current_pc.IsValid()) { uint32_t permissions; addr_t current_pc_addr = @@ -765,7 +765,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // No Module for the current pc, try using the architecture default unwind. ModuleSP pc_module_sp(m_current_pc.GetModule()); if (!m_current_pc.IsValid() || !pc_module_sp || - pc_module_sp->GetObjectFile() == NULL) { + pc_module_sp->GetObjectFile() == nullptr) { m_frame_type = eNormalFrame; return arch_default_unwind_plan_sp; } @@ -1349,7 +1349,7 @@ RegisterContextLLDB::SavedLocationForRegister( // register, we may be able to fall back to some ABI-defined default. For // example, some ABIs allow to determine the caller's SP via the CFA. Also, // the ABI may set volatile registers to the undefined state. - ABI *abi = process ? process->GetABI().get() : NULL; + ABI *abi = process ? process->GetABI().get() : nullptr; if (abi) { const RegisterInfo *reg_info = GetRegisterInfoAtIndex(regnum.GetAsKind(eRegisterKindLLDB)); @@ -1702,10 +1702,10 @@ bool RegisterContextLLDB::TryFallbackUnwindPlan() { } bool RegisterContextLLDB::ForceSwitchToFallbackUnwindPlan() { - if (m_fallback_unwind_plan_sp.get() == NULL) + if (m_fallback_unwind_plan_sp.get() == nullptr) return false; - if (m_full_unwind_plan_sp.get() == NULL) + if (m_full_unwind_plan_sp.get() == nullptr) return false; if (m_full_unwind_plan_sp.get() == m_fallback_unwind_plan_sp.get() || @@ -2067,7 +2067,7 @@ void RegisterContextLLDB::UnwindLogMsg(const char *fmt, ...) { va_start(args, fmt); char *logmsg; - if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == NULL) { + if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == nullptr) { if (logmsg) free(logmsg); va_end(args); @@ -2088,7 +2088,7 @@ void RegisterContextLLDB::UnwindLogMsgVerbose(const char *fmt, ...) { va_start(args, fmt); char *logmsg; - if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == NULL) { + if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == nullptr) { if (logmsg) free(logmsg); va_end(args); -- cgit v1.2.3