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/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index af3c3b4..0b71b2a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -657,7 +657,7 @@
         }
 
         if (byte_size_valid && byte_size == 0 && type_name_cstr &&
-            die.HasChildren() == false &&
+            !die.HasChildren() &&
             sc.comp_unit->GetLanguage() == eLanguageTypeObjC) {
           // Work around an issue with clang at the moment where forward
           // declarations for objective C classes are emitted as:
@@ -895,7 +895,7 @@
           // has child classes or types that require the class to be created
           // for use as their decl contexts the class will be ready to accept
           // these child definitions.
-          if (die.HasChildren() == false) {
+          if (!die.HasChildren()) {
             // No children for this struct/union/class, lets finish it
             if (ClangASTContext::StartTagDeclarationDefinition(clang_type)) {
               ClangASTContext::CompleteTagDeclarationDefinition(clang_type);
@@ -1746,7 +1746,7 @@
                 element_type->GetForwardCompilerType();
 
             if (ClangASTContext::IsCXXClassType(array_element_type) &&
-                array_element_type.GetCompleteType() == false) {
+                !array_element_type.GetCompleteType()) {
               ModuleSP module_sp = die.GetModule();
               if (module_sp) {
                 if (die.GetCU()->GetProducer() == eProducerClang)
@@ -2269,7 +2269,7 @@
             if (type_source_info) {
               CompilerType base_class_type(
                   &m_ast, type_source_info->getType().getAsOpaquePtr());
-              if (base_class_type.GetCompleteType() == false) {
+              if (!base_class_type.GetCompleteType()) {
                 auto module = dwarf->GetObjectFile()->GetModule();
                 module->ReportError(":: Class '%s' has a base class '%s' which "
                                     "does not have a complete definition.",
@@ -2885,7 +2885,7 @@
           break;
         }
 
-        if (is_artificial == false) {
+        if (!is_artificial) {
           Type *member_type = die.ResolveTypeUID(DIERef(encoding_form));
 
           clang::FieldDecl *field_decl = NULL;
@@ -3083,7 +3083,7 @@
               }
 
               if (ClangASTContext::IsCXXClassType(member_clang_type) &&
-                  member_clang_type.GetCompleteType() == false) {
+                  !member_clang_type.GetCompleteType()) {
                 if (die.GetCU()->GetProducer() == eProducerClang)
                   module_sp->ReportError(
                       "DWARF DIE at 0x%8.8x (class %s) has a member variable "
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp
index 1c31d1c..d79acdc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp
@@ -25,7 +25,7 @@
   header.m_version = debug_macro_data.GetU16(offset);
 
   uint8_t flags = debug_macro_data.GetU8(offset);
-  header.m_offset_is_64_bit = flags & OFFSET_SIZE_MASK ? true : false;
+  header.m_offset_is_64_bit = (flags & OFFSET_SIZE_MASK) != 0;
 
   if (flags & DEBUG_LINE_OFFSET_MASK) {
     if (header.m_offset_is_64_bit)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 89be3d6..57d2be9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -648,9 +648,7 @@
 }
 
 bool DWARFUnit::Supports_DW_AT_APPLE_objc_complete_type() {
-  if (GetProducer() == eProducerLLVMGCC)
-    return false;
-  return true;
+  return GetProducer() != eProducerLLVMGCC;
 }
 
 bool DWARFUnit::DW_AT_decl_file_attributes_are_invalid() {
@@ -662,11 +660,8 @@
 bool DWARFUnit::Supports_unnamed_objc_bitfields() {
   if (GetProducer() == eProducerClang) {
     const uint32_t major_version = GetProducerVersionMajor();
-    if (major_version > 425 ||
-        (major_version == 425 && GetProducerVersionUpdate() >= 13))
-      return true;
-    else
-      return false;
+    return major_version > 425 ||
+           (major_version == 425 && GetProducerVersionUpdate() >= 13);
   }
   return true; // Assume all other compilers didn't have incorrect ObjC bitfield
                // info
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 39dfe31..eafdea4 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1679,7 +1679,7 @@
     DWARFUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx);
 
     const DWARFBaseDIE die = dwarf_cu->GetUnitDIEOnly();
-    if (die && die.HasChildren() == false) {
+    if (die && !die.HasChildren()) {
       const char *name = die.GetAttributeValueAsString(DW_AT_name, nullptr);
 
       if (name) {
@@ -2265,7 +2265,7 @@
       sc.block = function_block.FindBlockByID(inlined_die.GetID());
       if (sc.block == NULL)
         sc.block = function_block.FindBlockByID(inlined_die.GetOffset());
-      if (sc.block == NULL || sc.block->GetStartAddress(addr) == false)
+      if (sc.block == NULL || !sc.block->GetStartAddress(addr))
         addr.Clear();
     } else {
       sc.block = NULL;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index fa6ace8..d931ccb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -89,7 +89,7 @@
            idx < oso_end_idx; ++idx) {
         Symbol *exe_symbol = exe_symtab->SymbolAtIndex(idx);
         if (exe_symbol) {
-          if (exe_symbol->IsDebug() == false)
+          if (!exe_symbol->IsDebug())
             continue;
 
           switch (exe_symbol->GetType()) {
@@ -179,7 +179,7 @@
   GetSymbolVendor(bool can_create = true,
                   lldb_private::Stream *feedback_strm = NULL) override {
     // Scope for locker
-    if (m_symfile_ap.get() || can_create == false)
+    if (m_symfile_ap.get() || !can_create)
       return m_symfile_ap.get();
 
     ModuleSP exe_module_sp(m_exe_module_wp.lock());
@@ -1155,7 +1155,7 @@
   // Only search all .o files for the definition if we don't need the
   // implementation because otherwise, with a valid debug map we should have
   // the ObjC class symbol and the code above should have found it.
-  if (must_be_implementation == false) {
+  if (!must_be_implementation) {
     TypeSP type_sp;
 
     ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
@@ -1190,10 +1190,7 @@
     ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
       oso_dwarf->FindTypes(sc, name, parent_decl_ctx, append, max_matches,
                            searched_symbol_files, types);
-      if (types.GetSize() >= max_matches)
-        return true;
-      else
-        return false;
+      return types.GetSize() >= max_matches;
     });
   }
 
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index 37757578..65e718b 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -658,7 +658,7 @@
     CompilerType element_ast_type = element_type->GetForwardCompilerType();
     // If element type is UDT, it needs to be complete.
     if (ClangASTContext::IsCXXClassType(element_ast_type) &&
-        element_ast_type.GetCompleteType() == false) {
+        !element_ast_type.GetCompleteType()) {
       if (ClangASTContext::StartTagDeclarationDefinition(element_ast_type)) {
         ClangASTContext::CompleteTagDeclarationDefinition(element_ast_type);
       } else {