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/API/SBQueue.cpp b/lldb/source/API/SBQueue.cpp
index 5f85211..b4a3cd0 100644
--- a/lldb/source/API/SBQueue.cpp
+++ b/lldb/source/API/SBQueue.cpp
@@ -107,7 +107,7 @@
}
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 @@
}
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 @@
uint32_t result = 0;
QueueSP queue_sp = m_queue_wp.lock();
- if (m_pending_items_fetched == false && queue_sp) {
+ if (!m_pending_items_fetched && queue_sp) {
result = queue_sp->GetNumPendingWorkItems();
} else {
result = m_pending_items.size();
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 5771b37..97a9df6 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -571,7 +571,7 @@
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 @@
}
}
- if (log && sb_origin_thread.IsValid() == false)
+ if (log && !sb_origin_thread.IsValid())
log->Printf("SBThread(%p)::GetExtendedBacktraceThread() is not returning a "
"Valid thread",
static_cast<void *>(exe_ctx.GetThreadPtr()));
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index e199b7a..7af2709 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -47,20 +47,20 @@
//{}
//
bool SBType::operator==(SBType &rhs) {
- if (IsValid() == false)
+ if (!IsValid())
return !rhs.IsValid();
- if (rhs.IsValid() == false)
+ if (!rhs.IsValid())
return false;
return *m_opaque_sp.get() == *rhs.m_opaque_sp.get();
}
bool SBType::operator!=(SBType &rhs) {
- if (IsValid() == false)
+ if (!IsValid())
return rhs.IsValid();
- if (rhs.IsValid() == false)
+ if (!rhs.IsValid())
return true;
return *m_opaque_sp.get() != *rhs.m_opaque_sp.get();
diff --git a/lldb/source/API/SBTypeCategory.cpp b/lldb/source/API/SBTypeCategory.cpp
index 30414bd..7c2a37e 100644
--- a/lldb/source/API/SBTypeCategory.cpp
+++ b/lldb/source/API/SBTypeCategory.cpp
@@ -529,14 +529,14 @@
}
bool SBTypeCategory::operator==(lldb::SBTypeCategory &rhs) {
- if (IsValid() == false)
+ if (!IsValid())
return !rhs.IsValid();
return m_opaque_sp.get() == rhs.m_opaque_sp.get();
}
bool SBTypeCategory::operator!=(lldb::SBTypeCategory &rhs) {
- if (IsValid() == false)
+ if (!IsValid())
return rhs.IsValid();
return m_opaque_sp.get() != rhs.m_opaque_sp.get();
diff --git a/lldb/source/API/SBTypeFilter.cpp b/lldb/source/API/SBTypeFilter.cpp
index 8fa3222..9709d2e 100644
--- a/lldb/source/API/SBTypeFilter.cpp
+++ b/lldb/source/API/SBTypeFilter.cpp
@@ -91,14 +91,14 @@
}
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::operator!=(lldb::SBTypeFilter &rhs) {
- if (IsValid() == false)
+ if (!IsValid())
return !rhs.IsValid();
return m_opaque_sp != rhs.m_opaque_sp;
diff --git a/lldb/source/API/SBTypeFormat.cpp b/lldb/source/API/SBTypeFormat.cpp
index 6fe7625..66bfd36 100644
--- a/lldb/source/API/SBTypeFormat.cpp
+++ b/lldb/source/API/SBTypeFormat.cpp
@@ -88,13 +88,13 @@
}
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::operator!=(lldb::SBTypeFormat &rhs) {
- if (IsValid() == false)
+ if (!IsValid())
return !rhs.IsValid();
return m_opaque_sp != rhs.m_opaque_sp;
}
diff --git a/lldb/source/API/SBTypeNameSpecifier.cpp b/lldb/source/API/SBTypeNameSpecifier.cpp
index 2f9deaf..5ffb3d9 100644
--- a/lldb/source/API/SBTypeNameSpecifier.cpp
+++ b/lldb/source/API/SBTypeNameSpecifier.cpp
@@ -80,13 +80,13 @@
}
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::operator!=(lldb::SBTypeNameSpecifier &rhs) {
- if (IsValid() == false)
+ if (!IsValid())
return !rhs.IsValid();
return m_opaque_sp != rhs.m_opaque_sp;
}
diff --git a/lldb/source/API/SBTypeSummary.cpp b/lldb/source/API/SBTypeSummary.cpp
index cd4edd1..314c711 100644
--- a/lldb/source/API/SBTypeSummary.cpp
+++ b/lldb/source/API/SBTypeSummary.cpp
@@ -261,7 +261,7 @@
}
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::operator!=(lldb::SBTypeSummary &rhs) {
- if (IsValid() == false)
+ if (!IsValid())
return !rhs.IsValid();
return m_opaque_sp != rhs.m_opaque_sp;
}
diff --git a/lldb/source/API/SBTypeSynthetic.cpp b/lldb/source/API/SBTypeSynthetic.cpp
index 37b6086..750d917 100644
--- a/lldb/source/API/SBTypeSynthetic.cpp
+++ b/lldb/source/API/SBTypeSynthetic.cpp
@@ -106,13 +106,13 @@
}
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::operator!=(lldb::SBTypeSynthetic &rhs) {
- if (IsValid() == false)
+ if (!IsValid())
return !rhs.IsValid();
return m_opaque_sp != rhs.m_opaque_sp;
}
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 67ad625..a61a2a1 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -98,10 +98,7 @@
// 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();
}
}