Use *{Map,Set}::contains (NFC)
This commit is contained in:
parent
6c756486d4
commit
4e585e51c1
|
@ -2589,8 +2589,7 @@ struct CFISnapshotDiff : public CFISnapshot {
|
|||
if (RestoredRegs[Reg])
|
||||
return true;
|
||||
RestoredRegs[Reg] = true;
|
||||
const int32_t CurRegRule =
|
||||
RegRule.find(Reg) != RegRule.end() ? RegRule[Reg] : UNKNOWN;
|
||||
const int32_t CurRegRule = RegRule.contains(Reg) ? RegRule[Reg] : UNKNOWN;
|
||||
if (CurRegRule == UNKNOWN) {
|
||||
if (Instr.getOperation() == MCCFIInstruction::OpRestore ||
|
||||
Instr.getOperation() == MCCFIInstruction::OpSameValue)
|
||||
|
@ -2731,7 +2730,7 @@ BinaryFunction::unwindCFIState(int32_t FromState, int32_t ToState,
|
|||
Reg = *R;
|
||||
}
|
||||
|
||||
if (ToCFITable.RegRule.find(Reg) == ToCFITable.RegRule.end()) {
|
||||
if (!ToCFITable.RegRule.contains(Reg)) {
|
||||
FrameInstructions.emplace_back(
|
||||
MCCFIInstruction::createRestore(nullptr, Reg));
|
||||
if (FromCFITable.isRedundant(FrameInstructions.back())) {
|
||||
|
|
|
@ -360,7 +360,7 @@ void ReorderFunctions::runOnFunctions(BinaryContext &BC) {
|
|||
}
|
||||
// Strip LTO suffixes
|
||||
if (std::optional<StringRef> CommonName = getLTOCommonName(Function))
|
||||
if (LTOCommonNameMap.find(*CommonName) != LTOCommonNameMap.end())
|
||||
if (LTOCommonNameMap.contains(*CommonName))
|
||||
llvm::append_range(FuncAddrs, LTOCommonNameMap[*CommonName]);
|
||||
} else {
|
||||
FuncAddrs.push_back(BD->getAddress());
|
||||
|
|
|
@ -285,10 +285,10 @@ Error YAMLProfileReader::preprocessProfile(BinaryContext &BC) {
|
|||
|
||||
bool YAMLProfileReader::mayHaveProfileData(const BinaryFunction &BF) {
|
||||
for (StringRef Name : BF.getNames()) {
|
||||
if (ProfileNameToProfile.find(Name) != ProfileNameToProfile.end())
|
||||
if (ProfileNameToProfile.contains(Name))
|
||||
return true;
|
||||
if (const std::optional<StringRef> CommonName = getLTOCommonName(Name)) {
|
||||
if (LTOCommonNameMap.find(*CommonName) != LTOCommonNameMap.end())
|
||||
if (LTOCommonNameMap.contains(*CommonName))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5275,8 +5275,7 @@ RewriteInstance::patchELFAllocatableRelaSections(ELFObjectFile<ELFT> *File) {
|
|||
NewRelA.r_offset = RelOffset;
|
||||
NewRelA.r_addend = Addend;
|
||||
|
||||
const bool IsJmpRel =
|
||||
!!(IsJmpRelocation.find(Rel.Type) != IsJmpRelocation.end());
|
||||
const bool IsJmpRel = IsJmpRelocation.contains(Rel.Type);
|
||||
uint64_t &Offset = IsJmpRel ? RelPltOffset : RelDynOffset;
|
||||
const uint64_t &EndOffset =
|
||||
IsJmpRel ? RelPltEndOffset : RelDynEndOffset;
|
||||
|
|
|
@ -264,13 +264,13 @@ constexpr unsigned char BitCodeConstants::Signature[];
|
|||
void ClangDocBitcodeWriter::AbbreviationMap::add(RecordId RID,
|
||||
unsigned AbbrevID) {
|
||||
assert(RecordIdNameMap[RID] && "Unknown RecordId.");
|
||||
assert(Abbrevs.find(RID) == Abbrevs.end() && "Abbreviation already added.");
|
||||
assert(!Abbrevs.contains(RID) && "Abbreviation already added.");
|
||||
Abbrevs[RID] = AbbrevID;
|
||||
}
|
||||
|
||||
unsigned ClangDocBitcodeWriter::AbbreviationMap::get(RecordId RID) const {
|
||||
assert(RecordIdNameMap[RID] && "Unknown RecordId.");
|
||||
assert(Abbrevs.find(RID) != Abbrevs.end() && "Unknown abbreviation.");
|
||||
assert(Abbrevs.contains(RID) && "Unknown abbreviation.");
|
||||
return Abbrevs.lookup(RID);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ MockTildeExpressionResolver::MockTildeExpressionResolver(StringRef CurrentUser,
|
|||
|
||||
void MockTildeExpressionResolver::AddKnownUser(StringRef User,
|
||||
StringRef HomeDir) {
|
||||
assert(UserDirectories.find(User) == UserDirectories.end());
|
||||
assert(!UserDirectories.contains(User));
|
||||
UserDirectories.insert(std::make_pair(User, HomeDir));
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ void MockTildeExpressionResolver::Clear() {
|
|||
}
|
||||
|
||||
void MockTildeExpressionResolver::SetCurrentUser(StringRef User) {
|
||||
assert(UserDirectories.find(User) != UserDirectories.end());
|
||||
assert(UserDirectories.contains(User));
|
||||
CurrentUser = User;
|
||||
}
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ void PipelineDataTransfer::runOnAffineForOp(AffineForOp forOp) {
|
|||
SmallVector<uint64_t, 8> shifts(forOp.getBody()->getOperations().size());
|
||||
unsigned s = 0;
|
||||
for (auto &op : forOp.getBody()->without_terminator()) {
|
||||
assert(instShiftMap.find(&op) != instShiftMap.end());
|
||||
assert(instShiftMap.contains(&op));
|
||||
shifts[s++] = instShiftMap[&op];
|
||||
|
||||
// Tagging operations with shifts for debugging purposes.
|
||||
|
|
|
@ -1044,7 +1044,7 @@ FailureOr<Value> ModuleImport::convertConstant(llvm::Constant *constant) {
|
|||
// resulting in a conflicting `valueMapping` entry.
|
||||
llvm::Instruction *inst = constExpr->getAsInstruction();
|
||||
auto guard = llvm::make_scope_exit([&]() {
|
||||
assert(noResultOpMapping.find(inst) == noResultOpMapping.end() &&
|
||||
assert(!noResultOpMapping.contains(inst) &&
|
||||
"expected constant expression to return a result");
|
||||
valueMapping.erase(inst);
|
||||
inst->deleteValue();
|
||||
|
|
|
@ -1703,7 +1703,7 @@ void StaticMatcherHelper::populateStaticMatchers(raw_ostream &os) {
|
|||
|
||||
std::string funcName =
|
||||
formatv("static_dag_matcher_{0}", staticMatcherCounter++);
|
||||
assert(matcherNames.find(node) == matcherNames.end());
|
||||
assert(!matcherNames.contains(node));
|
||||
PatternEmitter(dagInfo.second, &opMap, os, *this)
|
||||
.emitStaticMatcher(node, funcName);
|
||||
matcherNames[node] = funcName;
|
||||
|
|
|
@ -850,7 +850,7 @@ void IslNodeBuilder::generateCopyStmt(
|
|||
}
|
||||
|
||||
Value *IslNodeBuilder::materializeNonScopLoopInductionVariable(const Loop *L) {
|
||||
assert(OutsideLoopIterations.find(L) == OutsideLoopIterations.end() &&
|
||||
assert(!OutsideLoopIterations.contains(L) &&
|
||||
"trying to materialize loop induction variable twice");
|
||||
const SCEV *OuterLIV = SE.getAddRecExpr(SE.getUnknown(Builder.getInt64(0)),
|
||||
SE.getUnknown(Builder.getInt64(1)), L,
|
||||
|
|
Loading…
Reference in New Issue
Block a user