r344859 - Use llvm::{all, any, none}_of instead std::{all, any, none}_of. NFC

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 20 10:53:43 PDT 2018


Author: maskray
Date: Sat Oct 20 10:53:42 2018
New Revision: 344859

URL: http://llvm.org/viewvc/llvm-project?rev=344859&view=rev
Log:
Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFC

Modified:
    cfe/trunk/lib/AST/VTableBuilder.cpp
    cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
    cfe/trunk/lib/Analysis/CloneDetection.cpp
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
    cfe/trunk/lib/Parse/ParseTentative.cpp
    cfe/trunk/lib/Sema/SemaInit.cpp
    cfe/trunk/lib/Sema/SemaLookup.cpp
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp

Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=344859&r1=344858&r2=344859&view=diff
==============================================================================
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Sat Oct 20 10:53:42 2018
@@ -3406,10 +3406,9 @@ static void removeRedundantPaths(std::li
     for (const FullPathTy &OtherPath : FullPaths) {
       if (&SpecificPath == &OtherPath)
         continue;
-      if (std::all_of(SpecificPath.begin(), SpecificPath.end(),
-                      [&](const BaseSubobject &BSO) {
-                        return OtherPath.count(BSO) != 0;
-                      })) {
+      if (llvm::all_of(SpecificPath, [&](const BaseSubobject &BSO) {
+            return OtherPath.count(BSO) != 0;
+          })) {
         return true;
       }
     }
@@ -3485,10 +3484,9 @@ static const FullPathTy *selectBestPath(
       // It's possible that the overrider isn't in this path.  If so, skip it
       // because this path didn't introduce it.
       const CXXRecordDecl *OverridingParent = OverridingMethod->getParent();
-      if (std::none_of(SpecificPath.begin(), SpecificPath.end(),
-                       [&](const BaseSubobject &BSO) {
-                         return BSO.getBase() == OverridingParent;
-                       }))
+      if (llvm::none_of(SpecificPath, [&](const BaseSubobject &BSO) {
+            return BSO.getBase() == OverridingParent;
+          }))
         continue;
       CurrentOverrides.insert(OverridingMethod);
     }

Modified: cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp?rev=344859&r1=344858&r2=344859&view=diff
==============================================================================
--- cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp Sat Oct 20 10:53:42 2018
@@ -144,10 +144,10 @@ DynTypedMatcher DynTypedMatcher::constru
     ast_type_traits::ASTNodeKind SupportedKind,
     std::vector<DynTypedMatcher> InnerMatchers) {
   assert(!InnerMatchers.empty() && "Array must not be empty.");
-  assert(std::all_of(InnerMatchers.begin(), InnerMatchers.end(),
-                     [SupportedKind](const DynTypedMatcher &M) {
-                       return M.canConvertTo(SupportedKind);
-                     }) &&
+  assert(llvm::all_of(InnerMatchers,
+                      [SupportedKind](const DynTypedMatcher &M) {
+                        return M.canConvertTo(SupportedKind);
+                      }) &&
          "InnerMatchers must be convertible to SupportedKind!");
 
   // We must relax the restrict kind here.
@@ -449,7 +449,7 @@ bool HasNameMatcher::matchesNodeUnqualif
   assert(UseUnqualifiedMatch);
   llvm::SmallString<128> Scratch;
   StringRef NodeName = getNodeName(Node, Scratch);
-  return std::any_of(Names.begin(), Names.end(), [&](StringRef Name) {
+  return llvm::any_of(Names, [&](StringRef Name) {
     return consumeNameSuffix(Name, NodeName) && Name.empty();
   });
 }

Modified: cfe/trunk/lib/Analysis/CloneDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CloneDetection.cpp?rev=344859&r1=344858&r2=344859&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CloneDetection.cpp (original)
+++ cfe/trunk/lib/Analysis/CloneDetection.cpp Sat Oct 20 10:53:42 2018
@@ -523,8 +523,7 @@ void CloneConstraint::splitCloneGroups(
       Result.push_back(PotentialGroup);
     }
 
-    assert(std::all_of(Indexes.begin(), Indexes.end(),
-                       [](char c) { return c == 1; }));
+    assert(llvm::all_of(Indexes, [](char c) { return c == 1; }));
   }
   CloneGroups = Result;
 }

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=344859&r1=344858&r2=344859&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Sat Oct 20 10:53:42 2018
@@ -741,8 +741,8 @@ CodeGenTypes::arrangeLLVMFunctionInfo(Ca
                                       FunctionType::ExtInfo info,
                      ArrayRef<FunctionProtoType::ExtParameterInfo> paramInfos,
                                       RequiredArgs required) {
-  assert(std::all_of(argTypes.begin(), argTypes.end(),
-                     [](CanQualType T) { return T.isCanonicalAsParam(); }));
+  assert(llvm::all_of(argTypes,
+                      [](CanQualType T) { return T.isCanonicalAsParam(); }));
 
   // Lookup or create unique function info.
   llvm::FoldingSetNodeID ID;

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=344859&r1=344858&r2=344859&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Sat Oct 20 10:53:42 2018
@@ -2284,14 +2284,13 @@ static bool hasRequiredFeatures(const Sm
       ReqFeatures.begin(), ReqFeatures.end(), [&](StringRef Feature) {
         SmallVector<StringRef, 1> OrFeatures;
         Feature.split(OrFeatures, '|');
-        return std::any_of(OrFeatures.begin(), OrFeatures.end(),
-                           [&](StringRef Feature) {
-                             if (!CallerFeatureMap.lookup(Feature)) {
-                               FirstMissing = Feature.str();
-                               return false;
-                             }
-                             return true;
-                           });
+        return llvm::any_of(OrFeatures, [&](StringRef Feature) {
+          if (!CallerFeatureMap.lookup(Feature)) {
+            FirstMissing = Feature.str();
+            return false;
+          }
+          return true;
+        });
       });
 }
 

Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=344859&r1=344858&r2=344859&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Sat Oct 20 10:53:42 2018
@@ -1160,8 +1160,8 @@ public:
     // Reject any candidate that only resolves to instance members since they
     // aren't viable as standalone identifiers instead of member references.
     if (Candidate.isResolved() && !Candidate.isKeyword() &&
-        std::all_of(Candidate.begin(), Candidate.end(),
-                    [](NamedDecl *ND) { return ND->isCXXInstanceMember(); }))
+        llvm::all_of(Candidate,
+                     [](NamedDecl *ND) { return ND->isCXXInstanceMember(); }))
       return false;
 
     return CorrectionCandidateCallback::ValidateCandidate(Candidate);

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=344859&r1=344858&r2=344859&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Sat Oct 20 10:53:42 2018
@@ -6441,7 +6441,7 @@ static bool isVarOnPath(IndirectLocalPat
 }
 
 static bool pathContainsInit(IndirectLocalPath &Path) {
-  return std::any_of(Path.begin(), Path.end(), [=](IndirectLocalPathEntry E) {
+  return llvm::any_of(Path, [=](IndirectLocalPathEntry E) {
     return E.Kind == IndirectLocalPathEntry::DefaultInit ||
            E.Kind == IndirectLocalPathEntry::VarInit;
   });

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=344859&r1=344858&r2=344859&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Sat Oct 20 10:53:42 2018
@@ -1600,9 +1600,9 @@ bool Sema::isModuleVisible(const Module
     return false;
 
   // Check whether M is transitively exported to an import of the lookup set.
-  return std::any_of(LookupModules.begin(), LookupModules.end(),
-                     [&](const Module *LookupM) {
-                       return LookupM->isModuleVisible(M); });
+  return llvm::any_of(LookupModules, [&](const Module *LookupM) {
+    return LookupM->isModuleVisible(M);
+  });
 }
 
 bool Sema::isVisibleSlow(const NamedDecl *D) {

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=344859&r1=344858&r2=344859&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sat Oct 20 10:53:42 2018
@@ -10997,7 +10997,7 @@ private:
 
     // Note: We explicitly leave Matches unmodified if there isn't a clear best
     // option, so we can potentially give the user a better error
-    if (!std::all_of(Matches.begin(), Matches.end(), IsBestOrInferiorToBest))
+    if (!llvm::all_of(Matches, IsBestOrInferiorToBest))
       return false;
     Matches[0] = *Best;
     Matches.resize(1);

Modified: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp?rev=344859&r1=344858&r2=344859&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp (original)
+++ cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp Sat Oct 20 10:53:42 2018
@@ -845,9 +845,8 @@ void ASTDiff::Impl::matchBottomUp(Mappin
     }
     bool Matched = M.hasSrc(Id1);
     const Node &N1 = T1.getNode(Id1);
-    bool MatchedChildren =
-        std::any_of(N1.Children.begin(), N1.Children.end(),
-                    [&](NodeId Child) { return M.hasSrc(Child); });
+    bool MatchedChildren = llvm::any_of(
+        N1.Children, [&](NodeId Child) { return M.hasSrc(Child); });
     if (Matched || !MatchedChildren)
       continue;
     NodeId Id2 = findCandidate(M, Id1);




More information about the cfe-commits mailing list