Skip to content

Commit d937289

Browse files
[clang] Use llvm::is_contained (NFC)
1 parent 3f33d67 commit d937289

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

clang/lib/Basic/Targets/PPC.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,26 +594,26 @@ bool PPCTargetInfo::initFeatureMap(
594594
}
595595

596596
if (!(ArchDefs & ArchDefinePwr10)) {
597-
if (llvm::find(FeaturesVec, "+mma") != FeaturesVec.end()) {
597+
if (llvm::is_contained(FeaturesVec, "+mma")) {
598598
// MMA operations are not available pre-Power10.
599599
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mmma" << CPU;
600600
return false;
601601
}
602-
if (llvm::find(FeaturesVec, "+pcrel") != FeaturesVec.end()) {
602+
if (llvm::is_contained(FeaturesVec, "+pcrel")) {
603603
// PC-Relative instructions are not available pre-Power10,
604604
// and these instructions also require prefixed instructions support.
605605
Diags.Report(diag::err_opt_not_valid_without_opt)
606606
<< "-mpcrel"
607607
<< "-mcpu=pwr10 -mprefixed";
608608
return false;
609609
}
610-
if (llvm::find(FeaturesVec, "+prefixed") != FeaturesVec.end()) {
610+
if (llvm::is_contained(FeaturesVec, "+prefixed")) {
611611
// Prefixed instructions are not available pre-Power10.
612612
Diags.Report(diag::err_opt_not_valid_without_opt) << "-mprefixed"
613613
<< "-mcpu=pwr10";
614614
return false;
615615
}
616-
if (llvm::find(FeaturesVec, "+paired-vector-memops") != FeaturesVec.end()) {
616+
if (llvm::is_contained(FeaturesVec, "+paired-vector-memops")) {
617617
// Paired vector memops are not available pre-Power10.
618618
Diags.Report(diag::err_opt_not_valid_without_opt)
619619
<< "-mpaired-vector-memops"

clang/lib/Basic/Targets/RISCV.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,9 @@ bool RISCVTargetInfo::initFeatureMap(
235235
// RISCVISAInfo makes implications for ISA features
236236
std::vector<std::string> ImpliedFeatures = (*ParseResult)->toFeatureVector();
237237
// Add non-ISA features like `relax` and `save-restore` back
238-
for (std::string Feature : FeaturesVec) {
239-
if (std::find(begin(ImpliedFeatures), end(ImpliedFeatures), Feature) ==
240-
end(ImpliedFeatures))
238+
for (const std::string &Feature : FeaturesVec)
239+
if (!llvm::is_contained(ImpliedFeatures, Feature))
241240
ImpliedFeatures.push_back(Feature);
242-
}
243241

244242
return TargetInfo::initFeatureMap(Features, Diags, CPU, ImpliedFeatures);
245243
}

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3498,7 +3498,7 @@ bool Sema::checkTargetClonesAttrString(SourceLocation LiteralLoc, StringRef Str,
34983498
return Diag(CurLoc, diag::warn_unsupported_target_attribute)
34993499
<< Unsupported << None << Cur << TargetClones;
35003500

3501-
if (llvm::find(Strings, Cur) != Strings.end() || DefaultIsDupe)
3501+
if (llvm::is_contained(Strings, Cur) || DefaultIsDupe)
35023502
Diag(CurLoc, diag::warn_target_clone_duplicate_options);
35033503
// Note: Add even if there are duplicates, since it changes name mangling.
35043504
Strings.push_back(Cur);

clang/lib/Sema/SemaExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19606,7 +19606,7 @@ class EvaluatedExprMarker : public UsedDeclVisitor<EvaluatedExprMarker> {
1960619606
}
1960719607

1960819608
void Visit(Expr *E) {
19609-
if (std::find(StopAt.begin(), StopAt.end(), E) != StopAt.end())
19609+
if (llvm::is_contained(StopAt, E))
1961019610
return;
1961119611
Inherited::Visit(E);
1961219612
}

0 commit comments

Comments
 (0)