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 | 8a5809b568c427137f614656f89de89f500b585e (patch) | |
tree | 520290f1764cf632f51b4523b2fcf12a62ffece1 | |
parent | aa56a4ca3409605157ef242d3cdd743c6633e476 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@349215 91177308-0d34-0410-b5e6-96231b3b80d8
177 files changed, 599 insertions, 1018 deletions
diff --git a/include/lldb/Core/ModuleSpec.h b/include/lldb/Core/ModuleSpec.h index 697cc860a..ae772c2a1 100644 --- a/include/lldb/Core/ModuleSpec.h +++ b/include/lldb/Core/ModuleSpec.h @@ -255,20 +255,20 @@ public: if (match_module_spec.GetFileSpecPtr()) { const FileSpec &fspec = match_module_spec.GetFileSpec(); if (!FileSpec::Equal(fspec, GetFileSpec(), - fspec.GetDirectory().IsEmpty() == false)) + !fspec.GetDirectory().IsEmpty())) return false; } if (GetPlatformFileSpec() && match_module_spec.GetPlatformFileSpecPtr()) { const FileSpec &fspec = match_module_spec.GetPlatformFileSpec(); if (!FileSpec::Equal(fspec, GetPlatformFileSpec(), - fspec.GetDirectory().IsEmpty() == false)) + !fspec.GetDirectory().IsEmpty())) return false; } // Only match the symbol file spec if there is one in this ModuleSpec if (GetSymbolFileSpec() && match_module_spec.GetSymbolFileSpecPtr()) { const FileSpec &fspec = match_module_spec.GetSymbolFileSpec(); if (!FileSpec::Equal(fspec, GetSymbolFileSpec(), - fspec.GetDirectory().IsEmpty() == false)) + !fspec.GetDirectory().IsEmpty())) return false; } if (match_module_spec.GetArchitecturePtr()) { diff --git a/include/lldb/DataFormatters/TypeCategory.h b/include/lldb/DataFormatters/TypeCategory.h index cb9202d97..177e602e6 100644 --- a/include/lldb/DataFormatters/TypeCategory.h +++ b/include/lldb/DataFormatters/TypeCategory.h @@ -344,7 +344,7 @@ public: bool IsEnabled() const { return m_enabled; } uint32_t GetEnabledPosition() { - if (m_enabled == false) + if (!m_enabled) return UINT32_MAX; else return m_enabled_position; diff --git a/include/lldb/Symbol/Symtab.h b/include/lldb/Symbol/Symtab.h index 7c16d05ee..286e4f48c 100644 --- a/include/lldb/Symbol/Symtab.h +++ b/include/lldb/Symbol/Symtab.h @@ -168,12 +168,12 @@ private: Visibility symbol_visibility) const { switch (symbol_debug_type) { case eDebugNo: - if (m_symbols[idx].IsDebug() == true) + if (m_symbols[idx].IsDebug()) return false; break; case eDebugYes: - if (m_symbols[idx].IsDebug() == false) + if (!m_symbols[idx].IsDebug()) return false; break; diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h index 2c88e3829..4a697e378 100644 --- a/include/lldb/Target/Thread.h +++ b/include/lldb/Target/Thread.h @@ -280,7 +280,7 @@ public: /// message). //------------------------------------------------------------------ StructuredData::ObjectSP GetExtendedInfo() { - if (m_extended_info_fetched == false) { + if (!m_extended_info_fetched) { m_extended_info = FetchThreadExtendedInfo(); m_extended_info_fetched = true; } diff --git a/include/lldb/Utility/StructuredData.h b/include/lldb/Utility/StructuredData.h index d4b589f5b..100b4fa98 100644 --- a/include/lldb/Utility/StructuredData.h +++ b/include/lldb/Utility/StructuredData.h @@ -170,7 +170,7 @@ public: bool ForEach(std::function<bool(Object *object)> const &foreach_callback) const { for (const auto &object_sp : m_items) { - if (foreach_callback(object_sp.get()) == false) + if (!foreach_callback(object_sp.get())) return false; } return true; @@ -359,7 +359,7 @@ public: void ForEach(std::function<bool(ConstString key, Object *object)> const &callback) const { for (const auto &pair : m_dict) { - if (callback(pair.first, pair.second.get()) == false) + if (!callback(pair.first, pair.second.get())) break; } } diff --git a/source/API/SBQueue.cpp b/source/API/SBQueue.cpp index 5f852111e..b4a3cd0c5 100644 --- a/source/API/SBQueue.cpp +++ b/source/API/SBQueue.cpp @@ -107,7 +107,7 @@ public: } void FetchThreads() { - if (m_thread_list_fetched == false) { + if (!m_thread_list_fetched) { lldb::QueueSP queue_sp = m_queue_wp.lock(); if (queue_sp) { Process::StopLocker stop_locker; @@ -127,7 +127,7 @@ public: } void FetchItems() { - if (m_pending_items_fetched == false) { + if (!m_pending_items_fetched) { QueueSP queue_sp = m_queue_wp.lock(); if (queue_sp) { Process::StopLocker stop_locker; @@ -178,7 +178,7 @@ public: uint32_t result = 0; QueueSP queue_sp = m_queue_wp.lock(); - if (m_pending_items_fetched == false && queue_sp) { + if (!m_pending_items_fetched && queue_sp) { result = queue_sp->GetNumPendingWorkItems(); } else { result = m_pending_items.size(); diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp index 5771b37ea..97a9df625 100644 --- a/source/API/SBThread.cpp +++ b/source/API/SBThread.cpp @@ -571,7 +571,7 @@ bool SBThread::GetInfoItemByPathAsString(const char *path, SBStream &strm) { success = true; } if (node->GetType() == eStructuredDataTypeBoolean) { - if (node->GetAsBoolean()->GetValue() == true) + if (node->GetAsBoolean()->GetValue()) strm.Printf("true"); else strm.Printf("false"); @@ -1470,7 +1470,7 @@ SBThread SBThread::GetExtendedBacktraceThread(const char *type) { } } - if (log && sb_origin_thread.IsValid() == false) + if (log && !sb_origin_thread.IsValid()) log->Printf("SBThread(%p)::GetExtendedBacktraceThread() is not returning a " "Valid thread", static_cast<void *>(exe_ctx.GetThreadPtr())); diff --git a/source/API/SBType.cpp b/source/API/SBType.cpp index e199b7a33..7af27095e 100644 --- a/source/API/SBType.cpp +++ b/source/API/SBType.cpp @@ -47,20 +47,20 @@ SBType::SBType(const SBType &rhs) : m_opaque_sp() { //{} // bool SBType::operator==(SBType &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); - if (rhs.IsValid() == false) + if (!rhs.IsValid()) return false; return *m_opaque_sp.get() == *rhs.m_opaque_sp.get(); } bool SBType::operator!=(SBType &rhs) { - if (IsValid() == false) + if (!IsValid()) return rhs.IsValid(); - if (rhs.IsValid() == false) + if (!rhs.IsValid()) return true; return *m_opaque_sp.get() != *rhs.m_opaque_sp.get(); diff --git a/source/API/SBTypeCategory.cpp b/source/API/SBTypeCategory.cpp index 30414bd72..7c2a37e7c 100644 --- a/source/API/SBTypeCategory.cpp +++ b/source/API/SBTypeCategory.cpp @@ -529,14 +529,14 @@ operator=(const lldb::SBTypeCategory &rhs) { } bool SBTypeCategory::operator==(lldb::SBTypeCategory &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp.get() == rhs.m_opaque_sp.get(); } bool SBTypeCategory::operator!=(lldb::SBTypeCategory &rhs) { - if (IsValid() == false) + if (!IsValid()) return rhs.IsValid(); return m_opaque_sp.get() != rhs.m_opaque_sp.get(); diff --git a/source/API/SBTypeFilter.cpp b/source/API/SBTypeFilter.cpp index 8fa322211..9709d2e5d 100644 --- a/source/API/SBTypeFilter.cpp +++ b/source/API/SBTypeFilter.cpp @@ -91,14 +91,14 @@ lldb::SBTypeFilter &SBTypeFilter::operator=(const lldb::SBTypeFilter &rhs) { } bool SBTypeFilter::operator==(lldb::SBTypeFilter &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp == rhs.m_opaque_sp; } bool SBTypeFilter::IsEqualTo(lldb::SBTypeFilter &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); if (GetNumberOfExpressionPaths() != rhs.GetNumberOfExpressionPaths()) @@ -113,7 +113,7 @@ bool SBTypeFilter::IsEqualTo(lldb::SBTypeFilter &rhs) { } bool SBTypeFilter::operator!=(lldb::SBTypeFilter &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp != rhs.m_opaque_sp; diff --git a/source/API/SBTypeFormat.cpp b/source/API/SBTypeFormat.cpp index 6fe762583..66bfd3671 100644 --- a/source/API/SBTypeFormat.cpp +++ b/source/API/SBTypeFormat.cpp @@ -88,13 +88,13 @@ lldb::SBTypeFormat &SBTypeFormat::operator=(const lldb::SBTypeFormat &rhs) { } bool SBTypeFormat::operator==(lldb::SBTypeFormat &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp == rhs.m_opaque_sp; } bool SBTypeFormat::IsEqualTo(lldb::SBTypeFormat &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); if (GetFormat() == rhs.GetFormat()) @@ -104,7 +104,7 @@ bool SBTypeFormat::IsEqualTo(lldb::SBTypeFormat &rhs) { } bool SBTypeFormat::operator!=(lldb::SBTypeFormat &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp != rhs.m_opaque_sp; } diff --git a/source/API/SBTypeNameSpecifier.cpp b/source/API/SBTypeNameSpecifier.cpp index 2f9deafb6..5ffb3d98a 100644 --- a/source/API/SBTypeNameSpecifier.cpp +++ b/source/API/SBTypeNameSpecifier.cpp @@ -80,13 +80,13 @@ operator=(const lldb::SBTypeNameSpecifier &rhs) { } bool SBTypeNameSpecifier::operator==(lldb::SBTypeNameSpecifier &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp == rhs.m_opaque_sp; } bool SBTypeNameSpecifier::IsEqualTo(lldb::SBTypeNameSpecifier &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); if (IsRegex() != rhs.IsRegex()) @@ -98,7 +98,7 @@ bool SBTypeNameSpecifier::IsEqualTo(lldb::SBTypeNameSpecifier &rhs) { } bool SBTypeNameSpecifier::operator!=(lldb::SBTypeNameSpecifier &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp != rhs.m_opaque_sp; } diff --git a/source/API/SBTypeSummary.cpp b/source/API/SBTypeSummary.cpp index cd4edd17f..314c71193 100644 --- a/source/API/SBTypeSummary.cpp +++ b/source/API/SBTypeSummary.cpp @@ -261,7 +261,7 @@ lldb::SBTypeSummary &SBTypeSummary::operator=(const lldb::SBTypeSummary &rhs) { } bool SBTypeSummary::operator==(lldb::SBTypeSummary &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp == rhs.m_opaque_sp; } @@ -305,7 +305,7 @@ bool SBTypeSummary::IsEqualTo(lldb::SBTypeSummary &rhs) { } bool SBTypeSummary::operator!=(lldb::SBTypeSummary &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp != rhs.m_opaque_sp; } diff --git a/source/API/SBTypeSynthetic.cpp b/source/API/SBTypeSynthetic.cpp index 37b6086f8..750d917e6 100644 --- a/source/API/SBTypeSynthetic.cpp +++ b/source/API/SBTypeSynthetic.cpp @@ -106,13 +106,13 @@ operator=(const lldb::SBTypeSynthetic &rhs) { } bool SBTypeSynthetic::operator==(lldb::SBTypeSynthetic &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp == rhs.m_opaque_sp; } bool SBTypeSynthetic::IsEqualTo(lldb::SBTypeSynthetic &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); if (m_opaque_sp->IsScripted() != rhs.m_opaque_sp->IsScripted()) @@ -128,7 +128,7 @@ bool SBTypeSynthetic::IsEqualTo(lldb::SBTypeSynthetic &rhs) { } bool SBTypeSynthetic::operator!=(lldb::SBTypeSynthetic &rhs) { - if (IsValid() == false) + if (!IsValid()) return !rhs.IsValid(); return m_opaque_sp != rhs.m_opaque_sp; } diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp index 67ad6259c..a61a2a19a 100644 --- a/source/API/SBValue.cpp +++ b/source/API/SBValue.cpp @@ -98,10 +98,7 @@ public: // they depend on. So I have no good way to make that check without // tracking that in all the ValueObject subclasses. TargetSP target_sp = m_valobj_sp->GetTargetSP(); - if (target_sp && target_sp->IsValid()) - return true; - else - return false; + return target_sp && target_sp->IsValid(); } } diff --git a/source/Breakpoint/Watchpoint.cpp b/source/Breakpoint/Watchpoint.cpp index 553542088..34daaee64 100644 --- a/source/Breakpoint/Watchpoint.cpp +++ b/source/Breakpoint/Watchpoint.cpp @@ -131,10 +131,7 @@ void Watchpoint::IncrementFalseAlarmsAndReviseHitCount() { bool Watchpoint::ShouldStop(StoppointCallbackContext *context) { IncrementHitCount(); - if (!IsEnabled()) - return false; - - return true; + return IsEnabled(); } void Watchpoint::GetDescription(Stream *s, lldb::DescriptionLevel level) { diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp index 113745920..e87d68a53 100644 --- a/source/Commands/CommandObjectExpression.cpp +++ b/source/Commands/CommandObjectExpression.cpp @@ -420,8 +420,7 @@ bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr, if (m_command_options.auto_apply_fixits == eLazyBoolCalculate) auto_apply_fixits = target->GetEnableAutoApplyFixIts(); else - auto_apply_fixits = - m_command_options.auto_apply_fixits == eLazyBoolYes ? true : false; + auto_apply_fixits = m_command_options.auto_apply_fixits == eLazyBoolYes; options.SetAutoApplyFixIts(auto_apply_fixits); diff --git a/source/Commands/CommandObjectQuit.cpp b/source/Commands/CommandObjectQuit.cpp index d1630b83d..2c5b20bf5 100644 --- a/source/Commands/CommandObjectQuit.cpp +++ b/source/Commands/CommandObjectQuit.cpp @@ -31,7 +31,7 @@ CommandObjectQuit::~CommandObjectQuit() {} // if all alive processes will be detached when you quit and false if at least // one process will be killed instead bool CommandObjectQuit::ShouldAskForConfirmation(bool &is_a_detach) { - if (m_interpreter.GetPromptOnQuit() == false) + if (!m_interpreter.GetPromptOnQuit()) return false; bool should_prompt = false; is_a_detach = true; @@ -51,7 +51,7 @@ bool CommandObjectQuit::ShouldAskForConfirmation(bool &is_a_detach) { if (process_sp && process_sp->IsValid() && process_sp->IsAlive() && process_sp->WarnBeforeDetach()) { should_prompt = true; - if (process_sp->GetShouldDetach() == false) { + if (!process_sp->GetShouldDetach()) { // if we need to kill at least one process, just say so and return is_a_detach = false; return should_prompt; diff --git a/source/Commands/CommandObjectWatchpoint.cpp b/source/Commands/CommandObjectWatchpoint.cpp index ed51b614d..d2600a462 100644 --- a/source/Commands/CommandObjectWatchpoint.cpp +++ b/source/Commands/CommandObjectWatchpoint.cpp @@ -138,11 +138,9 @@ bool CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs( return false; wp_ids.push_back(beg); } - // It is an error if after the loop, we're still in_range. - if (in_range) - return false; - return true; // Success! + // It is an error if after the loop, we're still in_range. + return !in_range; } //------------------------------------------------------------------------- diff --git a/source/Core/Disassembler.cpp b/source/Core/Disassembler.cpp index f957a5c69..a34b8038c 100644 --- a/source/Core/Disassembler.cpp +++ b/source/Core/Disassembler.cpp @@ -452,8 +452,7 @@ bool Disassembler::PrintInstructions(Disassembler *disasm_ptr, if (mixed_source_and_assembly && sc.line_entry.IsValid()) { if (sc.symbol != previous_symbol) { SourceLine decl_line = GetFunctionDeclLineEntry(sc); - if (ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, decl_line) == - false) + if (!ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, decl_line)) AddLineToSourceLineTables(decl_line, source_lines_seen); } if (sc.line_entry.IsValid()) { @@ -461,8 +460,7 @@ bool Disassembler::PrintInstructions(Disassembler *disasm_ptr, this_line.file = sc.line_entry.file; this_line.line = sc.line_entry.line; this_line.column = sc.line_entry.column; - if (ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, this_line) == - false) + if (!ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, this_line)) AddLineToSourceLineTables(this_line, source_lines_seen); } } @@ -506,8 +504,8 @@ bool Disassembler::PrintInstructions(Disassembler *disasm_ptr, previous_symbol = sc.symbol; if (sc.function && sc.line_entry.IsValid()) { LineEntry prologue_end_line = sc.line_entry; - if (ElideMixedSourceAndDisassemblyLine( - exe_ctx, sc, prologue_end_line) == false) { + if (!ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, + prologue_end_line)) { FileSpec func_decl_file; uint32_t func_decl_line; sc.function->GetStartLineSourceInfo(func_decl_file, @@ -547,8 +545,8 @@ bool Disassembler::PrintInstructions(Disassembler *disasm_ptr, this_line.file = sc.line_entry.file; this_line.line = sc.line_entry.line; - if (ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, - this_line) == false) { + if (!ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, + this_line)) { // Only print this source line if it is different from the // last source line we printed. There may have been inlined // functions between these lines that we elided, resulting in diff --git a/source/Core/Mangled.cpp b/source/Core/Mangled.cpp index 536c812c3..943df008e 100644 --- a/source/Core/Mangled.cpp +++ b/source/Core/Mangled.cpp @@ -419,9 +419,7 @@ bool Mangled::NameMatches(const RegularExpression ®ex, return true; ConstString demangled = GetDemangledName(language); - if (demangled && regex.Execute(demangled.AsCString())) - return true; - return false; + return demangled && regex.Execute(demangled.AsCString()); } //---------------------------------------------------------------------- diff --git a/source/Core/SearchFilter.cpp b/source/Core/SearchFilter.cpp index df1b6d308..ebacbd292 100644 --- a/source/Core/SearchFilter.cpp +++ b/source/Core/SearchFilter.cpp @@ -388,10 +388,7 @@ SearchFilterForUnconstrainedSearches::SerializeToStructuredData() { bool SearchFilterForUnconstrainedSearches::ModulePasses( const FileSpec &module_spec) { - if (m_target_sp->ModuleIsExcludedForUnconstrainedSearches(module_spec)) - return false; - else - return true; + return !m_target_sp->ModuleIsExcludedForUnconstrainedSearches(module_spec); } bool SearchFilterForUnconstrainedSearches::ModulePasses( @@ -570,22 +567,15 @@ bool SearchFilterByModuleList::ModulePasses(const ModuleSP &module_sp) { if (m_module_spec_list.GetSize() == 0) return true; - if (module_sp && - m_module_spec_list.FindFileIndex(0, module_sp->GetFileSpec(), false) != - UINT32_MAX) - return true; - else - return false; + return module_sp && m_module_spec_list.FindFileIndex( + 0, module_sp->GetFileSpec(), false) != UINT32_MAX; } bool SearchFilterByModuleList::ModulePasses(const FileSpec &spec) { if (m_module_spec_list.GetSize() == 0) return true; - if (m_module_spec_list.FindFileIndex(0, spec, true) != UINT32_MAX) - return true; - else - return false; + return m_module_spec_list.FindFileIndex(0, spec, true) != UINT32_MAX; } bool SearchFilterByModuleList::AddressPasses(Address &address) { diff --git a/source/Core/SourceManager.cpp b/source/Core/SourceManager.cpp index 16cc1b805..fe603c5a4 100644 --- a/source/Core/SourceManager.cpp +++ b/source/Core/SourceManager.cpp @@ -486,7 +486,7 @@ uint32_t SourceManager::File::GetLineLength(uint32_t line, if (end_offset > start_offset) { uint32_t length = end_offset - start_offset; - if (include_newline_chars == false) { + if (!include_newline_chars) { const char *line_start = (const char *)m_data_sp->GetBytes() + start_offset; while (length > 0) { diff --git a/source/Core/ValueObject.cpp b/source/Core/ValueObject.cpp index 96a171688..b0dd04ab9 100644 --- a/source/Core/ValueObject.cpp +++ b/source/Core/ValueObject.cpp @@ -214,7 +214,7 @@ bool ValueObject::UpdateValueIfNeeded(bool update_format) { if (first_update) SetValueDidChange(false); - else if (!m_value_did_change && success == false) { + else if (!m_value_did_change && !success) { // The value wasn't gotten successfully, so we mark this as changed if // the value used to be valid and now isn't SetValueDidChange(value_was_valid); @@ -442,10 +442,7 @@ bool ValueObject::IsLogicalTrue(Status &error) { } bool ret; - if (scalar_value.ULongLong(1) == 0) - ret = false; - else - ret = true; + ret = scalar_value.ULongLong(1) != 0; error.Clear(); return ret; } @@ -639,7 +636,7 @@ ValueObject *ValueObject::CreateChildAtIndex(size_t idx, bool child_is_deref_of_parent = false; uint64_t language_flags = 0; - const bool transparent_pointers = synthetic_array_member == false; + const bool transparent_pointers = !synthetic_array_member; CompilerType child_compiler_type; ExecutionContext exe_ctx(GetExecutionContextRef()); @@ -1921,11 +1918,11 @@ ValueObject::GetSyntheticExpressionPathChild(const char *expression, } void ValueObject::CalculateSyntheticValue(bool use_synthetic) { - if (use_synthetic == false) + if (!use_synthetic) return; TargetSP target_sp(GetTargetSP()); - if (target_sp && target_sp->GetEnableSyntheticValue() == false) { + if (target_sp && !target_sp->GetEnableSyntheticValue()) { m_synthetic_value = NULL; return; } @@ -1976,7 +1973,7 @@ ValueObjectSP ValueObject::GetStaticValue() { return GetSP(); } lldb::ValueObjectSP ValueObject::GetNonSyntheticValue() { return GetSP(); } ValueObjectSP ValueObject::GetSyntheticValue(bool use_synthetic) { - if (use_synthetic == false) + if (!use_synthetic) return ValueObjectSP(); CalculateSyntheticValue(use_synthetic); @@ -1995,10 +1992,7 @@ bool ValueObject::HasSyntheticValue() { CalculateSyntheticValue(true); - if (m_synthetic_value) - return true; - else - return false; + return m_synthetic_value != nullptr; } bool ValueObject::GetBaseClassPath(Stream &s) { @@ -3195,7 +3189,7 @@ ValueObject * ValueObject::FollowParentChain(std::function<bool(ValueObject *)> f) { ValueObject *vo = this; while (vo) { - if (f(vo) == false) + if (!f(vo)) break; vo = vo->m_parent; } @@ -3264,8 +3258,7 @@ bool ValueObject::CanProvideValue() { // board debugging scenarios have no notion of types, but still manage to // have raw numeric values for things like registers. sigh. const CompilerType &type(GetCompilerType()); - return (false == type.IsValid()) || - (0 != (type.GetTypeInfo() & eTypeHasValue)); + return (!type.IsValid()) || (0 != (type.GetTypeInfo() & eTypeHasValue)); } bool ValueObject::IsChecksumEmpty() { return m_value_checksum.empty(); } diff --git a/source/Core/ValueObjectChild.cpp b/source/Core/ValueObjectChild.cpp index 42b31cc11..7255eed59 100644 --- a/source/Core/ValueObjectChild.cpp +++ b/source/Core/ValueObjectChild.cpp @@ -124,7 +124,7 @@ bool ValueObjectChild::UpdateValue() { Flags parent_type_flags(parent_type.GetTypeInfo()); const bool is_instance_ptr_base = - ((m_is_base_class == true) && + ((m_is_base_class) && (parent_type_flags.AnySet(lldb::eTypeInstanceIsPointer))); if (parent->GetCompilerType().ShouldTreatScalarValueAsAddress()) { @@ -142,7 +142,7 @@ bool ValueObjectChild::UpdateValue() { switch (addr_type) { case eAddressTypeFile: { lldb::ProcessSP process_sp(GetProcessSP()); - if (process_sp && process_sp->IsAlive() == true) + if (process_sp && process_sp->IsAlive()) m_value.SetValueType(Value::eValueTypeLoadAddress); else m_value.SetValueType(Value::eValueTypeFileAddress); diff --git a/source/Core/ValueObjectConstResultImpl.cpp b/source/Core/ValueObjectConstResultImpl.cpp index 789f388d2..6bf8e62db 100644 --- a/source/Core/ValueObjectConstResultImpl.cpp +++ b/source/Core/ValueObjectConstResultImpl.cpp @@ -66,7 +66,7 @@ ValueObject *ValueObjectConstResultImpl::CreateChildAtIndex( bool child_is_deref_of_parent = false; uint64_t language_flags; - const bool transparent_pointers = synthetic_array_member == false; + const bool transparent_pointers = !synthetic_array_member; CompilerType compiler_type = m_impl_backend->GetCompilerType(); CompilerType child_compiler_type; diff --git a/source/Core/ValueObjectSyntheticFilter.cpp b/source/Core/ValueObjectSyntheticFilter.cpp index 1da142f7b..d22b1dc1c 100644 --- a/source/Core/ValueObjectSyntheticFilter.cpp +++ b/source/Core/ValueObjectSyntheticFilter.cpp @@ -119,7 +119,7 @@ bool ValueObjectSynthetic::MightHaveChildren() { if (m_might_have_children == eLazyBoolCalculate) m_might_have_children = (m_synth_filter_ap->MightHaveChildren() ? eLazyBoolYes : eLazyBoolNo); - return (m_might_have_children == eLazyBoolNo ? false : true); + return (m_might_have_children != eLazyBoolNo); } uint64_t ValueObjectSynthetic::GetByteSize() { return m_parent->GetByteSize(); } @@ -174,7 +174,7 @@ bool ValueObjectSynthetic::UpdateValue() { } // let our backend do its update - if (m_synth_filter_ap->Update() == false) { + if (!m_synth_filter_ap->Update()) { if (log) log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic " "filter said caches are stale - clearing", @@ -235,7 +235,7 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(size_t idx, UpdateValueIfNeeded(); ValueObject *valobj; - if (m_children_byindex.GetValueForKey(idx, valobj) == false) { + if (!m_children_byindex.GetValueForKey(idx, valobj)) { if (can_create && m_synth_filter_ap.get() != nullptr) { if (log) log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at " diff --git a/source/DataFormatters/CXXFunctionPointer.cpp b/source/DataFormatters/CXXFunctionPointer.cpp index fad67a9d5..9059891e5 100644 --- a/source/DataFormatters/CXXFunctionPointer.cpp +++ b/source/DataFormatters/CXXFunctionPointer.cpp @@ -38,7 +38,7 @@ bool lldb_private::formatters::CXXFunctionPointerSummaryProvider( 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/source/DataFormatters/DataVisualization.cpp b/source/DataFormatters/DataVisualization.cpp index ee8e1e42c..23b8b6e12 100644 --- a/source/DataFormatters/DataVisualization.cpp +++ b/source/DataFormatters/DataVisualization.cpp @@ -145,7 +145,7 @@ void DataVisualization::Categories::Enable(lldb::LanguageType lang_type) { } 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::Enable( 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/source/DataFormatters/DumpValueObjectOptions.cpp b/source/DataFormatters/DumpValueObjectOptions.cpp index 6915196fe..17f8d00ff 100644 --- a/source/DataFormatters/DumpValueObjectOptions.cpp +++ b/source/DataFormatters/DumpValueObjectOptions.cpp @@ -67,7 +67,7 @@ DumpValueObjectOptions &DumpValueObjectOptions::SetUseObjectiveC(bool use) { } DumpValueObjectOptions &DumpValueObjectOptions::SetShowSummary(bool show) { - if (show == false) + if (!show) SetOmitSummaryDepth(UINT32_MAX); else SetOmitSummaryDepth(0); diff --git a/source/DataFormatters/FormatManager.cpp b/source/DataFormatters/FormatManager.cpp index 82ad6e86e..da03c64b0 100644 --- a/source/DataFormatters/FormatManager.cpp +++ b/source/DataFormatters/FormatManager.cpp @@ -293,7 +293,7 @@ FormatManager::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) { 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 @@ FormatManager::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) { 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 @@ FormatManager::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) { 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 @@ FormatManager::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) { 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 @@ FormatManager::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) { 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 @@ lldb::Format FormatManager::GetSingleItemFormat(lldb::Format vector_format) { 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 @@ bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) { 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/source/DataFormatters/StringPrinter.cpp b/source/DataFormatters/StringPrinter.cpp index 89d7a9506..6a000f0f6 100644 --- a/source/DataFormatters/StringPrinter.cpp +++ b/source/DataFormatters/StringPrinter.cpp @@ -312,7 +312,7 @@ static bool DumpUTFBufferToStream( 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/source/DataFormatters/TypeCategory.cpp b/source/DataFormatters/TypeCategory.cpp index 0f53f7643..5740a095f 100644 --- a/source/DataFormatters/TypeCategory.cpp +++ b/source/DataFormatters/TypeCategory.cpp @@ -157,10 +157,7 @@ bool TypeCategoryImpl::Get(ValueObject &valobj, 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/source/DataFormatters/TypeCategoryMap.cpp b/source/DataFormatters/TypeCategoryMap.cpp index 0cc57fe40..3193f2703 100644 --- a/source/DataFormatters/TypeCategoryMap.cpp +++ b/source/DataFormatters/TypeCategoryMap.cpp @@ -118,8 +118,7 @@ void TypeCategoryMap::EnableAllCategories() { 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/source/DataFormatters/TypeFormat.cpp b/source/DataFormatters/TypeFormat.cpp index 14ec1caa6..1e8bc7162 100644 --- a/source/DataFormatters/TypeFormat.cpp +++ b/source/DataFormatters/TypeFormat.cpp @@ -178,7 +178,7 @@ bool TypeFormatImpl_EnumType::FormatObject(ValueObject *valobj, } } 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/source/DataFormatters/TypeSummary.cpp b/source/DataFormatters/TypeSummary.cpp index 2f7e3a0ba..492d3efc7 100644 --- a/source/DataFormatters/TypeSummary.cpp +++ b/source/DataFormatters/TypeSummary.cpp @@ -135,7 +135,7 @@ bool CXXFunctionSummaryFormat::FormatObject(ValueObject *valobj, 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/source/DataFormatters/ValueObjectPrinter.cpp b/source/DataFormatters/ValueObjectPrinter.cpp index 0792fdf3b..082158822 100644 --- a/source/DataFormatters/ValueObjectPrinter.cpp +++ b/source/DataFormatters/ValueObjectPrinter.cpp @@ -129,13 +129,13 @@ bool ValueObjectPrinter::GetMostSpecializedValue() { } 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 @@ const char *ValueObjectPrinter::GetRootNameForDisplay(const char *if_fail) { 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 @@ bool ValueObjectPrinter::CheckScopeIfNeeded() { } 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 @@ bool ValueObjectPrinter::PrintObjectDescriptionIfNeeded(bool value_printed, 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 @@ bool ValueObjectPrinter::ShouldPrintEmptyBrackets(bool value_printed, 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; } diff --git a/source/Expression/DWARFExpression.cpp b/source/Expression/DWARFExpression.cpp index 310eb79de..a6249b3a2 100644 --- a/source/Expression/DWARFExpression.cpp +++ b/source/Expression/DWARFExpression.cpp @@ -1839,7 +1839,7 @@ bool DWARFExpression::Evaluate( error_ptr->SetErrorString( "Expression stack needs at least 1 item for DW_OP_abs."); return false; - } else if (stack.back().ResolveValue(exe_ctx).AbsoluteValue() == false) { + } else if (!stack.back().ResolveValue(exe_ctx).AbsoluteValue()) { if (error_ptr) error_ptr->SetErrorString( "Failed to take the absolute value of the first stack item."); @@ -1972,7 +1972,7 @@ bool DWARFExpression::Evaluate( "Expression stack needs at least 1 item for DW_OP_neg."); return false; } else { - if (stack.back().ResolveValue(exe_ctx).UnaryNegate() == false) { + if (!stack.back().ResolveValue(exe_ctx).UnaryNegate()) { if (error_ptr) error_ptr->SetErrorString("Unary negate failed."); return false; @@ -1993,7 +1993,7 @@ bool DWARFExpression::Evaluate( "Expression stack needs at least 1 item for DW_OP_not."); return false; } else { - if (stack.back().ResolveValue(exe_ctx).OnesComplement() == false) { + if (!stack.back().ResolveValue(exe_ctx).OnesComplement()) { if (error_ptr) error_ptr->SetErrorString("Logical NOT failed."); return false; @@ -2100,8 +2100,8 @@ bool DWARFExpression::Evaluate( } else { tmp = stack.back(); stack.pop_back(); - if (stack.back().ResolveValue(exe_ctx).ShiftRightLogical( - tmp.ResolveValue(exe_ctx)) == false) { + if (!stack.back().ResolveValue(exe_ctx).ShiftRightLogical( + tmp.ResolveValue(exe_ctx))) { if (error_ptr) error_ptr->SetErrorString("DW_OP_shr failed."); return false; diff --git a/source/Expression/ExpressionSourceCode.cpp b/source/Expression/ExpressionSourceCode.cpp index abbb332fa..03b2d26a2 100644 --- a/source/Expression/ExpressionSourceCode.cpp +++ b/source/Expression/ExpressionSourceCode.cpp @@ -105,10 +105,7 @@ public: if (m_file_stack.back() != m_current_file) return true; - if (line >= m_current_file_line) - return false; - else - return true; + return line < m_current_file_line; default: return false; } @@ -378,7 +375,5 @@ bool ExpressionSourceCode::GetOriginalBodyBounds( return false; start_loc += strlen(start_marker); end_loc = transformed_text.find(end_marker); - if (end_loc == std::string::npos) - return false; - return true; + return end_loc != std::string::npos; } diff --git a/source/Expression/Materializer.cpp b/source/Expression/Materializer.cpp index 0b6bf522b..f92eb6489 100644 --- a/source/Expression/Materializer.cpp +++ b/source/Expression/Materializer.cpp @@ -528,7 +528,7 @@ public: if (data.GetByteSize() < m_variable_sp->GetType()->GetByteSize()) { if (data.GetByteSize() == 0 && - m_variable_sp->LocationExpression().IsValid() == false) { + !m_variable_sp->LocationExpression().IsValid()) { err.SetErrorStringWithFormat("the variable '%s' has no location, " "it may have been optimized out", m_variable_sp->GetName().AsCString()); diff --git a/source/Host/common/Editline.cpp b/source/Host/common/Editline.cpp index a330eca85..81fb672b3 100644 --- a/source/Host/common/Editline.cpp +++ b/source/Host/common/Editline.cpp @@ -430,7 +430,7 @@ unsigned char Editline::RecallHistory(bool earlier) { // Treat moving from the "live" entry differently if (!m_in_history) { - if (earlier == false) + if (!earlier) return CC_ERROR; // Can't go newer than the "live" entry if (history_w(pHistory, &history_event, H_FIRST) == -1) return CC_ERROR; diff --git a/source/Host/common/FileCache.cpp b/source/Host/common/FileCache.cpp index 0e4a05a8c..17833ef2c 100644 --- a/source/Host/common/FileCache.cpp +++ b/source/Host/common/FileCache.cpp @@ -32,7 +32,7 @@ lldb::user_id_t FileCache::OpenFile(const FileSpec &file_spec, uint32_t flags, } FileSP file_sp(new File()); error = FileSystem::Instance().Open(*file_sp, file_spec, flags, mode); - if (file_sp->IsValid() == false) + if (!file_sp->IsValid()) return UINT64_MAX; lldb::user_id_t fd = file_sp->GetDescriptor(); m_cache[fd] = file_sp; diff --git a/source/Host/common/ProcessRunLock.cpp b/source/Host/common/ProcessRunLock.cpp index 48dcd62bb..e0ba2ecfd 100644 --- a/source/Host/common/ProcessRunLock.cpp +++ b/source/Host/common/ProcessRunLock.cpp @@ -30,7 +30,7 @@ ProcessRunLock::~ProcessRunLock() { bool ProcessRunLock::ReadTryLock() { ::pthread_rwlock_rdlock(&m_rwlock); - if (m_running == false) { + if (!m_running) { return true; } ::pthread_rwlock_unlock(&m_rwlock); diff --git a/source/Host/common/Symbols.cpp b/source/Host/common/Symbols.cpp index 5297ff040..831483b9a 100644 --- a/source/Host/common/Symbols.cpp +++ b/source/Host/common/Symbols.cpp @@ -215,7 +215,7 @@ FileSpec LocateExecutableSymbolFileDsym(const ModuleSpec &module_spec) { ModuleSpec dsym_module_spec; // First try and find the dSYM in the same directory as the executable or in // an appropriate parent directory - if (LocateDSYMInVincinityOfExecutable(module_spec, symbol_fspec) == false) { + if (!LocateDSYMInVincinityOfExecutable(module_spec, symbol_fspec)) { // We failed to easily find the dSYM above, so use DebugSymbols LocateMacOSXFilesUsingDebugSymbols(module_spec, dsym_module_spec); } else { diff --git a/source/Host/common/XML.cpp b/source/Host/common/XML.cpp index 7468a3d7a..b964a2e26 100644 --- a/source/Host/common/XML.cpp +++ b/source/Host/common/XML.cpp @@ -201,8 +201,7 @@ void XMLNode::ForEachAttribute(AttributeCallback const &callback) const { llvm::StringRef attr_value; if (child->content) attr_value = llvm::StringRef((const char *)child->content); - if (callback(llvm::StringRef((const char *)attr->name), attr_value) == - false) + if (!callback(llvm::StringRef((const char *)attr->name), attr_value)) return; } } @@ -217,7 +216,7 @@ void XMLNode::ForEachSiblingNode(NodeCallback const &callback) const { if (IsValid()) { // iterate through all siblings for (xmlNodePtr node = m_node; node; node = node->next) { - if (callback(XMLNode(node)) == false) + if (!callback(XMLNode(node))) return; } } @@ -234,7 +233,7 @@ void XMLNode::ForEachSiblingElement(NodeCallback const &callback) const { if (node->type != XML_ELEMENT_NODE) continue; - if (callback(XMLNode(node)) == false) + if (!callback(XMLNode(node))) return; } } @@ -263,7 +262,7 @@ void XMLNode::ForEachSiblingElementWithName( // ignore this one } - if (callback(XMLNode(node)) == false) + if (!callback(XMLNode(node))) return; } } diff --git a/source/Host/macosx/Symbols.cpp b/source/Host/macosx/Symbols.cpp index 15d52d365..980bbc344 100644 --- a/source/Host/macosx/Symbols.cpp +++ b/source/Host/macosx/Symbols.cpp @@ -399,7 +399,7 @@ static bool GetModuleSpecInfoFromUUIDDictionary(CFDictionaryRef uuid_dict, // DBGSourcePath values (the "values" half of key-value path pairs) // were wrong. Ignore them and use the universal DBGSourcePath // string from earlier. - if (new_style_source_remapping_dictionary == true && + if (new_style_source_remapping_dictionary && !original_DBGSourcePath_value.empty()) { DBGSourcePath = original_DBGSourcePath_value; } @@ -475,7 +475,7 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec, // it once per lldb run and cache the result. static bool g_have_checked_for_dbgshell_command = false; static const char *g_dbgshell_command = NULL; - if (g_have_checked_for_dbgshell_command == false) { + if (!g_have_checked_for_dbgshell_command) { g_have_checked_for_dbgshell_command = true; CFTypeRef defaults_setting = CFPreferencesCopyAppValue( CFSTR("DBGShellCommands"), CFSTR("com.apple.DebugSymbols")); @@ -495,7 +495,7 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec, // When g_dbgshell_command is NULL, the user has not enabled the use of an // external program to find the symbols, don't run it for them. - if (force_lookup == false && g_dbgshell_command == NULL) { + if (!force_lookup && g_dbgshell_command == NULL) { return false; } diff --git a/source/Host/macosx/cfcpp/CFCMutableArray.cpp b/source/Host/macosx/cfcpp/CFCMutableArray.cpp index 0b6258315..f426e9c13 100644 --- a/source/Host/macosx/cfcpp/CFCMutableArray.cpp +++ b/source/Host/macosx/cfcpp/CFCMutableArray.cpp @@ -88,7 +88,7 @@ bool CFCMutableArray::SetValueAtIndex(CFIndex idx, const void *value) { bool CFCMutableArray::AppendValue(const void *value, bool can_create) { CFMutableArrayRef array = get(); if (array == NULL) { - if (can_create == false) + if (!can_create) return false; array = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); @@ -106,7 +106,7 @@ bool CFCMutableArray::AppendCStringAsCFString(const char *s, bool can_create) { CFMutableArrayRef array = get(); if (array == NULL) { - if (can_create == false) + if (!can_create) return false; array = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); @@ -124,7 +124,7 @@ bool CFCMutableArray::AppendFileSystemRepresentationAsCFString( const char *s, bool can_create) { CFMutableArrayRef array = get(); if (array == NULL) { - if (can_create == false) + if (!can_create) return false; array = ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); diff --git a/source/Host/macosx/cfcpp/CFCMutableSet.cpp b/source/Host/macosx/cfcpp/CFCMutableSet.cpp index 7a9c6dc2e..b8bf81e1b 100644 --- a/source/Host/macosx/cfcpp/CFCMutableSet.cpp +++ b/source/Host/macosx/cfcpp/CFCMutableSet.cpp @@ -60,7 +60,7 @@ const void *CFCMutableSet::GetValue(const void *value) const { const void *CFCMutableSet::AddValue(const void *value, bool can_create) { CFMutableSetRef set = get(); if (set == NULL) { - if (can_create == false) + if (!can_create) return NULL; set = ::CFSetCreateMutable(kCFAllocatorDefault, 0, &kCFTypeSetCallBacks); reset(set); diff --git a/source/Host/macosx/objcxx/Host.mm b/source/Host/macosx/objcxx/Host.mm index ec876837d..18f2a53e5 100644 --- a/source/Host/macosx/objcxx/Host.mm +++ b/source/Host/macosx/objcxx/Host.mm @@ -486,11 +486,9 @@ static bool GetMacOSXProcessCPUType(ProcessInstanceInfo &process_info) { bool host_cpu_is_64bit; uint32_t is64bit_capable; size_t is64bit_capable_len = sizeof(is64bit_capable); - if (sysctlbyname("hw.cpu64bit_capable", &is64bit_capable, - &is64bit_capable_len, NULL, 0) == 0) - host_cpu_is_64bit = true; - else - host_cpu_is_64bit = false; + host_cpu_is_64bit = + sysctlbyname("hw.cpu64bit_capable", &is64bit_capable, + &is64bit_capable_len, NULL, 0) == 0; // if the host is an armv8 device, its cpusubtype will be in // CPU_SUBTYPE_ARM64 numbering @@ -660,7 +658,7 @@ uint32_t Host::FindProcesses(const ProcessInstanceInfoMatch &match_info, if (our_uid == 0) kinfo_user_matches = true; - if (kinfo_user_matches == false || // Make sure the user is acceptable + if (!kinfo_user_matches || // Make sure the user is acceptable static_cast<lldb::pid_t>(kinfo.kp_proc.p_pid) == our_pid || // Skip this process kinfo.kp_proc.p_pid == 0 || // Skip kernel (kernel pid is zero) diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp index 0ed2d4a1c..1072b4447 100644 --- a/source/Interpreter/CommandInterpreter.cpp +++ b/source/Interpreter/CommandInterpreter.cpp @@ -987,16 +987,16 @@ bool CommandInterpreter::AddUserCommand(llvm::StringRef name, if (!name.empty()) { // do not allow replacement of internal commands if (CommandExists(name)) { - if (can_replace == false) + if (!can_replace) return false; - if (m_command_dict[name]->IsRemovable() == false) + if (!m_command_dict[name]->IsRemovable()) return false; } if (UserCommandExists(name)) { - if (can_replace == false) + if (!can_replace) return false; - if (m_user_dict[name]->IsRemovable() == false) + if (!m_user_dict[name]->IsRemovable()) return false; } @@ -2131,7 +2131,7 @@ void CommandInterpreter::SourceInitFile(bool in_cwd, profilePath.AppendPathComponent(".lldbinit"); std::string init_file_path = profilePath.GetPath(); - if (m_skip_app_init_files == false) { + if (!m_skip_app_init_files) { FileSpec program_file_spec(HostInfo::GetProgramFileSpec()); const char *program_name = program_file_spec.GetFilename().AsCString(); @@ -2769,7 +2769,7 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler, return; const bool is_interactive = io_handler.GetIsInteractive(); - if (is_interactive == false) { + if (!is_interactive) { // When we are not interactive, don't execute blank lines. This will happen // sourcing a commands file. We don't want blank lines to repeat the // previous command and cause any errors to occur (like redefining an @@ -3018,8 +3018,7 @@ CommandInterpreter::ResolveCommandImpl(std::string &command_line, bool is_alias = GetAliasFullName(next_word, full_name); cmd_obj = GetCommandObject(next_word, &matches); bool is_real_command = - (is_alias == false) || - (cmd_obj != nullptr && cmd_obj->IsAlias() == false); + (!is_alias) || (cmd_obj != nullptr && !cmd_obj->IsAlias()); if (!is_real_command) { matches.Clear(); std::string alias_result; diff --git a/source/Interpreter/CommandObject.cpp b/source/Interpreter/CommandObject.cpp index 324b0b511..05c540b37 100644 --- a/source/Interpreter/CommandObject.cpp +++ b/source/Interpreter/CommandObject.cpp @@ -409,15 +409,12 @@ const char *CommandObject::GetArgumentName(CommandArgumentType arg_type) { } bool CommandObject::IsPairType(ArgumentRepetitionType arg_repeat_type) { - if ((arg_repeat_type == eArgRepeatPairPlain) || - (arg_repeat_type == eArgRepeatPairOptional) || - (arg_repeat_type == eArgRepeatPairPlus) || - (arg_repeat_type == eArgRepeatPairStar) || - (arg_repeat_type == eArgRepeatPairRange) || - (arg_repeat_type == eArgRepeatPairRangeOptional)) - return true; - - return false; + return (arg_repeat_type == eArgRepeatPairPlain) || + (arg_repeat_type == eArgRepeatPairOptional) || + (arg_repeat_type == eArgRepeatPairPlus) || + (arg_repeat_type == eArgRepeatPairStar) || + (arg_repeat_type == eArgRepeatPairRange) || + (arg_repeat_type == eArgRepeatPairRangeOptional); } static CommandObject::CommandArgumentEntry diff --git a/source/Interpreter/OptionGroupVariable.cpp b/source/Interpreter/OptionGroupVariable.cpp index 40be6d7b6..f90212cfc 100644 --- a/source/Interpreter/OptionGroupVariable.cpp +++ b/source/Interpreter/OptionGroupVariable.cpp @@ -55,8 +55,8 @@ static Status ValidateNamedSummary(const char *str, void *) { if (!str || !str[0]) return Status("must specify a valid named summary"); TypeSummaryImplSP summary_sp; - if (DataVisualization::NamedSummaryFormats::GetSummaryFormat( - ConstString(str), summary_sp) == false) + if (!DataVisualization::NamedSummaryFormats::GetSummaryFormat( + ConstString(str), summary_sp)) return Status("must specify a valid named summary"); return Status(); } diff --git a/source/Interpreter/OptionValueProperties.cpp b/source/Interpreter/OptionValueProperties.cpp index 834cd976f..327d26b09 100644 --- a/source/Interpreter/OptionValueProperties.cpp +++ b/source/Interpreter/OptionValueProperties.cpp @@ -38,7 +38,7 @@ OptionValueProperties::OptionValueProperties( for (size_t i = 0; i < num_properties; ++i) { // Duplicate any values that are not global when constructing properties // from a global copy - if (m_properties[i].IsGlobal() == false) { + if (!m_properties[i].IsGlobal()) { lldb::OptionValueSP new_value_sp(m_properties[i].GetValue()->DeepCopy()); m_properties[i].SetOptionValue(new_value_sp); } @@ -212,7 +212,7 @@ Status OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx, else { // Don't set an error if the path contained .experimental. - those are // allowed to be missing and should silently fail. - if (name_contains_experimental == false && error.AsCString() == nullptr) { + if (!name_contains_experimental && error.AsCString() == nullptr) { error.SetErrorStringWithFormat("invalid value path '%s'", name.str().c_str()); } } diff --git a/source/Interpreter/Options.cpp b/source/Interpreter/Options.cpp index 3ddb064a8..c6357399a 100644 --- a/source/Interpreter/Options.cpp +++ b/source/Interpreter/Options.cpp @@ -457,7 +457,7 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd, } } - if (options.empty() == false) { + if (!options.empty()) { // We have some required options with no arguments strm.PutCString(" -"); for (i = 0; i < 2; ++i) @@ -476,14 +476,14 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd, if (def.usage_mask & opt_set_mask && isprint8(def.short_option)) { // Add current option to the end of out_stream. - if (def.required == false && + if (!def.required && def.option_has_arg == OptionParser::eNoArgument) { options.insert(def.short_option); } } } - if (options.empty() == false) { + if (!options.empty()) { // We have some required options with no arguments strm.PutCString(" [-"); for (i = 0; i < 2; ++i) diff --git a/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp b/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp index bee476c47..d26818d46 100644 --- a/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp +++ b/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp @@ -1440,10 +1440,7 @@ bool ABISysV_arm::PrepareTrivialCall(Thread &thread, addr_t sp, ~1ull; // clear bit zero since the CPSR will take care of the mode for us // Set "pc" to the address requested - if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_num, function_addr)) - return false; - - return true; + return reg_ctx->WriteRegisterFromUnsigned(pc_reg_num, function_addr); } bool ABISysV_arm::GetArgumentValues(Thread &thread, ValueList &values) const { diff --git a/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h b/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h index bc8f973f5..5433ebb45 100644 --- a/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h +++ b/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h @@ -57,9 +57,7 @@ public: bool CodeAddressIsValid(lldb::addr_t pc) override { // Code addressed must be 2 byte aligned - if (pc & 1ull) - return false; - return true; + return (pc & 1ull) == 0; } const lldb_private::RegisterInfo * diff --git a/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp index 58fcd0163..5df842250 100644 --- a/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ b/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp @@ -1336,10 +1336,7 @@ bool DisassemblerLLVMC::FlavorValidForArchSpec( if (triple.getArch() == llvm::Triple::x86 || triple.getArch() == llvm::Triple::x86_64) { - if (strcmp(flavor, "intel") == 0 || strcmp(flavor, "att") == 0) - return true; - else - return false; + return strcmp(flavor, "intel") == 0 || strcmp(flavor, "att") == 0; } else return false; } diff --git a/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 551f038fa..024f82800 100644 --- a/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -387,8 +387,8 @@ DynamicLoaderDarwinKernel::ReadMachHeader(addr_t addr, Process *process, llvm::M if (::memcmp (&header.magic, &magicks[i], sizeof (uint32_t)) == 0) found_matching_pattern = true; - if (found_matching_pattern == false) - return false; + if (!found_matching_pattern) + return false; if (header.magic == llvm::MachO::MH_CIGAM || header.magic == llvm::MachO::MH_CIGAM_64) { @@ -424,7 +424,7 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr, llvm::MachO::mach_header header; - if (ReadMachHeader (addr, process, header) == false) + if (!ReadMachHeader(addr, process, header)) return UUID(); // First try a quick test -- read the first 4 bytes and see if there is a @@ -604,16 +604,10 @@ void DynamicLoaderDarwinKernel::KextImageInfo::SetProcessStopId( bool DynamicLoaderDarwinKernel::KextImageInfo:: operator==(const KextImageInfo &rhs) { if (m_uuid.IsValid() || rhs.GetUUID().IsValid()) { - if (m_uuid == rhs.GetUUID()) { - return true; - } - return false; + return m_uuid == rhs.GetUUID(); } - if (m_name == rhs.GetName() && m_load_address == rhs.GetLoadAddress()) - return true; - - return false; + return m_name == rhs.GetName() && m_load_address == rhs.GetLoadAddress(); } void DynamicLoaderDarwinKernel::KextImageInfo::SetName(const char *name) { @@ -731,7 +725,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule( } bool DynamicLoaderDarwinKernel::KextImageInfo::IsKernel() const { - return m_kernel_image == true; + return m_kernel_image; } void DynamicLoaderDarwinKernel::KextImageInfo::SetIsKernel(bool is_kernel) { @@ -1280,7 +1274,7 @@ bool DynamicLoaderDarwinKernel::ParseKextSummaries( const uint32_t num_of_new_kexts = kext_summaries.size(); for (uint32_t new_kext = 0; new_kext < num_of_new_kexts; new_kext++) { - if (to_be_added[new_kext] == true) { + if (to_be_added[new_kext]) { KextImageInfo &image_info = kext_summaries[new_kext]; if (load_kexts) { if (!image_info.LoadImageUsingMemoryModule(m_process)) { diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 595e8484d..944be9633 100644 --- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -359,16 +359,18 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo( if (image_sp.get() == nullptr || image_sp->GetAsDictionary() == nullptr) return false; StructuredData::Dictionary *image = image_sp->GetAsDictionary(); - if (image->HasKey("load_address") == false || - image->HasKey("pathname") == false || - image->HasKey("mod_date") == false || - image->HasKey("mach_header") == false || + // clang-format off + if (!image->HasKey("load_address") || + !image->HasKey("pathname") || + !image->HasKey("mod_date") || + !image->HasKey("mach_header") || image->GetValueForKey("mach_header")->GetAsDictionary() == nullptr || - image->HasKey("segments") == false || + !image->HasKey("segments") || image->GetValueForKey("segments")->GetAsArray() == nullptr || - image->HasKey("uuid") == false) { + !image->HasKey("uuid")) { return false; } + // clang-format on image_infos[i].address = image->GetValueForKey("load_address")->GetAsInteger()->GetValue(); image_infos[i].mod_date = @@ -712,11 +714,7 @@ bool DynamicLoaderDarwin::AlwaysRelyOnEHUnwindInfo(SymbolContext &sym_ctx) { return false; ObjCLanguageRuntime *objc_runtime = m_process->GetObjCLanguageRuntime(); - if (objc_runtime != NULL && objc_runtime->IsModuleObjCLibrary(module_sp)) { - return true; - } - - return false; + return objc_runtime != NULL && objc_runtime->IsModuleObjCLibrary(module_sp); } //---------------------------------------------------------------------- diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index 7fd886cde..1ff0ec2c7 100644 --- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -65,7 +65,7 @@ DynamicLoader *DynamicLoaderMacOS::CreateInstance(Process *process, } } - if (UseDYLDSPI(process) == false) { + if (!UseDYLDSPI(process)) { create = false; } @@ -503,8 +503,7 @@ bool DynamicLoaderMacOS::GetSharedCacheInformation( info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue(); if (!uuid_str.empty()) uuid.SetFromStringRef(uuid_str); - if (info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue() == - false) + if (!info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue()) using_shared_cache = eLazyBoolYes; else using_shared_cache = eLazyBoolNo; diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 50ed1eff8..ec459a783 100644 --- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -85,7 +85,7 @@ DynamicLoader *DynamicLoaderMacOSXDYLD::CreateInstance(Process *process, } } - if (UseDYLDSPI(process) == true) { + if (UseDYLDSPI(process)) { create = false; } @@ -122,12 +122,12 @@ bool DynamicLoaderMacOSXDYLD::ProcessDidExec() { // value differs from the Process' image info address. When a process // execs itself it might cause a change if ASLR is enabled. const addr_t shlib_addr = m_process->GetImageInfoAddress(); - if (m_process_image_addr_is_all_images_infos == true && + if (m_process_image_addr_is_all_images_infos && shlib_addr != m_dyld_all_image_infos_addr) { // The image info address from the process is the // 'dyld_all_image_infos' address and it has changed. did_exec = true; - } else if (m_process_image_addr_is_all_images_infos == false && + } else if (!m_process_image_addr_is_all_images_infos && shlib_addr == m_dyld.address) { // The image info address from the process is the mach_header address // for dyld and it has changed. diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp index 68eb3389e..b30a1ab2c 100644 --- a/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -455,14 +455,10 @@ static bool isLoadBiasIncorrect(Target &target, const std::string &file_path) { // On Android L (API 21, 22) the load address of the "/system/bin/linker" // isn't filled in correctly. unsigned os_major = target.GetPlatform()->GetOSVersion().getMajor(); - if (target.GetArchitecture().GetTriple().isAndroid() && - (os_major == 21 || os_major == 22) && - (file_path == "/system/bin/linker" || - file_path == "/system/bin/linker64")) { - return true; - } - - return false; + return target.GetArchitecture().GetTriple().isAndroid() && + (os_major == 21 || os_major == 22) && + (file_path == "/system/bin/linker" || + file_path == "/system/bin/linker64"); } void DYLDRendezvous::UpdateBaseAddrIfNecessary(SOEntry &entry, diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 72ef71e2f..660bba65d 100644 --- a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -117,7 +117,7 @@ void DynamicLoaderPOSIXDYLD::DidAttach() { EvalSpecialModulesStatus(); // if we dont have a load address we cant re-base - bool rebase_exec = (load_offset == LLDB_INVALID_ADDRESS) ? false : true; + bool rebase_exec = load_offset != LLDB_INVALID_ADDRESS; // if we have a valid executable if (executable_sp.get()) { diff --git a/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index 1116624aa..f03c71475 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -778,12 +778,9 @@ bool ClangASTSource::IgnoreName(const ConstString name, StringRef name_string_ref = name.GetStringRef(); // The ClangASTSource is not responsible for finding $-names. - if (name_string_ref.empty() || - (ignore_all_dollar_names && name_string_ref.startswith("$")) || - name_string_ref.startswith("_$")) - return true; - - return false; + return name_string_ref.empty() || + (ignore_all_dollar_names && name_string_ref.startswith("$")) || + name_string_ref.startswith("_$"); } void ClangASTSource::FindExternalVisibleDecls( diff --git a/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index bc18d27ee..fde610a09 100644 --- a/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -778,11 +778,8 @@ bool IRForTarget::RewriteObjCConstStrings() { static bool IsObjCSelectorRef(Value *value) { GlobalVariable *global_variable = dyn_cast<GlobalVariable>(value); - if (!global_variable || !global_variable->hasName() || - !global_variable->getName().startswith("OBJC_SELECTOR_REFERENCES_")) - return false; - - return true; + return !(!global_variable || !global_variable->hasName() || + !global_variable->getName().startswith("OBJC_SELECTOR_REFERENCES_")); } // This function does not report errors; its callers are responsible. @@ -953,11 +950,8 @@ bool IRForTarget::RewriteObjCSelectors(BasicBlock &basic_block) { static bool IsObjCClassReference(Value *value) { GlobalVariable *global_variable = dyn_cast<GlobalVariable>(value); - if (!global_variable || !global_variable->hasName() || - !global_variable->getName().startswith("OBJC_CLASS_REFERENCES_")) - return false; - - return true; + return !(!global_variable || !global_variable->hasName() || + !global_variable->getName().startswith("OBJC_CLASS_REFERENCES_")); } // This function does not report errors; its callers are responsible. @@ -1259,12 +1253,9 @@ bool IRForTarget::MaterializeInitializer(uint8_t *data, Constant *initializer) { llvm::NextPowerOf2(constant_size) * 8); lldb_private::Status get_data_error; - if (!scalar.GetAsMemoryData(data, constant_size, - lldb_private::endian::InlHostByteOrder(), - get_data_error)) - return false; - - return true; + return scalar.GetAsMemoryData(data, constant_size, + lldb_private::endian::InlHostByteOrder(), + get_data_error) != 0; } else if (ConstantDataArray *array_initializer = dyn_cast<ConstantDataArray>(initializer)) { if (array_initializer->isString()) { diff --git a/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp index d11cc1ed1..85bc4a61c 100644 --- a/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp +++ b/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp @@ -776,10 +776,7 @@ bool EmulateInstructionARM::WriteBits32UnknownToMemory(addr_t address) { uint32_t random_data = rand(); const uint32_t addr_byte_size = GetAddressByteSize(); - if (!MemAWrite(context, address, random_data, addr_byte_size)) - return false; - - return true; + return MemAWrite(context, address, random_data, addr_byte_size); } // Write "bits (32) UNKNOWN" to register n. Helper function for many ARM @@ -3340,10 +3337,7 @@ bool EmulateInstructionARM::EmulateCMNImm(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteFlags(context, res.result, res.carry_out, res.overflow)) - return false; - - return true; + return WriteFlags(context, res.result, res.carry_out, res.overflow); } // Compare Negative (register) adds a register value and an optionally-shifted @@ -3410,10 +3404,7 @@ bool EmulateInstructionARM::EmulateCMNReg(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteFlags(context, res.result, res.carry_out, res.overflow)) - return false; - - return true; + return WriteFlags(context, res.result, res.carry_out, res.overflow); } // Compare (immediate) subtracts an immediate value from a register value. It @@ -3463,10 +3454,7 @@ bool EmulateInstructionARM::EmulateCMPImm(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteFlags(context, res.result, res.carry_out, res.overflow)) - return false; - - return true; + return WriteFlags(context, res.result, res.carry_out, res.overflow); } // Compare (register) subtracts an optionally-shifted register value from a @@ -3542,10 +3530,7 @@ bool EmulateInstructionARM::EmulateCMPReg(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteFlags(context, res.result, res.carry_out, res.overflow)) - return false; - - return true; + return WriteFlags(context, res.result, res.carry_out, res.overflow); } // Arithmetic Shift Right (immediate) shifts a register value right by an @@ -9245,11 +9230,8 @@ bool EmulateInstructionARM::EmulateRSBImm(const uint32_t opcode, context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // Reverse Subtract (register) subtracts a register value from an optionally- @@ -9326,11 +9308,8 @@ bool EmulateInstructionARM::EmulateRSBReg(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // Reverse Subtract with Carry (immediate) subtracts a register value and the @@ -9388,11 +9367,8 @@ bool EmulateInstructionARM::EmulateRSCImm(const uint32_t opcode, context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // Reverse Subtract with Carry (register) subtracts a register value and the @@ -9460,11 +9436,8 @@ bool EmulateInstructionARM::EmulateRSCReg(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // Subtract with Carry (immediate) subtracts an immediate value and the value @@ -9531,11 +9504,8 @@ bool EmulateInstructionARM::EmulateSBCImm(const uint32_t opcode, context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // Subtract with Carry (register) subtracts an optionally-shifted register @@ -9620,11 +9590,8 @@ bool EmulateInstructionARM::EmulateSBCReg(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // This instruction subtracts an immediate value from a register value, and @@ -9713,11 +9680,8 @@ bool EmulateInstructionARM::EmulateSUBImmThumb(const uint32_t opcode, context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // This instruction subtracts an immediate value from a register value, and @@ -14153,11 +14117,8 @@ bool EmulateInstructionARM::BranchWritePC(const Context &context, else target = addr & 0xfffffffe; - if (!WriteRegisterUnsigned(context, eRegisterKindGeneric, - LLDB_REGNUM_GENERIC_PC, target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_PC, target); } // As a side effect, BXWritePC sets context.arg2 to eModeARM or eModeThumb by @@ -14191,11 +14152,8 @@ bool EmulateInstructionARM::BXWritePC(Context &context, uint32_t addr) { LLDB_REGNUM_GENERIC_FLAGS, m_new_inst_cpsr)) return false; } - if (!WriteRegisterUnsigned(context, eRegisterKindGeneric, - LLDB_REGNUM_GENERIC_PC, target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_PC, target); } // Dispatches to either BXWritePC or BranchWritePC based on architecture @@ -14408,14 +14366,14 @@ bool EmulateInstructionARM::EvaluateInstruction(uint32_t evaluate_options) { evaluate_options & eEmulateInstructionOptionIgnoreConditions; bool success = false; - if (m_opcode_cpsr == 0 || m_ignore_conditions == false) { + if (m_opcode_cpsr == 0 || !m_ignore_conditions) { m_opcode_cpsr = ReadRegisterUnsigned(eRegisterKindDWARF, dwarf_cpsr, 0, &success); } // Only return false if we are unable to read the CPSR if we care about // conditions - if (success == false && m_ignore_conditions == false) + if (!success && !m_ignore_conditions) return false; uint32_t orig_pc_value = 0; diff --git a/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp b/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp index bab249311..661a651c5 100644 --- a/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp +++ b/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp @@ -436,7 +436,7 @@ bool EmulateInstructionARM64::EvaluateInstruction(uint32_t evaluate_options) { // Only return false if we are unable to read the CPSR if we care about // conditions - if (success == false && m_ignore_conditions == false) + if (!success && !m_ignore_conditions) return false; uint32_t orig_pc_value = 0; @@ -546,11 +546,8 @@ bool EmulateInstructionARM64::BranchTo(const Context &context, uint32_t N, } else return false; - if (!WriteRegisterUnsigned(context, eRegisterKindGeneric, - LLDB_REGNUM_GENERIC_PC, addr)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_PC, addr); } bool EmulateInstructionARM64::ConditionHolds(const uint32_t cond) { @@ -1096,9 +1093,7 @@ bool EmulateInstructionARM64::EmulateB(const uint32_t opcode) { return false; } - if (!BranchTo(context, 64, target)) - return false; - return true; + return BranchTo(context, 64, target); } bool EmulateInstructionARM64::EmulateBcond(const uint32_t opcode) { diff --git a/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp b/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp index 9b5cc704c..7fccb2311 100644 --- a/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ b/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -220,10 +220,8 @@ EmulateInstructionMIPS::CreateInstance(const ArchSpec &arch, } bool EmulateInstructionMIPS::SetTargetTriple(const ArchSpec &arch) { - if (arch.GetTriple().getArch() == llvm::Triple::mips || - arch.GetTriple().getArch() == llvm::Triple::mipsel) - return true; - return false; + return arch.GetTriple().getArch() == llvm::Triple::mips || + arch.GetTriple().getArch() == llvm::Triple::mipsel; } const char *EmulateInstructionMIPS::GetRegisterName(unsigned reg_num, @@ -1350,10 +1348,7 @@ bool EmulateInstructionMIPS::Emulate_LW(llvm::MCInst &insn) { context.type = eContextPopRegisterOffStack; context.SetAddress(address); - if (!WriteRegister(context, ®_info_src, data_src)) - return false; - - return true; + return WriteRegister(context, ®_info_src, data_src); } return false; @@ -1450,11 +1445,8 @@ bool EmulateInstructionMIPS::Emulate_LUI(llvm::MCInst &insn) { context.SetImmediateSigned(imm); context.type = eContextImmediate; - if (WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_zero_mips + rt, - imm)) - return true; - - return false; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, + dwarf_zero_mips + rt, imm); } bool EmulateInstructionMIPS::Emulate_ADDIUSP(llvm::MCInst &insn) { @@ -1697,10 +1689,7 @@ bool EmulateInstructionMIPS::Emulate_LWSP(llvm::MCInst &insn) { context.type = eContextPopRegisterOffStack; context.SetAddress(base_address); - if (!WriteRegister(context, ®_info_src, data_src)) - return false; - - return true; + return WriteRegister(context, ®_info_src, data_src); } return false; @@ -1807,11 +1796,8 @@ bool EmulateInstructionMIPS::Emulate_JRADDIUSP(llvm::MCInst &insn) { context.type = eContextAdjustStackPointer; // update SP - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_sp_mips, - result)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_sp_mips, + result); } static int IsAdd64bitOverflow(int32_t a, int32_t b) { @@ -1864,11 +1850,8 @@ bool EmulateInstructionMIPS::Emulate_BXX_3ops(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } /* @@ -1947,11 +1930,8 @@ bool EmulateInstructionMIPS::Emulate_BXX_3ops_C(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(current_inst_size + offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } /* @@ -2122,11 +2102,8 @@ bool EmulateInstructionMIPS::Emulate_BXX_2ops(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } /* @@ -2189,11 +2166,8 @@ bool EmulateInstructionMIPS::Emulate_BXX_2ops_C(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(current_inst_size + offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_B16_MM(llvm::MCInst &insn) { @@ -2214,11 +2188,8 @@ bool EmulateInstructionMIPS::Emulate_B16_MM(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(current_inst_size + offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } /* @@ -2529,11 +2500,8 @@ bool EmulateInstructionMIPS::Emulate_BC(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_J(llvm::MCInst &insn) { @@ -2556,10 +2524,7 @@ bool EmulateInstructionMIPS::Emulate_J(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, pc)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, pc); } bool EmulateInstructionMIPS::Emulate_JAL(llvm::MCInst &insn) { @@ -2688,11 +2653,8 @@ bool EmulateInstructionMIPS::Emulate_JIC(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_JR(llvm::MCInst &insn) { @@ -2713,11 +2675,8 @@ bool EmulateInstructionMIPS::Emulate_JR(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - rs_val)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + rs_val); } /* @@ -2758,11 +2717,8 @@ bool EmulateInstructionMIPS::Emulate_FP_branch(llvm::MCInst &insn) { } Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_BC1EQZ(llvm::MCInst &insn) { @@ -2797,11 +2753,8 @@ bool EmulateInstructionMIPS::Emulate_BC1EQZ(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_BC1NEZ(llvm::MCInst &insn) { @@ -2836,11 +2789,8 @@ bool EmulateInstructionMIPS::Emulate_BC1NEZ(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } /* @@ -2898,11 +2848,8 @@ bool EmulateInstructionMIPS::Emulate_3D_branch(llvm::MCInst &insn) { } Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_BNZB(llvm::MCInst &insn) { @@ -2993,11 +2940,8 @@ bool EmulateInstructionMIPS::Emulate_MSA_Branch_DF(llvm::MCInst &insn, Context context; context.type = eContextRelativeBranchImmediate; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_BNZV(llvm::MCInst &insn) { @@ -3039,11 +2983,8 @@ bool EmulateInstructionMIPS::Emulate_MSA_Branch_V(llvm::MCInst &insn, Context context; context.type = eContextRelativeBranchImmediate; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_LDST_Imm(llvm::MCInst &insn) { diff --git a/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp b/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp index cbf3e7dfc..9d178dd97 100644 --- a/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ b/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp @@ -207,10 +207,8 @@ EmulateInstructionMIPS64::CreateInstance(const ArchSpec &arch, } bool EmulateInstructionMIPS64::SetTargetTriple(const ArchSpec &arch) { - if (arch.GetTriple().getArch() == llvm::Triple::mips64 || - arch.GetTriple().getArch() == llvm::Triple::mips64el) - return true; - return false; + return arch.GetTriple().getArch() == llvm::Triple::mips64 || + arch.GetTriple().getArch() == llvm::Triple::mips64el; } const char *EmulateInstructionMIPS64::GetRegisterName(unsigned reg_num, @@ -1240,10 +1238,7 @@ bool EmulateInstructionMIPS64::Emulate_LD(llvm::MCInst &insn) { Context context; context.type = eContextRegisterLoad; - if (!WriteRegister(context, ®_info_src, data_src)) - return false; - - return true; + return WriteRegister(context, ®_info_src, data_src); } return false; @@ -1262,11 +1257,8 @@ bool EmulateInstructionMIPS64::Emulate_LUI(llvm::MCInst &insn) { context.SetImmediateSigned(imm); context.type = eContextImmediate; - if (WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_zero_mips64 + rt, - imm)) - return true; - - return false; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, + dwarf_zero_mips64 + rt, imm); } bool EmulateInstructionMIPS64::Emulate_DSUBU_DADDU(llvm::MCInst &insn) { @@ -1394,11 +1386,8 @@ bool EmulateInstructionMIPS64::Emulate_BXX_3ops(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } /* @@ -1633,11 +1622,8 @@ bool EmulateInstructionMIPS64::Emulate_BXX_2ops(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_BC(llvm::MCInst &insn) { @@ -1659,11 +1645,8 @@ bool EmulateInstructionMIPS64::Emulate_BC(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } static int IsAdd64bitOverflow(int64_t a, int64_t b) { @@ -1747,11 +1730,8 @@ bool EmulateInstructionMIPS64::Emulate_BXX_3ops_C(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(current_inst_size + offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } /* @@ -1814,11 +1794,8 @@ bool EmulateInstructionMIPS64::Emulate_BXX_2ops_C(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(current_inst_size + offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_J(llvm::MCInst &insn) { @@ -1841,10 +1818,8 @@ bool EmulateInstructionMIPS64::Emulate_J(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, pc)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + pc); } bool EmulateInstructionMIPS64::Emulate_JAL(llvm::MCInst &insn) { @@ -1973,11 +1948,8 @@ bool EmulateInstructionMIPS64::Emulate_JIC(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_JR(llvm::MCInst &insn) { @@ -1998,11 +1970,8 @@ bool EmulateInstructionMIPS64::Emulate_JR(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - rs_val)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + rs_val); } /* @@ -2052,11 +2021,8 @@ bool EmulateInstructionMIPS64::Emulate_FP_branch(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_BC1EQZ(llvm::MCInst &insn) { @@ -2091,11 +2057,8 @@ bool EmulateInstructionMIPS64::Emulate_BC1EQZ(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_BC1NEZ(llvm::MCInst &insn) { @@ -2130,11 +2093,8 @@ bool EmulateInstructionMIPS64::Emulate_BC1NEZ(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } /* @@ -2193,11 +2153,8 @@ bool EmulateInstructionMIPS64::Emulate_3D_branch(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_BNZB(llvm::MCInst &insn) { @@ -2288,11 +2245,8 @@ bool EmulateInstructionMIPS64::Emulate_MSA_Branch_DF(llvm::MCInst &insn, Context context; context.type = eContextRelativeBranchImmediate; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_BNZV(llvm::MCInst &insn) { @@ -2334,11 +2288,8 @@ bool EmulateInstructionMIPS64::Emulate_MSA_Branch_V(llvm::MCInst &insn, Context context; context.type = eContextRelativeBranchImmediate; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_LDST_Imm(llvm::MCInst &insn) { diff --git a/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index d21456b6a..982b286d0 100644 --- a/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -141,10 +141,7 @@ static bool IsTrivialBasename(const llvm::StringRef &basename) { } // We processed all characters. It is a vaild basename. - if (idx == basename.size()) - return true; - - return false; + return idx == basename.size(); } bool CPlusPlusLanguage::MethodName::TrySimplifiedParse() { diff --git a/source/Plugins/Language/ObjC/CF.cpp b/source/Plugins/Language/ObjC/CF.cpp index 9bb8eeab1..e3dab5a14 100644 --- a/source/Plugins/Language/ObjC/CF.cpp +++ b/source/Plugins/Language/ObjC/CF.cpp @@ -149,7 +149,7 @@ bool lldb_private::formatters::CFBitVectorSummaryProvider( } } - if (is_type_ok == false) + if (!is_type_ok) return false; Status error; diff --git a/source/Plugins/Language/ObjC/NSException.cpp b/source/Plugins/Language/ObjC/NSException.cpp index bb0bcb946..2404ef9d1 100644 --- a/source/Plugins/Language/ObjC/NSException.cpp +++ b/source/Plugins/Language/ObjC/NSException.cpp @@ -144,11 +144,8 @@ public: m_userinfo_sp.reset(); m_reserved_sp.reset(); - if (!ExtractFields(m_backend, &m_name_sp, &m_reason_sp, &m_userinfo_sp, - &m_reserved_sp)) { - return false; - } - return true; + return ExtractFields(m_backend, &m_name_sp, &m_reason_sp, &m_userinfo_sp, + &m_reserved_sp); } bool MightHaveChildren() override { return true; } diff --git a/source/Plugins/Language/ObjC/NSIndexPath.cpp b/source/Plugins/Language/ObjC/NSIndexPath.cpp index dac70cd1c..41df9abb3 100644 --- a/source/Plugins/Language/ObjC/NSIndexPath.cpp +++ b/source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -126,11 +126,7 @@ public: return false; } - bool MightHaveChildren() override { - if (m_impl.m_mode == Mode::Invalid) - return false; - return true; - } + bool MightHaveChildren() override { return m_impl.m_mode != Mode::Invalid; } size_t GetIndexOfChildWithName(const ConstString &name) override { const char *item_name = name.GetCString(); diff --git a/source/Plugins/Language/ObjC/NSString.cpp b/source/Plugins/Language/ObjC/NSString.cpp index 0b12edb53..f882b2adc 100644 --- a/source/Plugins/Language/ObjC/NSString.cpp +++ b/source/Plugins/Language/ObjC/NSString.cpp @@ -225,10 +225,10 @@ bool lldb_private::formatters::NSStringSummaryProvider( options.SetStream(&stream); options.SetQuote('"'); options.SetSourceSize(explicit_length); - options.SetNeedsZeroTermination(has_explicit_length == false); + options.SetNeedsZeroTermination(!has_explicit_length); options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped); - options.SetBinaryZeroIsTerminator(has_explicit_length == false); + options.SetBinaryZeroIsTerminator(!has_explicit_length); options.SetLanguage(summary_options.GetLanguage()); return StringPrinter::ReadStringAndDumpToStream< StringPrinter::StringElementType::UTF16>(options); @@ -245,10 +245,10 @@ bool lldb_private::formatters::NSStringSummaryProvider( options.SetStream(&stream); options.SetQuote('"'); options.SetSourceSize(explicit_length); - options.SetNeedsZeroTermination(has_explicit_length == false); + options.SetNeedsZeroTermination(!has_explicit_length); options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped); - options.SetBinaryZeroIsTerminator(has_explicit_length == false); + options.SetBinaryZeroIsTerminator(!has_explicit_length); options.SetLanguage(summary_options.GetLanguage()); return StringPrinter::ReadStringAndDumpToStream< StringPrinter::StringElementType::UTF16>(options); @@ -260,10 +260,7 @@ bool lldb_private::formatters::NSStringSummaryProvider( Status error; explicit_length = process_sp->ReadUnsignedIntegerFromMemory(location, 1, 0, error); - if (error.Fail() || explicit_length == 0) - has_explicit_length = false; - else - has_explicit_length = true; + has_explicit_length = !(error.Fail() || explicit_length == 0); location++; } options.SetLocation(location); diff --git a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 062ae2818..3f9ae937b 100644 --- a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -309,10 +309,7 @@ bool ItaniumABILanguageRuntime::IsVTableName(const char *name) { return false; // Can we maybe ask Clang about this? - if (strstr(name, "_vptr$") == name) - return true; - else - return false; + return strstr(name, "_vptr$") == name; } //------------------------------------------------------------------ diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index edb29e735..421c0040d 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -264,11 +264,7 @@ bool ClassDescriptorV2::method_t::Read(Process *process, lldb::addr_t addr) { } process->ReadCStringFromMemory(m_types_ptr, m_types, error); - if (error.Fail()) { - return false; - } - - return true; + return !error.Fail(); } bool ClassDescriptorV2::ivar_list_t::Read(Process *process, lldb::addr_t addr) { @@ -323,11 +319,7 @@ bool ClassDescriptorV2::ivar_t::Read(Process *process, lldb::addr_t addr) { } process->ReadCStringFromMemory(m_type_ptr, m_type, error); - if (error.Fail()) { - return false; - } - - return true; + return !error.Fail(); } bool ClassDescriptorV2::Describe( diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index 74b17f539..f55a7e8dd 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -441,13 +441,10 @@ bool AppleObjCRuntime::CalculateHasNewLiteralsAndIndexing() { SymbolContextList sc_list; - if (target.GetImages().FindSymbolsWithNameAndType(s_method_signature, - eSymbolTypeCode, sc_list) || - target.GetImages().FindSymbolsWithNameAndType(s_arclite_method_signature, - eSymbolTypeCode, sc_list)) - return true; - else - return false; + return target.GetImages().FindSymbolsWithNameAndType( + s_method_signature, eSymbolTypeCode, sc_list) || + target.GetImages().FindSymbolsWithNameAndType( + s_arclite_method_signature, eSymbolTypeCode, sc_list); } lldb::SearchFilterSP AppleObjCRuntime::CreateExceptionSearchFilter() { diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp index aaecfb27e..1cfc7a1a0 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -58,7 +58,7 @@ bool AppleObjCRuntimeV1::GetDynamicTypeAndAddress( class_type_or_name.SetName(class_descriptor->GetClassName()); } } - return class_type_or_name.IsEmpty() == false; + return !class_type_or_name.IsEmpty(); } //------------------------------------------------------------------ diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index bbe6dd8e8..d3228d69e 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -454,7 +454,7 @@ bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress( } } } - return class_type_or_name.IsEmpty() == false; + return !class_type_or_name.IsEmpty(); } //------------------------------------------------------------------ @@ -1852,8 +1852,8 @@ void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() { // warn if: // - we could not run either expression // - we found fewer than num_classes_to_warn_at classes total - if ((false == shared_cache_update_result.m_update_ran) || - (false == dynamic_update_result.m_update_ran)) + if ((!shared_cache_update_result.m_update_ran) || + (!dynamic_update_result.m_update_ran)) WarnIfNoClassesCached( SharedCacheWarningReason::eExpressionExecutionFailure); else if (dynamic_update_result.m_num_found + @@ -2428,7 +2428,7 @@ AppleObjCRuntimeV2::NonPointerISACache::NonPointerISACache( ObjCLanguageRuntime::ClassDescriptorSP AppleObjCRuntimeV2::NonPointerISACache::GetClassDescriptor(ObjCISA isa) { ObjCISA real_isa = 0; - if (EvaluateNonPointerISA(isa, real_isa) == false) + if (!EvaluateNonPointerISA(isa, real_isa)) return ObjCLanguageRuntime::ClassDescriptorSP(); auto cache_iter = m_cache.find(real_isa); if (cache_iter != m_cache.end()) diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp index 19d9676e8..2b54d0a54 100644 --- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp +++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp @@ -200,10 +200,7 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) { // The base class MischiefManaged does some cleanup - so you have to call it in // your MischiefManaged derived class. bool AppleThreadPlanStepThroughObjCTrampoline::MischiefManaged() { - if (IsPlanComplete()) - return true; - else - return false; + return IsPlanComplete(); } bool AppleThreadPlanStepThroughObjCTrampoline::WillStop() { return true; } diff --git a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index 95daadfac..fa775d9bf 100644 --- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -2074,10 +2074,8 @@ bool RenderScriptRuntime::JITElementPacked(Element &elem, // If this Element has subelements then JIT rsaElementGetSubElements() for // details about its fields - if (*elem.field_count.get() > 0 && !JITSubelements(elem, context, frame_ptr)) - return false; - - return true; + return !(*elem.field_count.get() > 0 && + !JITSubelements(elem, context, frame_ptr)); } // JITs the RS runtime for information about the subelements/fields of a struct @@ -2300,10 +2298,7 @@ bool RenderScriptRuntime::RefreshAllocation(AllocationDetails *alloc, SetElementSize(alloc->element); // Use GetOffsetPointer() to infer size of the allocation - if (!JITAllocationSize(alloc, frame_ptr)) - return false; - - return true; + return JITAllocationSize(alloc, frame_ptr); } // Function attempts to set the type_name member of the paramaterised Element diff --git a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index ae7409352..391ab7546 100644 --- a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -207,7 +207,7 @@ ObjectContainerBSDArchive::Archive::FindCachedArchive( while (pos != archive_map.end() && pos->first == file) { bool match = true; if (arch.IsValid() && - pos->second->GetArchitecture().IsCompatibleMatch(arch) == false) + !pos->second->GetArchitecture().IsCompatibleMatch(arch)) match = false; else if (file_offset != LLDB_INVALID_OFFSET && pos->second->GetFileOffset() != file_offset) diff --git a/source/Plugins/ObjectFile/ELF/ELFHeader.cpp b/source/Plugins/ObjectFile/ELF/ELFHeader.cpp index 16cbb6e57..3d4735286 100644 --- a/source/Plugins/ObjectFile/ELF/ELFHeader.cpp +++ b/source/Plugins/ObjectFile/ELF/ELFHeader.cpp @@ -38,7 +38,7 @@ static bool GetMaxU64(const lldb_private::DataExtractor &data, lldb::offset_t saved_offset = *offset; for (uint32_t i = 0; i < count; ++i, ++value) { - if (GetMaxU64(data, offset, value, byte_size) == false) { + if (!GetMaxU64(data, offset, value, byte_size)) { *offset = saved_offset; return false; } @@ -60,7 +60,7 @@ static bool GetMaxS64(const lldb_private::DataExtractor &data, lldb::offset_t saved_offset = *offset; for (uint32_t i = 0; i < count; ++i, ++value) { - if (GetMaxS64(data, offset, value, byte_size) == false) { + if (!GetMaxS64(data, offset, value, byte_size)) { *offset = saved_offset; return false; } @@ -133,7 +133,7 @@ bool ELFHeader::Parse(lldb_private::DataExtractor &data, return false; // Read e_entry, e_phoff and e_shoff. - if (GetMaxU64(data, offset, &e_entry, byte_size, 3) == false) + if (!GetMaxU64(data, offset, &e_entry, byte_size, 3)) return false; // Read e_flags. @@ -232,11 +232,11 @@ bool ELFSectionHeader::Parse(const lldb_private::DataExtractor &data, return false; // Read sh_flags. - if (GetMaxU64(data, offset, &sh_flags, byte_size) == false) + if (!GetMaxU64(data, offset, &sh_flags, byte_size)) return false; // Read sh_addr, sh_off and sh_size. - if (GetMaxU64(data, offset, &sh_addr, byte_size, 3) == false) + if (!GetMaxU64(data, offset, &sh_addr, byte_size, 3)) return false; // Read sh_link and sh_info. @@ -244,7 +244,7 @@ bool ELFSectionHeader::Parse(const lldb_private::DataExtractor &data, return false; // Read sh_addralign and sh_entsize. - if (GetMaxU64(data, offset, &sh_addralign, byte_size, 2) == false) + if (!GetMaxU64(data, offset, &sh_addralign, byte_size, 2)) return false; return true; @@ -332,7 +332,7 @@ bool ELFSymbol::Parse(const lldb_private::DataExtractor &data, if (parsing_32) { // Read st_value and st_size. - if (GetMaxU64(data, offset, &st_value, byte_size, 2) == false) + if (!GetMaxU64(data, offset, &st_value, byte_size, 2)) return false; // Read st_info and st_other. @@ -376,7 +376,7 @@ bool ELFProgramHeader::Parse(const lldb_private::DataExtractor &data, if (parsing_32) { // Read p_offset, p_vaddr, p_paddr, p_filesz and p_memsz. - if (GetMaxU64(data, offset, &p_offset, byte_size, 5) == false) + if (!GetMaxU64(data, offset, &p_offset, byte_size, 5)) return false; // Read p_flags. @@ -384,7 +384,7 @@ bool ELFProgramHeader::Parse(const lldb_private::DataExtractor &data, return false; // Read p_align. - if (GetMaxU64(data, offset, &p_align, byte_size) == false) + if (!GetMaxU64(data, offset, &p_align, byte_size)) return false; } else { // Read p_flags. @@ -392,7 +392,7 @@ bool ELFProgramHeader::Parse(const lldb_private::DataExtractor &data, return false; // Read p_offset, p_vaddr, p_paddr, p_filesz, p_memsz and p_align. - if (GetMaxU64(data, offset, &p_offset, byte_size, 6) == false) + if (!GetMaxU64(data, offset, &p_offset, byte_size, 6)) return false; } @@ -420,10 +420,7 @@ bool ELFRel::Parse(const lldb_private::DataExtractor &data, const unsigned byte_size = data.GetAddressByteSize(); // Read r_offset and r_info. - if (GetMaxU64(data, offset, &r_offset, byte_size, 2) == false) - return false; - - return true; + return GetMaxU64(data, offset, &r_offset, byte_size, 2) != false; } //------------------------------------------------------------------------------ @@ -436,11 +433,11 @@ bool ELFRela::Parse(const lldb_private::DataExtractor &data, const unsigned byte_size = data.GetAddressByteSize(); // Read r_offset and r_info. - if (GetMaxU64(data, offset, &r_offset, byte_size, 2) == false) + if (!GetMaxU64(data, offset, &r_offset, byte_size, 2)) return false; // Read r_addend; - if (GetMaxS64(data, offset, &r_addend, byte_size) == false) + if (!GetMaxS64(data, offset, &r_addend, byte_size)) return false; return true; diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 77ae9731e..e294bd470 100644 --- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1140,7 +1140,7 @@ size_t ObjectFileELF::GetProgramHeaderInfo(ProgramHeaderColl &program_headers, uint32_t idx; lldb::offset_t offset; for (idx = 0, offset = 0; idx < header.e_phnum; ++idx) { - if (program_headers[idx].Parse(data, &offset) == false) + if (!program_headers[idx].Parse(data, &offset)) break; } @@ -1552,7 +1552,7 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers, uint32_t idx; lldb::offset_t offset; for (idx = 0, offset = 0; idx < header.e_shnum; ++idx) { - if (section_headers[idx].Parse(sh_data, &offset) == false) + if (!section_headers[idx].Parse(sh_data, &offset)) break; } if (idx < section_headers.size()) @@ -1953,7 +1953,7 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, unsigned i; for (i = 0; i < num_symbols; ++i) { - if (symbol.Parse(symtab_data, &offset) == false) + if (!symbol.Parse(symtab_data, &offset)) break; const char *symbol_name = strtab_data.PeekCStr(symbol.st_name); @@ -2419,7 +2419,7 @@ static unsigned ParsePLTRelocations( unsigned slot_type = hdr->GetRelocationJumpSlotType(); unsigned i; for (i = 0; i < num_relocations; ++i) { - if (rel.Parse(rel_data, &offset) == false) + if (!rel.Parse(rel_data, &offset)) break; if (reloc_type(rel) != slot_type) @@ -2552,7 +2552,7 @@ unsigned ObjectFileELF::ApplyRelocations( } for (unsigned i = 0; i < num_relocations; ++i) { - if (rel.Parse(rel_data, &offset) == false) + if (!rel.Parse(rel_data, &offset)) break; Symbol *symbol = NULL; diff --git a/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp index 53eb82074..bce352245 100644 --- a/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ b/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -218,7 +218,7 @@ bool ObjectFileJIT::SetLoadAddress(Target &target, lldb::addr_t value, // that size on disk (to avoid __PAGEZERO) and load them SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx)); if (section_sp && section_sp->GetFileSize() > 0 && - section_sp->IsThreadSpecific() == false) { + !section_sp->IsThreadSpecific()) { if (target.GetSectionLoadList().SetSectionLoadAddress( section_sp, section_sp->GetFileAddress() + value)) ++num_loaded_sections; diff --git a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index e6b9c520d..c7a790ebd 100644 --- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -4469,7 +4469,7 @@ size_t ObjectFileMachO::ParseSymtab() { symbol_value -= section_file_addr; } - if (is_debug == false) { + if (!is_debug) { if (type == eSymbolTypeCode) { // See if we can find a N_FUN entry for any code symbols. If we // do find a match, and the name matches, then we can merge the @@ -4616,7 +4616,7 @@ size_t ObjectFileMachO::ParseSymtab() { if (function_starts_count > 0) { uint32_t num_synthetic_function_symbols = 0; for (i = 0; i < function_starts_count; ++i) { - if (function_starts.GetEntryRef(i).data == false) + if (!function_starts.GetEntryRef(i).data) ++num_synthetic_function_symbols; } @@ -4628,7 +4628,7 @@ size_t ObjectFileMachO::ParseSymtab() { for (i = 0; i < function_starts_count; ++i) { const FunctionStarts::Entry *func_start_entry = function_starts.GetEntryAtIndex(i); - if (func_start_entry->data == false) { + if (!func_start_entry->data) { addr_t symbol_file_addr = func_start_entry->addr; uint32_t symbol_flags = 0; if (is_arm) { @@ -5861,7 +5861,7 @@ uint32_t ObjectFileMachO::GetSDKVersion(uint32_t *versions, if (m_sdk_versions.empty()) { lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic); bool success = false; - for (uint32_t i = 0; success == false && i < m_header.ncmds; ++i) { + for (uint32_t i = 0; !success && i < m_header.ncmds; ++i) { const lldb::offset_t load_cmd_offset = offset; version_min_command lc; @@ -5890,47 +5890,46 @@ uint32_t ObjectFileMachO::GetSDKVersion(uint32_t *versions, offset = load_cmd_offset + lc.cmdsize; } - if (success == false) - { - offset = MachHeaderSizeFromMagic(m_header.magic); - for (uint32_t i = 0; success == false && i < m_header.ncmds; ++i) - { - const lldb::offset_t load_cmd_offset = offset; + if (!success) { + offset = MachHeaderSizeFromMagic(m_header.magic); + for (uint32_t i = 0; !success && i < m_header.ncmds; ++i) { + const lldb::offset_t load_cmd_offset = offset; - version_min_command lc; - if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) - break; - if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) - { - // struct build_version_command { - // uint32_t cmd; /* LC_BUILD_VERSION */ - // uint32_t cmdsize; /* sizeof(struct build_version_command) plus */ - // /* ntools * sizeof(struct build_tool_version) */ - // uint32_t platform; /* platform */ - // uint32_t minos; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ - // uint32_t sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ - // uint32_t ntools; /* number of tool entries following this */ - // }; - - offset += 4; // skip platform - uint32_t minos = m_data.GetU32(&offset); - - const uint32_t xxxx = minos >> 16; - const uint32_t yy = (minos >> 8) & 0xffu; - const uint32_t zz = minos & 0xffu; - if (xxxx) - { - m_sdk_versions.push_back (xxxx); - m_sdk_versions.push_back (yy); - m_sdk_versions.push_back (zz); - success = true; - } - } - offset = load_cmd_offset + lc.cmdsize; + version_min_command lc; + if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) + break; + if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) { + // struct build_version_command { + // uint32_t cmd; /* LC_BUILD_VERSION */ + // uint32_t cmdsize; /* sizeof(struct + // build_version_command) plus */ + // /* ntools * sizeof(struct + // build_tool_version) */ + // uint32_t platform; /* platform */ + // uint32_t minos; /* X.Y.Z is encoded in nibbles + // xxxx.yy.zz */ uint32_t sdk; /* X.Y.Z is encoded + // in nibbles xxxx.yy.zz */ uint32_t ntools; /* number + // of tool entries following this */ + // }; + + offset += 4; // skip platform + uint32_t minos = m_data.GetU32(&offset); + + const uint32_t xxxx = minos >> 16; + const uint32_t yy = (minos >> 8) & 0xffu; + const uint32_t zz = minos & 0xffu; + if (xxxx) { + m_sdk_versions.push_back(xxxx); + m_sdk_versions.push_back(yy); + m_sdk_versions.push_back(zz); + success = true; + } } + offset = load_cmd_offset + lc.cmdsize; + } } - if (success == false) { + if (!success) { // Push an invalid value so we don't try to find // the version # again on the next call to this // method. @@ -5991,8 +5990,7 @@ Section *ObjectFileMachO::GetMachHeaderSection() { ++sect_idx) { Section *section = section_list->GetSectionAtIndex(sect_idx).get(); if (section && section->GetFileSize() > 0 && - section->GetFileOffset() == 0 && - section->IsThreadSpecific() == false && + section->GetFileOffset() == 0 && !section->IsThreadSpecific() && module_sp.get() == section->GetModule().get()) { return section; } @@ -6011,7 +6009,7 @@ lldb::addr_t ObjectFileMachO::CalculateSectionLoadAddressForMemoryImage( lldb::addr_t mach_header_file_addr = mach_header_section->GetFileAddress(); if (mach_header_file_addr != LLDB_INVALID_ADDRESS) { if (section && section->GetFileSize() > 0 && - section->IsThreadSpecific() == false && + !section->IsThreadSpecific() && module_sp.get() == section->GetModule().get()) { // Ignore __LINKEDIT and __DWARF segments if (section->GetName() == GetSegmentNameLINKEDIT()) { @@ -6019,7 +6017,7 @@ lldb::addr_t ObjectFileMachO::CalculateSectionLoadAddressForMemoryImage( // kernel binary like a kext or mach_kernel. const bool is_memory_image = (bool)m_process_wp.lock(); const Strata strata = GetStrata(); - if (is_memory_image == false || strata == eStrataKernel) + if (!is_memory_image || strata == eStrataKernel) return LLDB_INVALID_ADDRESS; } return section->GetFileAddress() - mach_header_file_addr + @@ -6046,7 +6044,7 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value, // sections that size on disk (to avoid __PAGEZERO) and load them SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx)); if (section_sp && section_sp->GetFileSize() > 0 && - section_sp->IsThreadSpecific() == false && + !section_sp->IsThreadSpecific() && module_sp.get() == section_sp->GetModule().get()) { // Ignore __LINKEDIT and __DWARF segments if (section_sp->GetName() == GetSegmentNameLINKEDIT()) { @@ -6054,7 +6052,7 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value, // isn't a kernel binary like a kext or mach_kernel. const bool is_memory_image = (bool)m_process_wp.lock(); const Strata strata = GetStrata(); - if (is_memory_image == false || strata == eStrataKernel) + if (!is_memory_image || strata == eStrataKernel) continue; } if (target.GetSectionLoadList().SetSectionLoadAddress( diff --git a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 12d9a673e..abdec6550 100644 --- a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -527,7 +527,7 @@ bool ObjectFilePECOFF::ParseSectionHeaders( } } - return m_sect_headers.empty() == false; + return !m_sect_headers.empty(); } bool ObjectFilePECOFF::GetSectionName(std::string §_name, diff --git a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 8247e33e0..89a0f2253 100644 --- a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -213,7 +213,7 @@ bool OperatingSystemPython::UpdateThreadList(ThreadList &old_thread_list, // beginning of the list uint32_t insert_idx = 0; for (uint32_t core_idx = 0; core_idx < num_cores; ++core_idx) { - if (core_used_map[core_idx] == false) { + if (!core_used_map[core_idx]) { new_thread_list.InsertThread( core_thread_list.GetThreadAtIndex(core_idx, false), insert_idx); ++insert_idx; diff --git a/source/Plugins/Platform/Android/PlatformAndroid.cpp b/source/Plugins/Platform/Android/PlatformAndroid.cpp index 5925dd006..a56ab0e30 100644 --- a/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -74,7 +74,7 @@ PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) { } bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getVendor()) { case llvm::Triple::PC: diff --git a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index f1bbfb0c7..59cce3a6b 100644 --- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -48,7 +48,7 @@ PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) { arch ? arch->GetTriple().getTriple() : "<null>"); bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getOS()) { case llvm::Triple::FreeBSD: diff --git a/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp b/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp index 27af40fe3..cc902b7f7 100644 --- a/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp +++ b/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp @@ -30,7 +30,7 @@ static uint32_t g_initialize_count = 0; PlatformSP PlatformKalimba::CreateInstance(bool force, const ArchSpec *arch) { bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getVendor()) { case llvm::Triple::CSR: diff --git a/source/Plugins/Platform/Linux/PlatformLinux.cpp b/source/Plugins/Platform/Linux/PlatformLinux.cpp index 6a7339bce..3ce4b2084 100644 --- a/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -46,7 +46,7 @@ PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) { arch ? arch->GetTriple().getTriple() : "<null>"); bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getOS()) { case llvm::Triple::Linux: diff --git a/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp index 60ffb68d1..26a22a0a1 100644 --- a/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ b/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp @@ -76,7 +76,7 @@ PlatformSP PlatformAppleTVSimulator::CreateInstance(bool force, } bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { switch (arch->GetMachine()) { case llvm::Triple::x86_64: { const llvm::Triple &triple = arch->GetTriple(); diff --git a/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp index e211050cf..23eee15f7 100644 --- a/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ b/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp @@ -75,7 +75,7 @@ PlatformSP PlatformAppleWatchSimulator::CreateInstance(bool force, } bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { switch (arch->GetMachine()) { case llvm::Triple::x86_64: { const llvm::Triple &triple = arch->GetTriple(); diff --git a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 30b035d44..3868d9770 100644 --- a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -489,10 +489,7 @@ bool PlatformDarwin::ModuleIsExcludedForUnconstrainedSearches( return false; ObjectFile::Type obj_type = obj_file->GetType(); - if (obj_type == ObjectFile::eTypeDynamicLinker) - return true; - else - return false; + return obj_type == ObjectFile::eTypeDynamicLinker; } bool PlatformDarwin::x86GetSupportedArchitectureAtIndex(uint32_t idx, diff --git a/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index 241f8d5ec..330785850 100644 --- a/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -91,7 +91,7 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force, // ArchSpec for normal userland debugging. It is only useful in kernel debug // sessions and the DynamicLoaderDarwinPlugin (or a user doing 'platform // select') will force the creation of this Platform plugin. - if (force == false) { + if (!force) { if (log) log->Printf("PlatformDarwinKernel::%s() aborting creation of platform " "because force == false", @@ -102,7 +102,7 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force, bool create = force; LazyBool is_ios_debug_session = eLazyBoolCalculate; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getVendor()) { case llvm::Triple::Apple: @@ -640,10 +640,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling( shallow_bundle_str += ".dSYM"; dsym_fspec.SetFile(shallow_bundle_str, FileSpec::Style::native); FileSystem::Instance().Resolve(dsym_fspec); - if (FileSystem::Instance().IsDirectory(dsym_fspec)) { - return true; - } - return false; + return FileSystem::Instance().IsDirectory(dsym_fspec); } // Given a FileSpec of /dir/dir/mach.development.t7004 Return true if a dSYM @@ -654,10 +651,7 @@ bool PlatformDarwinKernel::KernelHasdSYMSibling(const FileSpec &kernel_binary) { std::string filename = kernel_binary.GetFilename().AsCString(); filename += ".dSYM"; kernel_dsym.GetFilename() = ConstString(filename); - if (FileSystem::Instance().IsDirectory(kernel_dsym)) { - return true; - } - return false; + return FileSystem::Instance().IsDirectory(kernel_dsym); } Status PlatformDarwinKernel::GetSharedModule( diff --git a/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 530be63db..4e18b90f5 100644 --- a/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -80,7 +80,7 @@ PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch) { const bool is_host = false; bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getVendor()) { case llvm::Triple::Apple: diff --git a/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index aa4da1e9e..d14bd89e4 100644 --- a/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -71,7 +71,7 @@ PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) { } bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { switch (arch->GetMachine()) { case llvm::Triple::arm: case llvm::Triple::aarch64: diff --git a/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index 0d9d3d0bd..9d1e5f433 100644 --- a/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -76,7 +76,7 @@ PlatformSP PlatformiOSSimulator::CreateInstance(bool force, } bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { switch (arch->GetMachine()) { case llvm::Triple::x86_64: case llvm::Triple::x86: { diff --git a/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm b/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm index 8964906f3..a601e27dc 100644 --- a/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ b/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm @@ -591,7 +591,7 @@ void CoreSimulatorSupport::DeviceSet::ForEach( std::function<bool(const Device &)> f) { const size_t n = GetNumDevices(); for (NSUInteger i = 0; i < n; ++i) { - if (f(GetDeviceAtIndex(i)) == false) + if (!f(GetDeviceAtIndex(i))) break; } } diff --git a/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp index b2fcedeaa..eea0887e9 100644 --- a/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -46,7 +46,7 @@ PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) { arch ? arch->GetTriple().getTriple() : "<null>"); bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getOS()) { case llvm::Triple::NetBSD: diff --git a/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp b/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp index e98434511..7358acb61 100644 --- a/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp +++ b/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp @@ -46,7 +46,7 @@ PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch) { arch ? arch->GetTriple().getTriple() : "<null>"); bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getOS()) { case llvm::Triple::OpenBSD: diff --git a/source/Plugins/Platform/Windows/PlatformWindows.cpp b/source/Plugins/Platform/Windows/PlatformWindows.cpp index 26eca5dc4..9d49486d4 100644 --- a/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -67,7 +67,7 @@ PlatformSP PlatformWindows::CreateInstance(bool force, const bool is_host = false; bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getVendor()) { case llvm::Triple::PC: diff --git a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 9e7a8a362..7187b94a6 100644 --- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -40,7 +40,7 @@ static bool g_initialized = false; void PlatformRemoteGDBServer::Initialize() { Platform::Initialize(); - if (g_initialized == false) { + if (!g_initialized) { g_initialized = true; PluginManager::RegisterPlugin( PlatformRemoteGDBServer::GetPluginNameStatic(), diff --git a/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp index 7b22bec66..8908108ef 100644 --- a/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp +++ b/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp @@ -463,19 +463,13 @@ lldb_private::UUID CommunicationKDP::GetUUID() { bool CommunicationKDP::RemoteIsEFI() { if (GetKernelVersion() == NULL) return false; - if (strncmp(m_kernel_version.c_str(), "EFI", 3) == 0) - return true; - else - return false; + return strncmp(m_kernel_version.c_str(), "EFI", 3) == 0; } bool CommunicationKDP::RemoteIsDarwinKernel() { if (GetKernelVersion() == NULL) return false; - if (m_kernel_version.find("Darwin Kernel") != std::string::npos) - return true; - else - return false; + return m_kernel_version.find("Darwin Kernel") != std::string::npos; } lldb::addr_t CommunicationKDP::GetLoadAddress() { @@ -1258,9 +1252,7 @@ bool CommunicationKDP::SendRequestResume() { request_packet.PutHex32(GetCPUMask()); DataExtractor reply_packet; - if (SendRequestAndGetReply(command, request_packet, reply_packet)) - return true; - return false; + return SendRequestAndGetReply(command, request_packet, reply_packet); } bool CommunicationKDP::SendRequestBreakpoint(bool set, addr_t addr) { @@ -1293,7 +1285,5 @@ bool CommunicationKDP::SendRequestSuspend() { const uint32_t command_length = 8; MakeRequestPacketHeader(command, request_packet, command_length); DataExtractor reply_packet; - if (SendRequestAndGetReply(command, request_packet, reply_packet)) - return true; - return false; + return SendRequestAndGetReply(command, request_packet, reply_packet); } diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp index 6de7e885e..9ad896abd 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp +++ b/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp @@ -1670,7 +1670,7 @@ uint32_t RegisterContextDarwin_arm::SetHardwareWatchpoint(lldb::addr_t addr, return LLDB_INVALID_INDEX32; // We must watch for either read or write - if (read == false && write == false) + if (!read && !write) return LLDB_INVALID_INDEX32; // Can't watch more than 4 bytes per WVR/WCR pair diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp index ff8a787a1..b478645e0 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp @@ -956,7 +956,7 @@ uint32_t RegisterContextDarwin_arm64::SetHardwareWatchpoint(lldb::addr_t addr, return LLDB_INVALID_INDEX32; // We must watch for either read or write - if (read == false && write == false) + if (!read && !write) return LLDB_INVALID_INDEX32; // Can't watch more than 4 bytes per WVR/WCR pair diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 3a1f2fb37..8c420a87e 100644 --- a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -324,7 +324,7 @@ void RegisterContextLLDB::InitializeNonZerothFrame() { above_trap_handler = true; if (pc == 0 || pc == 0x1) { - if (above_trap_handler == false) { + if (!above_trap_handler) { m_frame_type = eNotAValidFrame; UnwindLogMsg("this frame has a pc of 0x0"); return; @@ -474,7 +474,7 @@ void RegisterContextLLDB::InitializeNonZerothFrame() { bool decr_pc_and_recompute_addr_range = false; // If the symbol lookup failed... - if (m_sym_ctx_valid == false) + if (!m_sym_ctx_valid) decr_pc_and_recompute_addr_range = true; // Or if we're in the middle of the stack (and not "above" an asynchronous @@ -1250,7 +1250,7 @@ RegisterContextLLDB::SavedLocationForRegister( // Address register and it hasn't been saved anywhere yet -- that is, // it's still live in the actual register. Handle this specially. - if (have_unwindplan_regloc == false && return_address_reg.IsValid() && + if (!have_unwindplan_regloc && return_address_reg.IsValid() && IsFrameZero()) { if (return_address_reg.GetAsKind(eRegisterKindLLDB) != LLDB_INVALID_REGNUM) { @@ -1329,11 +1329,7 @@ RegisterContextLLDB::SavedLocationForRegister( } } - if (can_fetch_pc_value && can_fetch_cfa) { - have_unwindplan_regloc = true; - } else { - have_unwindplan_regloc = false; - } + have_unwindplan_regloc = can_fetch_pc_value && can_fetch_cfa; } else { // We were unable to fall back to another unwind plan have_unwindplan_regloc = false; @@ -1344,7 +1340,7 @@ RegisterContextLLDB::SavedLocationForRegister( ExecutionContext exe_ctx(m_thread.shared_from_this()); Process *process = exe_ctx.GetProcessPtr(); - if (have_unwindplan_regloc == false) { + if (!have_unwindplan_regloc) { // If the UnwindPlan failed to give us an unwind location for this // 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, @@ -1363,7 +1359,7 @@ RegisterContextLLDB::SavedLocationForRegister( } } - if (have_unwindplan_regloc == false) { + if (!have_unwindplan_regloc) { if (IsFrameZero()) { // This is frame 0 - we should return the actual live register context // value @@ -1409,7 +1405,7 @@ RegisterContextLLDB::SavedLocationForRegister( } if (unwindplan_regloc.IsSame()) { - if (IsFrameZero() == false && + if (!IsFrameZero() && (regnum.GetAsKind(eRegisterKindGeneric) == LLDB_REGNUM_GENERIC_PC || regnum.GetAsKind(eRegisterKindGeneric) == LLDB_REGNUM_GENERIC_RA)) { UnwindLogMsg("register %s (%d) is marked as 'IsSame' - it is a pc or " @@ -2051,12 +2047,8 @@ bool RegisterContextLLDB::ReadPC(addr_t &pc) { pc = abi->FixCodeAddress(pc); } - if (m_all_registers_available == false && above_trap_handler == false && - (pc == 0 || pc == 1)) { - return false; - } - - return true; + return !(m_all_registers_available == false && + above_trap_handler == false && (pc == 0 || pc == 1)); } else { return false; } diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp b/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp index b846b4478..78f561a0f 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp @@ -376,7 +376,7 @@ RegisterContextPOSIX_x86::FPRType RegisterContextPOSIX_x86::GetFPRType() { if (m_fpr_type == eNotValid) { // TODO: Use assembly to call cpuid on the inferior and query ebx or ecx m_fpr_type = eXSAVE; // extended floating-point registers, if available - if (false == ReadFPR()) + if (!ReadFPR()) m_fpr_type = eFXSAVE; // assume generic floating-point registers } return m_fpr_type; diff --git a/source/Plugins/Process/Utility/UnwindLLDB.cpp b/source/Plugins/Process/Utility/UnwindLLDB.cpp index 49c06fea7..b34c87230 100644 --- a/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -212,15 +212,15 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneMoreFrame(ABI *abi) { // On Mac OS X, the _sigtramp asynchronous signal trampoline frame may not // have its (constructed) CFA aligned correctly -- don't do the abi // alignment check for these. - if (reg_ctx_sp->IsTrapHandlerFrame() == false) { + if (!reg_ctx_sp->IsTrapHandlerFrame()) { // See if we can find a fallback unwind plan for THIS frame. It may be // that the UnwindPlan we're using for THIS frame was bad and gave us a // bad CFA. If that's not it, then see if we can change the UnwindPlan // for the frame below us ("NEXT") -- see if using that other UnwindPlan // gets us a better unwind state. - if (reg_ctx_sp->TryFallbackUnwindPlan() == false || - reg_ctx_sp->GetCFA(cursor_sp->cfa) == false || - abi->CallFrameAddressIsValid(cursor_sp->cfa) == false) { + if (!reg_ctx_sp->TryFallbackUnwindPlan() || + !reg_ctx_sp->GetCFA(cursor_sp->cfa) || + !abi->CallFrameAddressIsValid(cursor_sp->cfa)) { if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) { // TryFallbackUnwindPlan for prev_frame succeeded and updated // reg_ctx_lldb_sp field of prev_frame. However, cfa field of @@ -385,10 +385,8 @@ bool UnwindLLDB::AddOneMoreFrame(ABI *abi) { // Cursor::m_frames[m_frames.size() - 2], reg_ctx_lldb_sp field was already // updated during TryFallbackUnwindPlan call above. However, cfa field // still needs to be updated. Hence updating it here and then returning. - if (!(m_frames[m_frames.size() - 2]->reg_ctx_lldb_sp->GetCFA( - m_frames[m_frames.size() - 2]->cfa))) - return false; - return true; + return m_frames[m_frames.size() - 2]->reg_ctx_lldb_sp->GetCFA( + m_frames[m_frames.size() - 2]->cfa); } // The new frame hasn't helped in unwinding. Fall back to the original one as @@ -470,10 +468,7 @@ bool UnwindLLDB::SearchForSavedLocationForRegister( UnwindLLDB::RegisterSearchResult result; result = m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister( lldb_regnum, regloc); - if (result == UnwindLLDB::RegisterSearchResult::eRegisterFound) - return true; - else - return false; + return result == UnwindLLDB::RegisterSearchResult::eRegisterFound; } while (frame_num >= 0) { UnwindLLDB::RegisterSearchResult result; diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp index 4e20b56fb..a3a4aa053 100644 --- a/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp +++ b/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp @@ -379,7 +379,7 @@ void GDBRemoteClientBase::Lock::SyncWithContinueThread(bool interrupt) { log->PutCString("GDBRemoteClientBase::Lock::Lock sent packet: \\x03"); m_comm.m_interrupt_time = steady_clock::now(); } - m_comm.m_cv.wait(lock, [this] { return m_comm.m_is_running == false; }); + m_comm.m_cv.wait(lock, [this] { return !m_comm.m_is_running; }); m_did_interrupt = true; } m_acquired = true; diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 1e0db84c5..4605bd2e9 100644 --- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -656,7 +656,7 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, size_t src_len, // Size of packet before it is decompressed, for logging purposes size_t original_packet_size = m_bytes.size(); if (CompressionIsEnabled()) { - if (DecompressPacket() == false) { + if (!DecompressPacket()) { packet.Clear(); return GDBRemoteCommunication::PacketType::Standard; } diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 1b14e8cb7..92bde0323 100644 --- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -252,10 +252,7 @@ bool GDBRemoteCommunicationClient::GetVAttachOrWaitSupported() { m_attach_or_wait_reply = eLazyBoolYes; } } - if (m_attach_or_wait_reply == eLazyBoolYes) - return true; - else - return false; + return m_attach_or_wait_reply == eLazyBoolYes; } bool GDBRemoteCommunicationClient::GetSyncThreadStateSupported() { @@ -269,14 +266,11 @@ bool GDBRemoteCommunicationClient::GetSyncThreadStateSupported() { m_prepare_for_reg_writing_reply = eLazyBoolYes; } } - if (m_prepare_for_reg_writing_reply == eLazyBoolYes) - return true; - else - return false; + return m_prepare_for_reg_writing_reply == eLazyBoolYes; } void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) { - if (did_exec == false) { + if (!did_exec) { // Hard reset everything, this is when we first connect to a GDB server m_supports_not_sending_acks = eLazyBoolCalculate; m_supports_thread_suffix = eLazyBoolCalculate; @@ -745,7 +739,7 @@ lldb::pid_t GDBRemoteCommunicationClient::GetCurrentProcessID(bool allow_lazy) { bool sequence_mutex_unavailable; size_t size; size = GetCurrentThreadIDs(thread_ids, sequence_mutex_unavailable); - if (size && sequence_mutex_unavailable == false) { + if (size && !sequence_mutex_unavailable) { m_curr_pid = thread_ids.front(); m_curr_pid_is_valid = eLazyBoolYes; return m_curr_pid; @@ -839,8 +833,8 @@ int GDBRemoteCommunicationClient::SendEnvironmentPacket( if (name_equal_value && name_equal_value[0]) { StreamString packet; bool send_hex_encoding = false; - for (const char *p = name_equal_value; - *p != '\0' && send_hex_encoding == false; ++p) { + for (const char *p = name_equal_value; *p != '\0' && !send_hex_encoding; + ++p) { if (isprint(*p)) { switch (*p) { case '$': @@ -1693,7 +1687,7 @@ Status GDBRemoteCommunicationClient::GetWatchpointSupportInfo(uint32_t &num) { found_num_field = true; } } - if (found_num_field == false) { + if (!found_num_field) { m_supports_watchpoint_support_info = eLazyBoolNo; } } else { @@ -1728,12 +1722,10 @@ GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction( // On targets like MIPS and ppc64le, watchpoint exceptions are always // generated before the instruction is executed. The connected target may // not support qHostInfo or qWatchpointSupportInfo packets. - if (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel || - atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el || - atype == llvm::Triple::ppc64le) - after = false; - else - after = true; + after = + !(atype == llvm::Triple::mips || atype == llvm::Triple::mipsel || + atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el || + atype == llvm::Triple::ppc64le); } else { // For MIPS and ppc64le, set m_watchpoints_trigger_after_instruction to // eLazyBoolNo if it is not calculated before. @@ -3776,7 +3768,7 @@ void GDBRemoteCommunicationClient::ServeSymbolLookups( // Is this the initial qSymbol:: packet? bool first_qsymbol_query = true; - if (m_supports_qSymbol && m_qSymbol_requests_done == false) { + if (m_supports_qSymbol && !m_qSymbol_requests_done) { Lock lock(*this, false); if (lock) { StreamString packet; diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 98a2745b6..e58f47f4b 100644 --- a/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -458,7 +458,7 @@ bool GDBRemoteRegisterContext::ReadAllRegisterValues( ((ProcessGDBRemote *)process)->GetGDBRemote()); const bool use_g_packet = - gdb_comm.AvoidGPackets((ProcessGDBRemote *)process) == false; + !gdb_comm.AvoidGPackets((ProcessGDBRemote *)process); GDBRemoteClientBase::Lock lock(gdb_comm, false); if (lock) { @@ -521,7 +521,7 @@ bool GDBRemoteRegisterContext::WriteAllRegisterValues( ((ProcessGDBRemote *)process)->GetGDBRemote()); const bool use_g_packet = - gdb_comm.AvoidGPackets((ProcessGDBRemote *)process) == false; + !gdb_comm.AvoidGPackets((ProcessGDBRemote *)process); GDBRemoteClientBase::Lock lock(gdb_comm, false); if (lock) { diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 5959d9bc2..ef0915f70 100644 --- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1528,7 +1528,7 @@ Status ProcessGDBRemote::DoResume() { new EventDataBytes(continue_packet.GetString().data(), continue_packet.GetSize())); - if (listener_sp->GetEvent(event_sp, std::chrono::seconds(5)) == false) { + if (!listener_sp->GetEvent(event_sp, std::chrono::seconds(5))) { error.SetErrorString("Resume timed out."); if (log) log->Printf("ProcessGDBRemote::DoResume: Resume timed out."); @@ -1984,7 +1984,7 @@ ThreadSP ProcessGDBRemote::SetThreadStopInfo( } } - if (!handled && signo && did_exec == false) { + if (!handled && signo && !did_exec) { if (signo == SIGTRAP) { // Currently we are going to assume SIGTRAP means we are either // hitting a breakpoint or hardware single stepping. @@ -2698,7 +2698,7 @@ void ProcessGDBRemote::SetLastStopPacket( // We are are not using non-stop mode, there can only be one last stop // reply packet, so clear the list. - if (GetTarget().GetNonStopModeEnabled() == false) + if (!GetTarget().GetNonStopModeEnabled()) m_stop_packet_stack.clear(); // Add this stop packet to the stop packet stack This stack will get popped diff --git a/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 36a2cffec..db7dc3eae 100644 --- a/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -197,13 +197,10 @@ void ThreadGDBRemote::SetQueueLibdispatchQueueAddress( } bool ThreadGDBRemote::ThreadHasQueueInformation() const { - if (m_thread_dispatch_qaddr != 0 && - m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS && - m_dispatch_queue_t != LLDB_INVALID_ADDRESS && - m_queue_kind != eQueueKindUnknown && m_queue_serial_number != 0) { - return true; - } - return false; + return m_thread_dispatch_qaddr != 0 && + m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS && + m_dispatch_queue_t != LLDB_INVALID_ADDRESS && + m_queue_kind != eQueueKindUnknown && m_queue_serial_number != 0; } LazyBool ThreadGDBRemote::GetAssociatedWithLibdispatchQueue() { diff --git a/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/source/Plugins/Process/mach-core/ProcessMachCore.cpp index bdb6a6041..08b9f08a4 100644 --- a/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -302,36 +302,38 @@ Status ProcessMachCore::DoLoadCore() { // LC_IDENT is very obsolete and should not be used in new code, but if the // load command is present, let's use the contents. std::string corefile_identifier = core_objfile->GetIdentifierString(); - if (found_main_binary_definitively == false - && corefile_identifier.find("Darwin Kernel") != std::string::npos) { - UUID uuid; - addr_t addr = LLDB_INVALID_ADDRESS; - if (corefile_identifier.find("UUID=") != std::string::npos) { - size_t p = corefile_identifier.find("UUID=") + strlen("UUID="); - std::string uuid_str = corefile_identifier.substr(p, 36); - uuid.SetFromStringRef(uuid_str); - } - if (corefile_identifier.find("stext=") != std::string::npos) { - size_t p = corefile_identifier.find("stext=") + strlen("stext="); - if (corefile_identifier[p] == '0' && corefile_identifier[p + 1] == 'x') { - errno = 0; - addr = ::strtoul(corefile_identifier.c_str() + p, NULL, 16); - if (errno != 0 || addr == 0) - addr = LLDB_INVALID_ADDRESS; - } - } - if (uuid.IsValid() && addr != LLDB_INVALID_ADDRESS) { - m_mach_kernel_addr = addr; - found_main_binary_definitively = true; - if (log) - log->Printf("ProcessMachCore::DoLoadCore: Using the kernel address 0x%" PRIx64 - " from LC_IDENT/LC_NOTE 'kern ver str' string: '%s'", addr, corefile_identifier.c_str()); + if (!found_main_binary_definitively && + corefile_identifier.find("Darwin Kernel") != std::string::npos) { + UUID uuid; + addr_t addr = LLDB_INVALID_ADDRESS; + if (corefile_identifier.find("UUID=") != std::string::npos) { + size_t p = corefile_identifier.find("UUID=") + strlen("UUID="); + std::string uuid_str = corefile_identifier.substr(p, 36); + uuid.SetFromStringRef(uuid_str); + } + if (corefile_identifier.find("stext=") != std::string::npos) { + size_t p = corefile_identifier.find("stext=") + strlen("stext="); + if (corefile_identifier[p] == '0' && corefile_identifier[p + 1] == 'x') { + errno = 0; + addr = ::strtoul(corefile_identifier.c_str() + p, NULL, 16); + if (errno != 0 || addr == 0) + addr = LLDB_INVALID_ADDRESS; } + } + if (uuid.IsValid() && addr != LLDB_INVALID_ADDRESS) { + m_mach_kernel_addr = addr; + found_main_binary_definitively = true; + if (log) + log->Printf( + "ProcessMachCore::DoLoadCore: Using the kernel address 0x%" PRIx64 + " from LC_IDENT/LC_NOTE 'kern ver str' string: '%s'", + addr, corefile_identifier.c_str()); + } } - if (found_main_binary_definitively == false - && (m_dyld_addr == LLDB_INVALID_ADDRESS - || m_mach_kernel_addr == LLDB_INVALID_ADDRESS)) { + if (!found_main_binary_definitively && + (m_dyld_addr == LLDB_INVALID_ADDRESS || + m_mach_kernel_addr == LLDB_INVALID_ADDRESS)) { // We need to locate the main executable in the memory ranges we have in // the core file. We need to search for both a user-process dyld binary // and a kernel binary in memory; we must look at all the pages in the @@ -352,16 +354,15 @@ Status ProcessMachCore::DoLoadCore() { } } - if (found_main_binary_definitively == false - && m_mach_kernel_addr != LLDB_INVALID_ADDRESS) { + if (!found_main_binary_definitively && + m_mach_kernel_addr != LLDB_INVALID_ADDRESS) { // In the case of multiple kernel images found in the core file via // exhaustive search, we may not pick the correct one. See if the // DynamicLoaderDarwinKernel's search heuristics might identify the correct // one. Most of the time, I expect the address from SearchForDarwinKernel() // will be the same as the address we found via exhaustive search. - if (GetTarget().GetArchitecture().IsValid() == false && - m_core_module_sp.get()) { + if (!GetTarget().GetArchitecture().IsValid() && m_core_module_sp.get()) { GetTarget().SetArchitecture(m_core_module_sp->GetArchitecture()); } diff --git a/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index 45ffd0813..7e96dd989 100644 --- a/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -222,9 +222,7 @@ PythonBytes::~PythonBytes() {} bool PythonBytes::Check(PyObject *py_obj) { if (!py_obj) return false; - if (PyBytes_Check(py_obj)) - return true; - return false; + return PyBytes_Check(py_obj); } void PythonBytes::Reset(PyRefType type, PyObject *py_obj) { @@ -294,9 +292,7 @@ PythonByteArray::~PythonByteArray() {} bool PythonByteArray::Check(PyObject *py_obj) { if (!py_obj) return false; - if (PyByteArray_Check(py_obj)) - return true; - return false; + return PyByteArray_Check(py_obj); } void PythonByteArray::Reset(PyRefType type, PyObject *py_obj) { diff --git a/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 289607e30..41cb443d4 100644 --- a/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -208,7 +208,7 @@ ScriptInterpreterPython::Locker::Locker(ScriptInterpreterPython *py_interpreter, m_python_interpreter(py_interpreter) { DoAcquireLock(); if ((on_entry & InitSession) == InitSession) { - if (DoInitSession(on_entry, in, out, err) == false) { + if (!DoInitSession(on_entry, in, out, err)) { // Don't teardown the session if we didn't init it. m_teardown_session = false; } @@ -2838,7 +2838,7 @@ bool ScriptInterpreterPython::LoadScriptingModule( bool was_imported = (was_imported_globally || was_imported_locally); - if (was_imported == true && can_reload == false) { + if (was_imported && !can_reload) { error.SetErrorString("module already imported"); return false; } diff --git a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index af3c3b4b4..0b71b2a4b 100644 --- a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -657,7 +657,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } 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 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, // 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 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, 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 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die, 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 @@ bool DWARFASTParserClang::ParseChildMembers( 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 @@ bool DWARFASTParserClang::ParseChildMembers( } 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/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp index 1c31d1c42..d79acdc5c 100644 --- a/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp +++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp @@ -25,7 +25,7 @@ DWARFDebugMacroHeader::ParseHeader(const DWARFDataExtractor &debug_macro_data, 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/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index 89be3d6c0..57d2be93c 100644 --- a/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -648,9 +648,7 @@ void DWARFUnit::SetUserData(void *d) { } 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::DW_AT_decl_file_attributes_are_invalid() { 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/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 39dfe31cb..eafdea4eb 100644 --- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1679,7 +1679,7 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() { 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 @@ bool SymbolFileDWARF::ResolveFunction(const DWARFDIE &orig_die, 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/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index fa6ace8c3..d931ccb9d 100644 --- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -89,7 +89,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap( 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 @@ public: 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 @@ TypeSP SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE( // 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 @@ uint32_t SymbolFileDWARFDebugMap::FindTypes( 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/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp index 37757578b..65e718bed 100644 --- a/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ b/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -658,7 +658,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) { 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 { diff --git a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp index 0d47dd11d..169eed817 100644 --- a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -237,8 +237,7 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp, // object is DBGSourcePath std::string DBGSourcePath = object->GetStringValue(); - if (new_style_source_remapping_dictionary == - false && + if (!new_style_source_remapping_dictionary && !original_DBGSourcePath_value.empty()) { DBGSourcePath = original_DBGSourcePath_value; } diff --git a/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp index 500ef0d5f..43e401330 100644 --- a/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ b/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -238,7 +238,7 @@ AppleGetItemInfoHandler::GetItemInfo(Thread &thread, uint64_t item, error.Clear(); - if (thread.SafeToCallFunctions() == false) { + if (!thread.SafeToCallFunctions()) { if (log) log->Printf("Not safe to call functions on thread 0x%" PRIx64, thread.GetID()); diff --git a/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp index 4aed12387..78e50e673 100644 --- a/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ b/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -241,7 +241,7 @@ AppleGetPendingItemsHandler::GetPendingItems(Thread &thread, addr_t queue, error.Clear(); - if (thread.SafeToCallFunctions() == false) { + if (!thread.SafeToCallFunctions()) { if (log) log->Printf("Not safe to call functions on thread 0x%" PRIx64, thread.GetID()); diff --git a/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp index 4b077ee49..245ff6742 100644 --- a/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ b/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -243,7 +243,7 @@ AppleGetQueuesHandler::GetCurrentQueues(Thread &thread, addr_t page_to_free, error.Clear(); - if (thread.SafeToCallFunctions() == false) { + if (!thread.SafeToCallFunctions()) { if (log) log->Printf("Not safe to call functions on thread 0x%" PRIx64, thread.GetID()); diff --git a/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp index dab22427c..ede81333a 100644 --- a/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ b/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -248,7 +248,7 @@ AppleGetThreadItemInfoHandler::GetThreadItemInfo(Thread &thread, error.Clear(); - if (thread.SafeToCallFunctions() == false) { + if (!thread.SafeToCallFunctions()) { if (log) log->Printf("Not safe to call functions on thread 0x%" PRIx64, thread.GetID()); diff --git a/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp b/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp index 9295a0953..04f9cbbf0 100644 --- a/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp +++ b/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp @@ -100,10 +100,10 @@ bool UnwindAssembly_x86::AugmentUnwindPlanFromCallSite( return false; } UnwindPlan::Row::RegisterLocation first_row_pc_loc; - if (first_row->GetRegisterInfo( + if (!first_row->GetRegisterInfo( pc_regnum.GetAsKind(unwind_plan.GetRegisterKind()), - first_row_pc_loc) == false || - first_row_pc_loc.IsAtCFAPlusOffset() == false || + first_row_pc_loc) || + !first_row_pc_loc.IsAtCFAPlusOffset() || first_row_pc_loc.GetOffset() != -wordsize) { return false; } diff --git a/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp b/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp index eb1989895..f8e70204e 100644 --- a/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp +++ b/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp @@ -304,26 +304,20 @@ bool x86AssemblyInspectionEngine::nonvolatile_reg_p(int machine_regno) { // pushq %rbp [0x55] bool x86AssemblyInspectionEngine::push_rbp_pattern_p() { uint8_t *p = m_cur_insn; - if (*p == 0x55) - return true; - return false; + return *p == 0x55; } // pushq $0 ; the first instruction in start() [0x6a 0x00] bool x86AssemblyInspectionEngine::push_0_pattern_p() { uint8_t *p = m_cur_insn; - if (*p == 0x6a && *(p + 1) == 0x0) - return true; - return false; + return *p == 0x6a && *(p + 1) == 0x0; } // pushq $0 // pushl $0 bool x86AssemblyInspectionEngine::push_imm_pattern_p() { uint8_t *p = m_cur_insn; - if (*p == 0x68 || *p == 0x6a) - return true; - return false; + return *p == 0x68 || *p == 0x6a; } // pushl imm8(%esp) @@ -675,9 +669,7 @@ bool x86AssemblyInspectionEngine::mov_reg_to_local_stack_frame_p( // ret [0xc9] or [0xc2 imm8] or [0xca imm8] bool x86AssemblyInspectionEngine::ret_pattern_p() { uint8_t *p = m_cur_insn; - if (*p == 0xc9 || *p == 0xc2 || *p == 0xca || *p == 0xc3) - return true; - return false; + return *p == 0xc9 || *p == 0xc2 || *p == 0xca || *p == 0xc3; } uint32_t x86AssemblyInspectionEngine::extract_4(uint8_t *b) { @@ -723,7 +715,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( if (data == nullptr || size == 0) return false; - if (m_register_map_initialized == false) + if (!m_register_map_initialized) return false; addr_t current_func_text_offset = 0; @@ -864,7 +856,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( // on the stack if (nonvolatile_reg_p(machine_regno) && machine_regno_to_lldb_regno(machine_regno, lldb_regno) && - saved_registers[machine_regno] == false) { + !saved_registers[machine_regno]) { UnwindPlan::Row::RegisterLocation regloc; if (is_aligned) regloc.SetAtAFAPlusOffset(-current_sp_bytes_offset_from_fa); @@ -881,7 +873,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( if (nonvolatile_reg_p(machine_regno) && machine_regno_to_lldb_regno(machine_regno, lldb_regno) && - saved_registers[machine_regno] == true) { + saved_registers[machine_regno]) { saved_registers[machine_regno] = false; row->RemoveRegisterInfo(lldb_regno); @@ -953,7 +945,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( else if (mov_reg_to_local_stack_frame_p(machine_regno, stack_offset) && nonvolatile_reg_p(machine_regno) && machine_regno_to_lldb_regno(machine_regno, lldb_regno) && - saved_registers[machine_regno] == false) { + !saved_registers[machine_regno]) { saved_registers[machine_regno] = true; UnwindPlan::Row::RegisterLocation regloc; @@ -1081,7 +1073,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( } } - if (in_epilogue == false && row_updated) { + if (!in_epilogue && row_updated) { // If we're not in an epilogue sequence, save the updated Row UnwindPlan::Row *newrow = new UnwindPlan::Row; *newrow = *row.get(); @@ -1096,7 +1088,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( // We may change the sp value without adding a new Row necessarily -- keep // track of it either way. - if (in_epilogue == false) { + if (!in_epilogue) { prologue_completed_sp_bytes_offset_from_cfa = current_sp_bytes_offset_from_fa; prologue_completed_is_aligned = is_aligned; @@ -1362,7 +1354,7 @@ bool x86AssemblyInspectionEngine::FindFirstNonPrologueInstruction( uint8_t *data, size_t size, size_t &offset) { offset = 0; - if (m_register_map_initialized == false) + if (!m_register_map_initialized) return false; while (offset < size) { diff --git a/source/Symbol/Block.cpp b/source/Symbol/Block.cpp index acc284de7..d03423559 100644 --- a/source/Symbol/Block.cpp +++ b/source/Symbol/Block.cpp @@ -83,7 +83,7 @@ void Block::Dump(Stream *s, addr_t base_addr, int32_t depth, size_t num_ranges = m_ranges.GetSize(); for (size_t i = 0; i < num_ranges; ++i) { const Range &range = m_ranges.GetEntryRef(i); - if (parent_block != nullptr && parent_block->Contains(range) == false) + if (parent_block != nullptr && !parent_block->Contains(range)) *s << '!'; else *s << ' '; @@ -369,7 +369,7 @@ void Block::SetInlinedFunctionInfo(const char *name, const char *mangled, } VariableListSP Block::GetBlockVariableList(bool can_create) { - if (m_parsed_block_variables == false) { + if (!m_parsed_block_variables) { if (m_variable_list_sp.get() == nullptr && can_create) { m_parsed_block_variables = true; SymbolContext sc; @@ -402,7 +402,7 @@ Block::AppendBlockVariables(bool can_create, bool get_child_block_variables, collection::const_iterator pos, end = m_children.end(); for (pos = m_children.begin(); pos != end; ++pos) { Block *child_block = pos->get(); - if (stop_if_child_block_is_inlined_function == false || + if (!stop_if_child_block_is_inlined_function || child_block->GetInlinedFunctionInfo() == nullptr) { num_variables_added += child_block->AppendBlockVariables( can_create, get_child_block_variables, diff --git a/source/Symbol/ClangASTContext.cpp b/source/Symbol/ClangASTContext.cpp index c39590351..67e27f26e 100644 --- a/source/Symbol/ClangASTContext.cpp +++ b/source/Symbol/ClangASTContext.cpp @@ -992,9 +992,7 @@ TargetInfo *ClangASTContext::getTargetInfo() { static inline bool QualTypeMatchesBitSize(const uint64_t bit_size, ASTContext *ast, QualType qual_type) { uint64_t qual_type_bit_size = ast->getTypeSize(qual_type); - if (qual_type_bit_size == bit_size) - return true; - return false; + return qual_type_bit_size == bit_size; } CompilerType @@ -1866,8 +1864,7 @@ CompilerType ClangASTContext::CreateObjCClass(const char *name, } static inline bool BaseSpecifierIsEmpty(const CXXBaseSpecifier *b) { - return ClangASTContext::RecordHasFields(b->getType()->getAsCXXRecordDecl()) == - false; + return !ClangASTContext::RecordHasFields(b->getType()->getAsCXXRecordDecl()); } uint32_t @@ -3936,9 +3933,7 @@ bool ClangASTContext::IsCXXClassType(const CompilerType &type) { return false; clang::QualType qual_type(ClangUtil::GetCanonicalQualType(type)); - if (!qual_type.isNull() && qual_type->getAsCXXRecordDecl() != nullptr) - return true; - return false; + return !qual_type.isNull() && qual_type->getAsCXXRecordDecl() != nullptr; } bool ClangASTContext::IsBeingDefined(lldb::opaque_compiler_type_t type) { @@ -5593,7 +5588,7 @@ uint32_t ClangASTContext::GetNumChildren(lldb::opaque_compiler_type_t type, ->getDecl()); // Skip empty base classes - if (ClangASTContext::RecordHasFields(base_class_decl) == false) + if (!ClangASTContext::RecordHasFields(base_class_decl)) continue; num_children++; @@ -6655,7 +6650,7 @@ CompilerType ClangASTContext::GetChildCompilerTypeAtIndex( if (omit_empty_base_classes) { base_class_decl = llvm::cast<clang::CXXRecordDecl>( base_class->getType()->getAs<clang::RecordType>()->getDecl()); - if (ClangASTContext::RecordHasFields(base_class_decl) == false) + if (!ClangASTContext::RecordHasFields(base_class_decl)) continue; } @@ -7450,7 +7445,7 @@ ClangASTContext::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, ->getAs<clang::RecordType>() ->getDecl()); if (omit_empty_base_classes && - ClangASTContext::RecordHasFields(base_class_decl) == false) + !ClangASTContext::RecordHasFields(base_class_decl)) continue; CompilerType base_class_clang_type(getASTContext(), @@ -9105,8 +9100,7 @@ void ClangASTContext::DumpValue( base_class->getType()->getAs<clang::RecordType>()->getDecl()); // Skip empty base classes - if (verbose == false && - ClangASTContext::RecordHasFields(base_class_decl) == false) + if (!verbose && !ClangASTContext::RecordHasFields(base_class_decl)) continue; if (base_class->isVirtual()) diff --git a/source/Symbol/ClangASTImporter.cpp b/source/Symbol/ClangASTImporter.cpp index b6850785b..621441449 100644 --- a/source/Symbol/ClangASTImporter.cpp +++ b/source/Symbol/ClangASTImporter.cpp @@ -1002,7 +1002,7 @@ clang::Decl *ClangASTImporter::Minion::Imported(clang::Decl *from, if (isa<TagDecl>(to) || isa<ObjCInterfaceDecl>(to)) { RecordDecl *from_record_decl = dyn_cast<RecordDecl>(from); if (from_record_decl == nullptr || - from_record_decl->isInjectedClassName() == false) { + !from_record_decl->isInjectedClassName()) { NamedDecl *to_named_decl = dyn_cast<NamedDecl>(to); if (!m_decls_already_deported->count(to_named_decl)) diff --git a/source/Symbol/CompactUnwindInfo.cpp b/source/Symbol/CompactUnwindInfo.cpp index 871047076..1baf444bb 100644 --- a/source/Symbol/CompactUnwindInfo.cpp +++ b/source/Symbol/CompactUnwindInfo.cpp @@ -259,7 +259,7 @@ void CompactUnwindInfo::ScanIndex(const ProcessSP &process_sp) { m_objfile.GetModule()->LogMessage( log, "Reading compact unwind first-level indexes"); - if (m_unwindinfo_data_computed == false) { + if (!m_unwindinfo_data_computed) { if (m_section_sp->IsEncrypted()) { // Can't get section contents of a protected/encrypted section until we // have a live process and can read them out of memory. @@ -529,7 +529,7 @@ bool CompactUnwindInfo::GetCompactUnwindInfoForFunction( --it; } - if (it->sentinal_entry == true) { + if (it->sentinal_entry) { return false; } @@ -925,7 +925,7 @@ bool CompactUnwindInfo::CreateUnwindPlan_x86_64(Target &target, for (uint32_t i = 0; i < register_count; i++) { int renum = 0; for (int j = 1; j < 7; j++) { - if (used[j] == false) { + if (!used[j]) { if (renum == permunreg[i]) { registers[i] = j; used[j] = true; @@ -1187,7 +1187,7 @@ bool CompactUnwindInfo::CreateUnwindPlan_i386(Target &target, for (uint32_t i = 0; i < register_count; i++) { int renum = 0; for (int j = 1; j < 7; j++) { - if (used[j] == false) { + if (!used[j]) { if (renum == permunreg[i]) { registers[i] = j; used[j] = true; diff --git a/source/Symbol/CompileUnit.cpp b/source/Symbol/CompileUnit.cpp index 79cf0180c..318afcba6 100644 --- a/source/Symbol/CompileUnit.cpp +++ b/source/Symbol/CompileUnit.cpp @@ -291,7 +291,7 @@ uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec, // If we are not looking for inlined functions and our file spec doesn't // match then we are done... - if (file_spec_matches_cu_file_spec == false && check_inlines == false) + if (!file_spec_matches_cu_file_spec && !check_inlines) return 0; uint32_t file_idx = diff --git a/source/Symbol/DWARFCallFrameInfo.cpp b/source/Symbol/DWARFCallFrameInfo.cpp index 1bf9ff99e..4c9602e23 100644 --- a/source/Symbol/DWARFCallFrameInfo.cpp +++ b/source/Symbol/DWARFCallFrameInfo.cpp @@ -161,7 +161,7 @@ bool DWARFCallFrameInfo::GetUnwindPlan(Address addr, UnwindPlan &unwind_plan) { module_sp->GetObjectFile() != &m_objfile) return false; - if (GetFDEEntryByFileAddress(addr.GetFileAddress(), fde_entry) == false) + if (!GetFDEEntryByFileAddress(addr.GetFileAddress(), fde_entry)) return false; return FDEToUnwindPlan(fde_entry.data, addr, unwind_plan); } @@ -243,7 +243,7 @@ DWARFCallFrameInfo::CIESP DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) { CIESP cie_sp(new CIE(cie_offset)); lldb::offset_t offset = cie_offset; - if (m_cfi_data_initialized == false) + if (!m_cfi_data_initialized) GetCFIData(); uint32_t length = m_cfi_data.GetU32(&offset); dw_offset_t cie_id, end_offset; @@ -394,7 +394,7 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) { } void DWARFCallFrameInfo::GetCFIData() { - if (m_cfi_data_initialized == false) { + if (!m_cfi_data_initialized) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); if (log) m_objfile.GetModule()->LogMessage(log, "Reading EH frame info"); @@ -431,7 +431,7 @@ void DWARFCallFrameInfo::GetFDEIndex() { } lldb::offset_t offset = 0; - if (m_cfi_data_initialized == false) + if (!m_cfi_data_initialized) GetCFIData(); while (m_cfi_data.ValidOffsetForDataOfSize(offset, 8)) { const dw_offset_t current_entry = offset; @@ -533,7 +533,7 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset, if (m_section_sp.get() == nullptr || m_section_sp->IsEncrypted()) return false; - if (m_cfi_data_initialized == false) + if (!m_cfi_data_initialized) GetCFIData(); uint32_t length = m_cfi_data.GetU32(&offset); diff --git a/source/Symbol/FuncUnwinders.cpp b/source/Symbol/FuncUnwinders.cpp index 2384d35e3..da1f0da78 100644 --- a/source/Symbol/FuncUnwinders.cpp +++ b/source/Symbol/FuncUnwinders.cpp @@ -255,7 +255,7 @@ UnwindPlanSP FuncUnwinders::GetAssemblyUnwindPlan(Target &target, int current_offset) { std::lock_guard<std::recursive_mutex> guard(m_mutex); if (m_unwind_plan_assembly_sp.get() || m_tried_unwind_plan_assembly || - m_unwind_table.GetAllowAssemblyEmulationUnwindPlans() == false) { + !m_unwind_table.GetAllowAssemblyEmulationUnwindPlans()) { return m_unwind_plan_assembly_sp; } diff --git a/source/Symbol/ObjectFile.cpp b/source/Symbol/ObjectFile.cpp index 63b48759d..86c18c7be 100644 --- a/source/Symbol/ObjectFile.cpp +++ b/source/Symbol/ObjectFile.cpp @@ -588,9 +588,7 @@ bool ObjectFile::SplitArchivePathWithObject(const char *path_with_object, regex_match.GetMatchAtIndex(path_with_object, 2, obj)) { archive_file.SetFile(path, FileSpec::Style::native); archive_object.SetCString(obj.c_str()); - if (must_exist && !FileSystem::Instance().Exists(archive_file)) - return false; - return true; + return !(must_exist && !FileSystem::Instance().Exists(archive_file)); } } return false; diff --git a/source/Symbol/SymbolContext.cpp b/source/Symbol/SymbolContext.cpp index eac3ed48e..596df200b 100644 --- a/source/Symbol/SymbolContext.cpp +++ b/source/Symbol/SymbolContext.cpp @@ -105,12 +105,12 @@ bool SymbolContext::DumpStopContext(Stream *s, ExecutionContextScope *exe_scope, if (function != nullptr) { SymbolContext inline_parent_sc; Address inline_parent_addr; - if (show_function_name == false) { + if (!show_function_name) { s->Printf("<"); dumped_something = true; } else { ConstString name; - if (show_function_arguments == false) + if (!show_function_arguments) name = function->GetNameNoArguments(); if (!name) name = function->GetName(); @@ -122,7 +122,7 @@ bool SymbolContext::DumpStopContext(Stream *s, ExecutionContextScope *exe_scope, const addr_t function_offset = addr.GetOffset() - function->GetAddressRange().GetBaseAddress().GetOffset(); - if (show_function_name == false) { + if (!show_function_name) { // Print +offset even if offset is 0 dumped_something = true; s->Printf("+%" PRIu64 ">", function_offset); @@ -171,7 +171,7 @@ bool SymbolContext::DumpStopContext(Stream *s, ExecutionContextScope *exe_scope, } } } else if (symbol != nullptr) { - if (show_function_name == false) { + if (!show_function_name) { s->Printf("<"); dumped_something = true; } else if (symbol->GetName()) { @@ -184,7 +184,7 @@ bool SymbolContext::DumpStopContext(Stream *s, ExecutionContextScope *exe_scope, if (addr.IsValid() && symbol->ValueIsAddress()) { const addr_t symbol_offset = addr.GetOffset() - symbol->GetAddressRef().GetOffset(); - if (show_function_name == false) { + if (!show_function_name) { // Print +offset even if offset is 0 dumped_something = true; s->Printf("+%" PRIu64 ">", symbol_offset); @@ -1259,7 +1259,7 @@ bool SymbolContextList::AppendIfUnique(const SymbolContext &sc, } if (merge_symbol_into_function && sc.symbol != nullptr && sc.comp_unit == nullptr && sc.function == nullptr && - sc.block == nullptr && sc.line_entry.IsValid() == false) { + sc.block == nullptr && !sc.line_entry.IsValid()) { if (sc.symbol->ValueIsAddress()) { for (pos = m_symbol_contexts.begin(); pos != end; ++pos) { // Don't merge symbols into inlined function symbol contexts @@ -1289,7 +1289,7 @@ bool SymbolContextList::MergeSymbolContextIntoFunctionContext( const SymbolContext &symbol_sc, uint32_t start_idx, uint32_t stop_idx) { if (symbol_sc.symbol != nullptr && symbol_sc.comp_unit == nullptr && symbol_sc.function == nullptr && symbol_sc.block == nullptr && - symbol_sc.line_entry.IsValid() == false) { + !symbol_sc.line_entry.IsValid()) { if (symbol_sc.symbol->ValueIsAddress()) { const size_t end = std::min<size_t>(m_symbol_contexts.size(), stop_idx); for (size_t i = start_idx; i < end; ++i) { diff --git a/source/Symbol/Symtab.cpp b/source/Symbol/Symtab.cpp index e1089f996..0d1b2f0db 100644 --- a/source/Symbol/Symtab.cpp +++ b/source/Symbol/Symtab.cpp @@ -740,7 +740,7 @@ uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType( for (uint32_t i = 0; i < sym_end; i++) { if (symbol_type == eSymbolTypeAny || m_symbols[i].GetType() == symbol_type) { - if (CheckSymbolAtIndex(i, symbol_debug_type, symbol_visibility) == false) + if (!CheckSymbolAtIndex(i, symbol_debug_type, symbol_visibility)) continue; const char *name = m_symbols[i].GetName().AsCString(); diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp index f6344c073..5f1078491 100644 --- a/source/Symbol/Type.cpp +++ b/source/Symbol/Type.cpp @@ -746,10 +746,7 @@ void TypeAndOrName::SetCompilerType(CompilerType compiler_type) { } bool TypeAndOrName::IsEmpty() const { - if ((bool)m_type_name || (bool)m_type_pair) - return false; - else - return true; + return !((bool)m_type_name || (bool)m_type_pair); } void TypeAndOrName::Clear() { diff --git a/source/Symbol/TypeSystem.cpp b/source/Symbol/TypeSystem.cpp index b29d1a410..91d347edf 100644 --- a/source/Symbol/TypeSystem.cpp +++ b/source/Symbol/TypeSystem.cpp @@ -193,7 +193,7 @@ void TypeSystemMap::ForEach(std::function<bool(TypeSystem *)> const &callback) { TypeSystem *type_system = pair.second.get(); if (type_system && !visited.count(type_system)) { visited.insert(type_system); - if (callback(type_system) == false) + if (!callback(type_system)) break; } } diff --git a/source/Target/Platform.cpp b/source/Target/Platform.cpp index 8d7a88948..400b3c92b 100644 --- a/source/Target/Platform.cpp +++ b/source/Target/Platform.cpp @@ -1586,14 +1586,14 @@ Status Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, if (process->GetModuleSpec(module_spec.GetFileSpec(), module_spec.GetArchitecture(), resolved_module_spec)) { - if (module_spec.GetUUID().IsValid() == false || + if (!module_spec.GetUUID().IsValid() || module_spec.GetUUID() == resolved_module_spec.GetUUID()) { got_module_spec = true; } } } - if (module_spec.GetArchitecture().IsValid() == false) { + if (!module_spec.GetArchitecture().IsValid()) { Status error; // No valid architecture was specified, ask the platform for the // architectures that we should be using (in the correct order) and see if @@ -1616,7 +1616,7 @@ Status Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, // Get module information from a target. if (!GetModuleSpec(module_spec.GetFileSpec(), module_spec.GetArchitecture(), resolved_module_spec)) { - if (module_spec.GetUUID().IsValid() == false || + if (!module_spec.GetUUID().IsValid() || module_spec.GetUUID() == resolved_module_spec.GetUUID()) { return module_resolver(module_spec); } diff --git a/source/Target/QueueItem.cpp b/source/Target/QueueItem.cpp index fe58980c0..a20fa918a 100644 --- a/source/Target/QueueItem.cpp +++ b/source/Target/QueueItem.cpp @@ -94,7 +94,7 @@ std::string QueueItem::GetQueueLabel() { ProcessSP QueueItem::GetProcessSP() { return m_process_wp.lock(); } void QueueItem::FetchEntireItem() { - if (m_have_fetched_entire_item == true) + if (m_have_fetched_entire_item) return; ProcessSP process_sp = m_process_wp.lock(); if (process_sp) { diff --git a/source/Target/RegisterNumber.cpp b/source/Target/RegisterNumber.cpp index d1bb8adf5..8b01bd103 100644 --- a/source/Target/RegisterNumber.cpp +++ b/source/Target/RegisterNumber.cpp @@ -61,26 +61,15 @@ bool RegisterNumber::operator==(RegisterNumber &rhs) { return false; if (m_kind == rhs.m_kind) { - if (m_regnum == rhs.m_regnum) - return true; - else - return false; + return m_regnum == rhs.m_regnum; } uint32_t rhs_regnum = rhs.GetAsKind(m_kind); if (rhs_regnum != LLDB_INVALID_REGNUM) { - if (m_regnum == rhs_regnum) - return true; - else - return false; + return m_regnum == rhs_regnum; } uint32_t lhs_regnum = GetAsKind(rhs.m_kind); - { - if (lhs_regnum == rhs.m_regnum) - return true; - else - return false; - } + { return lhs_regnum == rhs.m_regnum; } return false; } diff --git a/source/Target/StackFrame.cpp b/source/Target/StackFrame.cpp index 592eaab46..3cea64445 100644 --- a/source/Target/StackFrame.cpp +++ b/source/Target/StackFrame.cpp @@ -1079,9 +1079,9 @@ bool StackFrame::GetFrameBaseValue(Scalar &frame_base, Status *error_ptr) { m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress( exe_ctx.GetTargetPtr()); - if (m_sc.function->GetFrameBaseExpression().Evaluate( + if (!m_sc.function->GetFrameBaseExpression().Evaluate( &exe_ctx, nullptr, loclist_base_addr, nullptr, nullptr, - expr_value, &m_frame_base_error) == false) { + expr_value, &m_frame_base_error)) { // We should really have an error if evaluate returns, but in case we // don't, lets set the error to something at least. if (m_frame_base_error.Success()) diff --git a/source/Target/StopInfo.cpp b/source/Target/StopInfo.cpp index f7ea966b8..4e13c588b 100644 --- a/source/Target/StopInfo.cpp +++ b/source/Target/StopInfo.cpp @@ -542,9 +542,9 @@ protected: __FUNCTION__, m_value); } - if ((m_should_stop == false || internal_breakpoint) - && thread_sp->CompletedPlanOverridesBreakpoint()) { - + if ((!m_should_stop || internal_breakpoint) && + thread_sp->CompletedPlanOverridesBreakpoint()) { + // Override should_stop decision when we have completed step plan // additionally to the breakpoint m_should_stop = true; diff --git a/source/Target/TargetList.cpp b/source/Target/TargetList.cpp index 5c83dfbeb..5b262509c 100644 --- a/source/Target/TargetList.cpp +++ b/source/Target/TargetList.cpp @@ -234,7 +234,7 @@ Status TargetList::CreateTargetInternal( // All platforms for all modules in the executable match, so we can // select this platform platform_sp = platforms.front(); - } else if (more_than_one_platforms == false) { + } else if (!more_than_one_platforms) { // No platforms claim to support this file error.SetErrorString("No matching platforms found for this file, " "specify one with the --platform option"); diff --git a/source/Target/ThreadPlanBase.cpp b/source/Target/ThreadPlanBase.cpp index 5b05c0073..058d1468e 100644 --- a/source/Target/ThreadPlanBase.cpp +++ b/source/Target/ThreadPlanBase.cpp @@ -57,10 +57,7 @@ bool ThreadPlanBase::ValidatePlan(Stream *error) { return true; } bool ThreadPlanBase::DoPlanExplainsStop(Event *event_ptr) { // The base plan should defer to its tracer, since by default it always // handles the stop. - if (TracerExplainsStop()) - return false; - else - return true; + return !TracerExplainsStop(); } Vote ThreadPlanBase::ShouldReportStop(Event *event_ptr) { diff --git a/source/Target/ThreadPlanStepOverRange.cpp b/source/Target/ThreadPlanStepOverRange.cpp index a9fff1be1..129f30371 100644 --- a/source/Target/ThreadPlanStepOverRange.cpp +++ b/source/Target/ThreadPlanStepOverRange.cpp @@ -123,10 +123,7 @@ bool ThreadPlanStepOverRange::IsEquivalentContext( } } // Fall back to symbol if we have no decision from comp_unit/function/block. - if (m_addr_context.symbol && m_addr_context.symbol == context.symbol) { - return true; - } - return false; + return m_addr_context.symbol && m_addr_context.symbol == context.symbol; } bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) { diff --git a/source/Utility/ArchSpec.cpp b/source/Utility/ArchSpec.cpp index be51921de..752fb182d 100644 --- a/source/Utility/ArchSpec.cpp +++ b/source/Utility/ArchSpec.cpp @@ -610,10 +610,8 @@ const char *ArchSpec::GetArchitectureName() const { bool ArchSpec::IsMIPS() const { const llvm::Triple::ArchType machine = GetMachine(); - if (machine == llvm::Triple::mips || machine == llvm::Triple::mipsel || - machine == llvm::Triple::mips64 || machine == llvm::Triple::mips64el) - return true; - return false; + return machine == llvm::Triple::mips || machine == llvm::Triple::mipsel || + machine == llvm::Triple::mips64 || machine == llvm::Triple::mips64el; } std::string ArchSpec::GetTargetABI() const { @@ -1096,9 +1094,7 @@ bool ArchSpec::IsEqualTo(const ArchSpec &rhs, bool exact_match) const { const llvm::Triple::EnvironmentType rhs_triple_env = rhs_triple.getEnvironment(); - if (!IsCompatibleEnvironment(lhs_triple_env, rhs_triple_env)) - return false; - return true; + return IsCompatibleEnvironment(lhs_triple_env, rhs_triple_env); } return false; } diff --git a/source/Utility/Listener.cpp b/source/Utility/Listener.cpp index eba93ebf4..a20859e53 100644 --- a/source/Utility/Listener.cpp +++ b/source/Utility/Listener.cpp @@ -251,9 +251,7 @@ public: return false; } - if (m_event_type_mask == 0 || m_event_type_mask & event_sp->GetType()) - return true; - return false; + return m_event_type_mask == 0 || m_event_type_mask & event_sp->GetType(); } private: diff --git a/source/Utility/RegisterValue.cpp b/source/Utility/RegisterValue.cpp index f51a9641d..0abe92ec0 100644 --- a/source/Utility/RegisterValue.cpp +++ b/source/Utility/RegisterValue.cpp @@ -475,7 +475,7 @@ bool RegisterValue::SignExtend(uint32_t sign_bitpos) { bool RegisterValue::CopyValue(const RegisterValue &rhs) { if (this == &rhs) - return rhs.m_type == eTypeInvalid ? false : true; + return rhs.m_type != eTypeInvalid; m_type = rhs.m_type; switch (m_type) { diff --git a/source/Utility/StructuredData.cpp b/source/Utility/StructuredData.cpp index 26a96d597..76a141af4 100644 --- a/source/Utility/StructuredData.cpp +++ b/source/Utility/StructuredData.cpp @@ -226,7 +226,7 @@ void StructuredData::Float::Dump(Stream &s, bool pretty_print) const { } void StructuredData::Boolean::Dump(Stream &s, bool pretty_print) const { - if (m_value == true) + if (m_value) s.PutCString("true"); else s.PutCString("false"); diff --git a/tools/debugserver/source/JSONGenerator.h b/tools/debugserver/source/JSONGenerator.h index 6c6a6253d..0ac5e0bb7 100644 --- a/tools/debugserver/source/JSONGenerator.h +++ b/tools/debugserver/source/JSONGenerator.h @@ -182,7 +182,7 @@ public: 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 @@ public: 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/tools/debugserver/source/MacOSX/Genealogy.cpp b/tools/debugserver/source/MacOSX/Genealogy.cpp index 22ff52aba..1473a53fc 100644 --- a/tools/debugserver/source/MacOSX/Genealogy.cpp +++ b/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/tools/debugserver/source/MacOSX/MachProcess.mm b/tools/debugserver/source/MacOSX/MachProcess.mm index edbd012e6..a3b905d05 100644 --- a/tools/debugserver/source/MacOSX/MachProcess.mm +++ b/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/tools/debugserver/source/MacOSX/MachThread.cpp b/tools/debugserver/source/MacOSX/MachThread.cpp index fc9782578..062e1c3d9 100644 --- a/tools/debugserver/source/MacOSX/MachThread.cpp +++ b/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/tools/debugserver/source/MacOSX/MachVMRegion.cpp b/tools/debugserver/source/MacOSX/MachVMRegion.cpp index c011c133a..172fc7867 100644 --- a/tools/debugserver/source/MacOSX/MachVMRegion.cpp +++ b/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/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp b/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp index adcd65002..ba37a328e 100644 --- a/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp +++ b/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/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp b/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp index f0a3d2b00..2f8ed32fa 100644 --- a/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp +++ b/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 diff --git a/tools/debugserver/source/RNBRemote.cpp b/tools/debugserver/source/RNBRemote.cpp index bfcd799f1..c8ef153fc 100644 --- a/tools/debugserver/source/RNBRemote.cpp +++ b/tools/debugserver/source/RNBRemote.cpp @@ -3413,10 +3413,7 @@ static bool RNBRemoteShouldCancelCallback(void *not_used) { 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 @@ rnb_err_t RNBRemote::HandlePacket_v(const char *p) { 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 @@ RNBRemote::GetJSONThreadsInfo(bool threads_with_valid_stop_info_only) { 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 @@ rnb_err_t RNBRemote::HandlePacket_jThreadExtendedInfo(const char *p) { 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/tools/debugserver/source/RNBServices.cpp b/tools/debugserver/source/RNBServices.cpp index b2f4910f8..89c4c27da 100644 --- a/tools/debugserver/source/RNBServices.cpp +++ b/tools/debugserver/source/RNBServices.cpp @@ -57,9 +57,9 @@ int GetProcesses(CFMutableArrayRef plistMutableArray, bool all_users) { 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/tools/debugserver/source/libdebugserver.cpp b/tools/debugserver/source/libdebugserver.cpp index 0d27cfd89..34df67521 100644 --- a/tools/debugserver/source/libdebugserver.cpp +++ b/tools/debugserver/source/libdebugserver.cpp @@ -176,7 +176,7 @@ RNBRunLoopMode HandleProcessStateChange(RNBRemoteSP &remote, bool initialize) { 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(); diff --git a/tools/lldb-mi/MICmdArgValFile.cpp b/tools/lldb-mi/MICmdArgValFile.cpp index 77e9a6b2a..cb2ba0125 100644 --- a/tools/lldb-mi/MICmdArgValFile.cpp +++ b/tools/lldb-mi/MICmdArgValFile.cpp @@ -158,10 +158,7 @@ bool CMICmdArgValFile::IsFilePath(const CMIUtilString &vrFileNamePath) const { return false; const bool bValidChars = IsValidChars(vrFileNamePath); - if (bValidChars || bHavePosSlash || bHaveBckSlash) - return true; - - return false; + return bValidChars || bHavePosSlash || bHaveBckSlash; } //++ diff --git a/tools/lldb-mi/MICmdArgValOptionLong.cpp b/tools/lldb-mi/MICmdArgValOptionLong.cpp index 70faab900..3824fe191 100644 --- a/tools/lldb-mi/MICmdArgValOptionLong.cpp +++ b/tools/lldb-mi/MICmdArgValOptionLong.cpp @@ -252,10 +252,7 @@ bool CMICmdArgValOptionLong::IsArgLongOption(const CMIUtilString &vrTxt) const { return false; const CMIUtilString strArg = vrTxt.substr(2); - if (strArg.IsNumber()) - return false; - - return true; + return !strArg.IsNumber(); } //++ diff --git a/tools/lldb-mi/MICmdArgValString.cpp b/tools/lldb-mi/MICmdArgValString.cpp index e872f3630..28d4d18c3 100644 --- a/tools/lldb-mi/MICmdArgValString.cpp +++ b/tools/lldb-mi/MICmdArgValString.cpp @@ -33,7 +33,7 @@ CMICmdArgValString::CMICmdArgValString() // Throws: None. //-- CMICmdArgValString::CMICmdArgValString(const bool vbAnything) - : m_bHandleQuotedString(vbAnything ? true : false), m_bAcceptNumbers(false), + : m_bHandleQuotedString(vbAnything), m_bAcceptNumbers(false), m_bHandleDirPaths(false), m_bHandleAnything(vbAnything) {} //++ @@ -391,8 +391,5 @@ bool CMICmdArgValString::IsStringArgQuotedQuotedTextEmbedded( return false; const size_t nLen = vrTxt.length(); - if ((nLen > 5) && ((nPos + 2) == (nPos2 - 2))) - return false; - - return true; + return !((nLen > 5) && ((nPos + 2) == (nPos2 - 2))); } diff --git a/tools/lldb-mi/MICmdArgValThreadGrp.cpp b/tools/lldb-mi/MICmdArgValThreadGrp.cpp index 613ad0dcc..4ed83e619 100644 --- a/tools/lldb-mi/MICmdArgValThreadGrp.cpp +++ b/tools/lldb-mi/MICmdArgValThreadGrp.cpp @@ -115,10 +115,7 @@ bool CMICmdArgValThreadGrp::IsArgThreadGrp(const CMIUtilString &vrTxt) const { return false; const CMIUtilString strNum = vrTxt.substr(1); - if (!strNum.IsNumber()) - return false; - - return true; + return strNum.IsNumber(); } //++ diff --git a/tools/lldb-mi/MICmdFactory.cpp b/tools/lldb-mi/MICmdFactory.cpp index 8f6215463..ad4283e50 100644 --- a/tools/lldb-mi/MICmdFactory.cpp +++ b/tools/lldb-mi/MICmdFactory.cpp @@ -128,10 +128,7 @@ bool CMICmdFactory::CmdRegister(const CMIUtilString &vMiCmd, bool CMICmdFactory::HaveAlready(const CMIUtilString &vMiCmd) const { const MapMiCmdToCmdCreatorFn_t::const_iterator it = m_mapMiCmdToCmdCreatorFn.find(vMiCmd); - if (it != m_mapMiCmdToCmdCreatorFn.end()) - return true; - - return false; + return it != m_mapMiCmdToCmdCreatorFn.end(); } //++ diff --git a/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp b/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp index cf4f21d94..f7f43f001 100644 --- a/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp +++ b/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -532,7 +532,7 @@ bool CMICmnLLDBDebugSessionInfo::GetVariableInfo(const lldb::SBValue &vrValue, const bool vbInSimpleForm, CMIUtilString &vwrStrValue) { const CMICmnLLDBUtilSBValue utilValue(vrValue, true, false); - const bool bExpandAggregates = vbInSimpleForm ? false : true; + const bool bExpandAggregates = !vbInSimpleForm; vwrStrValue = utilValue.GetValue(bExpandAggregates); return MIstatus::success; } diff --git a/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp b/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp index fae466229..cd54c2bb5 100644 --- a/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp +++ b/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp @@ -437,10 +437,10 @@ bool CMICmnLLDBDebuggerHandleEvents::HandleEventSBBreakpointAdded( sBrkPtInfo.m_nIgnore = brkPt.GetIgnoreCount(); sBrkPtInfo.m_bPending = false; const char *pStrCondition = brkPt.GetCondition(); - sBrkPtInfo.m_bCondition = (pStrCondition != nullptr) ? true : false; + sBrkPtInfo.m_bCondition = pStrCondition != nullptr; sBrkPtInfo.m_strCondition = (pStrCondition != nullptr) ? pStrCondition : "??"; - sBrkPtInfo.m_bBrkPtThreadId = (brkPt.GetThreadID() != 0) ? true : false; + sBrkPtInfo.m_bBrkPtThreadId = brkPt.GetThreadID() != 0; sBrkPtInfo.m_nBrkPtThreadId = brkPt.GetThreadID(); } diff --git a/tools/lldb-mi/MICmnLog.cpp b/tools/lldb-mi/MICmnLog.cpp index 8643a8784..d30c03f50 100644 --- a/tools/lldb-mi/MICmnLog.cpp +++ b/tools/lldb-mi/MICmnLog.cpp @@ -209,10 +209,7 @@ bool CMICmnLog::RegisterMedium(const IMedium &vrMedium) { bool CMICmnLog::HaveMediumAlready(const IMedium &vrMedium) const { IMedium *pMedium = const_cast<IMedium *>(&vrMedium); const MapMediumToName_t::const_iterator it = m_mapMediumToName.find(pMedium); - if (it != m_mapMediumToName.end()) - return true; - - return false; + return it != m_mapMediumToName.end(); } //++ diff --git a/tools/lldb-mi/MIUtilMapIdToVariant.cpp b/tools/lldb-mi/MIUtilMapIdToVariant.cpp index 52bc413a4..0a4e7299e 100644 --- a/tools/lldb-mi/MIUtilMapIdToVariant.cpp +++ b/tools/lldb-mi/MIUtilMapIdToVariant.cpp @@ -52,10 +52,7 @@ void CMIUtilMapIdToVariant::Clear() { m_mapKeyToVariantValue.clear(); } bool CMIUtilMapIdToVariant::HaveAlready(const CMIUtilString &vId) const { const MapKeyToVariantValue_t::const_iterator it = m_mapKeyToVariantValue.find(vId); - if (it != m_mapKeyToVariantValue.end()) - return true; - - return false; + return it != m_mapKeyToVariantValue.end(); } //++ diff --git a/tools/lldb-mi/MIUtilString.cpp b/tools/lldb-mi/MIUtilString.cpp index 2ddd4eb88..627c2f3d4 100644 --- a/tools/lldb-mi/MIUtilString.cpp +++ b/tools/lldb-mi/MIUtilString.cpp @@ -378,10 +378,7 @@ bool CMIUtilString::IsNumber() const { return false; const size_t nPos = find_first_not_of("-.0123456789"); - if (nPos != std::string::npos) - return false; - - return true; + return nPos == std::string::npos; } //++ @@ -399,10 +396,7 @@ bool CMIUtilString::IsHexadecimalNumber() const { // Skip '0x..' prefix const size_t nPos = find_first_not_of("01234567890ABCDEFabcedf", 2); - if (nPos != std::string::npos) - return false; - - return true; + return nPos == std::string::npos; } //++ @@ -419,10 +413,7 @@ bool CMIUtilString::ExtractNumber(MIint64 &vwrNumber) const { vwrNumber = 0; if (!IsNumber()) { - if (ExtractNumberFromHexadecimal(vwrNumber)) - return true; - - return false; + return ExtractNumberFromHexadecimal(vwrNumber); } std::stringstream ss(const_cast<CMIUtilString &>(*this)); @@ -639,10 +630,7 @@ bool CMIUtilString::IsQuoted() const { return false; const size_t nLen = length(); - if ((nLen > 0) && (at(nLen - 1) != cQuote)) - return false; - - return true; + return !((nLen > 0) && (at(nLen - 1) != cQuote)); } //++ diff --git a/tools/lldb-vscode/JSONUtils.cpp b/tools/lldb-vscode/JSONUtils.cpp index e80d9fca3..76cd44cc7 100644 --- a/tools/lldb-vscode/JSONUtils.cpp +++ b/tools/lldb-vscode/JSONUtils.cpp @@ -97,9 +97,7 @@ int64_t GetSigned(const llvm::json::Object *obj, llvm::StringRef key, } bool ObjectContainsKey(const llvm::json::Object &obj, llvm::StringRef key) { - if (obj.find(key) != obj.end()) - return true; - return false; + return obj.find(key) != obj.end(); } std::vector<std::string> GetStrings(const llvm::json::Object *obj, |