Skip to content

Commit 8afcfbf

Browse files
Use true/false instead of 1/0 (NFC)
Identified by modernize-use-bool-literals.
1 parent 47b9aad commit 8afcfbf

File tree

12 files changed

+17
-14
lines changed

12 files changed

+17
-14
lines changed

clang-tools-extra/clangd/refactor/Rename.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ llvm::Optional<std::vector<Range>> getMappedRanges(ArrayRef<Range> Indexed,
906906

907907
std::vector<size_t> Best;
908908
size_t BestCost = std::numeric_limits<size_t>::max();
909-
bool HasMultiple = 0;
909+
bool HasMultiple = false;
910910
std::vector<size_t> ResultStorage;
911911
int Fuel = 10000;
912912
findNearMiss(ResultStorage, Indexed, Lexed, 0, Fuel,

lld/COFF/Writer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ void Writer::mergeSections() {
12461246
if (p.first == toName)
12471247
continue;
12481248
StringSet<> names;
1249-
while (1) {
1249+
while (true) {
12501250
if (!names.insert(toName).second)
12511251
fatal("/merge: cycle found for section '" + p.first + "'");
12521252
auto i = config->merge.find(toName);

lld/ELF/Arch/X86_64.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ bool X86_64::deleteFallThruJmpInsn(InputSection &is, InputFile *file,
282282
const unsigned sizeOfJmpCCInsn = 6;
283283
// To flip, there must be atleast one JmpCC and one direct jmp.
284284
if (is.getSize() < sizeOfDirectJmpInsn + sizeOfJmpCCInsn)
285-
return 0;
285+
return false;
286286

287287
unsigned rbIndex =
288288
getRelocationWithOffset(is, (is.getSize() - sizeOfDirectJmpInsn - 4));
289289
if (rbIndex == is.relocations.size())
290-
return 0;
290+
return false;
291291

292292
Relocation &rB = is.relocations[rbIndex];
293293

lld/MachO/Arch/ARM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void ARM::relocateOne(uint8_t *loc, const Reloc &r, uint64_t value,
116116
return;
117117
} else if (isBlx && !defined->thumb) {
118118
Bitfield::set<Cond>(base, 0xe); // unconditional BL
119-
Bitfield::set<BitfieldFlag<24>>(base, 1);
119+
Bitfield::set<BitfieldFlag<24>>(base, true);
120120
isBlx = false;
121121
}
122122
} else {

lld/MachO/InputSection.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ class WordLiteralInputSection final : public InputSection {
234234
bool isLive(uint64_t off) const override {
235235
return live[off >> power2LiteralSize];
236236
}
237-
void markLive(uint64_t off) override { live[off >> power2LiteralSize] = 1; }
237+
void markLive(uint64_t off) override {
238+
live[off >> power2LiteralSize] = true;
239+
}
238240

239241
static bool classof(const InputSection *isec) {
240242
return isec->kind() == WordLiteralKind;

lldb/source/Host/common/Host.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) {
191191
::sigaction(SIGUSR1, &sigUsr1Action, nullptr);
192192
#endif // __linux__
193193

194-
while (1) {
194+
while (true) {
195195
log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS);
196196
LLDB_LOGF(log, "%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...",
197197
function, pid, options);

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,8 +889,8 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
889889
ThreadPlanSP ret_plan_sp;
890890
lldb::addr_t curr_pc = thread.GetRegisterContext()->GetPC();
891891

892-
DispatchFunction vtable_dispatch
893-
= {"vtable", 0, false, false, DispatchFunction::eFixUpFixed};
892+
DispatchFunction vtable_dispatch = {"vtable", false, false, false,
893+
DispatchFunction::eFixUpFixed};
894894

895895
// First step is to look and see if we are in one of the known ObjC
896896
// dispatch functions. We've already compiled a table of same, so

lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5149,7 +5149,7 @@ void ObjectFileMachO::GetAllArchSpecs(const llvm::MachO::mach_header &header,
51495149
triple.setEnvironmentName(os_env.environment);
51505150
add_triple(triple);
51515151
}
5152-
} while (0);
5152+
} while (false);
51535153
offset = cmd_offset + load_cmd.cmdsize;
51545154
}
51555155

lldb/source/Symbol/TypeSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using namespace lldb;
2222
static const size_t g_num_small_bitvector_bits = 64 - 8;
2323
static_assert(eNumLanguageTypes < g_num_small_bitvector_bits,
2424
"Languages bit vector is no longer small on 64 bit systems");
25-
LanguageSet::LanguageSet() : bitvector(eNumLanguageTypes, 0) {}
25+
LanguageSet::LanguageSet() : bitvector(eNumLanguageTypes, false) {}
2626

2727
llvm::Optional<LanguageType> LanguageSet::GetSingularLanguage() {
2828
if (bitvector.count() == 1)

lldb/source/Target/TraceInstructionDumper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ static void DumpInstructionDisassembly(Stream &s, InstructionSymbolInfo &insn) {
149149
return;
150150
s.Printf(" ");
151151
insn.instruction->Dump(&s, /*show_address=*/false, /*show_bytes=*/false,
152-
/*max_opcode_byte_size=*/0, &insn.exe_ctx, &insn.sc,
152+
/*max_opcode_byte_size=*/false, &insn.exe_ctx,
153+
&insn.sc,
153154
/*prev_sym_ctx=*/nullptr,
154155
/*disassembly_addr_format=*/nullptr,
155156
/*max_address_text_size=*/0);

polly/lib/Analysis/ScopDetection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ bool ScopDetection::isValidAccess(Instruction *Inst, const SCEV *AF,
11661166
// as invariant, we use fixed-point iteration method here i.e we iterate
11671167
// over the alias set for arbitrary number of times until it is safe to
11681168
// assume that all the invariant loads have been detected
1169-
while (1) {
1169+
while (true) {
11701170
const unsigned int VariantSize = VariantLS.size(),
11711171
InvariantSize = InvariantLS.size();
11721172

polly/lib/CodeGen/PerfMonitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void PerfMonitor::addGlobalVariables() {
103103
TryRegisterGlobal(M, "__polly_perf_cycles_total_start", Builder.getInt64(0),
104104
&CyclesTotalStartPtr);
105105

106-
TryRegisterGlobal(M, "__polly_perf_initialized", Builder.getInt1(0),
106+
TryRegisterGlobal(M, "__polly_perf_initialized", Builder.getInt1(false),
107107
&AlreadyInitializedPtr);
108108

109109
TryRegisterGlobal(M, "__polly_perf_cycles_in_scops", Builder.getInt64(0),

0 commit comments

Comments
 (0)