[clang] d937289 - [clang] Use llvm::is_contained (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 5 17:56:47 PDT 2022
Author: Kazu Hirata
Date: 2022-06-05T17:56:40-07:00
New Revision: d93728978b24da15c1a9e2847c36d031aa737f33
URL: https://github.com/llvm/llvm-project/commit/d93728978b24da15c1a9e2847c36d031aa737f33
DIFF: https://github.com/llvm/llvm-project/commit/d93728978b24da15c1a9e2847c36d031aa737f33.diff
LOG: [clang] Use llvm::is_contained (NFC)
Added:
Modified:
clang/lib/Basic/Targets/PPC.cpp
clang/lib/Basic/Targets/RISCV.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaExpr.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp
index 7de40b5db04a3..9120808e298df 100644
--- a/clang/lib/Basic/Targets/PPC.cpp
+++ b/clang/lib/Basic/Targets/PPC.cpp
@@ -594,12 +594,12 @@ bool PPCTargetInfo::initFeatureMap(
}
if (!(ArchDefs & ArchDefinePwr10)) {
- if (llvm::find(FeaturesVec, "+mma") != FeaturesVec.end()) {
+ if (llvm::is_contained(FeaturesVec, "+mma")) {
// MMA operations are not available pre-Power10.
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mmma" << CPU;
return false;
}
- if (llvm::find(FeaturesVec, "+pcrel") != FeaturesVec.end()) {
+ if (llvm::is_contained(FeaturesVec, "+pcrel")) {
// PC-Relative instructions are not available pre-Power10,
// and these instructions also require prefixed instructions support.
Diags.Report(diag::err_opt_not_valid_without_opt)
@@ -607,13 +607,13 @@ bool PPCTargetInfo::initFeatureMap(
<< "-mcpu=pwr10 -mprefixed";
return false;
}
- if (llvm::find(FeaturesVec, "+prefixed") != FeaturesVec.end()) {
+ if (llvm::is_contained(FeaturesVec, "+prefixed")) {
// Prefixed instructions are not available pre-Power10.
Diags.Report(diag::err_opt_not_valid_without_opt) << "-mprefixed"
<< "-mcpu=pwr10";
return false;
}
- if (llvm::find(FeaturesVec, "+paired-vector-memops") != FeaturesVec.end()) {
+ if (llvm::is_contained(FeaturesVec, "+paired-vector-memops")) {
// Paired vector memops are not available pre-Power10.
Diags.Report(diag::err_opt_not_valid_without_opt)
<< "-mpaired-vector-memops"
diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp
index cc51bf78f0c1a..098bf21d6caa0 100644
--- a/clang/lib/Basic/Targets/RISCV.cpp
+++ b/clang/lib/Basic/Targets/RISCV.cpp
@@ -235,11 +235,9 @@ bool RISCVTargetInfo::initFeatureMap(
// RISCVISAInfo makes implications for ISA features
std::vector<std::string> ImpliedFeatures = (*ParseResult)->toFeatureVector();
// Add non-ISA features like `relax` and `save-restore` back
- for (std::string Feature : FeaturesVec) {
- if (std::find(begin(ImpliedFeatures), end(ImpliedFeatures), Feature) ==
- end(ImpliedFeatures))
+ for (const std::string &Feature : FeaturesVec)
+ if (!llvm::is_contained(ImpliedFeatures, Feature))
ImpliedFeatures.push_back(Feature);
- }
return TargetInfo::initFeatureMap(Features, Diags, CPU, ImpliedFeatures);
}
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index b629fcb91b25a..ef01bef2a9dff 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3498,7 +3498,7 @@ bool Sema::checkTargetClonesAttrString(SourceLocation LiteralLoc, StringRef Str,
return Diag(CurLoc, diag::warn_unsupported_target_attribute)
<< Unsupported << None << Cur << TargetClones;
- if (llvm::find(Strings, Cur) != Strings.end() || DefaultIsDupe)
+ if (llvm::is_contained(Strings, Cur) || DefaultIsDupe)
Diag(CurLoc, diag::warn_target_clone_duplicate_options);
// Note: Add even if there are duplicates, since it changes name mangling.
Strings.push_back(Cur);
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 6627aaf3e6d88..01a3599087f84 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -19606,7 +19606,7 @@ class EvaluatedExprMarker : public UsedDeclVisitor<EvaluatedExprMarker> {
}
void Visit(Expr *E) {
- if (std::find(StopAt.begin(), StopAt.end(), E) != StopAt.end())
+ if (llvm::is_contained(StopAt, E))
return;
Inherited::Visit(E);
}
More information about the cfe-commits
mailing list