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/source/DataFormatters/CXXFunctionPointer.cpp b/lldb/source/DataFormatters/CXXFunctionPointer.cpp
index fad67a9..9059891 100644
--- a/lldb/source/DataFormatters/CXXFunctionPointer.cpp
+++ b/lldb/source/DataFormatters/CXXFunctionPointer.cpp
@@ -38,7 +38,7 @@
 
       Address so_addr;
       Target *target = exe_ctx.GetTargetPtr();
-      if (target && target->GetSectionLoadList().IsEmpty() == false) {
+      if (target && !target->GetSectionLoadList().IsEmpty()) {
         if (target->GetSectionLoadList().ResolveLoadAddress(func_ptr_address,
                                                             so_addr)) {
           so_addr.Dump(&sstr, exe_ctx.GetBestExecutionContextScope(),
diff --git a/lldb/source/DataFormatters/DataVisualization.cpp b/lldb/source/DataFormatters/DataVisualization.cpp
index ee8e1e4..23b8b6e 100644
--- a/lldb/source/DataFormatters/DataVisualization.cpp
+++ b/lldb/source/DataFormatters/DataVisualization.cpp
@@ -145,7 +145,7 @@
 }
 
 void DataVisualization::Categories::Disable(const ConstString &category) {
-  if (GetFormatManager().GetCategory(category)->IsEnabled() == true)
+  if (GetFormatManager().GetCategory(category)->IsEnabled())
     GetFormatManager().DisableCategory(category);
 }
 
@@ -166,7 +166,7 @@
 
 void DataVisualization::Categories::Disable(
     const lldb::TypeCategoryImplSP &category) {
-  if (category.get() && category->IsEnabled() == true)
+  if (category.get() && category->IsEnabled())
     GetFormatManager().DisableCategory(category);
 }
 
diff --git a/lldb/source/DataFormatters/DumpValueObjectOptions.cpp b/lldb/source/DataFormatters/DumpValueObjectOptions.cpp
index 6915196..17f8d00 100644
--- a/lldb/source/DataFormatters/DumpValueObjectOptions.cpp
+++ b/lldb/source/DataFormatters/DumpValueObjectOptions.cpp
@@ -67,7 +67,7 @@
 }
 
 DumpValueObjectOptions &DumpValueObjectOptions::SetShowSummary(bool show) {
-  if (show == false)
+  if (!show)
     SetOmitSummaryDepth(UINT32_MAX);
   else
     SetOmitSummaryDepth(0);
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 82ad6e8..da03c64 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -293,7 +293,7 @@
   uint32_t prio_category = UINT32_MAX;
   for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
     category_sp = GetCategoryAtIndex(category_id);
-    if (category_sp->IsEnabled() == false)
+    if (!category_sp->IsEnabled())
       continue;
     lldb::TypeFormatImplSP format_current_sp =
         category_sp->GetFormatForType(type_sp);
@@ -317,7 +317,7 @@
   uint32_t prio_category = UINT32_MAX;
   for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
     category_sp = GetCategoryAtIndex(category_id);
-    if (category_sp->IsEnabled() == false)
+    if (!category_sp->IsEnabled())
       continue;
     lldb::TypeSummaryImplSP summary_current_sp =
         category_sp->GetSummaryForType(type_sp);
@@ -341,7 +341,7 @@
   uint32_t prio_category = UINT32_MAX;
   for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
     category_sp = GetCategoryAtIndex(category_id);
-    if (category_sp->IsEnabled() == false)
+    if (!category_sp->IsEnabled())
       continue;
     lldb::TypeFilterImplSP filter_current_sp(
         (TypeFilterImpl *)category_sp->GetFilterForType(type_sp).get());
@@ -366,7 +366,7 @@
   uint32_t prio_category = UINT32_MAX;
   for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
     category_sp = GetCategoryAtIndex(category_id);
-    if (category_sp->IsEnabled() == false)
+    if (!category_sp->IsEnabled())
       continue;
     lldb::ScriptedSyntheticChildrenSP synth_current_sp(
         (ScriptedSyntheticChildren *)category_sp->GetSyntheticForType(type_sp)
@@ -406,7 +406,7 @@
   uint32_t prio_category = UINT32_MAX;
   for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
     category_sp = GetCategoryAtIndex(category_id);
-    if (category_sp->IsEnabled() == false)
+    if (!category_sp->IsEnabled())
       continue;
     lldb::TypeValidatorImplSP validator_current_sp(
         category_sp->GetValidatorForType(type_sp).get());
@@ -479,7 +479,7 @@
 bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) {
   // if settings say no oneline whatsoever
   if (valobj.GetTargetSP().get() &&
-      valobj.GetTargetSP()->GetDebugger().GetAutoOneLineSummaries() == false)
+      !valobj.GetTargetSP()->GetDebugger().GetAutoOneLineSummaries())
     return false; // then don't oneline
 
   // if this object has a summary, then ask the summary
@@ -535,7 +535,7 @@
       if (!synth_sp)
         return false;
       // but if we only have them to provide a value, keep going
-      if (synth_sp->MightHaveChildren() == false &&
+      if (!synth_sp->MightHaveChildren() &&
           synth_sp->DoesProvideSyntheticValue())
         is_synth_val = true;
       else
diff --git a/lldb/source/DataFormatters/StringPrinter.cpp b/lldb/source/DataFormatters/StringPrinter.cpp
index 89d7a95..6a000f0 100644
--- a/lldb/source/DataFormatters/StringPrinter.cpp
+++ b/lldb/source/DataFormatters/StringPrinter.cpp
@@ -312,7 +312,7 @@
       utf8_data_end_ptr = utf8_data_ptr + utf8_data_buffer_sp->GetByteSize();
       ConvertFunction(&data_ptr, data_end_ptr, &utf8_data_ptr,
                       utf8_data_end_ptr, llvm::lenientConversion);
-      if (false == zero_is_terminator)
+      if (!zero_is_terminator)
         utf8_data_end_ptr = utf8_data_ptr;
       // needed because the ConvertFunction will change the value of the
       // data_ptr.
diff --git a/lldb/source/DataFormatters/TypeCategory.cpp b/lldb/source/DataFormatters/TypeCategory.cpp
index 0f53f76..5740a09 100644
--- a/lldb/source/DataFormatters/TypeCategory.cpp
+++ b/lldb/source/DataFormatters/TypeCategory.cpp
@@ -157,10 +157,7 @@
 
   else /*if (filter_sp.get() && synth.get())*/
   {
-    if (filter_sp->GetRevision() > synth->GetRevision())
-      pick_synth = false;
-    else
-      pick_synth = true;
+    pick_synth = filter_sp->GetRevision() <= synth->GetRevision();
   }
   if (pick_synth) {
     if (regex_synth && reason)
diff --git a/lldb/source/DataFormatters/TypeCategoryMap.cpp b/lldb/source/DataFormatters/TypeCategoryMap.cpp
index 0cc57fe..3193f27 100644
--- a/lldb/source/DataFormatters/TypeCategoryMap.cpp
+++ b/lldb/source/DataFormatters/TypeCategoryMap.cpp
@@ -118,8 +118,7 @@
 
 void TypeCategoryMap::DisableAllCategories() {
   std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-  Position p = First;
-  for (; false == m_active_categories.empty(); p++) {
+  for (Position p = First; !m_active_categories.empty(); p++) {
     m_active_categories.front()->SetEnabledPosition(p);
     Disable(m_active_categories.front());
   }
diff --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp
index 14ec1ca..1e8bc71 100644
--- a/lldb/source/DataFormatters/TypeFormat.cpp
+++ b/lldb/source/DataFormatters/TypeFormat.cpp
@@ -178,7 +178,7 @@
     }
   } else
     valobj_enum_type = iter->second;
-  if (valobj_enum_type.IsValid() == false)
+  if (!valobj_enum_type.IsValid())
     return false;
   DataExtractor data;
   Status error;
diff --git a/lldb/source/DataFormatters/TypeSummary.cpp b/lldb/source/DataFormatters/TypeSummary.cpp
index 2f7e3a0..492d3ef 100644
--- a/lldb/source/DataFormatters/TypeSummary.cpp
+++ b/lldb/source/DataFormatters/TypeSummary.cpp
@@ -135,7 +135,7 @@
                                             const TypeSummaryOptions &options) {
   dest.clear();
   StreamString stream;
-  if (!m_impl || m_impl(*valobj, stream, options) == false)
+  if (!m_impl || !m_impl(*valobj, stream, options))
     return false;
   dest = stream.GetString();
   return true;
diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
index 0792fdf..0821588 100644
--- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp
+++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
@@ -129,13 +129,13 @@
     }
 
     if (m_valobj->IsSynthetic()) {
-      if (m_options.m_use_synthetic == false) {
+      if (!m_options.m_use_synthetic) {
         ValueObject *non_synthetic = m_valobj->GetNonSyntheticValue().get();
         if (non_synthetic)
           m_valobj = non_synthetic;
       }
     } else {
-      if (m_options.m_use_synthetic == true) {
+      if (m_options.m_use_synthetic) {
         ValueObject *synthetic = m_valobj->GetSyntheticValue().get();
         if (synthetic)
           m_valobj = synthetic;
@@ -166,7 +166,7 @@
 bool ValueObjectPrinter::ShouldPrintValueObject() {
   if (m_should_print == eLazyBoolCalculate)
     m_should_print =
-        (m_options.m_flat_output == false || m_type_flags.Test(eTypeHasValue))
+        (!m_options.m_flat_output || m_type_flags.Test(eTypeHasValue))
             ? eLazyBoolYes
             : eLazyBoolNo;
   return m_should_print == eLazyBoolYes;
@@ -326,7 +326,7 @@
 }
 
 TypeSummaryImpl *ValueObjectPrinter::GetSummaryFormatter(bool null_if_omitted) {
-  if (m_summary_formatter.second == false) {
+  if (!m_summary_formatter.second) {
     TypeSummaryImpl *entry = m_options.m_summary_sp
                                  ? m_options.m_summary_sp.get()
                                  : m_valobj->GetSummaryFormat().get();
@@ -458,7 +458,7 @@
         else
             m_stream->Printf("%s\n", object_desc);        
         return true;
-      } else if (value_printed == false && summary_printed == false)
+      } else if (!value_printed && !summary_printed)
         return true;
       else
         return false;
@@ -625,7 +625,7 @@
   if (!IsAggregate())
     return false;
 
-  if (m_options.m_reveal_empty_aggregates == false) {
+  if (!m_options.m_reveal_empty_aggregates) {
     if (value_printed || summary_printed)
       return false;
   }