1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[llvm] Use *Set::contains (NFC)

This commit is contained in:
Kazu Hirata 2021-01-11 18:48:07 -08:00
parent 04ea28f569
commit 2fa31266e2
4 changed files with 10 additions and 10 deletions

View File

@ -2574,7 +2574,7 @@ static void removeOldExitPreds(RegionMRT *Region) {
static bool mbbHasBackEdge(MachineBasicBlock *MBB, static bool mbbHasBackEdge(MachineBasicBlock *MBB,
SmallPtrSet<MachineBasicBlock *, 8> &MBBs) { SmallPtrSet<MachineBasicBlock *, 8> &MBBs) {
for (auto SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE; ++SI) { for (auto SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE; ++SI) {
if (MBBs.count(*SI) != 0) { if (MBBs.contains(*SI)) {
return true; return true;
} }
} }

View File

@ -179,7 +179,7 @@ bool FileAnalysis::willTrapOnCFIViolation(const Instr &InstrMeta) const {
if (!MIA->evaluateBranch(InstrMeta.Instruction, InstrMeta.VMAddress, if (!MIA->evaluateBranch(InstrMeta.Instruction, InstrMeta.VMAddress,
InstrMeta.InstructionSize, Target)) InstrMeta.InstructionSize, Target))
return false; return false;
return TrapOnFailFunctionAddresses.count(Target) > 0; return TrapOnFailFunctionAddresses.contains(Target);
} }
bool FileAnalysis::canFallThrough(const Instr &InstrMeta) const { bool FileAnalysis::canFallThrough(const Instr &InstrMeta) const {
@ -558,7 +558,7 @@ Error FileAnalysis::parseSymbolTable() {
auto SymNameOrErr = Sym.getName(); auto SymNameOrErr = Sym.getName();
if (!SymNameOrErr) if (!SymNameOrErr)
consumeError(SymNameOrErr.takeError()); consumeError(SymNameOrErr.takeError());
else if (TrapOnFailFunctions.count(*SymNameOrErr) > 0) { else if (TrapOnFailFunctions.contains(*SymNameOrErr)) {
auto AddrOrErr = Sym.getAddress(); auto AddrOrErr = Sym.getAddress();
if (!AddrOrErr) if (!AddrOrErr)
consumeError(AddrOrErr.takeError()); consumeError(AddrOrErr.takeError());
@ -574,7 +574,7 @@ Error FileAnalysis::parseSymbolTable() {
auto SymNameOrErr = Sym.getName(); auto SymNameOrErr = Sym.getName();
if (!SymNameOrErr) if (!SymNameOrErr)
consumeError(SymNameOrErr.takeError()); consumeError(SymNameOrErr.takeError());
else if (TrapOnFailFunctions.count(*SymNameOrErr) > 0) else if (TrapOnFailFunctions.contains(*SymNameOrErr))
TrapOnFailFunctionAddresses.insert(Addr.second); TrapOnFailFunctionAddresses.insert(Addr.second);
} }
} }

View File

@ -89,7 +89,7 @@ const Section *Object::findSection(ssize_t UniqueId) const {
void Object::removeSections(function_ref<bool(const Section &)> ToRemove) { void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {
DenseSet<ssize_t> AssociatedSections; DenseSet<ssize_t> AssociatedSections;
auto RemoveAssociated = [&AssociatedSections](const Section &Sec) { auto RemoveAssociated = [&AssociatedSections](const Section &Sec) {
return AssociatedSections.count(Sec.UniqueId) == 1; return AssociatedSections.contains(Sec.UniqueId);
}; };
do { do {
DenseSet<ssize_t> RemovedSections; DenseSet<ssize_t> RemovedSections;
@ -109,7 +109,7 @@ void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {
// leave them dangling). // leave them dangling).
if (RemovedSections.count(Sym.AssociativeComdatTargetSectionId) == 1) if (RemovedSections.count(Sym.AssociativeComdatTargetSectionId) == 1)
AssociatedSections.insert(Sym.TargetSectionId); AssociatedSections.insert(Sym.TargetSectionId);
return RemovedSections.count(Sym.TargetSectionId) == 1; return RemovedSections.contains(Sym.TargetSectionId);
}); });
ToRemove = RemoveAssociated; ToRemove = RemoveAssociated;
} while (!AssociatedSections.empty()); } while (!AssociatedSections.empty());

View File

@ -178,10 +178,10 @@ static Error processLoadCommands(const CopyConfig &Config, Object &Obj) {
for (const auto &OldNew : Config.RPathsToUpdate) { for (const auto &OldNew : Config.RPathsToUpdate) {
StringRef Old = OldNew.getFirst(); StringRef Old = OldNew.getFirst();
StringRef New = OldNew.getSecond(); StringRef New = OldNew.getSecond();
if (RPaths.count(Old) == 0) if (!RPaths.contains(Old))
return createStringError(errc::invalid_argument, return createStringError(errc::invalid_argument,
"no LC_RPATH load command with path: " + Old); "no LC_RPATH load command with path: " + Old);
if (RPaths.count(New) != 0) if (RPaths.contains(New))
return createStringError(errc::invalid_argument, return createStringError(errc::invalid_argument,
"rpath '" + New + "rpath '" + New +
"' would create a duplicate load command"); "' would create a duplicate load command");
@ -220,7 +220,7 @@ static Error processLoadCommands(const CopyConfig &Config, Object &Obj) {
// Add new RPaths. // Add new RPaths.
for (StringRef RPath : Config.RPathToAdd) { for (StringRef RPath : Config.RPathToAdd) {
if (RPaths.count(RPath) != 0) if (RPaths.contains(RPath))
return createStringError(errc::invalid_argument, return createStringError(errc::invalid_argument,
"rpath '" + RPath + "rpath '" + RPath +
"' would create a duplicate load command"); "' would create a duplicate load command");
@ -229,7 +229,7 @@ static Error processLoadCommands(const CopyConfig &Config, Object &Obj) {
} }
for (StringRef RPath : Config.RPathToPrepend) { for (StringRef RPath : Config.RPathToPrepend) {
if (RPaths.count(RPath) != 0) if (RPaths.contains(RPath))
return createStringError(errc::invalid_argument, return createStringError(errc::invalid_argument,
"rpath '" + RPath + "rpath '" + RPath +
"' would create a duplicate load command"); "' would create a duplicate load command");