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
diff --git a/lldb/tools/debugserver/source/JSONGenerator.h b/lldb/tools/debugserver/source/JSONGenerator.h
index 6c6a625..0ac5e0b 100644
--- a/lldb/tools/debugserver/source/JSONGenerator.h
+++ b/lldb/tools/debugserver/source/JSONGenerator.h
@@ -182,7 +182,7 @@
     void SetValue(bool value) { m_value = value; }
 
     void Dump(std::ostream &s) const override {
-      if (m_value == true)
+      if (m_value)
         s << "true";
       else
         s << "false";
@@ -262,7 +262,7 @@
       s << "{";
       for (collection::const_iterator iter = m_dict.begin();
            iter != m_dict.end(); ++iter) {
-        if (have_printed_one_elem == false) {
+        if (!have_printed_one_elem) {
           have_printed_one_elem = true;
         } else {
           s << ",";
diff --git a/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp b/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp
index 22ff52a..1473a53 100644
--- a/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/Genealogy.cpp
@@ -74,8 +74,7 @@
   // (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 edbd012..a3b905d 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -783,8 +783,8 @@
     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 @@
 
 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 @@
     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 @@
     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 @@
       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 fc97825..062e1c3 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
@@ -83,7 +83,7 @@
   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 @@
   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 c011c13..172fc78 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachVMRegion.cpp
@@ -166,10 +166,7 @@
   // 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 adcd650..ba37a32 100644
--- a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
@@ -889,10 +889,7 @@
       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 @@
     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 f0a3d2b..2f8ed32 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 @@
       "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 @@
     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/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index bfcd799..c8ef153 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -3413,10 +3413,7 @@
   RNBRemoteSP remoteSP(g_remoteSP);
   if (remoteSP.get() != NULL) {
     RNBRemote *remote = remoteSP.get();
-    if (remote->Comm().IsConnected())
-      return false;
-    else
-      return true;
+    return !remote->Comm().IsConnected();
   }
   return true;
 }
@@ -3817,7 +3814,7 @@
             attach_failed_due_to_sip = true;
           }
 
-          if (attach_failed_due_to_sip == false) {
+          if (!attach_failed_due_to_sip) {
             int csops_flags = 0;
             int retval = ::csops(pid_attaching_to, CS_OPS_STATUS, &csops_flags,
                                  sizeof(csops_flags));
@@ -5300,7 +5297,7 @@
 
       thread_dict_sp->AddStringItem("reason", reason_value);
 
-      if (threads_with_valid_stop_info_only == false) {
+      if (!threads_with_valid_stop_info_only) {
         const char *thread_name = DNBThreadGetName(pid, tid);
         if (thread_name && thread_name[0])
           thread_dict_sp->AddStringItem("name", thread_name);
@@ -5488,7 +5485,7 @@
 
       bool need_to_print_comma = false;
 
-      if (thread_activity_sp && timed_out == false) {
+      if (thread_activity_sp && !timed_out) {
         const Genealogy::Activity *activity =
             &thread_activity_sp->current_activity;
         bool need_vouchers_comma_sep = false;
diff --git a/lldb/tools/debugserver/source/RNBServices.cpp b/lldb/tools/debugserver/source/RNBServices.cpp
index b2f4910..89c4c27 100644
--- a/lldb/tools/debugserver/source/RNBServices.cpp
+++ b/lldb/tools/debugserver/source/RNBServices.cpp
@@ -57,9 +57,9 @@
 
       const pid_t pid = proc_info.kp_proc.p_pid;
       // Skip zombie processes and processes with unset status
-      if (kinfo_user_matches == false || // User is acceptable
-          pid == our_pid ||              // Skip this process
-          pid == 0 ||                    // Skip kernel (kernel pid is zero)
+      if (!kinfo_user_matches || // User is acceptable
+          pid == our_pid ||      // Skip this process
+          pid == 0 ||            // Skip kernel (kernel pid is zero)
           proc_info.kp_proc.p_stat ==
               SZOMB || // Zombies are bad, they like brains...
           proc_info.kp_proc.p_flag & P_TRACED || // Being debugged?
diff --git a/lldb/tools/debugserver/source/libdebugserver.cpp b/lldb/tools/debugserver/source/libdebugserver.cpp
index 0d27cfd..34df675 100644
--- a/lldb/tools/debugserver/source/libdebugserver.cpp
+++ b/lldb/tools/debugserver/source/libdebugserver.cpp
@@ -176,7 +176,7 @@
   case eStateSuspended:
   case eStateCrashed:
   case eStateStopped:
-    if (initialize == false) {
+    if (!initialize) {
       // Compare the last stop count to our current notion of a stop count
       // to make sure we don't notify more than once for a given stop.
       nub_size_t prev_pid_stop_count = ctx.GetProcessStopCount();