Skip to content

Commit 7e4441b

Browse files
kazutakahirataJDevlieghere
authored andcommitted
Use true/false instead of 1/0 (NFC)
Identified by modernize-use-bool-literals. (cherry picked from commit 8afcfbf) (cherry picked from commit 59679eeef2d471dc0c2bccb966aac5eae9195802)
1 parent cc22f67 commit 7e4441b

File tree

11 files changed

+16
-13
lines changed

11 files changed

+16
-13
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
@@ -1240,7 +1240,7 @@ void Writer::mergeSections() {
12401240
if (p.first == toName)
12411241
continue;
12421242
StringSet<> names;
1243-
while (1) {
1243+
while (true) {
12441244
if (!names.insert(toName).second)
12451245
fatal("/merge: cycle found for section '" + p.first + "'");
12461246
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
@@ -278,12 +278,12 @@ bool X86_64::deleteFallThruJmpInsn(InputSection &is, InputFile *file,
278278
const unsigned sizeOfJmpCCInsn = 6;
279279
// To flip, there must be atleast one JmpCC and one direct jmp.
280280
if (is.getSize() < sizeOfDirectJmpInsn + sizeOfJmpCCInsn)
281-
return 0;
281+
return false;
282282

283283
unsigned rbIndex =
284284
getRelocationWithOffset(is, (is.getSize() - sizeOfDirectJmpInsn - 4));
285285
if (rbIndex == is.relocations.size())
286-
return 0;
286+
return false;
287287

288288
Relocation &rB = is.relocations[rbIndex];
289289

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
@@ -233,7 +233,9 @@ class WordLiteralInputSection final : public InputSection {
233233
bool isLive(uint64_t off) const override {
234234
return live[off >> power2LiteralSize];
235235
}
236-
void markLive(uint64_t off) override { live[off >> power2LiteralSize] = 1; }
236+
void markLive(uint64_t off) override {
237+
live[off >> power2LiteralSize] = true;
238+
}
237239

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

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

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

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

896896
// First step is to look and see if we are in one of the known ObjC
897897
// 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
@@ -5209,7 +5209,7 @@ void ObjectFileMachO::GetAllArchSpecs(const llvm::MachO::mach_header &header,
52095209
triple.setEnvironmentName(os_env.environment);
52105210
add_triple(triple);
52115211
}
5212-
} while (0);
5212+
} while (false);
52135213
offset = cmd_offset + load_cmd.cmdsize;
52145214
}
52155215

lldb/source/Symbol/TypeSystem.cpp

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

2828
llvm::Optional<LanguageType> LanguageSet::GetSingularLanguage() {
2929
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)