diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-12-15 00:15:33 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-12-15 00:15:33 +0000 |
| commit | a6682a413d893bc1ed6190dfadcee806155da66e (patch) | |
| tree | 326b3a6e484e3a3a3a5087663e1284f9b594f2a8 /lldb/tools/debugserver/source/MacOSX | |
| parent | 9d1827331f3f9582fa2ed05913ae4301f2604a19 (diff) | |
| download | bcm5719-llvm-a6682a413d893bc1ed6190dfadcee806155da66e.tar.gz bcm5719-llvm-a6682a413d893bc1ed6190dfadcee806155da66e.zip | |
Simplify Boolean expressions
This patch simplifies boolean expressions acorss LLDB. It was generated
using clang-tidy with the following command:
run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD
Differential revision: https://reviews.llvm.org/D55584
llvm-svn: 349215
Diffstat (limited to 'lldb/tools/debugserver/source/MacOSX')
6 files changed, 14 insertions, 24 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp b/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp index 22ff52abaa4..1473a53fcbe 100644 --- a/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp +++ b/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp @@ -74,8 +74,7 @@ Genealogy::GetGenealogyInfoForThread(pid_t pid, nub_thread_t tid, // (else we'll need to hit the timeout for every thread we're asked about.) // We'll try again at the next public stop. - if (m_thread_activities.size() == 0 && - m_diagnosticd_call_timed_out == false) { + if (m_thread_activities.size() == 0 && !m_diagnosticd_call_timed_out) { GetActivities(pid, thread_list, task); } std::map<nub_thread_t, ThreadActivitySP>::const_iterator search; diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm index edbd012e6e2..a3b905d0515 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm @@ -783,8 +783,8 @@ JSONGenerator::ObjectSP MachProcess::FormatDynamicLibrariesIntoJSON( uuid_unparse_upper(image_infos[i].macho_info.uuid, uuidstr); image_info_dict_sp->AddStringItem("uuid", uuidstr); - if (image_infos[i].macho_info.min_version_os_name.empty() == false && - image_infos[i].macho_info.min_version_os_version.empty() == false) { + if (!image_infos[i].macho_info.min_version_os_name.empty() && + !image_infos[i].macho_info.min_version_os_version.empty()) { image_info_dict_sp->AddStringItem( "min_version_os_name", image_infos[i].macho_info.min_version_os_name); image_info_dict_sp->AddStringItem( @@ -1602,7 +1602,7 @@ nub_size_t MachProcess::WriteMemory(nub_addr_t addr, nub_size_t size, void MachProcess::ReplyToAllExceptions() { PTHREAD_MUTEX_LOCKER(locker, m_exception_messages_mutex); - if (m_exception_messages.empty() == false) { + if (!m_exception_messages.empty()) { MachException::Message::iterator pos; MachException::Message::iterator begin = m_exception_messages.begin(); MachException::Message::iterator end = m_exception_messages.end(); @@ -1774,7 +1774,7 @@ bool MachProcess::DisableBreakpoint(nub_addr_t addr, bool remove) { if (bp->IsHardware()) { bool hw_disable_result = m_thread_list.DisableHardwareBreakpoint(bp); - if (hw_disable_result == true) { + if (hw_disable_result) { bp->SetEnabled(false); // Let the thread list know that a breakpoint has been modified if (remove) { @@ -1909,7 +1909,7 @@ bool MachProcess::DisableWatchpoint(nub_addr_t addr, bool remove) { if (wp->IsHardware()) { bool hw_disable_result = m_thread_list.DisableHardwareWatchpoint(wp); - if (hw_disable_result == true) { + if (hw_disable_result) { wp->SetEnabled(false); if (remove) m_watchpoints.Remove(addr); @@ -2179,7 +2179,7 @@ task_t MachProcess::ExceptionMessageBundleComplete() { m_thread_list.Dump(); bool step_more = false; - if (m_thread_list.ShouldStop(step_more) && auto_resume == false) { + if (m_thread_list.ShouldStop(step_more) && !auto_resume) { // Wait for the eEventProcessRunningStateChanged event to be reset // before changing state to stopped to avoid race condition with // very fast start/stops diff --git a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp index fc97825786a..062e1c3d9ed 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp @@ -83,7 +83,7 @@ bool MachThread::SetSuspendCountBeforeResume(bool others_stopped) { DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__); DNBError err; - if (MachPortNumberIsValid(m_mach_port_number) == false) + if (!MachPortNumberIsValid(m_mach_port_number)) return false; integer_t times_to_resume; @@ -121,7 +121,7 @@ bool MachThread::RestoreSuspendCountAfterStop() { DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::%s ( )", __FUNCTION__); DNBError err; - if (MachPortNumberIsValid(m_mach_port_number) == false) + if (!MachPortNumberIsValid(m_mach_port_number)) return false; if (m_suspend_count > 0) { diff --git a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp index c011c133ac3..172fc7867b5 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp @@ -166,10 +166,7 @@ bool MachVMRegion::GetRegionForAddress(nub_addr_t addr) { // doesn't mean that "addr" is in the range. The data in this object will // be valid though, so you could see where the next region begins. So we // return false, yet leave "m_err" with a successfull return code. - if ((addr < m_start) || (addr >= (m_start + m_size))) - return false; - - return true; + return !((addr < m_start) || (addr >= (m_start + m_size))); } uint32_t MachVMRegion::GetDNBPermissions() const { diff --git a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp index adcd6500219..ba37a328ecf 100644 --- a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp +++ b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp @@ -889,10 +889,7 @@ bool DNBArchImplI386::RollbackTransForHWP() { LOG_WATCHPOINTS, "DNBArchImplI386::RollbackTransForHWP() SetDBGState() => 0x%8.8x.", kret); - if (kret == KERN_SUCCESS) - return true; - else - return false; + return kret == KERN_SUCCESS; } bool DNBArchImplI386::FinishTransForHWP() { m_2pc_trans_state = Trans_Done; @@ -918,7 +915,7 @@ uint32_t DNBArchImplI386::EnableHardwareWatchpoint(nub_addr_t addr, return INVALID_NUB_HW_INDEX; // We must watch for either read or write - if (read == false && write == false) + if (!read && !write) return INVALID_NUB_HW_INDEX; // Read the debug state diff --git a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp index f0a3d2b001b..2f8ed32fa5d 100644 --- a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp +++ b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp @@ -844,10 +844,7 @@ bool DNBArchImplX86_64::RollbackTransForHWP() { "DNBArchImplX86_64::RollbackTransForHWP() SetDBGState() => 0x%8.8x.", kret); - if (kret == KERN_SUCCESS) - return true; - else - return false; + return kret == KERN_SUCCESS; } bool DNBArchImplX86_64::FinishTransForHWP() { m_2pc_trans_state = Trans_Done; @@ -873,7 +870,7 @@ uint32_t DNBArchImplX86_64::EnableHardwareWatchpoint(nub_addr_t addr, return INVALID_NUB_HW_INDEX; // We must watch for either read or write - if (read == false && write == false) + if (!read && !write) return INVALID_NUB_HW_INDEX; // Read the debug state |

