Simplify Boolean expressions
This patch simplifies boolean expressions acorss LLDB. It was generated
using clang-tidy with the following command:
run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD
Differential revision: https://reviews.llvm.org/D55584
llvm-svn: 349215
diff --git a/lldb/source/Plugins/Language/ObjC/CF.cpp b/lldb/source/Plugins/Language/ObjC/CF.cpp
index 9bb8eea..e3dab5a 100644
--- a/lldb/source/Plugins/Language/ObjC/CF.cpp
+++ b/lldb/source/Plugins/Language/ObjC/CF.cpp
@@ -149,7 +149,7 @@
}
}
- if (is_type_ok == false)
+ if (!is_type_ok)
return false;
Status error;
diff --git a/lldb/source/Plugins/Language/ObjC/NSException.cpp b/lldb/source/Plugins/Language/ObjC/NSException.cpp
index bb0bcb9..2404ef9 100644
--- a/lldb/source/Plugins/Language/ObjC/NSException.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSException.cpp
@@ -144,11 +144,8 @@
m_userinfo_sp.reset();
m_reserved_sp.reset();
- if (!ExtractFields(m_backend, &m_name_sp, &m_reason_sp, &m_userinfo_sp,
- &m_reserved_sp)) {
- return false;
- }
- return true;
+ return ExtractFields(m_backend, &m_name_sp, &m_reason_sp, &m_userinfo_sp,
+ &m_reserved_sp);
}
bool MightHaveChildren() override { return true; }
diff --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
index dac70cd1..41df9ab 100644
--- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
@@ -126,11 +126,7 @@
return false;
}
- bool MightHaveChildren() override {
- if (m_impl.m_mode == Mode::Invalid)
- return false;
- return true;
- }
+ bool MightHaveChildren() override { return m_impl.m_mode != Mode::Invalid; }
size_t GetIndexOfChildWithName(const ConstString &name) override {
const char *item_name = name.GetCString();
diff --git a/lldb/source/Plugins/Language/ObjC/NSString.cpp b/lldb/source/Plugins/Language/ObjC/NSString.cpp
index 0b12edb..f882b2a 100644
--- a/lldb/source/Plugins/Language/ObjC/NSString.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSString.cpp
@@ -225,10 +225,10 @@
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 @@
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 @@
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);