Simplify Boolean expressions

This patch simplifies boolean expressions acorss LLDB. It was generated
using clang-tidy with the following command:

run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD

Differential revision: https://reviews.llvm.org/D55584

llvm-svn: 349215
This commit is contained in:
Jonas Devlieghere 2018-12-15 00:15:33 +00:00
parent 9d1827331f
commit a6682a413d
177 changed files with 597 additions and 1016 deletions

View File

@ -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()) {

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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()));

View File

@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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();
}
}

View File

@ -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) {

View File

@ -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);

View File

@ -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;

View File

@ -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;
}
//-------------------------------------------------------------------------

View File

@ -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

View File

@ -419,9 +419,7 @@ bool Mangled::NameMatches(const RegularExpression &regex,
return true;
ConstString demangled = GetDemangledName(language);
if (demangled && regex.Execute(demangled.AsCString()))
return true;
return false;
return demangled && regex.Execute(demangled.AsCString());
}
//----------------------------------------------------------------------

View File

@ -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) {

View File

@ -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) {

View File

@ -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(); }

View File

@ -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);

View File

@ -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;

View File

@ -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 "

View File

@ -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(),

View File

@ -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);
}

View File

@ -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);

View File

@ -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

View File

@ -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.

View File

@ -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)

View File

@ -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());
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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());

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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 {

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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();
}

View File

@ -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());
}
}

View File

@ -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)

View File

@ -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 {

View File

@ -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 *

View File

@ -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;
}

View File

@ -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)) {

View File

@ -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);
}
//----------------------------------------------------------------------

View File

@ -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;

View File

@ -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.

View File

@ -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,

View File

@ -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()) {

View File

@ -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(

View File

@ -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()) {

View File

@ -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;

View File

@ -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) {

View File

@ -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, &reg_info_src, data_src))
return false;
return true;
return WriteRegister(context, &reg_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, &reg_info_src, data_src))
return false;
return true;
return WriteRegister(context, &reg_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) {

View File

@ -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, &reg_info_src, data_src))
return false;
return true;
return WriteRegister(context, &reg_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) {

View File

@ -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() {

View File

@ -149,7 +149,7 @@ bool lldb_private::formatters::CFBitVectorSummaryProvider(
}
}
if (is_type_ok == false)
if (!is_type_ok)
return false;
Status error;

View File

@ -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; }

View File

@ -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();

View File

@ -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);

View File

@ -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;
}
//------------------------------------------------------------------

View File

@ -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(

View File

@ -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() {

View File

@ -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();
}
//------------------------------------------------------------------

View File

@ -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())

View File

@ -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; }

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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 &section_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;

View File

@ -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;

View File

@ -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 */
// };
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);
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;
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(

View File

@ -527,7 +527,7 @@ bool ObjectFilePECOFF::ParseSectionHeaders(
}
}
return m_sect_headers.empty() == false;
return !m_sect_headers.empty();
}
bool ObjectFilePECOFF::GetSectionName(std::string &sect_name,

View File

@ -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;

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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();

View File

@ -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();

View File

@ -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,

View File

@ -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(

View File

@ -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:

View File

@ -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:

View File

@ -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: {

View File

@ -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;
}
}

Some files were not shown because too many files have changed in this diff Show More