[Lldb-commits] [lldb] 8afcfbf - Use true/false instead of 1/0 (NFC)
Kazu Hirata via lldb-commits
lldb-commits at lists.llvm.org
Sun Jan 9 12:21:27 PST 2022
Author: Kazu Hirata
Date: 2022-01-09T12:21:06-08:00
New Revision: 8afcfbfb8fc1e53023ffac9d9bdc424248d6d2ff
URL: https://github.com/llvm/llvm-project/commit/8afcfbfb8fc1e53023ffac9d9bdc424248d6d2ff
DIFF: https://github.com/llvm/llvm-project/commit/8afcfbfb8fc1e53023ffac9d9bdc424248d6d2ff.diff
LOG: Use true/false instead of 1/0 (NFC)
Identified by modernize-use-bool-literals.
Added:
Modified:
clang-tools-extra/clangd/refactor/Rename.cpp
lld/COFF/Writer.cpp
lld/ELF/Arch/X86_64.cpp
lld/MachO/Arch/ARM.cpp
lld/MachO/InputSection.h
lldb/source/Host/common/Host.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Symbol/TypeSystem.cpp
lldb/source/Target/TraceInstructionDumper.cpp
polly/lib/Analysis/ScopDetection.cpp
polly/lib/CodeGen/PerfMonitor.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index 5e157db5900af..e092c677c57cf 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -906,7 +906,7 @@ llvm::Optional<std::vector<Range>> getMappedRanges(ArrayRef<Range> Indexed,
std::vector<size_t> Best;
size_t BestCost = std::numeric_limits<size_t>::max();
- bool HasMultiple = 0;
+ bool HasMultiple = false;
std::vector<size_t> ResultStorage;
int Fuel = 10000;
findNearMiss(ResultStorage, Indexed, Lexed, 0, Fuel,
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index 0788f3519f4e0..4a41c541ee7f9 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -1246,7 +1246,7 @@ void Writer::mergeSections() {
if (p.first == toName)
continue;
StringSet<> names;
- while (1) {
+ while (true) {
if (!names.insert(toName).second)
fatal("/merge: cycle found for section '" + p.first + "'");
auto i = config->merge.find(toName);
diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp
index 08591d8e5f06b..161e99e3ba3fb 100644
--- a/lld/ELF/Arch/X86_64.cpp
+++ b/lld/ELF/Arch/X86_64.cpp
@@ -282,12 +282,12 @@ bool X86_64::deleteFallThruJmpInsn(InputSection &is, InputFile *file,
const unsigned sizeOfJmpCCInsn = 6;
// To flip, there must be atleast one JmpCC and one direct jmp.
if (is.getSize() < sizeOfDirectJmpInsn + sizeOfJmpCCInsn)
- return 0;
+ return false;
unsigned rbIndex =
getRelocationWithOffset(is, (is.getSize() - sizeOfDirectJmpInsn - 4));
if (rbIndex == is.relocations.size())
- return 0;
+ return false;
Relocation &rB = is.relocations[rbIndex];
diff --git a/lld/MachO/Arch/ARM.cpp b/lld/MachO/Arch/ARM.cpp
index 42c7b89308684..4dda94d7b0f38 100644
--- a/lld/MachO/Arch/ARM.cpp
+++ b/lld/MachO/Arch/ARM.cpp
@@ -116,7 +116,7 @@ void ARM::relocateOne(uint8_t *loc, const Reloc &r, uint64_t value,
return;
} else if (isBlx && !defined->thumb) {
Bitfield::set<Cond>(base, 0xe); // unconditional BL
- Bitfield::set<BitfieldFlag<24>>(base, 1);
+ Bitfield::set<BitfieldFlag<24>>(base, true);
isBlx = false;
}
} else {
diff --git a/lld/MachO/InputSection.h b/lld/MachO/InputSection.h
index fa137223c426f..58f794227b617 100644
--- a/lld/MachO/InputSection.h
+++ b/lld/MachO/InputSection.h
@@ -234,7 +234,9 @@ class WordLiteralInputSection final : public InputSection {
bool isLive(uint64_t off) const override {
return live[off >> power2LiteralSize];
}
- void markLive(uint64_t off) override { live[off >> power2LiteralSize] = 1; }
+ void markLive(uint64_t off) override {
+ live[off >> power2LiteralSize] = true;
+ }
static bool classof(const InputSection *isec) {
return isec->kind() == WordLiteralKind;
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index d14ebe99fd155..53a096c617dff 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -191,7 +191,7 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) {
::sigaction(SIGUSR1, &sigUsr1Action, nullptr);
#endif // __linux__
- while (1) {
+ while (true) {
log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS);
LLDB_LOGF(log, "%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...",
function, pid, options);
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index aa6306bef8b99..ff41f187ba9d0 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -889,8 +889,8 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
ThreadPlanSP ret_plan_sp;
lldb::addr_t curr_pc = thread.GetRegisterContext()->GetPC();
- DispatchFunction vtable_dispatch
- = {"vtable", 0, false, false, DispatchFunction::eFixUpFixed};
+ DispatchFunction vtable_dispatch = {"vtable", false, false, false,
+ DispatchFunction::eFixUpFixed};
// First step is to look and see if we are in one of the known ObjC
// dispatch functions. We've already compiled a table of same, so
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 30d7d239834b0..20383d9646fdc 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -5149,7 +5149,7 @@ void ObjectFileMachO::GetAllArchSpecs(const llvm::MachO::mach_header &header,
triple.setEnvironmentName(os_env.environment);
add_triple(triple);
}
- } while (0);
+ } while (false);
offset = cmd_offset + load_cmd.cmdsize;
}
diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp
index 0b3f7e4f3bd4e..3092dc0bf0a4f 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -22,7 +22,7 @@ using namespace lldb;
static const size_t g_num_small_bitvector_bits = 64 - 8;
static_assert(eNumLanguageTypes < g_num_small_bitvector_bits,
"Languages bit vector is no longer small on 64 bit systems");
-LanguageSet::LanguageSet() : bitvector(eNumLanguageTypes, 0) {}
+LanguageSet::LanguageSet() : bitvector(eNumLanguageTypes, false) {}
llvm::Optional<LanguageType> LanguageSet::GetSingularLanguage() {
if (bitvector.count() == 1)
diff --git a/lldb/source/Target/TraceInstructionDumper.cpp b/lldb/source/Target/TraceInstructionDumper.cpp
index 69d59dcfb12f5..f0947d8f88b82 100644
--- a/lldb/source/Target/TraceInstructionDumper.cpp
+++ b/lldb/source/Target/TraceInstructionDumper.cpp
@@ -149,7 +149,8 @@ static void DumpInstructionDisassembly(Stream &s, InstructionSymbolInfo &insn) {
return;
s.Printf(" ");
insn.instruction->Dump(&s, /*show_address=*/false, /*show_bytes=*/false,
- /*max_opcode_byte_size=*/0, &insn.exe_ctx, &insn.sc,
+ /*max_opcode_byte_size=*/false, &insn.exe_ctx,
+ &insn.sc,
/*prev_sym_ctx=*/nullptr,
/*disassembly_addr_format=*/nullptr,
/*max_address_text_size=*/0);
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 393af1e5f6053..f0be6d5ff1ae0 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -1166,7 +1166,7 @@ bool ScopDetection::isValidAccess(Instruction *Inst, const SCEV *AF,
// as invariant, we use fixed-point iteration method here i.e we iterate
// over the alias set for arbitrary number of times until it is safe to
// assume that all the invariant loads have been detected
- while (1) {
+ while (true) {
const unsigned int VariantSize = VariantLS.size(),
InvariantSize = InvariantLS.size();
diff --git a/polly/lib/CodeGen/PerfMonitor.cpp b/polly/lib/CodeGen/PerfMonitor.cpp
index f6efc532364fe..ccd8990283efe 100644
--- a/polly/lib/CodeGen/PerfMonitor.cpp
+++ b/polly/lib/CodeGen/PerfMonitor.cpp
@@ -103,7 +103,7 @@ void PerfMonitor::addGlobalVariables() {
TryRegisterGlobal(M, "__polly_perf_cycles_total_start", Builder.getInt64(0),
&CyclesTotalStartPtr);
- TryRegisterGlobal(M, "__polly_perf_initialized", Builder.getInt1(0),
+ TryRegisterGlobal(M, "__polly_perf_initialized", Builder.getInt1(false),
&AlreadyInitializedPtr);
TryRegisterGlobal(M, "__polly_perf_cycles_in_scops", Builder.getInt64(0),
More information about the lldb-commits
mailing list