diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-12-15 00:15:33 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-12-15 00:15:33 +0000 |
commit | 5b261d732b6b0b1e29be26ad80254f1544dcff61 (patch) | |
tree | b9da1c886f65e0d2eb4a53ea21da2419f1534a08 /lldb/source/Plugins | |
parent | fbf6864d1a804d6db312c6f22670caa5fe14564e (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/Plugins')
78 files changed, 368 insertions, 659 deletions
diff --git a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp index bee476c47d4..d26818d4666 100644 --- a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp +++ b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp @@ -1440,10 +1440,7 @@ bool ABISysV_arm::PrepareTrivialCall(Thread &thread, addr_t sp, ~1ull; // clear bit zero since the CPSR will take care of the mode for us // Set "pc" to the address requested - if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_num, function_addr)) - return false; - - return true; + return reg_ctx->WriteRegisterFromUnsigned(pc_reg_num, function_addr); } bool ABISysV_arm::GetArgumentValues(Thread &thread, ValueList &values) const { diff --git a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h index bc8f973f51d..5433ebb4593 100644 --- a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h +++ b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h @@ -57,9 +57,7 @@ public: bool CodeAddressIsValid(lldb::addr_t pc) override { // Code addressed must be 2 byte aligned - if (pc & 1ull) - return false; - return true; + return (pc & 1ull) == 0; } const lldb_private::RegisterInfo * diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp index 58fcd0163e5..5df84225059 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp @@ -1336,10 +1336,7 @@ bool DisassemblerLLVMC::FlavorValidForArchSpec( if (triple.getArch() == llvm::Triple::x86 || triple.getArch() == llvm::Triple::x86_64) { - if (strcmp(flavor, "intel") == 0 || strcmp(flavor, "att") == 0) - return true; - else - return false; + return strcmp(flavor, "intel") == 0 || strcmp(flavor, "att") == 0; } else return false; } diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 551f038fa20..024f82800f6 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -387,8 +387,8 @@ DynamicLoaderDarwinKernel::ReadMachHeader(addr_t addr, Process *process, llvm::M if (::memcmp (&header.magic, &magicks[i], sizeof (uint32_t)) == 0) found_matching_pattern = true; - if (found_matching_pattern == false) - return false; + if (!found_matching_pattern) + return false; if (header.magic == llvm::MachO::MH_CIGAM || header.magic == llvm::MachO::MH_CIGAM_64) { @@ -424,7 +424,7 @@ DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr, llvm::MachO::mach_header header; - if (ReadMachHeader (addr, process, header) == false) + if (!ReadMachHeader(addr, process, header)) return UUID(); // First try a quick test -- read the first 4 bytes and see if there is a @@ -604,16 +604,10 @@ void DynamicLoaderDarwinKernel::KextImageInfo::SetProcessStopId( bool DynamicLoaderDarwinKernel::KextImageInfo:: operator==(const KextImageInfo &rhs) { if (m_uuid.IsValid() || rhs.GetUUID().IsValid()) { - if (m_uuid == rhs.GetUUID()) { - return true; - } - return false; + return m_uuid == rhs.GetUUID(); } - if (m_name == rhs.GetName() && m_load_address == rhs.GetLoadAddress()) - return true; - - return false; + return m_name == rhs.GetName() && m_load_address == rhs.GetLoadAddress(); } void DynamicLoaderDarwinKernel::KextImageInfo::SetName(const char *name) { @@ -731,7 +725,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule( } bool DynamicLoaderDarwinKernel::KextImageInfo::IsKernel() const { - return m_kernel_image == true; + return m_kernel_image; } void DynamicLoaderDarwinKernel::KextImageInfo::SetIsKernel(bool is_kernel) { @@ -1280,7 +1274,7 @@ bool DynamicLoaderDarwinKernel::ParseKextSummaries( const uint32_t num_of_new_kexts = kext_summaries.size(); for (uint32_t new_kext = 0; new_kext < num_of_new_kexts; new_kext++) { - if (to_be_added[new_kext] == true) { + if (to_be_added[new_kext]) { KextImageInfo &image_info = kext_summaries[new_kext]; if (load_kexts) { if (!image_info.LoadImageUsingMemoryModule(m_process)) { diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 595e8484d20..944be9633e0 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -359,16 +359,18 @@ bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo( if (image_sp.get() == nullptr || image_sp->GetAsDictionary() == nullptr) return false; StructuredData::Dictionary *image = image_sp->GetAsDictionary(); - if (image->HasKey("load_address") == false || - image->HasKey("pathname") == false || - image->HasKey("mod_date") == false || - image->HasKey("mach_header") == false || + // clang-format off + if (!image->HasKey("load_address") || + !image->HasKey("pathname") || + !image->HasKey("mod_date") || + !image->HasKey("mach_header") || image->GetValueForKey("mach_header")->GetAsDictionary() == nullptr || - image->HasKey("segments") == false || + !image->HasKey("segments") || image->GetValueForKey("segments")->GetAsArray() == nullptr || - image->HasKey("uuid") == false) { + !image->HasKey("uuid")) { return false; } + // clang-format on image_infos[i].address = image->GetValueForKey("load_address")->GetAsInteger()->GetValue(); image_infos[i].mod_date = @@ -712,11 +714,7 @@ bool DynamicLoaderDarwin::AlwaysRelyOnEHUnwindInfo(SymbolContext &sym_ctx) { return false; ObjCLanguageRuntime *objc_runtime = m_process->GetObjCLanguageRuntime(); - if (objc_runtime != NULL && objc_runtime->IsModuleObjCLibrary(module_sp)) { - return true; - } - - return false; + return objc_runtime != NULL && objc_runtime->IsModuleObjCLibrary(module_sp); } //---------------------------------------------------------------------- diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index 7fd886cdeae..1ff0ec2c793 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -65,7 +65,7 @@ DynamicLoader *DynamicLoaderMacOS::CreateInstance(Process *process, } } - if (UseDYLDSPI(process) == false) { + if (!UseDYLDSPI(process)) { create = false; } @@ -503,8 +503,7 @@ bool DynamicLoaderMacOS::GetSharedCacheInformation( info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue(); if (!uuid_str.empty()) uuid.SetFromStringRef(uuid_str); - if (info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue() == - false) + if (!info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue()) using_shared_cache = eLazyBoolYes; else using_shared_cache = eLazyBoolNo; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 50ed1eff8ca..ec459a783f9 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -85,7 +85,7 @@ DynamicLoader *DynamicLoaderMacOSXDYLD::CreateInstance(Process *process, } } - if (UseDYLDSPI(process) == true) { + if (UseDYLDSPI(process)) { create = false; } @@ -122,12 +122,12 @@ bool DynamicLoaderMacOSXDYLD::ProcessDidExec() { // value differs from the Process' image info address. When a process // execs itself it might cause a change if ASLR is enabled. const addr_t shlib_addr = m_process->GetImageInfoAddress(); - if (m_process_image_addr_is_all_images_infos == true && + if (m_process_image_addr_is_all_images_infos && shlib_addr != m_dyld_all_image_infos_addr) { // The image info address from the process is the // 'dyld_all_image_infos' address and it has changed. did_exec = true; - } else if (m_process_image_addr_is_all_images_infos == false && + } else if (!m_process_image_addr_is_all_images_infos && shlib_addr == m_dyld.address) { // The image info address from the process is the mach_header address // for dyld and it has changed. diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp index 68eb3389e91..b30a1ab2cf1 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -455,14 +455,10 @@ static bool isLoadBiasIncorrect(Target &target, const std::string &file_path) { // On Android L (API 21, 22) the load address of the "/system/bin/linker" // isn't filled in correctly. unsigned os_major = target.GetPlatform()->GetOSVersion().getMajor(); - if (target.GetArchitecture().GetTriple().isAndroid() && - (os_major == 21 || os_major == 22) && - (file_path == "/system/bin/linker" || - file_path == "/system/bin/linker64")) { - return true; - } - - return false; + return target.GetArchitecture().GetTriple().isAndroid() && + (os_major == 21 || os_major == 22) && + (file_path == "/system/bin/linker" || + file_path == "/system/bin/linker64"); } void DYLDRendezvous::UpdateBaseAddrIfNecessary(SOEntry &entry, diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 72ef71e2f3b..660bba65d8b 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -117,7 +117,7 @@ void DynamicLoaderPOSIXDYLD::DidAttach() { EvalSpecialModulesStatus(); // if we dont have a load address we cant re-base - bool rebase_exec = (load_offset == LLDB_INVALID_ADDRESS) ? false : true; + bool rebase_exec = load_offset != LLDB_INVALID_ADDRESS; // if we have a valid executable if (executable_sp.get()) { diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index 1116624aab2..f03c7147569 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -778,12 +778,9 @@ bool ClangASTSource::IgnoreName(const ConstString name, StringRef name_string_ref = name.GetStringRef(); // The ClangASTSource is not responsible for finding $-names. - if (name_string_ref.empty() || - (ignore_all_dollar_names && name_string_ref.startswith("$")) || - name_string_ref.startswith("_$")) - return true; - - return false; + return name_string_ref.empty() || + (ignore_all_dollar_names && name_string_ref.startswith("$")) || + name_string_ref.startswith("_$"); } void ClangASTSource::FindExternalVisibleDecls( diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index bc18d27eeb1..fde610a09ae 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -778,11 +778,8 @@ bool IRForTarget::RewriteObjCConstStrings() { static bool IsObjCSelectorRef(Value *value) { GlobalVariable *global_variable = dyn_cast<GlobalVariable>(value); - if (!global_variable || !global_variable->hasName() || - !global_variable->getName().startswith("OBJC_SELECTOR_REFERENCES_")) - return false; - - return true; + return !(!global_variable || !global_variable->hasName() || + !global_variable->getName().startswith("OBJC_SELECTOR_REFERENCES_")); } // This function does not report errors; its callers are responsible. @@ -953,11 +950,8 @@ bool IRForTarget::RewriteObjCSelectors(BasicBlock &basic_block) { static bool IsObjCClassReference(Value *value) { GlobalVariable *global_variable = dyn_cast<GlobalVariable>(value); - if (!global_variable || !global_variable->hasName() || - !global_variable->getName().startswith("OBJC_CLASS_REFERENCES_")) - return false; - - return true; + return !(!global_variable || !global_variable->hasName() || + !global_variable->getName().startswith("OBJC_CLASS_REFERENCES_")); } // This function does not report errors; its callers are responsible. @@ -1259,12 +1253,9 @@ bool IRForTarget::MaterializeInitializer(uint8_t *data, Constant *initializer) { llvm::NextPowerOf2(constant_size) * 8); lldb_private::Status get_data_error; - if (!scalar.GetAsMemoryData(data, constant_size, - lldb_private::endian::InlHostByteOrder(), - get_data_error)) - return false; - - return true; + return scalar.GetAsMemoryData(data, constant_size, + lldb_private::endian::InlHostByteOrder(), + get_data_error) != 0; } else if (ConstantDataArray *array_initializer = dyn_cast<ConstantDataArray>(initializer)) { if (array_initializer->isString()) { diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp index d11cc1ed107..85bc4a61c9d 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp @@ -776,10 +776,7 @@ bool EmulateInstructionARM::WriteBits32UnknownToMemory(addr_t address) { uint32_t random_data = rand(); const uint32_t addr_byte_size = GetAddressByteSize(); - if (!MemAWrite(context, address, random_data, addr_byte_size)) - return false; - - return true; + return MemAWrite(context, address, random_data, addr_byte_size); } // Write "bits (32) UNKNOWN" to register n. Helper function for many ARM @@ -3340,10 +3337,7 @@ bool EmulateInstructionARM::EmulateCMNImm(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteFlags(context, res.result, res.carry_out, res.overflow)) - return false; - - return true; + return WriteFlags(context, res.result, res.carry_out, res.overflow); } // Compare Negative (register) adds a register value and an optionally-shifted @@ -3410,10 +3404,7 @@ bool EmulateInstructionARM::EmulateCMNReg(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteFlags(context, res.result, res.carry_out, res.overflow)) - return false; - - return true; + return WriteFlags(context, res.result, res.carry_out, res.overflow); } // Compare (immediate) subtracts an immediate value from a register value. It @@ -3463,10 +3454,7 @@ bool EmulateInstructionARM::EmulateCMPImm(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteFlags(context, res.result, res.carry_out, res.overflow)) - return false; - - return true; + return WriteFlags(context, res.result, res.carry_out, res.overflow); } // Compare (register) subtracts an optionally-shifted register value from a @@ -3542,10 +3530,7 @@ bool EmulateInstructionARM::EmulateCMPReg(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteFlags(context, res.result, res.carry_out, res.overflow)) - return false; - - return true; + return WriteFlags(context, res.result, res.carry_out, res.overflow); } // Arithmetic Shift Right (immediate) shifts a register value right by an @@ -9245,11 +9230,8 @@ bool EmulateInstructionARM::EmulateRSBImm(const uint32_t opcode, context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // Reverse Subtract (register) subtracts a register value from an optionally- @@ -9326,11 +9308,8 @@ bool EmulateInstructionARM::EmulateRSBReg(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // Reverse Subtract with Carry (immediate) subtracts a register value and the @@ -9388,11 +9367,8 @@ bool EmulateInstructionARM::EmulateRSCImm(const uint32_t opcode, context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // Reverse Subtract with Carry (register) subtracts a register value and the @@ -9460,11 +9436,8 @@ bool EmulateInstructionARM::EmulateRSCReg(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // Subtract with Carry (immediate) subtracts an immediate value and the value @@ -9531,11 +9504,8 @@ bool EmulateInstructionARM::EmulateSBCImm(const uint32_t opcode, context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // Subtract with Carry (register) subtracts an optionally-shifted register @@ -9620,11 +9590,8 @@ bool EmulateInstructionARM::EmulateSBCReg(const uint32_t opcode, EmulateInstruction::Context context; context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // This instruction subtracts an immediate value from a register value, and @@ -9713,11 +9680,8 @@ bool EmulateInstructionARM::EmulateSUBImmThumb(const uint32_t opcode, context.type = EmulateInstruction::eContextImmediate; context.SetNoArgs(); - if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, - res.carry_out, res.overflow)) - return false; - - return true; + return WriteCoreRegOptionalFlags(context, res.result, Rd, setflags, + res.carry_out, res.overflow); } // This instruction subtracts an immediate value from a register value, and @@ -14153,11 +14117,8 @@ bool EmulateInstructionARM::BranchWritePC(const Context &context, else target = addr & 0xfffffffe; - if (!WriteRegisterUnsigned(context, eRegisterKindGeneric, - LLDB_REGNUM_GENERIC_PC, target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_PC, target); } // As a side effect, BXWritePC sets context.arg2 to eModeARM or eModeThumb by @@ -14191,11 +14152,8 @@ bool EmulateInstructionARM::BXWritePC(Context &context, uint32_t addr) { LLDB_REGNUM_GENERIC_FLAGS, m_new_inst_cpsr)) return false; } - if (!WriteRegisterUnsigned(context, eRegisterKindGeneric, - LLDB_REGNUM_GENERIC_PC, target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_PC, target); } // Dispatches to either BXWritePC or BranchWritePC based on architecture @@ -14408,14 +14366,14 @@ bool EmulateInstructionARM::EvaluateInstruction(uint32_t evaluate_options) { evaluate_options & eEmulateInstructionOptionIgnoreConditions; bool success = false; - if (m_opcode_cpsr == 0 || m_ignore_conditions == false) { + if (m_opcode_cpsr == 0 || !m_ignore_conditions) { m_opcode_cpsr = ReadRegisterUnsigned(eRegisterKindDWARF, dwarf_cpsr, 0, &success); } // Only return false if we are unable to read the CPSR if we care about // conditions - if (success == false && m_ignore_conditions == false) + if (!success && !m_ignore_conditions) return false; uint32_t orig_pc_value = 0; diff --git a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp index bab24931197..661a651c56c 100644 --- a/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp +++ b/lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp @@ -436,7 +436,7 @@ bool EmulateInstructionARM64::EvaluateInstruction(uint32_t evaluate_options) { // Only return false if we are unable to read the CPSR if we care about // conditions - if (success == false && m_ignore_conditions == false) + if (!success && !m_ignore_conditions) return false; uint32_t orig_pc_value = 0; @@ -546,11 +546,8 @@ bool EmulateInstructionARM64::BranchTo(const Context &context, uint32_t N, } else return false; - if (!WriteRegisterUnsigned(context, eRegisterKindGeneric, - LLDB_REGNUM_GENERIC_PC, addr)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindGeneric, + LLDB_REGNUM_GENERIC_PC, addr); } bool EmulateInstructionARM64::ConditionHolds(const uint32_t cond) { @@ -1096,9 +1093,7 @@ bool EmulateInstructionARM64::EmulateB(const uint32_t opcode) { return false; } - if (!BranchTo(context, 64, target)) - return false; - return true; + return BranchTo(context, 64, target); } bool EmulateInstructionARM64::EmulateBcond(const uint32_t opcode) { diff --git a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp index 9b5cc704ce3..7fccb231102 100644 --- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -220,10 +220,8 @@ EmulateInstructionMIPS::CreateInstance(const ArchSpec &arch, } bool EmulateInstructionMIPS::SetTargetTriple(const ArchSpec &arch) { - if (arch.GetTriple().getArch() == llvm::Triple::mips || - arch.GetTriple().getArch() == llvm::Triple::mipsel) - return true; - return false; + return arch.GetTriple().getArch() == llvm::Triple::mips || + arch.GetTriple().getArch() == llvm::Triple::mipsel; } const char *EmulateInstructionMIPS::GetRegisterName(unsigned reg_num, @@ -1350,10 +1348,7 @@ bool EmulateInstructionMIPS::Emulate_LW(llvm::MCInst &insn) { context.type = eContextPopRegisterOffStack; context.SetAddress(address); - if (!WriteRegister(context, ®_info_src, data_src)) - return false; - - return true; + return WriteRegister(context, ®_info_src, data_src); } return false; @@ -1450,11 +1445,8 @@ bool EmulateInstructionMIPS::Emulate_LUI(llvm::MCInst &insn) { context.SetImmediateSigned(imm); context.type = eContextImmediate; - if (WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_zero_mips + rt, - imm)) - return true; - - return false; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, + dwarf_zero_mips + rt, imm); } bool EmulateInstructionMIPS::Emulate_ADDIUSP(llvm::MCInst &insn) { @@ -1697,10 +1689,7 @@ bool EmulateInstructionMIPS::Emulate_LWSP(llvm::MCInst &insn) { context.type = eContextPopRegisterOffStack; context.SetAddress(base_address); - if (!WriteRegister(context, ®_info_src, data_src)) - return false; - - return true; + return WriteRegister(context, ®_info_src, data_src); } return false; @@ -1807,11 +1796,8 @@ bool EmulateInstructionMIPS::Emulate_JRADDIUSP(llvm::MCInst &insn) { context.type = eContextAdjustStackPointer; // update SP - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_sp_mips, - result)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_sp_mips, + result); } static int IsAdd64bitOverflow(int32_t a, int32_t b) { @@ -1864,11 +1850,8 @@ bool EmulateInstructionMIPS::Emulate_BXX_3ops(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } /* @@ -1947,11 +1930,8 @@ bool EmulateInstructionMIPS::Emulate_BXX_3ops_C(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(current_inst_size + offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } /* @@ -2122,11 +2102,8 @@ bool EmulateInstructionMIPS::Emulate_BXX_2ops(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } /* @@ -2189,11 +2166,8 @@ bool EmulateInstructionMIPS::Emulate_BXX_2ops_C(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(current_inst_size + offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_B16_MM(llvm::MCInst &insn) { @@ -2214,11 +2188,8 @@ bool EmulateInstructionMIPS::Emulate_B16_MM(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(current_inst_size + offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } /* @@ -2529,11 +2500,8 @@ bool EmulateInstructionMIPS::Emulate_BC(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_J(llvm::MCInst &insn) { @@ -2556,10 +2524,7 @@ bool EmulateInstructionMIPS::Emulate_J(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, pc)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, pc); } bool EmulateInstructionMIPS::Emulate_JAL(llvm::MCInst &insn) { @@ -2688,11 +2653,8 @@ bool EmulateInstructionMIPS::Emulate_JIC(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_JR(llvm::MCInst &insn) { @@ -2713,11 +2675,8 @@ bool EmulateInstructionMIPS::Emulate_JR(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - rs_val)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + rs_val); } /* @@ -2758,11 +2717,8 @@ bool EmulateInstructionMIPS::Emulate_FP_branch(llvm::MCInst &insn) { } Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_BC1EQZ(llvm::MCInst &insn) { @@ -2797,11 +2753,8 @@ bool EmulateInstructionMIPS::Emulate_BC1EQZ(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_BC1NEZ(llvm::MCInst &insn) { @@ -2836,11 +2789,8 @@ bool EmulateInstructionMIPS::Emulate_BC1NEZ(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } /* @@ -2898,11 +2848,8 @@ bool EmulateInstructionMIPS::Emulate_3D_branch(llvm::MCInst &insn) { } Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_BNZB(llvm::MCInst &insn) { @@ -2993,11 +2940,8 @@ bool EmulateInstructionMIPS::Emulate_MSA_Branch_DF(llvm::MCInst &insn, Context context; context.type = eContextRelativeBranchImmediate; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_BNZV(llvm::MCInst &insn) { @@ -3039,11 +2983,8 @@ bool EmulateInstructionMIPS::Emulate_MSA_Branch_V(llvm::MCInst &insn, Context context; context.type = eContextRelativeBranchImmediate; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips, + target); } bool EmulateInstructionMIPS::Emulate_LDST_Imm(llvm::MCInst &insn) { diff --git a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp index cbf3e7dfca4..9d178dd97dd 100644 --- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp @@ -207,10 +207,8 @@ EmulateInstructionMIPS64::CreateInstance(const ArchSpec &arch, } bool EmulateInstructionMIPS64::SetTargetTriple(const ArchSpec &arch) { - if (arch.GetTriple().getArch() == llvm::Triple::mips64 || - arch.GetTriple().getArch() == llvm::Triple::mips64el) - return true; - return false; + return arch.GetTriple().getArch() == llvm::Triple::mips64 || + arch.GetTriple().getArch() == llvm::Triple::mips64el; } const char *EmulateInstructionMIPS64::GetRegisterName(unsigned reg_num, @@ -1240,10 +1238,7 @@ bool EmulateInstructionMIPS64::Emulate_LD(llvm::MCInst &insn) { Context context; context.type = eContextRegisterLoad; - if (!WriteRegister(context, ®_info_src, data_src)) - return false; - - return true; + return WriteRegister(context, ®_info_src, data_src); } return false; @@ -1262,11 +1257,8 @@ bool EmulateInstructionMIPS64::Emulate_LUI(llvm::MCInst &insn) { context.SetImmediateSigned(imm); context.type = eContextImmediate; - if (WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_zero_mips64 + rt, - imm)) - return true; - - return false; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, + dwarf_zero_mips64 + rt, imm); } bool EmulateInstructionMIPS64::Emulate_DSUBU_DADDU(llvm::MCInst &insn) { @@ -1394,11 +1386,8 @@ bool EmulateInstructionMIPS64::Emulate_BXX_3ops(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } /* @@ -1633,11 +1622,8 @@ bool EmulateInstructionMIPS64::Emulate_BXX_2ops(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_BC(llvm::MCInst &insn) { @@ -1659,11 +1645,8 @@ bool EmulateInstructionMIPS64::Emulate_BC(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } static int IsAdd64bitOverflow(int64_t a, int64_t b) { @@ -1747,11 +1730,8 @@ bool EmulateInstructionMIPS64::Emulate_BXX_3ops_C(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(current_inst_size + offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } /* @@ -1814,11 +1794,8 @@ bool EmulateInstructionMIPS64::Emulate_BXX_2ops_C(llvm::MCInst &insn) { context.type = eContextRelativeBranchImmediate; context.SetImmediate(current_inst_size + offset); - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_J(llvm::MCInst &insn) { @@ -1841,10 +1818,8 @@ bool EmulateInstructionMIPS64::Emulate_J(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, pc)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + pc); } bool EmulateInstructionMIPS64::Emulate_JAL(llvm::MCInst &insn) { @@ -1973,11 +1948,8 @@ bool EmulateInstructionMIPS64::Emulate_JIC(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_JR(llvm::MCInst &insn) { @@ -1998,11 +1970,8 @@ bool EmulateInstructionMIPS64::Emulate_JR(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - rs_val)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + rs_val); } /* @@ -2052,11 +2021,8 @@ bool EmulateInstructionMIPS64::Emulate_FP_branch(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_BC1EQZ(llvm::MCInst &insn) { @@ -2091,11 +2057,8 @@ bool EmulateInstructionMIPS64::Emulate_BC1EQZ(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_BC1NEZ(llvm::MCInst &insn) { @@ -2130,11 +2093,8 @@ bool EmulateInstructionMIPS64::Emulate_BC1NEZ(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } /* @@ -2193,11 +2153,8 @@ bool EmulateInstructionMIPS64::Emulate_3D_branch(llvm::MCInst &insn) { Context context; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_BNZB(llvm::MCInst &insn) { @@ -2288,11 +2245,8 @@ bool EmulateInstructionMIPS64::Emulate_MSA_Branch_DF(llvm::MCInst &insn, Context context; context.type = eContextRelativeBranchImmediate; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_BNZV(llvm::MCInst &insn) { @@ -2334,11 +2288,8 @@ bool EmulateInstructionMIPS64::Emulate_MSA_Branch_V(llvm::MCInst &insn, Context context; context.type = eContextRelativeBranchImmediate; - if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, - target)) - return false; - - return true; + return WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_pc_mips64, + target); } bool EmulateInstructionMIPS64::Emulate_LDST_Imm(llvm::MCInst &insn) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index d21456b6ab3..982b286d0f0 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -141,10 +141,7 @@ static bool IsTrivialBasename(const llvm::StringRef &basename) { } // We processed all characters. It is a vaild basename. - if (idx == basename.size()) - return true; - - return false; + return idx == basename.size(); } bool CPlusPlusLanguage::MethodName::TrySimplifiedParse() { diff --git a/lldb/source/Plugins/Language/ObjC/CF.cpp b/lldb/source/Plugins/Language/ObjC/CF.cpp index 9bb8eeab1d2..e3dab5a1442 100644 --- a/lldb/source/Plugins/Language/ObjC/CF.cpp +++ b/lldb/source/Plugins/Language/ObjC/CF.cpp @@ -149,7 +149,7 @@ bool lldb_private::formatters::CFBitVectorSummaryProvider( } } - if (is_type_ok == false) + if (!is_type_ok) return false; Status error; diff --git a/lldb/source/Plugins/Language/ObjC/NSException.cpp b/lldb/source/Plugins/Language/ObjC/NSException.cpp index bb0bcb94688..2404ef9d100 100644 --- a/lldb/source/Plugins/Language/ObjC/NSException.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSException.cpp @@ -144,11 +144,8 @@ public: m_userinfo_sp.reset(); m_reserved_sp.reset(); - if (!ExtractFields(m_backend, &m_name_sp, &m_reason_sp, &m_userinfo_sp, - &m_reserved_sp)) { - return false; - } - return true; + return ExtractFields(m_backend, &m_name_sp, &m_reason_sp, &m_userinfo_sp, + &m_reserved_sp); } bool MightHaveChildren() override { return true; } diff --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp index dac70cd1c00..41df9abb3eb 100644 --- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -126,11 +126,7 @@ public: return false; } - bool MightHaveChildren() override { - if (m_impl.m_mode == Mode::Invalid) - return false; - return true; - } + bool MightHaveChildren() override { return m_impl.m_mode != Mode::Invalid; } size_t GetIndexOfChildWithName(const ConstString &name) override { const char *item_name = name.GetCString(); diff --git a/lldb/source/Plugins/Language/ObjC/NSString.cpp b/lldb/source/Plugins/Language/ObjC/NSString.cpp index 0b12edb53d7..f882b2adc26 100644 --- a/lldb/source/Plugins/Language/ObjC/NSString.cpp +++ b/lldb/source/Plugins/Language/ObjC/NSString.cpp @@ -225,10 +225,10 @@ bool lldb_private::formatters::NSStringSummaryProvider( options.SetStream(&stream); options.SetQuote('"'); options.SetSourceSize(explicit_length); - options.SetNeedsZeroTermination(has_explicit_length == false); + options.SetNeedsZeroTermination(!has_explicit_length); options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped); - options.SetBinaryZeroIsTerminator(has_explicit_length == false); + options.SetBinaryZeroIsTerminator(!has_explicit_length); options.SetLanguage(summary_options.GetLanguage()); return StringPrinter::ReadStringAndDumpToStream< StringPrinter::StringElementType::UTF16>(options); @@ -245,10 +245,10 @@ bool lldb_private::formatters::NSStringSummaryProvider( options.SetStream(&stream); options.SetQuote('"'); options.SetSourceSize(explicit_length); - options.SetNeedsZeroTermination(has_explicit_length == false); + options.SetNeedsZeroTermination(!has_explicit_length); options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped); - options.SetBinaryZeroIsTerminator(has_explicit_length == false); + options.SetBinaryZeroIsTerminator(!has_explicit_length); options.SetLanguage(summary_options.GetLanguage()); return StringPrinter::ReadStringAndDumpToStream< StringPrinter::StringElementType::UTF16>(options); @@ -260,10 +260,7 @@ bool lldb_private::formatters::NSStringSummaryProvider( Status error; explicit_length = process_sp->ReadUnsignedIntegerFromMemory(location, 1, 0, error); - if (error.Fail() || explicit_length == 0) - has_explicit_length = false; - else - has_explicit_length = true; + has_explicit_length = !(error.Fail() || explicit_length == 0); location++; } options.SetLocation(location); diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 062ae2818b5..3f9ae937b73 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -309,10 +309,7 @@ bool ItaniumABILanguageRuntime::IsVTableName(const char *name) { return false; // Can we maybe ask Clang about this? - if (strstr(name, "_vptr$") == name) - return true; - else - return false; + return strstr(name, "_vptr$") == name; } //------------------------------------------------------------------ diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index edb29e735ca..421c0040d13 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -264,11 +264,7 @@ bool ClassDescriptorV2::method_t::Read(Process *process, lldb::addr_t addr) { } process->ReadCStringFromMemory(m_types_ptr, m_types, error); - if (error.Fail()) { - return false; - } - - return true; + return !error.Fail(); } bool ClassDescriptorV2::ivar_list_t::Read(Process *process, lldb::addr_t addr) { @@ -323,11 +319,7 @@ bool ClassDescriptorV2::ivar_t::Read(Process *process, lldb::addr_t addr) { } process->ReadCStringFromMemory(m_type_ptr, m_type, error); - if (error.Fail()) { - return false; - } - - return true; + return !error.Fail(); } bool ClassDescriptorV2::Describe( diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index 74b17f539d9..f55a7e8dda4 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -441,13 +441,10 @@ bool AppleObjCRuntime::CalculateHasNewLiteralsAndIndexing() { SymbolContextList sc_list; - if (target.GetImages().FindSymbolsWithNameAndType(s_method_signature, - eSymbolTypeCode, sc_list) || - target.GetImages().FindSymbolsWithNameAndType(s_arclite_method_signature, - eSymbolTypeCode, sc_list)) - return true; - else - return false; + return target.GetImages().FindSymbolsWithNameAndType( + s_method_signature, eSymbolTypeCode, sc_list) || + target.GetImages().FindSymbolsWithNameAndType( + s_arclite_method_signature, eSymbolTypeCode, sc_list); } lldb::SearchFilterSP AppleObjCRuntime::CreateExceptionSearchFilter() { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp index aaecfb27e90..1cfc7a1a022 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -58,7 +58,7 @@ bool AppleObjCRuntimeV1::GetDynamicTypeAndAddress( class_type_or_name.SetName(class_descriptor->GetClassName()); } } - return class_type_or_name.IsEmpty() == false; + return !class_type_or_name.IsEmpty(); } //------------------------------------------------------------------ diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index bbe6dd8e8d1..d3228d69eac 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -454,7 +454,7 @@ bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress( } } } - return class_type_or_name.IsEmpty() == false; + return !class_type_or_name.IsEmpty(); } //------------------------------------------------------------------ @@ -1852,8 +1852,8 @@ void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() { // warn if: // - we could not run either expression // - we found fewer than num_classes_to_warn_at classes total - if ((false == shared_cache_update_result.m_update_ran) || - (false == dynamic_update_result.m_update_ran)) + if ((!shared_cache_update_result.m_update_ran) || + (!dynamic_update_result.m_update_ran)) WarnIfNoClassesCached( SharedCacheWarningReason::eExpressionExecutionFailure); else if (dynamic_update_result.m_num_found + @@ -2428,7 +2428,7 @@ AppleObjCRuntimeV2::NonPointerISACache::NonPointerISACache( ObjCLanguageRuntime::ClassDescriptorSP AppleObjCRuntimeV2::NonPointerISACache::GetClassDescriptor(ObjCISA isa) { ObjCISA real_isa = 0; - if (EvaluateNonPointerISA(isa, real_isa) == false) + if (!EvaluateNonPointerISA(isa, real_isa)) return ObjCLanguageRuntime::ClassDescriptorSP(); auto cache_iter = m_cache.find(real_isa); if (cache_iter != m_cache.end()) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp index 19d9676e8b0..2b54d0a542d 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp @@ -200,10 +200,7 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) { // The base class MischiefManaged does some cleanup - so you have to call it in // your MischiefManaged derived class. bool AppleThreadPlanStepThroughObjCTrampoline::MischiefManaged() { - if (IsPlanComplete()) - return true; - else - return false; + return IsPlanComplete(); } bool AppleThreadPlanStepThroughObjCTrampoline::WillStop() { return true; } diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index 95daadface6..fa775d9bfa9 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -2074,10 +2074,8 @@ bool RenderScriptRuntime::JITElementPacked(Element &elem, // If this Element has subelements then JIT rsaElementGetSubElements() for // details about its fields - if (*elem.field_count.get() > 0 && !JITSubelements(elem, context, frame_ptr)) - return false; - - return true; + return !(*elem.field_count.get() > 0 && + !JITSubelements(elem, context, frame_ptr)); } // JITs the RS runtime for information about the subelements/fields of a struct @@ -2300,10 +2298,7 @@ bool RenderScriptRuntime::RefreshAllocation(AllocationDetails *alloc, SetElementSize(alloc->element); // Use GetOffsetPointer() to infer size of the allocation - if (!JITAllocationSize(alloc, frame_ptr)) - return false; - - return true; + return JITAllocationSize(alloc, frame_ptr); } // Function attempts to set the type_name member of the paramaterised Element diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index ae7409352c5..391ab754696 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -207,7 +207,7 @@ ObjectContainerBSDArchive::Archive::FindCachedArchive( while (pos != archive_map.end() && pos->first == file) { bool match = true; if (arch.IsValid() && - pos->second->GetArchitecture().IsCompatibleMatch(arch) == false) + !pos->second->GetArchitecture().IsCompatibleMatch(arch)) match = false; else if (file_offset != LLDB_INVALID_OFFSET && pos->second->GetFileOffset() != file_offset) diff --git a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp index 16cbb6e5753..3d4735286bf 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp @@ -38,7 +38,7 @@ static bool GetMaxU64(const lldb_private::DataExtractor &data, lldb::offset_t saved_offset = *offset; for (uint32_t i = 0; i < count; ++i, ++value) { - if (GetMaxU64(data, offset, value, byte_size) == false) { + if (!GetMaxU64(data, offset, value, byte_size)) { *offset = saved_offset; return false; } @@ -60,7 +60,7 @@ static bool GetMaxS64(const lldb_private::DataExtractor &data, lldb::offset_t saved_offset = *offset; for (uint32_t i = 0; i < count; ++i, ++value) { - if (GetMaxS64(data, offset, value, byte_size) == false) { + if (!GetMaxS64(data, offset, value, byte_size)) { *offset = saved_offset; return false; } @@ -133,7 +133,7 @@ bool ELFHeader::Parse(lldb_private::DataExtractor &data, return false; // Read e_entry, e_phoff and e_shoff. - if (GetMaxU64(data, offset, &e_entry, byte_size, 3) == false) + if (!GetMaxU64(data, offset, &e_entry, byte_size, 3)) return false; // Read e_flags. @@ -232,11 +232,11 @@ bool ELFSectionHeader::Parse(const lldb_private::DataExtractor &data, return false; // Read sh_flags. - if (GetMaxU64(data, offset, &sh_flags, byte_size) == false) + if (!GetMaxU64(data, offset, &sh_flags, byte_size)) return false; // Read sh_addr, sh_off and sh_size. - if (GetMaxU64(data, offset, &sh_addr, byte_size, 3) == false) + if (!GetMaxU64(data, offset, &sh_addr, byte_size, 3)) return false; // Read sh_link and sh_info. @@ -244,7 +244,7 @@ bool ELFSectionHeader::Parse(const lldb_private::DataExtractor &data, return false; // Read sh_addralign and sh_entsize. - if (GetMaxU64(data, offset, &sh_addralign, byte_size, 2) == false) + if (!GetMaxU64(data, offset, &sh_addralign, byte_size, 2)) return false; return true; @@ -332,7 +332,7 @@ bool ELFSymbol::Parse(const lldb_private::DataExtractor &data, if (parsing_32) { // Read st_value and st_size. - if (GetMaxU64(data, offset, &st_value, byte_size, 2) == false) + if (!GetMaxU64(data, offset, &st_value, byte_size, 2)) return false; // Read st_info and st_other. @@ -376,7 +376,7 @@ bool ELFProgramHeader::Parse(const lldb_private::DataExtractor &data, if (parsing_32) { // Read p_offset, p_vaddr, p_paddr, p_filesz and p_memsz. - if (GetMaxU64(data, offset, &p_offset, byte_size, 5) == false) + if (!GetMaxU64(data, offset, &p_offset, byte_size, 5)) return false; // Read p_flags. @@ -384,7 +384,7 @@ bool ELFProgramHeader::Parse(const lldb_private::DataExtractor &data, return false; // Read p_align. - if (GetMaxU64(data, offset, &p_align, byte_size) == false) + if (!GetMaxU64(data, offset, &p_align, byte_size)) return false; } else { // Read p_flags. @@ -392,7 +392,7 @@ bool ELFProgramHeader::Parse(const lldb_private::DataExtractor &data, return false; // Read p_offset, p_vaddr, p_paddr, p_filesz, p_memsz and p_align. - if (GetMaxU64(data, offset, &p_offset, byte_size, 6) == false) + if (!GetMaxU64(data, offset, &p_offset, byte_size, 6)) return false; } @@ -420,10 +420,7 @@ bool ELFRel::Parse(const lldb_private::DataExtractor &data, const unsigned byte_size = data.GetAddressByteSize(); // Read r_offset and r_info. - if (GetMaxU64(data, offset, &r_offset, byte_size, 2) == false) - return false; - - return true; + return GetMaxU64(data, offset, &r_offset, byte_size, 2) != false; } //------------------------------------------------------------------------------ @@ -436,11 +433,11 @@ bool ELFRela::Parse(const lldb_private::DataExtractor &data, const unsigned byte_size = data.GetAddressByteSize(); // Read r_offset and r_info. - if (GetMaxU64(data, offset, &r_offset, byte_size, 2) == false) + if (!GetMaxU64(data, offset, &r_offset, byte_size, 2)) return false; // Read r_addend; - if (GetMaxS64(data, offset, &r_addend, byte_size) == false) + if (!GetMaxS64(data, offset, &r_addend, byte_size)) return false; return true; diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 77ae9731ea8..e294bd470a6 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1140,7 +1140,7 @@ size_t ObjectFileELF::GetProgramHeaderInfo(ProgramHeaderColl &program_headers, uint32_t idx; lldb::offset_t offset; for (idx = 0, offset = 0; idx < header.e_phnum; ++idx) { - if (program_headers[idx].Parse(data, &offset) == false) + if (!program_headers[idx].Parse(data, &offset)) break; } @@ -1552,7 +1552,7 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers, uint32_t idx; lldb::offset_t offset; for (idx = 0, offset = 0; idx < header.e_shnum; ++idx) { - if (section_headers[idx].Parse(sh_data, &offset) == false) + if (!section_headers[idx].Parse(sh_data, &offset)) break; } if (idx < section_headers.size()) @@ -1953,7 +1953,7 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, user_id_t start_id, unsigned i; for (i = 0; i < num_symbols; ++i) { - if (symbol.Parse(symtab_data, &offset) == false) + if (!symbol.Parse(symtab_data, &offset)) break; const char *symbol_name = strtab_data.PeekCStr(symbol.st_name); @@ -2419,7 +2419,7 @@ static unsigned ParsePLTRelocations( unsigned slot_type = hdr->GetRelocationJumpSlotType(); unsigned i; for (i = 0; i < num_relocations; ++i) { - if (rel.Parse(rel_data, &offset) == false) + if (!rel.Parse(rel_data, &offset)) break; if (reloc_type(rel) != slot_type) @@ -2552,7 +2552,7 @@ unsigned ObjectFileELF::ApplyRelocations( } for (unsigned i = 0; i < num_relocations; ++i) { - if (rel.Parse(rel_data, &offset) == false) + if (!rel.Parse(rel_data, &offset)) break; Symbol *symbol = NULL; diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp index 53eb820746e..bce35224550 100644 --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -218,7 +218,7 @@ bool ObjectFileJIT::SetLoadAddress(Target &target, lldb::addr_t value, // that size on disk (to avoid __PAGEZERO) and load them SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx)); if (section_sp && section_sp->GetFileSize() > 0 && - section_sp->IsThreadSpecific() == false) { + !section_sp->IsThreadSpecific()) { if (target.GetSectionLoadList().SetSectionLoadAddress( section_sp, section_sp->GetFileAddress() + value)) ++num_loaded_sections; diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index e6b9c520dd1..c7a790ebd09 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -4469,7 +4469,7 @@ size_t ObjectFileMachO::ParseSymtab() { symbol_value -= section_file_addr; } - if (is_debug == false) { + if (!is_debug) { if (type == eSymbolTypeCode) { // See if we can find a N_FUN entry for any code symbols. If we // do find a match, and the name matches, then we can merge the @@ -4616,7 +4616,7 @@ size_t ObjectFileMachO::ParseSymtab() { if (function_starts_count > 0) { uint32_t num_synthetic_function_symbols = 0; for (i = 0; i < function_starts_count; ++i) { - if (function_starts.GetEntryRef(i).data == false) + if (!function_starts.GetEntryRef(i).data) ++num_synthetic_function_symbols; } @@ -4628,7 +4628,7 @@ size_t ObjectFileMachO::ParseSymtab() { for (i = 0; i < function_starts_count; ++i) { const FunctionStarts::Entry *func_start_entry = function_starts.GetEntryAtIndex(i); - if (func_start_entry->data == false) { + if (!func_start_entry->data) { addr_t symbol_file_addr = func_start_entry->addr; uint32_t symbol_flags = 0; if (is_arm) { @@ -5861,7 +5861,7 @@ uint32_t ObjectFileMachO::GetSDKVersion(uint32_t *versions, if (m_sdk_versions.empty()) { lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic); bool success = false; - for (uint32_t i = 0; success == false && i < m_header.ncmds; ++i) { + for (uint32_t i = 0; !success && i < m_header.ncmds; ++i) { const lldb::offset_t load_cmd_offset = offset; version_min_command lc; @@ -5890,47 +5890,46 @@ uint32_t ObjectFileMachO::GetSDKVersion(uint32_t *versions, offset = load_cmd_offset + lc.cmdsize; } - if (success == false) - { - offset = MachHeaderSizeFromMagic(m_header.magic); - for (uint32_t i = 0; success == false && i < m_header.ncmds; ++i) - { - const lldb::offset_t load_cmd_offset = offset; + if (!success) { + offset = MachHeaderSizeFromMagic(m_header.magic); + for (uint32_t i = 0; !success && i < m_header.ncmds; ++i) { + const lldb::offset_t load_cmd_offset = offset; - version_min_command lc; - if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) - break; - if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) - { - // struct build_version_command { - // uint32_t cmd; /* LC_BUILD_VERSION */ - // uint32_t cmdsize; /* sizeof(struct build_version_command) plus */ - // /* ntools * sizeof(struct build_tool_version) */ - // uint32_t platform; /* platform */ - // uint32_t minos; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ - // uint32_t sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ - // uint32_t ntools; /* number of tool entries following this */ - // }; - - offset += 4; // skip platform - uint32_t minos = m_data.GetU32(&offset); - - const uint32_t xxxx = minos >> 16; - const uint32_t yy = (minos >> 8) & 0xffu; - const uint32_t zz = minos & 0xffu; - if (xxxx) - { - m_sdk_versions.push_back (xxxx); - m_sdk_versions.push_back (yy); - m_sdk_versions.push_back (zz); - success = true; - } - } - offset = load_cmd_offset + lc.cmdsize; + version_min_command lc; + if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) + break; + if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) { + // struct build_version_command { + // uint32_t cmd; /* LC_BUILD_VERSION */ + // uint32_t cmdsize; /* sizeof(struct + // build_version_command) plus */ + // /* ntools * sizeof(struct + // build_tool_version) */ + // uint32_t platform; /* platform */ + // uint32_t minos; /* X.Y.Z is encoded in nibbles + // xxxx.yy.zz */ uint32_t sdk; /* X.Y.Z is encoded + // in nibbles xxxx.yy.zz */ uint32_t ntools; /* number + // of tool entries following this */ + // }; + + offset += 4; // skip platform + uint32_t minos = m_data.GetU32(&offset); + + const uint32_t xxxx = minos >> 16; + const uint32_t yy = (minos >> 8) & 0xffu; + const uint32_t zz = minos & 0xffu; + if (xxxx) { + m_sdk_versions.push_back(xxxx); + m_sdk_versions.push_back(yy); + m_sdk_versions.push_back(zz); + success = true; + } } + offset = load_cmd_offset + lc.cmdsize; + } } - if (success == false) { + if (!success) { // Push an invalid value so we don't try to find // the version # again on the next call to this // method. @@ -5991,8 +5990,7 @@ Section *ObjectFileMachO::GetMachHeaderSection() { ++sect_idx) { Section *section = section_list->GetSectionAtIndex(sect_idx).get(); if (section && section->GetFileSize() > 0 && - section->GetFileOffset() == 0 && - section->IsThreadSpecific() == false && + section->GetFileOffset() == 0 && !section->IsThreadSpecific() && module_sp.get() == section->GetModule().get()) { return section; } @@ -6011,7 +6009,7 @@ lldb::addr_t ObjectFileMachO::CalculateSectionLoadAddressForMemoryImage( lldb::addr_t mach_header_file_addr = mach_header_section->GetFileAddress(); if (mach_header_file_addr != LLDB_INVALID_ADDRESS) { if (section && section->GetFileSize() > 0 && - section->IsThreadSpecific() == false && + !section->IsThreadSpecific() && module_sp.get() == section->GetModule().get()) { // Ignore __LINKEDIT and __DWARF segments if (section->GetName() == GetSegmentNameLINKEDIT()) { @@ -6019,7 +6017,7 @@ lldb::addr_t ObjectFileMachO::CalculateSectionLoadAddressForMemoryImage( // kernel binary like a kext or mach_kernel. const bool is_memory_image = (bool)m_process_wp.lock(); const Strata strata = GetStrata(); - if (is_memory_image == false || strata == eStrataKernel) + if (!is_memory_image || strata == eStrataKernel) return LLDB_INVALID_ADDRESS; } return section->GetFileAddress() - mach_header_file_addr + @@ -6046,7 +6044,7 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value, // sections that size on disk (to avoid __PAGEZERO) and load them SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx)); if (section_sp && section_sp->GetFileSize() > 0 && - section_sp->IsThreadSpecific() == false && + !section_sp->IsThreadSpecific() && module_sp.get() == section_sp->GetModule().get()) { // Ignore __LINKEDIT and __DWARF segments if (section_sp->GetName() == GetSegmentNameLINKEDIT()) { @@ -6054,7 +6052,7 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value, // isn't a kernel binary like a kext or mach_kernel. const bool is_memory_image = (bool)m_process_wp.lock(); const Strata strata = GetStrata(); - if (is_memory_image == false || strata == eStrataKernel) + if (!is_memory_image || strata == eStrataKernel) continue; } if (target.GetSectionLoadList().SetSectionLoadAddress( diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 12d9a673e03..abdec6550e5 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -527,7 +527,7 @@ bool ObjectFilePECOFF::ParseSectionHeaders( } } - return m_sect_headers.empty() == false; + return !m_sect_headers.empty(); } bool ObjectFilePECOFF::GetSectionName(std::string §_name, diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 8247e33e0c1..89a0f225393 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -213,7 +213,7 @@ bool OperatingSystemPython::UpdateThreadList(ThreadList &old_thread_list, // beginning of the list uint32_t insert_idx = 0; for (uint32_t core_idx = 0; core_idx < num_cores; ++core_idx) { - if (core_used_map[core_idx] == false) { + if (!core_used_map[core_idx]) { new_thread_list.InsertThread( core_thread_list.GetThreadAtIndex(core_idx, false), insert_idx); ++insert_idx; diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index 5925dd00676..a56ab0e3015 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -74,7 +74,7 @@ PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) { } bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getVendor()) { case llvm::Triple::PC: diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index f1bbfb0c7be..59cce3a6bc2 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -48,7 +48,7 @@ PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) { arch ? arch->GetTriple().getTriple() : "<null>"); bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getOS()) { case llvm::Triple::FreeBSD: diff --git a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp index 27af40fe3b4..cc902b7f7ad 100644 --- a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp +++ b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp @@ -30,7 +30,7 @@ static uint32_t g_initialize_count = 0; PlatformSP PlatformKalimba::CreateInstance(bool force, const ArchSpec *arch) { bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getVendor()) { case llvm::Triple::CSR: diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index 6a7339bce4c..3ce4b208498 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -46,7 +46,7 @@ PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) { arch ? arch->GetTriple().getTriple() : "<null>"); bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getOS()) { case llvm::Triple::Linux: diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp index 60ffb68d10d..26a22a0a19f 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp @@ -76,7 +76,7 @@ PlatformSP PlatformAppleTVSimulator::CreateInstance(bool force, } bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { switch (arch->GetMachine()) { case llvm::Triple::x86_64: { const llvm::Triple &triple = arch->GetTriple(); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp index e211050cf78..23eee15f730 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp @@ -75,7 +75,7 @@ PlatformSP PlatformAppleWatchSimulator::CreateInstance(bool force, } bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { switch (arch->GetMachine()) { case llvm::Triple::x86_64: { const llvm::Triple &triple = arch->GetTriple(); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 30b035d444e..3868d97700e 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -489,10 +489,7 @@ bool PlatformDarwin::ModuleIsExcludedForUnconstrainedSearches( return false; ObjectFile::Type obj_type = obj_file->GetType(); - if (obj_type == ObjectFile::eTypeDynamicLinker) - return true; - else - return false; + return obj_type == ObjectFile::eTypeDynamicLinker; } bool PlatformDarwin::x86GetSupportedArchitectureAtIndex(uint32_t idx, diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index 241f8d5ecc0..33078585002 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -91,7 +91,7 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force, // ArchSpec for normal userland debugging. It is only useful in kernel debug // sessions and the DynamicLoaderDarwinPlugin (or a user doing 'platform // select') will force the creation of this Platform plugin. - if (force == false) { + if (!force) { if (log) log->Printf("PlatformDarwinKernel::%s() aborting creation of platform " "because force == false", @@ -102,7 +102,7 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force, bool create = force; LazyBool is_ios_debug_session = eLazyBoolCalculate; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getVendor()) { case llvm::Triple::Apple: @@ -640,10 +640,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling( shallow_bundle_str += ".dSYM"; dsym_fspec.SetFile(shallow_bundle_str, FileSpec::Style::native); FileSystem::Instance().Resolve(dsym_fspec); - if (FileSystem::Instance().IsDirectory(dsym_fspec)) { - return true; - } - return false; + return FileSystem::Instance().IsDirectory(dsym_fspec); } // Given a FileSpec of /dir/dir/mach.development.t7004 Return true if a dSYM @@ -654,10 +651,7 @@ bool PlatformDarwinKernel::KernelHasdSYMSibling(const FileSpec &kernel_binary) { std::string filename = kernel_binary.GetFilename().AsCString(); filename += ".dSYM"; kernel_dsym.GetFilename() = ConstString(filename); - if (FileSystem::Instance().IsDirectory(kernel_dsym)) { - return true; - } - return false; + return FileSystem::Instance().IsDirectory(kernel_dsym); } Status PlatformDarwinKernel::GetSharedModule( diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 530be63db55..4e18b90f5d5 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -80,7 +80,7 @@ PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch) { const bool is_host = false; bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getVendor()) { case llvm::Triple::Apple: diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index aa4da1e9e5b..d14bd89e48a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -71,7 +71,7 @@ PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) { } bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { switch (arch->GetMachine()) { case llvm::Triple::arm: case llvm::Triple::aarch64: diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index 0d9d3d0bde4..9d1e5f43379 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -76,7 +76,7 @@ PlatformSP PlatformiOSSimulator::CreateInstance(bool force, } bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { switch (arch->GetMachine()) { case llvm::Triple::x86_64: case llvm::Triple::x86: { diff --git a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm index 8964906f3a3..a601e27dc8a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm @@ -591,7 +591,7 @@ void CoreSimulatorSupport::DeviceSet::ForEach( std::function<bool(const Device &)> f) { const size_t n = GetNumDevices(); for (NSUInteger i = 0; i < n; ++i) { - if (f(GetDeviceAtIndex(i)) == false) + if (!f(GetDeviceAtIndex(i))) break; } } diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp index b2fcedeaab6..eea0887e9c8 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -46,7 +46,7 @@ PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) { arch ? arch->GetTriple().getTriple() : "<null>"); bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getOS()) { case llvm::Triple::NetBSD: diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp index e9843451183..7358acb61f7 100644 --- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp +++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp @@ -46,7 +46,7 @@ PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch) { arch ? arch->GetTriple().getTriple() : "<null>"); bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getOS()) { case llvm::Triple::OpenBSD: diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp index 26eca5dc495..9d49486d488 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -67,7 +67,7 @@ PlatformSP PlatformWindows::CreateInstance(bool force, const bool is_host = false; bool create = force; - if (create == false && arch && arch->IsValid()) { + if (!create && arch && arch->IsValid()) { const llvm::Triple &triple = arch->GetTriple(); switch (triple.getVendor()) { case llvm::Triple::PC: diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 9e7a8a36257..7187b94a69a 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -40,7 +40,7 @@ static bool g_initialized = false; void PlatformRemoteGDBServer::Initialize() { Platform::Initialize(); - if (g_initialized == false) { + if (!g_initialized) { g_initialized = true; PluginManager::RegisterPlugin( PlatformRemoteGDBServer::GetPluginNameStatic(), diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp index 7b22bec666e..8908108eff4 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp @@ -463,19 +463,13 @@ lldb_private::UUID CommunicationKDP::GetUUID() { bool CommunicationKDP::RemoteIsEFI() { if (GetKernelVersion() == NULL) return false; - if (strncmp(m_kernel_version.c_str(), "EFI", 3) == 0) - return true; - else - return false; + return strncmp(m_kernel_version.c_str(), "EFI", 3) == 0; } bool CommunicationKDP::RemoteIsDarwinKernel() { if (GetKernelVersion() == NULL) return false; - if (m_kernel_version.find("Darwin Kernel") != std::string::npos) - return true; - else - return false; + return m_kernel_version.find("Darwin Kernel") != std::string::npos; } lldb::addr_t CommunicationKDP::GetLoadAddress() { @@ -1258,9 +1252,7 @@ bool CommunicationKDP::SendRequestResume() { request_packet.PutHex32(GetCPUMask()); DataExtractor reply_packet; - if (SendRequestAndGetReply(command, request_packet, reply_packet)) - return true; - return false; + return SendRequestAndGetReply(command, request_packet, reply_packet); } bool CommunicationKDP::SendRequestBreakpoint(bool set, addr_t addr) { @@ -1293,7 +1285,5 @@ bool CommunicationKDP::SendRequestSuspend() { const uint32_t command_length = 8; MakeRequestPacketHeader(command, request_packet, command_length); DataExtractor reply_packet; - if (SendRequestAndGetReply(command, request_packet, reply_packet)) - return true; - return false; + return SendRequestAndGetReply(command, request_packet, reply_packet); } diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp index 6de7e885ea5..9ad896abd0b 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp @@ -1670,7 +1670,7 @@ uint32_t RegisterContextDarwin_arm::SetHardwareWatchpoint(lldb::addr_t addr, return LLDB_INVALID_INDEX32; // We must watch for either read or write - if (read == false && write == false) + if (!read && !write) return LLDB_INVALID_INDEX32; // Can't watch more than 4 bytes per WVR/WCR pair diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp index ff8a787a11f..b478645e035 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp @@ -956,7 +956,7 @@ uint32_t RegisterContextDarwin_arm64::SetHardwareWatchpoint(lldb::addr_t addr, return LLDB_INVALID_INDEX32; // We must watch for either read or write - if (read == false && write == false) + if (!read && !write) return LLDB_INVALID_INDEX32; // Can't watch more than 4 bytes per WVR/WCR pair diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 3a1f2fb37b7..8c420a87e1b 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -324,7 +324,7 @@ void RegisterContextLLDB::InitializeNonZerothFrame() { above_trap_handler = true; if (pc == 0 || pc == 0x1) { - if (above_trap_handler == false) { + if (!above_trap_handler) { m_frame_type = eNotAValidFrame; UnwindLogMsg("this frame has a pc of 0x0"); return; @@ -474,7 +474,7 @@ void RegisterContextLLDB::InitializeNonZerothFrame() { bool decr_pc_and_recompute_addr_range = false; // If the symbol lookup failed... - if (m_sym_ctx_valid == false) + if (!m_sym_ctx_valid) decr_pc_and_recompute_addr_range = true; // Or if we're in the middle of the stack (and not "above" an asynchronous @@ -1250,7 +1250,7 @@ RegisterContextLLDB::SavedLocationForRegister( // Address register and it hasn't been saved anywhere yet -- that is, // it's still live in the actual register. Handle this specially. - if (have_unwindplan_regloc == false && return_address_reg.IsValid() && + if (!have_unwindplan_regloc && return_address_reg.IsValid() && IsFrameZero()) { if (return_address_reg.GetAsKind(eRegisterKindLLDB) != LLDB_INVALID_REGNUM) { @@ -1329,11 +1329,7 @@ RegisterContextLLDB::SavedLocationForRegister( } } - if (can_fetch_pc_value && can_fetch_cfa) { - have_unwindplan_regloc = true; - } else { - have_unwindplan_regloc = false; - } + have_unwindplan_regloc = can_fetch_pc_value && can_fetch_cfa; } else { // We were unable to fall back to another unwind plan have_unwindplan_regloc = false; @@ -1344,7 +1340,7 @@ RegisterContextLLDB::SavedLocationForRegister( ExecutionContext exe_ctx(m_thread.shared_from_this()); Process *process = exe_ctx.GetProcessPtr(); - if (have_unwindplan_regloc == false) { + if (!have_unwindplan_regloc) { // If the UnwindPlan failed to give us an unwind location for this // register, we may be able to fall back to some ABI-defined default. For // example, some ABIs allow to determine the caller's SP via the CFA. Also, @@ -1363,7 +1359,7 @@ RegisterContextLLDB::SavedLocationForRegister( } } - if (have_unwindplan_regloc == false) { + if (!have_unwindplan_regloc) { if (IsFrameZero()) { // This is frame 0 - we should return the actual live register context // value @@ -1409,7 +1405,7 @@ RegisterContextLLDB::SavedLocationForRegister( } if (unwindplan_regloc.IsSame()) { - if (IsFrameZero() == false && + if (!IsFrameZero() && (regnum.GetAsKind(eRegisterKindGeneric) == LLDB_REGNUM_GENERIC_PC || regnum.GetAsKind(eRegisterKindGeneric) == LLDB_REGNUM_GENERIC_RA)) { UnwindLogMsg("register %s (%d) is marked as 'IsSame' - it is a pc or " @@ -2051,12 +2047,8 @@ bool RegisterContextLLDB::ReadPC(addr_t &pc) { pc = abi->FixCodeAddress(pc); } - if (m_all_registers_available == false && above_trap_handler == false && - (pc == 0 || pc == 1)) { - return false; - } - - return true; + return !(m_all_registers_available == false && + above_trap_handler == false && (pc == 0 || pc == 1)); } else { return false; } diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp index b846b447809..78f561a0f04 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp @@ -376,7 +376,7 @@ RegisterContextPOSIX_x86::FPRType RegisterContextPOSIX_x86::GetFPRType() { if (m_fpr_type == eNotValid) { // TODO: Use assembly to call cpuid on the inferior and query ebx or ecx m_fpr_type = eXSAVE; // extended floating-point registers, if available - if (false == ReadFPR()) + if (!ReadFPR()) m_fpr_type = eFXSAVE; // assume generic floating-point registers } return m_fpr_type; diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp index 49c06fea78a..b34c87230bd 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -212,15 +212,15 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneMoreFrame(ABI *abi) { // On Mac OS X, the _sigtramp asynchronous signal trampoline frame may not // have its (constructed) CFA aligned correctly -- don't do the abi // alignment check for these. - if (reg_ctx_sp->IsTrapHandlerFrame() == false) { + if (!reg_ctx_sp->IsTrapHandlerFrame()) { // See if we can find a fallback unwind plan for THIS frame. It may be // that the UnwindPlan we're using for THIS frame was bad and gave us a // bad CFA. If that's not it, then see if we can change the UnwindPlan // for the frame below us ("NEXT") -- see if using that other UnwindPlan // gets us a better unwind state. - if (reg_ctx_sp->TryFallbackUnwindPlan() == false || - reg_ctx_sp->GetCFA(cursor_sp->cfa) == false || - abi->CallFrameAddressIsValid(cursor_sp->cfa) == false) { + if (!reg_ctx_sp->TryFallbackUnwindPlan() || + !reg_ctx_sp->GetCFA(cursor_sp->cfa) || + !abi->CallFrameAddressIsValid(cursor_sp->cfa)) { if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) { // TryFallbackUnwindPlan for prev_frame succeeded and updated // reg_ctx_lldb_sp field of prev_frame. However, cfa field of @@ -385,10 +385,8 @@ bool UnwindLLDB::AddOneMoreFrame(ABI *abi) { // Cursor::m_frames[m_frames.size() - 2], reg_ctx_lldb_sp field was already // updated during TryFallbackUnwindPlan call above. However, cfa field // still needs to be updated. Hence updating it here and then returning. - if (!(m_frames[m_frames.size() - 2]->reg_ctx_lldb_sp->GetCFA( - m_frames[m_frames.size() - 2]->cfa))) - return false; - return true; + return m_frames[m_frames.size() - 2]->reg_ctx_lldb_sp->GetCFA( + m_frames[m_frames.size() - 2]->cfa); } // The new frame hasn't helped in unwinding. Fall back to the original one as @@ -470,10 +468,7 @@ bool UnwindLLDB::SearchForSavedLocationForRegister( UnwindLLDB::RegisterSearchResult result; result = m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister( lldb_regnum, regloc); - if (result == UnwindLLDB::RegisterSearchResult::eRegisterFound) - return true; - else - return false; + return result == UnwindLLDB::RegisterSearchResult::eRegisterFound; } while (frame_num >= 0) { UnwindLLDB::RegisterSearchResult result; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp index 4e20b56fb11..a3a4aa05326 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp @@ -379,7 +379,7 @@ void GDBRemoteClientBase::Lock::SyncWithContinueThread(bool interrupt) { log->PutCString("GDBRemoteClientBase::Lock::Lock sent packet: \\x03"); m_comm.m_interrupt_time = steady_clock::now(); } - m_comm.m_cv.wait(lock, [this] { return m_comm.m_is_running == false; }); + m_comm.m_cv.wait(lock, [this] { return !m_comm.m_is_running; }); m_did_interrupt = true; } m_acquired = true; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 1e0db84c5c2..4605bd2e90e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -656,7 +656,7 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, size_t src_len, // Size of packet before it is decompressed, for logging purposes size_t original_packet_size = m_bytes.size(); if (CompressionIsEnabled()) { - if (DecompressPacket() == false) { + if (!DecompressPacket()) { packet.Clear(); return GDBRemoteCommunication::PacketType::Standard; } diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 1b14e8cb7af..92bde0323a9 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -252,10 +252,7 @@ bool GDBRemoteCommunicationClient::GetVAttachOrWaitSupported() { m_attach_or_wait_reply = eLazyBoolYes; } } - if (m_attach_or_wait_reply == eLazyBoolYes) - return true; - else - return false; + return m_attach_or_wait_reply == eLazyBoolYes; } bool GDBRemoteCommunicationClient::GetSyncThreadStateSupported() { @@ -269,14 +266,11 @@ bool GDBRemoteCommunicationClient::GetSyncThreadStateSupported() { m_prepare_for_reg_writing_reply = eLazyBoolYes; } } - if (m_prepare_for_reg_writing_reply == eLazyBoolYes) - return true; - else - return false; + return m_prepare_for_reg_writing_reply == eLazyBoolYes; } void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) { - if (did_exec == false) { + if (!did_exec) { // Hard reset everything, this is when we first connect to a GDB server m_supports_not_sending_acks = eLazyBoolCalculate; m_supports_thread_suffix = eLazyBoolCalculate; @@ -745,7 +739,7 @@ lldb::pid_t GDBRemoteCommunicationClient::GetCurrentProcessID(bool allow_lazy) { bool sequence_mutex_unavailable; size_t size; size = GetCurrentThreadIDs(thread_ids, sequence_mutex_unavailable); - if (size && sequence_mutex_unavailable == false) { + if (size && !sequence_mutex_unavailable) { m_curr_pid = thread_ids.front(); m_curr_pid_is_valid = eLazyBoolYes; return m_curr_pid; @@ -839,8 +833,8 @@ int GDBRemoteCommunicationClient::SendEnvironmentPacket( if (name_equal_value && name_equal_value[0]) { StreamString packet; bool send_hex_encoding = false; - for (const char *p = name_equal_value; - *p != '\0' && send_hex_encoding == false; ++p) { + for (const char *p = name_equal_value; *p != '\0' && !send_hex_encoding; + ++p) { if (isprint(*p)) { switch (*p) { case '$': @@ -1693,7 +1687,7 @@ Status GDBRemoteCommunicationClient::GetWatchpointSupportInfo(uint32_t &num) { found_num_field = true; } } - if (found_num_field == false) { + if (!found_num_field) { m_supports_watchpoint_support_info = eLazyBoolNo; } } else { @@ -1728,12 +1722,10 @@ GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction( // On targets like MIPS and ppc64le, watchpoint exceptions are always // generated before the instruction is executed. The connected target may // not support qHostInfo or qWatchpointSupportInfo packets. - if (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel || - atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el || - atype == llvm::Triple::ppc64le) - after = false; - else - after = true; + after = + !(atype == llvm::Triple::mips || atype == llvm::Triple::mipsel || + atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el || + atype == llvm::Triple::ppc64le); } else { // For MIPS and ppc64le, set m_watchpoints_trigger_after_instruction to // eLazyBoolNo if it is not calculated before. @@ -3776,7 +3768,7 @@ void GDBRemoteCommunicationClient::ServeSymbolLookups( // Is this the initial qSymbol:: packet? bool first_qsymbol_query = true; - if (m_supports_qSymbol && m_qSymbol_requests_done == false) { + if (m_supports_qSymbol && !m_qSymbol_requests_done) { Lock lock(*this, false); if (lock) { StreamString packet; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 98a2745b6d8..e58f47f4bef 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -458,7 +458,7 @@ bool GDBRemoteRegisterContext::ReadAllRegisterValues( ((ProcessGDBRemote *)process)->GetGDBRemote()); const bool use_g_packet = - gdb_comm.AvoidGPackets((ProcessGDBRemote *)process) == false; + !gdb_comm.AvoidGPackets((ProcessGDBRemote *)process); GDBRemoteClientBase::Lock lock(gdb_comm, false); if (lock) { @@ -521,7 +521,7 @@ bool GDBRemoteRegisterContext::WriteAllRegisterValues( ((ProcessGDBRemote *)process)->GetGDBRemote()); const bool use_g_packet = - gdb_comm.AvoidGPackets((ProcessGDBRemote *)process) == false; + !gdb_comm.AvoidGPackets((ProcessGDBRemote *)process); GDBRemoteClientBase::Lock lock(gdb_comm, false); if (lock) { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 5959d9bc2fa..ef0915f70c1 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1528,7 +1528,7 @@ Status ProcessGDBRemote::DoResume() { new EventDataBytes(continue_packet.GetString().data(), continue_packet.GetSize())); - if (listener_sp->GetEvent(event_sp, std::chrono::seconds(5)) == false) { + if (!listener_sp->GetEvent(event_sp, std::chrono::seconds(5))) { error.SetErrorString("Resume timed out."); if (log) log->Printf("ProcessGDBRemote::DoResume: Resume timed out."); @@ -1984,7 +1984,7 @@ ThreadSP ProcessGDBRemote::SetThreadStopInfo( } } - if (!handled && signo && did_exec == false) { + if (!handled && signo && !did_exec) { if (signo == SIGTRAP) { // Currently we are going to assume SIGTRAP means we are either // hitting a breakpoint or hardware single stepping. @@ -2698,7 +2698,7 @@ void ProcessGDBRemote::SetLastStopPacket( // We are are not using non-stop mode, there can only be one last stop // reply packet, so clear the list. - if (GetTarget().GetNonStopModeEnabled() == false) + if (!GetTarget().GetNonStopModeEnabled()) m_stop_packet_stack.clear(); // Add this stop packet to the stop packet stack This stack will get popped diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 36a2cffec3b..db7dc3eae0b 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -197,13 +197,10 @@ void ThreadGDBRemote::SetQueueLibdispatchQueueAddress( } bool ThreadGDBRemote::ThreadHasQueueInformation() const { - if (m_thread_dispatch_qaddr != 0 && - m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS && - m_dispatch_queue_t != LLDB_INVALID_ADDRESS && - m_queue_kind != eQueueKindUnknown && m_queue_serial_number != 0) { - return true; - } - return false; + return m_thread_dispatch_qaddr != 0 && + m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS && + m_dispatch_queue_t != LLDB_INVALID_ADDRESS && + m_queue_kind != eQueueKindUnknown && m_queue_serial_number != 0; } LazyBool ThreadGDBRemote::GetAssociatedWithLibdispatchQueue() { diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index bdb6a604118..08b9f08a47f 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -302,36 +302,38 @@ Status ProcessMachCore::DoLoadCore() { // LC_IDENT is very obsolete and should not be used in new code, but if the // load command is present, let's use the contents. std::string corefile_identifier = core_objfile->GetIdentifierString(); - if (found_main_binary_definitively == false - && corefile_identifier.find("Darwin Kernel") != std::string::npos) { - UUID uuid; - addr_t addr = LLDB_INVALID_ADDRESS; - if (corefile_identifier.find("UUID=") != std::string::npos) { - size_t p = corefile_identifier.find("UUID=") + strlen("UUID="); - std::string uuid_str = corefile_identifier.substr(p, 36); - uuid.SetFromStringRef(uuid_str); - } - if (corefile_identifier.find("stext=") != std::string::npos) { - size_t p = corefile_identifier.find("stext=") + strlen("stext="); - if (corefile_identifier[p] == '0' && corefile_identifier[p + 1] == 'x') { - errno = 0; - addr = ::strtoul(corefile_identifier.c_str() + p, NULL, 16); - if (errno != 0 || addr == 0) - addr = LLDB_INVALID_ADDRESS; - } - } - if (uuid.IsValid() && addr != LLDB_INVALID_ADDRESS) { - m_mach_kernel_addr = addr; - found_main_binary_definitively = true; - if (log) - log->Printf("ProcessMachCore::DoLoadCore: Using the kernel address 0x%" PRIx64 - " from LC_IDENT/LC_NOTE 'kern ver str' string: '%s'", addr, corefile_identifier.c_str()); + if (!found_main_binary_definitively && + corefile_identifier.find("Darwin Kernel") != std::string::npos) { + UUID uuid; + addr_t addr = LLDB_INVALID_ADDRESS; + if (corefile_identifier.find("UUID=") != std::string::npos) { + size_t p = corefile_identifier.find("UUID=") + strlen("UUID="); + std::string uuid_str = corefile_identifier.substr(p, 36); + uuid.SetFromStringRef(uuid_str); + } + if (corefile_identifier.find("stext=") != std::string::npos) { + size_t p = corefile_identifier.find("stext=") + strlen("stext="); + if (corefile_identifier[p] == '0' && corefile_identifier[p + 1] == 'x') { + errno = 0; + addr = ::strtoul(corefile_identifier.c_str() + p, NULL, 16); + if (errno != 0 || addr == 0) + addr = LLDB_INVALID_ADDRESS; } + } + if (uuid.IsValid() && addr != LLDB_INVALID_ADDRESS) { + m_mach_kernel_addr = addr; + found_main_binary_definitively = true; + if (log) + log->Printf( + "ProcessMachCore::DoLoadCore: Using the kernel address 0x%" PRIx64 + " from LC_IDENT/LC_NOTE 'kern ver str' string: '%s'", + addr, corefile_identifier.c_str()); + } } - if (found_main_binary_definitively == false - && (m_dyld_addr == LLDB_INVALID_ADDRESS - || m_mach_kernel_addr == LLDB_INVALID_ADDRESS)) { + if (!found_main_binary_definitively && + (m_dyld_addr == LLDB_INVALID_ADDRESS || + m_mach_kernel_addr == LLDB_INVALID_ADDRESS)) { // We need to locate the main executable in the memory ranges we have in // the core file. We need to search for both a user-process dyld binary // and a kernel binary in memory; we must look at all the pages in the @@ -352,16 +354,15 @@ Status ProcessMachCore::DoLoadCore() { } } - if (found_main_binary_definitively == false - && m_mach_kernel_addr != LLDB_INVALID_ADDRESS) { + if (!found_main_binary_definitively && + m_mach_kernel_addr != LLDB_INVALID_ADDRESS) { // In the case of multiple kernel images found in the core file via // exhaustive search, we may not pick the correct one. See if the // DynamicLoaderDarwinKernel's search heuristics might identify the correct // one. Most of the time, I expect the address from SearchForDarwinKernel() // will be the same as the address we found via exhaustive search. - if (GetTarget().GetArchitecture().IsValid() == false && - m_core_module_sp.get()) { + if (!GetTarget().GetArchitecture().IsValid() && m_core_module_sp.get()) { GetTarget().SetArchitecture(m_core_module_sp->GetArchitecture()); } diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index 45ffd0813d4..7e96dd9893c 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -222,9 +222,7 @@ PythonBytes::~PythonBytes() {} bool PythonBytes::Check(PyObject *py_obj) { if (!py_obj) return false; - if (PyBytes_Check(py_obj)) - return true; - return false; + return PyBytes_Check(py_obj); } void PythonBytes::Reset(PyRefType type, PyObject *py_obj) { @@ -294,9 +292,7 @@ PythonByteArray::~PythonByteArray() {} bool PythonByteArray::Check(PyObject *py_obj) { if (!py_obj) return false; - if (PyByteArray_Check(py_obj)) - return true; - return false; + return PyByteArray_Check(py_obj); } void PythonByteArray::Reset(PyRefType type, PyObject *py_obj) { diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 289607e309a..41cb443d4f1 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -208,7 +208,7 @@ ScriptInterpreterPython::Locker::Locker(ScriptInterpreterPython *py_interpreter, m_python_interpreter(py_interpreter) { DoAcquireLock(); if ((on_entry & InitSession) == InitSession) { - if (DoInitSession(on_entry, in, out, err) == false) { + if (!DoInitSession(on_entry, in, out, err)) { // Don't teardown the session if we didn't init it. m_teardown_session = false; } @@ -2838,7 +2838,7 @@ bool ScriptInterpreterPython::LoadScriptingModule( bool was_imported = (was_imported_globally || was_imported_locally); - if (was_imported == true && can_reload == false) { + if (was_imported && !can_reload) { error.SetErrorString("module already imported"); return false; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index af3c3b4b410..0b71b2a4b87 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -657,7 +657,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } if (byte_size_valid && byte_size == 0 && type_name_cstr && - die.HasChildren() == false && + !die.HasChildren() && sc.comp_unit->GetLanguage() == eLanguageTypeObjC) { // Work around an issue with clang at the moment where forward // declarations for objective C classes are emitted as: @@ -895,7 +895,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, // has child classes or types that require the class to be created // for use as their decl contexts the class will be ready to accept // these child definitions. - if (die.HasChildren() == false) { + if (!die.HasChildren()) { // No children for this struct/union/class, lets finish it if (ClangASTContext::StartTagDeclarationDefinition(clang_type)) { ClangASTContext::CompleteTagDeclarationDefinition(clang_type); @@ -1746,7 +1746,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, element_type->GetForwardCompilerType(); if (ClangASTContext::IsCXXClassType(array_element_type) && - array_element_type.GetCompleteType() == false) { + !array_element_type.GetCompleteType()) { ModuleSP module_sp = die.GetModule(); if (module_sp) { if (die.GetCU()->GetProducer() == eProducerClang) @@ -2269,7 +2269,7 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die, if (type_source_info) { CompilerType base_class_type( &m_ast, type_source_info->getType().getAsOpaquePtr()); - if (base_class_type.GetCompleteType() == false) { + if (!base_class_type.GetCompleteType()) { auto module = dwarf->GetObjectFile()->GetModule(); module->ReportError(":: Class '%s' has a base class '%s' which " "does not have a complete definition.", @@ -2885,7 +2885,7 @@ bool DWARFASTParserClang::ParseChildMembers( break; } - if (is_artificial == false) { + if (!is_artificial) { Type *member_type = die.ResolveTypeUID(DIERef(encoding_form)); clang::FieldDecl *field_decl = NULL; @@ -3083,7 +3083,7 @@ bool DWARFASTParserClang::ParseChildMembers( } if (ClangASTContext::IsCXXClassType(member_clang_type) && - member_clang_type.GetCompleteType() == false) { + !member_clang_type.GetCompleteType()) { if (die.GetCU()->GetProducer() == eProducerClang) module_sp->ReportError( "DWARF DIE at 0x%8.8x (class %s) has a member variable " diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp index 1c31d1c4259..d79acdc5cfc 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugMacro.cpp @@ -25,7 +25,7 @@ DWARFDebugMacroHeader::ParseHeader(const DWARFDataExtractor &debug_macro_data, header.m_version = debug_macro_data.GetU16(offset); uint8_t flags = debug_macro_data.GetU8(offset); - header.m_offset_is_64_bit = flags & OFFSET_SIZE_MASK ? true : false; + header.m_offset_is_64_bit = (flags & OFFSET_SIZE_MASK) != 0; if (flags & DEBUG_LINE_OFFSET_MASK) { if (header.m_offset_is_64_bit) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index 89be3d6c014..57d2be93c44 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -648,9 +648,7 @@ void DWARFUnit::SetUserData(void *d) { } bool DWARFUnit::Supports_DW_AT_APPLE_objc_complete_type() { - if (GetProducer() == eProducerLLVMGCC) - return false; - return true; + return GetProducer() != eProducerLLVMGCC; } bool DWARFUnit::DW_AT_decl_file_attributes_are_invalid() { @@ -662,11 +660,8 @@ bool DWARFUnit::DW_AT_decl_file_attributes_are_invalid() { bool DWARFUnit::Supports_unnamed_objc_bitfields() { if (GetProducer() == eProducerClang) { const uint32_t major_version = GetProducerVersionMajor(); - if (major_version > 425 || - (major_version == 425 && GetProducerVersionUpdate() >= 13)) - return true; - else - return false; + return major_version > 425 || + (major_version == 425 && GetProducerVersionUpdate() >= 13); } return true; // Assume all other compilers didn't have incorrect ObjC bitfield // info diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 39dfe31cbda..eafdea4eb71 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1679,7 +1679,7 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() { DWARFUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); const DWARFBaseDIE die = dwarf_cu->GetUnitDIEOnly(); - if (die && die.HasChildren() == false) { + if (die && !die.HasChildren()) { const char *name = die.GetAttributeValueAsString(DW_AT_name, nullptr); if (name) { @@ -2265,7 +2265,7 @@ bool SymbolFileDWARF::ResolveFunction(const DWARFDIE &orig_die, sc.block = function_block.FindBlockByID(inlined_die.GetID()); if (sc.block == NULL) sc.block = function_block.FindBlockByID(inlined_die.GetOffset()); - if (sc.block == NULL || sc.block->GetStartAddress(addr) == false) + if (sc.block == NULL || !sc.block->GetStartAddress(addr)) addr.Clear(); } else { sc.block = NULL; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index fa6ace8c3bb..d931ccb9d10 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -89,7 +89,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap( idx < oso_end_idx; ++idx) { Symbol *exe_symbol = exe_symtab->SymbolAtIndex(idx); if (exe_symbol) { - if (exe_symbol->IsDebug() == false) + if (!exe_symbol->IsDebug()) continue; switch (exe_symbol->GetType()) { @@ -179,7 +179,7 @@ public: GetSymbolVendor(bool can_create = true, lldb_private::Stream *feedback_strm = NULL) override { // Scope for locker - if (m_symfile_ap.get() || can_create == false) + if (m_symfile_ap.get() || !can_create) return m_symfile_ap.get(); ModuleSP exe_module_sp(m_exe_module_wp.lock()); @@ -1155,7 +1155,7 @@ TypeSP SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE( // Only search all .o files for the definition if we don't need the // implementation because otherwise, with a valid debug map we should have // the ObjC class symbol and the code above should have found it. - if (must_be_implementation == false) { + if (!must_be_implementation) { TypeSP type_sp; ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { @@ -1190,10 +1190,7 @@ uint32_t SymbolFileDWARFDebugMap::FindTypes( ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { oso_dwarf->FindTypes(sc, name, parent_decl_ctx, append, max_matches, searched_symbol_files, types); - if (types.GetSize() >= max_matches) - return true; - else - return false; + return types.GetSize() >= max_matches; }); } diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp index 37757578bdb..65e718bedaf 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -658,7 +658,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) { CompilerType element_ast_type = element_type->GetForwardCompilerType(); // If element type is UDT, it needs to be complete. if (ClangASTContext::IsCXXClassType(element_ast_type) && - element_ast_type.GetCompleteType() == false) { + !element_ast_type.GetCompleteType()) { if (ClangASTContext::StartTagDeclarationDefinition(element_ast_type)) { ClangASTContext::CompleteTagDeclarationDefinition(element_ast_type); } else { diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp index 0d47dd11de1..169eed81756 100644 --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -237,8 +237,7 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp, // object is DBGSourcePath std::string DBGSourcePath = object->GetStringValue(); - if (new_style_source_remapping_dictionary == - false && + if (!new_style_source_remapping_dictionary && !original_DBGSourcePath_value.empty()) { DBGSourcePath = original_DBGSourcePath_value; } diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp index 500ef0d5f73..43e401330c5 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -238,7 +238,7 @@ AppleGetItemInfoHandler::GetItemInfo(Thread &thread, uint64_t item, error.Clear(); - if (thread.SafeToCallFunctions() == false) { + if (!thread.SafeToCallFunctions()) { if (log) log->Printf("Not safe to call functions on thread 0x%" PRIx64, thread.GetID()); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp index 4aed12387e4..78e50e673af 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -241,7 +241,7 @@ AppleGetPendingItemsHandler::GetPendingItems(Thread &thread, addr_t queue, error.Clear(); - if (thread.SafeToCallFunctions() == false) { + if (!thread.SafeToCallFunctions()) { if (log) log->Printf("Not safe to call functions on thread 0x%" PRIx64, thread.GetID()); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp index 4b077ee497d..245ff6742b4 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -243,7 +243,7 @@ AppleGetQueuesHandler::GetCurrentQueues(Thread &thread, addr_t page_to_free, error.Clear(); - if (thread.SafeToCallFunctions() == false) { + if (!thread.SafeToCallFunctions()) { if (log) log->Printf("Not safe to call functions on thread 0x%" PRIx64, thread.GetID()); diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp index dab22427cba..ede81333a3e 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -248,7 +248,7 @@ AppleGetThreadItemInfoHandler::GetThreadItemInfo(Thread &thread, error.Clear(); - if (thread.SafeToCallFunctions() == false) { + if (!thread.SafeToCallFunctions()) { if (log) log->Printf("Not safe to call functions on thread 0x%" PRIx64, thread.GetID()); diff --git a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp index 9295a095353..04f9cbbf03a 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp +++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp @@ -100,10 +100,10 @@ bool UnwindAssembly_x86::AugmentUnwindPlanFromCallSite( return false; } UnwindPlan::Row::RegisterLocation first_row_pc_loc; - if (first_row->GetRegisterInfo( + if (!first_row->GetRegisterInfo( pc_regnum.GetAsKind(unwind_plan.GetRegisterKind()), - first_row_pc_loc) == false || - first_row_pc_loc.IsAtCFAPlusOffset() == false || + first_row_pc_loc) || + !first_row_pc_loc.IsAtCFAPlusOffset() || first_row_pc_loc.GetOffset() != -wordsize) { return false; } diff --git a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp index eb1989895af..f8e70204e50 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp +++ b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp @@ -304,26 +304,20 @@ bool x86AssemblyInspectionEngine::nonvolatile_reg_p(int machine_regno) { // pushq %rbp [0x55] bool x86AssemblyInspectionEngine::push_rbp_pattern_p() { uint8_t *p = m_cur_insn; - if (*p == 0x55) - return true; - return false; + return *p == 0x55; } // pushq $0 ; the first instruction in start() [0x6a 0x00] bool x86AssemblyInspectionEngine::push_0_pattern_p() { uint8_t *p = m_cur_insn; - if (*p == 0x6a && *(p + 1) == 0x0) - return true; - return false; + return *p == 0x6a && *(p + 1) == 0x0; } // pushq $0 // pushl $0 bool x86AssemblyInspectionEngine::push_imm_pattern_p() { uint8_t *p = m_cur_insn; - if (*p == 0x68 || *p == 0x6a) - return true; - return false; + return *p == 0x68 || *p == 0x6a; } // pushl imm8(%esp) @@ -675,9 +669,7 @@ bool x86AssemblyInspectionEngine::mov_reg_to_local_stack_frame_p( // ret [0xc9] or [0xc2 imm8] or [0xca imm8] bool x86AssemblyInspectionEngine::ret_pattern_p() { uint8_t *p = m_cur_insn; - if (*p == 0xc9 || *p == 0xc2 || *p == 0xca || *p == 0xc3) - return true; - return false; + return *p == 0xc9 || *p == 0xc2 || *p == 0xca || *p == 0xc3; } uint32_t x86AssemblyInspectionEngine::extract_4(uint8_t *b) { @@ -723,7 +715,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( if (data == nullptr || size == 0) return false; - if (m_register_map_initialized == false) + if (!m_register_map_initialized) return false; addr_t current_func_text_offset = 0; @@ -864,7 +856,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( // on the stack if (nonvolatile_reg_p(machine_regno) && machine_regno_to_lldb_regno(machine_regno, lldb_regno) && - saved_registers[machine_regno] == false) { + !saved_registers[machine_regno]) { UnwindPlan::Row::RegisterLocation regloc; if (is_aligned) regloc.SetAtAFAPlusOffset(-current_sp_bytes_offset_from_fa); @@ -881,7 +873,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( if (nonvolatile_reg_p(machine_regno) && machine_regno_to_lldb_regno(machine_regno, lldb_regno) && - saved_registers[machine_regno] == true) { + saved_registers[machine_regno]) { saved_registers[machine_regno] = false; row->RemoveRegisterInfo(lldb_regno); @@ -953,7 +945,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( else if (mov_reg_to_local_stack_frame_p(machine_regno, stack_offset) && nonvolatile_reg_p(machine_regno) && machine_regno_to_lldb_regno(machine_regno, lldb_regno) && - saved_registers[machine_regno] == false) { + !saved_registers[machine_regno]) { saved_registers[machine_regno] = true; UnwindPlan::Row::RegisterLocation regloc; @@ -1081,7 +1073,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( } } - if (in_epilogue == false && row_updated) { + if (!in_epilogue && row_updated) { // If we're not in an epilogue sequence, save the updated Row UnwindPlan::Row *newrow = new UnwindPlan::Row; *newrow = *row.get(); @@ -1096,7 +1088,7 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly( // We may change the sp value without adding a new Row necessarily -- keep // track of it either way. - if (in_epilogue == false) { + if (!in_epilogue) { prologue_completed_sp_bytes_offset_from_cfa = current_sp_bytes_offset_from_fa; prologue_completed_is_aligned = is_aligned; @@ -1362,7 +1354,7 @@ bool x86AssemblyInspectionEngine::FindFirstNonPrologueInstruction( uint8_t *data, size_t size, size_t &offset) { offset = 0; - if (m_register_map_initialized == false) + if (!m_register_map_initialized) return false; while (offset < size) { |