summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-01-09 12:21:06 -0800
committerKazu Hirata <kazu@google.com>2022-01-09 12:21:06 -0800
commit8afcfbfb8fc1e53023ffac9d9bdc424248d6d2ff (patch)
treeb75cb55484c551ea9ac668f33f76375213eccefd
parent47b9aadb3215e914119d0c45827ea58cb7499204 (diff)
downloadllvm-8afcfbfb8fc1e53023ffac9d9bdc424248d6d2ff.tar.gz
Use true/false instead of 1/0 (NFC)
Identified by modernize-use-bool-literals.
-rw-r--r--clang-tools-extra/clangd/refactor/Rename.cpp2
-rw-r--r--lld/COFF/Writer.cpp2
-rw-r--r--lld/ELF/Arch/X86_64.cpp4
-rw-r--r--lld/MachO/Arch/ARM.cpp2
-rw-r--r--lld/MachO/InputSection.h4
-rw-r--r--lldb/source/Host/common/Host.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp4
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp2
-rw-r--r--lldb/source/Symbol/TypeSystem.cpp2
-rw-r--r--lldb/source/Target/TraceInstructionDumper.cpp3
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp2
-rw-r--r--polly/lib/CodeGen/PerfMonitor.cpp2
12 files changed, 17 insertions, 14 deletions
diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index 5e157db5900a..e092c677c57c 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 0788f3519f4e..4a41c541ee7f 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 08591d8e5f06..161e99e3ba3f 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 42c7b8930868..4dda94d7b0f3 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 fa137223c426..58f794227b61 100644
--- a/lld/MachO/InputSection.h
+++ b/lld/MachO/InputSection.h
@@ -234,7 +234,9 @@ public:
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 d14ebe99fd15..53a096c617df 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 aa6306bef8b9..ff41f187ba9d 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 30d7d239834b..20383d9646fd 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 0b3f7e4f3bd4..3092dc0bf0a4 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 69d59dcfb12f..f0947d8f88b8 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 393af1e5f605..f0be6d5ff1ae 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 f6efc532364f..ccd8990283ef 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),