[clang] d3b9970 - [RISCV] Use llvm::none_of to replace a loop. NFC

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 16:30:35 PDT 2022


Author: Craig Topper
Date: 2022-09-06T16:24:23-07:00
New Revision: d3b99703427e354fe9eae6c19971f5b1d77aa2b4

URL: https://github.com/llvm/llvm-project/commit/d3b99703427e354fe9eae6c19971f5b1d77aa2b4
DIFF: https://github.com/llvm/llvm-project/commit/d3b99703427e354fe9eae6c19971f5b1d77aa2b4.diff

LOG: [RISCV] Use llvm::none_of to replace a loop. NFC

Added: 
    

Modified: 
    clang/lib/Sema/SemaChecking.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 5b2d28cf6ef2..fcdc866e6947 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4338,15 +4338,9 @@ bool Sema::CheckRISCVBuiltinFunctionCall(const TargetInfo &TI,
   for (StringRef F : ReqFeatures) {
     SmallVector<StringRef> ReqOpFeatures;
     F.split(ReqOpFeatures, '|');
-    bool HasFeature = false;
-    for (StringRef OF : ReqOpFeatures) {
-      if (TI.hasFeature(OF)) {
-        HasFeature = true;
-        continue;
-      }
-    }
 
-    if (!HasFeature) {
+    if (llvm::none_of(ReqOpFeatures,
+                      [&TI](StringRef OF) { return TI.hasFeature(OF); })) {
       std::string FeatureStrs;
       for (StringRef OF : ReqOpFeatures) {
         // If the feature is 64bit, alter the string so it will print better in


        


More information about the cfe-commits mailing list