summaryrefslogtreecommitdiff
path: root/lldb/source/Symbol
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-12-15 00:15:33 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-12-15 00:15:33 +0000
commit5b261d732b6b0b1e29be26ad80254f1544dcff61 (patch)
treeb9da1c886f65e0d2eb4a53ea21da2419f1534a08 /lldb/source/Symbol
parentfbf6864d1a804d6db312c6f22670caa5fe14564e (diff)
Simplify Boolean expressions
This patch simplifies boolean expressions acorss LLDB. It was generated using clang-tidy with the following command: run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD Differential revision: https://reviews.llvm.org/D55584
Diffstat (limited to 'lldb/source/Symbol')
-rw-r--r--lldb/source/Symbol/Block.cpp6
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp20
-rw-r--r--lldb/source/Symbol/ClangASTImporter.cpp2
-rw-r--r--lldb/source/Symbol/CompactUnwindInfo.cpp8
-rw-r--r--lldb/source/Symbol/CompileUnit.cpp2
-rw-r--r--lldb/source/Symbol/DWARFCallFrameInfo.cpp10
-rw-r--r--lldb/source/Symbol/FuncUnwinders.cpp2
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp4
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp14
-rw-r--r--lldb/source/Symbol/Symtab.cpp2
-rw-r--r--lldb/source/Symbol/Type.cpp5
-rw-r--r--lldb/source/Symbol/TypeSystem.cpp2
12 files changed, 33 insertions, 44 deletions
diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp
index acc284de75e..d0342355911 100644
--- a/lldb/source/Symbol/Block.cpp
+++ b/lldb/source/Symbol/Block.cpp
@@ -83,7 +83,7 @@ void Block::Dump(Stream *s, addr_t base_addr, int32_t depth,
size_t num_ranges = m_ranges.GetSize();
for (size_t i = 0; i < num_ranges; ++i) {
const Range &range = m_ranges.GetEntryRef(i);
- if (parent_block != nullptr && parent_block->Contains(range) == false)
+ if (parent_block != nullptr && !parent_block->Contains(range))
*s << '!';
else
*s << ' ';
@@ -369,7 +369,7 @@ void Block::SetInlinedFunctionInfo(const char *name, const char *mangled,
}
VariableListSP Block::GetBlockVariableList(bool can_create) {
- if (m_parsed_block_variables == false) {
+ if (!m_parsed_block_variables) {
if (m_variable_list_sp.get() == nullptr && can_create) {
m_parsed_block_variables = true;
SymbolContext sc;
@@ -402,7 +402,7 @@ Block::AppendBlockVariables(bool can_create, bool get_child_block_variables,
collection::const_iterator pos, end = m_children.end();
for (pos = m_children.begin(); pos != end; ++pos) {
Block *child_block = pos->get();
- if (stop_if_child_block_is_inlined_function == false ||
+ if (!stop_if_child_block_is_inlined_function ||
child_block->GetInlinedFunctionInfo() == nullptr) {
num_variables_added += child_block->AppendBlockVariables(
can_create, get_child_block_variables,
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index c39590351c9..67e27f26e5b 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -992,9 +992,7 @@ TargetInfo *ClangASTContext::getTargetInfo() {
static inline bool QualTypeMatchesBitSize(const uint64_t bit_size,
ASTContext *ast, QualType qual_type) {
uint64_t qual_type_bit_size = ast->getTypeSize(qual_type);
- if (qual_type_bit_size == bit_size)
- return true;
- return false;
+ return qual_type_bit_size == bit_size;
}
CompilerType
@@ -1866,8 +1864,7 @@ CompilerType ClangASTContext::CreateObjCClass(const char *name,
}
static inline bool BaseSpecifierIsEmpty(const CXXBaseSpecifier *b) {
- return ClangASTContext::RecordHasFields(b->getType()->getAsCXXRecordDecl()) ==
- false;
+ return !ClangASTContext::RecordHasFields(b->getType()->getAsCXXRecordDecl());
}
uint32_t
@@ -3936,9 +3933,7 @@ bool ClangASTContext::IsCXXClassType(const CompilerType &type) {
return false;
clang::QualType qual_type(ClangUtil::GetCanonicalQualType(type));
- if (!qual_type.isNull() && qual_type->getAsCXXRecordDecl() != nullptr)
- return true;
- return false;
+ return !qual_type.isNull() && qual_type->getAsCXXRecordDecl() != nullptr;
}
bool ClangASTContext::IsBeingDefined(lldb::opaque_compiler_type_t type) {
@@ -5593,7 +5588,7 @@ uint32_t ClangASTContext::GetNumChildren(lldb::opaque_compiler_type_t type,
->getDecl());
// Skip empty base classes
- if (ClangASTContext::RecordHasFields(base_class_decl) == false)
+ if (!ClangASTContext::RecordHasFields(base_class_decl))
continue;
num_children++;
@@ -6655,7 +6650,7 @@ CompilerType ClangASTContext::GetChildCompilerTypeAtIndex(
if (omit_empty_base_classes) {
base_class_decl = llvm::cast<clang::CXXRecordDecl>(
base_class->getType()->getAs<clang::RecordType>()->getDecl());
- if (ClangASTContext::RecordHasFields(base_class_decl) == false)
+ if (!ClangASTContext::RecordHasFields(base_class_decl))
continue;
}
@@ -7450,7 +7445,7 @@ ClangASTContext::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
->getAs<clang::RecordType>()
->getDecl());
if (omit_empty_base_classes &&
- ClangASTContext::RecordHasFields(base_class_decl) == false)
+ !ClangASTContext::RecordHasFields(base_class_decl))
continue;
CompilerType base_class_clang_type(getASTContext(),
@@ -9105,8 +9100,7 @@ void ClangASTContext::DumpValue(
base_class->getType()->getAs<clang::RecordType>()->getDecl());
// Skip empty base classes
- if (verbose == false &&
- ClangASTContext::RecordHasFields(base_class_decl) == false)
+ if (!verbose && !ClangASTContext::RecordHasFields(base_class_decl))
continue;
if (base_class->isVirtual())
diff --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp
index b6850785bd2..621441449c2 100644
--- a/lldb/source/Symbol/ClangASTImporter.cpp
+++ b/lldb/source/Symbol/ClangASTImporter.cpp
@@ -1002,7 +1002,7 @@ clang::Decl *ClangASTImporter::Minion::Imported(clang::Decl *from,
if (isa<TagDecl>(to) || isa<ObjCInterfaceDecl>(to)) {
RecordDecl *from_record_decl = dyn_cast<RecordDecl>(from);
if (from_record_decl == nullptr ||
- from_record_decl->isInjectedClassName() == false) {
+ !from_record_decl->isInjectedClassName()) {
NamedDecl *to_named_decl = dyn_cast<NamedDecl>(to);
if (!m_decls_already_deported->count(to_named_decl))
diff --git a/lldb/source/Symbol/CompactUnwindInfo.cpp b/lldb/source/Symbol/CompactUnwindInfo.cpp
index 87104707683..1baf444bbbe 100644
--- a/lldb/source/Symbol/CompactUnwindInfo.cpp
+++ b/lldb/source/Symbol/CompactUnwindInfo.cpp
@@ -259,7 +259,7 @@ void CompactUnwindInfo::ScanIndex(const ProcessSP &process_sp) {
m_objfile.GetModule()->LogMessage(
log, "Reading compact unwind first-level indexes");
- if (m_unwindinfo_data_computed == false) {
+ if (!m_unwindinfo_data_computed) {
if (m_section_sp->IsEncrypted()) {
// Can't get section contents of a protected/encrypted section until we
// have a live process and can read them out of memory.
@@ -529,7 +529,7 @@ bool CompactUnwindInfo::GetCompactUnwindInfoForFunction(
--it;
}
- if (it->sentinal_entry == true) {
+ if (it->sentinal_entry) {
return false;
}
@@ -925,7 +925,7 @@ bool CompactUnwindInfo::CreateUnwindPlan_x86_64(Target &target,
for (uint32_t i = 0; i < register_count; i++) {
int renum = 0;
for (int j = 1; j < 7; j++) {
- if (used[j] == false) {
+ if (!used[j]) {
if (renum == permunreg[i]) {
registers[i] = j;
used[j] = true;
@@ -1187,7 +1187,7 @@ bool CompactUnwindInfo::CreateUnwindPlan_i386(Target &target,
for (uint32_t i = 0; i < register_count; i++) {
int renum = 0;
for (int j = 1; j < 7; j++) {
- if (used[j] == false) {
+ if (!used[j]) {
if (renum == permunreg[i]) {
registers[i] = j;
used[j] = true;
diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp
index 79cf0180c15..318afcba633 100644
--- a/lldb/source/Symbol/CompileUnit.cpp
+++ b/lldb/source/Symbol/CompileUnit.cpp
@@ -291,7 +291,7 @@ uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
// If we are not looking for inlined functions and our file spec doesn't
// match then we are done...
- if (file_spec_matches_cu_file_spec == false && check_inlines == false)
+ if (!file_spec_matches_cu_file_spec && !check_inlines)
return 0;
uint32_t file_idx =
diff --git a/lldb/source/Symbol/DWARFCallFrameInfo.cpp b/lldb/source/Symbol/DWARFCallFrameInfo.cpp
index 1bf9ff99e01..4c9602e2376 100644
--- a/lldb/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/lldb/source/Symbol/DWARFCallFrameInfo.cpp
@@ -161,7 +161,7 @@ bool DWARFCallFrameInfo::GetUnwindPlan(Address addr, UnwindPlan &unwind_plan) {
module_sp->GetObjectFile() != &m_objfile)
return false;
- if (GetFDEEntryByFileAddress(addr.GetFileAddress(), fde_entry) == false)
+ if (!GetFDEEntryByFileAddress(addr.GetFileAddress(), fde_entry))
return false;
return FDEToUnwindPlan(fde_entry.data, addr, unwind_plan);
}
@@ -243,7 +243,7 @@ DWARFCallFrameInfo::CIESP
DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) {
CIESP cie_sp(new CIE(cie_offset));
lldb::offset_t offset = cie_offset;
- if (m_cfi_data_initialized == false)
+ if (!m_cfi_data_initialized)
GetCFIData();
uint32_t length = m_cfi_data.GetU32(&offset);
dw_offset_t cie_id, end_offset;
@@ -394,7 +394,7 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) {
}
void DWARFCallFrameInfo::GetCFIData() {
- if (m_cfi_data_initialized == false) {
+ if (!m_cfi_data_initialized) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND));
if (log)
m_objfile.GetModule()->LogMessage(log, "Reading EH frame info");
@@ -431,7 +431,7 @@ void DWARFCallFrameInfo::GetFDEIndex() {
}
lldb::offset_t offset = 0;
- if (m_cfi_data_initialized == false)
+ if (!m_cfi_data_initialized)
GetCFIData();
while (m_cfi_data.ValidOffsetForDataOfSize(offset, 8)) {
const dw_offset_t current_entry = offset;
@@ -533,7 +533,7 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset,
if (m_section_sp.get() == nullptr || m_section_sp->IsEncrypted())
return false;
- if (m_cfi_data_initialized == false)
+ if (!m_cfi_data_initialized)
GetCFIData();
uint32_t length = m_cfi_data.GetU32(&offset);
diff --git a/lldb/source/Symbol/FuncUnwinders.cpp b/lldb/source/Symbol/FuncUnwinders.cpp
index 2384d35e3d3..da1f0da78de 100644
--- a/lldb/source/Symbol/FuncUnwinders.cpp
+++ b/lldb/source/Symbol/FuncUnwinders.cpp
@@ -255,7 +255,7 @@ UnwindPlanSP FuncUnwinders::GetAssemblyUnwindPlan(Target &target,
int current_offset) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_unwind_plan_assembly_sp.get() || m_tried_unwind_plan_assembly ||
- m_unwind_table.GetAllowAssemblyEmulationUnwindPlans() == false) {
+ !m_unwind_table.GetAllowAssemblyEmulationUnwindPlans()) {
return m_unwind_plan_assembly_sp;
}
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index 63b48759d84..86c18c7beb0 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -588,9 +588,7 @@ bool ObjectFile::SplitArchivePathWithObject(const char *path_with_object,
regex_match.GetMatchAtIndex(path_with_object, 2, obj)) {
archive_file.SetFile(path, FileSpec::Style::native);
archive_object.SetCString(obj.c_str());
- if (must_exist && !FileSystem::Instance().Exists(archive_file))
- return false;
- return true;
+ return !(must_exist && !FileSystem::Instance().Exists(archive_file));
}
}
return false;
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index eac3ed48eee..596df200b7a 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -105,12 +105,12 @@ bool SymbolContext::DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
if (function != nullptr) {
SymbolContext inline_parent_sc;
Address inline_parent_addr;
- if (show_function_name == false) {
+ if (!show_function_name) {
s->Printf("<");
dumped_something = true;
} else {
ConstString name;
- if (show_function_arguments == false)
+ if (!show_function_arguments)
name = function->GetNameNoArguments();
if (!name)
name = function->GetName();
@@ -122,7 +122,7 @@ bool SymbolContext::DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
const addr_t function_offset =
addr.GetOffset() -
function->GetAddressRange().GetBaseAddress().GetOffset();
- if (show_function_name == false) {
+ if (!show_function_name) {
// Print +offset even if offset is 0
dumped_something = true;
s->Printf("+%" PRIu64 ">", function_offset);
@@ -171,7 +171,7 @@ bool SymbolContext::DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
}
}
} else if (symbol != nullptr) {
- if (show_function_name == false) {
+ if (!show_function_name) {
s->Printf("<");
dumped_something = true;
} else if (symbol->GetName()) {
@@ -184,7 +184,7 @@ bool SymbolContext::DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
if (addr.IsValid() && symbol->ValueIsAddress()) {
const addr_t symbol_offset =
addr.GetOffset() - symbol->GetAddressRef().GetOffset();
- if (show_function_name == false) {
+ if (!show_function_name) {
// Print +offset even if offset is 0
dumped_something = true;
s->Printf("+%" PRIu64 ">", symbol_offset);
@@ -1259,7 +1259,7 @@ bool SymbolContextList::AppendIfUnique(const SymbolContext &sc,
}
if (merge_symbol_into_function && sc.symbol != nullptr &&
sc.comp_unit == nullptr && sc.function == nullptr &&
- sc.block == nullptr && sc.line_entry.IsValid() == false) {
+ sc.block == nullptr && !sc.line_entry.IsValid()) {
if (sc.symbol->ValueIsAddress()) {
for (pos = m_symbol_contexts.begin(); pos != end; ++pos) {
// Don't merge symbols into inlined function symbol contexts
@@ -1289,7 +1289,7 @@ bool SymbolContextList::MergeSymbolContextIntoFunctionContext(
const SymbolContext &symbol_sc, uint32_t start_idx, uint32_t stop_idx) {
if (symbol_sc.symbol != nullptr && symbol_sc.comp_unit == nullptr &&
symbol_sc.function == nullptr && symbol_sc.block == nullptr &&
- symbol_sc.line_entry.IsValid() == false) {
+ !symbol_sc.line_entry.IsValid()) {
if (symbol_sc.symbol->ValueIsAddress()) {
const size_t end = std::min<size_t>(m_symbol_contexts.size(), stop_idx);
for (size_t i = start_idx; i < end; ++i) {
diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp
index e1089f9965a..0d1b2f0db10 100644
--- a/lldb/source/Symbol/Symtab.cpp
+++ b/lldb/source/Symbol/Symtab.cpp
@@ -740,7 +740,7 @@ uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType(
for (uint32_t i = 0; i < sym_end; i++) {
if (symbol_type == eSymbolTypeAny ||
m_symbols[i].GetType() == symbol_type) {
- if (CheckSymbolAtIndex(i, symbol_debug_type, symbol_visibility) == false)
+ if (!CheckSymbolAtIndex(i, symbol_debug_type, symbol_visibility))
continue;
const char *name = m_symbols[i].GetName().AsCString();
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index f6344c07310..5f107849118 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -746,10 +746,7 @@ void TypeAndOrName::SetCompilerType(CompilerType compiler_type) {
}
bool TypeAndOrName::IsEmpty() const {
- if ((bool)m_type_name || (bool)m_type_pair)
- return false;
- else
- return true;
+ return !((bool)m_type_name || (bool)m_type_pair);
}
void TypeAndOrName::Clear() {
diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp
index b29d1a4106c..91d347edfc7 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -193,7 +193,7 @@ void TypeSystemMap::ForEach(std::function<bool(TypeSystem *)> const &callback) {
TypeSystem *type_system = pair.second.get();
if (type_system && !visited.count(type_system)) {
visited.insert(type_system);
- if (callback(type_system) == false)
+ if (!callback(type_system))
break;
}
}