Remove all uses of std::mem_fun and std::bind1st removed in C++17.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 23 Mar 2017 23:17:58 +0000 (23:17 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 23 Mar 2017 23:17:58 +0000 (23:17 +0000)
llvm-svn: 298657

clang/include/clang/AST/DeclContextInternals.h
clang/include/clang/AST/DeclObjC.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
clang/lib/CodeGen/CGCall.cpp
clang/lib/Sema/Sema.cpp

index ff37758..eb86526 100644 (file)
@@ -131,7 +131,7 @@ public:
     } else {
       DeclsTy &Vec = *getAsVector();
       Vec.erase(std::remove_if(Vec.begin(), Vec.end(),
-                               std::mem_fun(&Decl::isFromASTFile)),
+                               [](Decl *D) { return D->isFromASTFile(); }),
                 Vec.end());
       // Don't have any external decls any more.
       Data = DeclsAndHasExternalTy(&Vec, false);
index c2a09cd..26c0cbe 100644 (file)
@@ -381,15 +381,17 @@ public:
                        ArrayRef<SourceLocation> SelLocs = llvm::None);
 
   // Iterator access to parameter types.
-  typedef std::const_mem_fun_t<QualType, ParmVarDecl> deref_fun;
-  typedef llvm::mapped_iterator<param_const_iterator, deref_fun>
-  param_type_iterator;
+  struct GetTypeFn {
+    QualType operator()(const ParmVarDecl *PD) const { return PD->getType(); }
+  };
+  typedef llvm::mapped_iterator<param_const_iterator, GetTypeFn>
+      param_type_iterator;
 
   param_type_iterator param_type_begin() const {
-    return llvm::map_iterator(param_begin(), deref_fun(&ParmVarDecl::getType));
+    return llvm::map_iterator(param_begin(), GetTypeFn());
   }
   param_type_iterator param_type_end() const {
-    return llvm::map_iterator(param_end(), deref_fun(&ParmVarDecl::getType));
+    return llvm::map_iterator(param_end(), GetTypeFn());
   }
 
   /// createImplicitParams - Used to lazily create the self and cmd
index aaecf38..fa7ee62 100644 (file)
@@ -383,7 +383,9 @@ public:
 
   // Iterator access to formal parameters and their types.
 private:
-  typedef std::const_mem_fun_t<QualType, ParmVarDecl> get_type_fun;
+  struct GetTypeFn {
+    QualType operator()(ParmVarDecl *PD) const { return PD->getType(); }
+  };
 
 public:
   /// Return call's formal parameters.
@@ -393,7 +395,7 @@ public:
   /// correspond with the argument value returned by \c getArgSVal(0).
   virtual ArrayRef<ParmVarDecl*> parameters() const = 0;
 
-  typedef llvm::mapped_iterator<ArrayRef<ParmVarDecl*>::iterator, get_type_fun>
+  typedef llvm::mapped_iterator<ArrayRef<ParmVarDecl*>::iterator, GetTypeFn>
     param_type_iterator;
 
   /// Returns an iterator over the types of the call's formal parameters.
@@ -402,13 +404,11 @@ public:
   /// definition because it represents a public interface, and probably has
   /// more annotations.
   param_type_iterator param_type_begin() const {
-    return llvm::map_iterator(parameters().begin(),
-                              get_type_fun(&ParmVarDecl::getType));
+    return llvm::map_iterator(parameters().begin(), GetTypeFn());
   }
   /// \sa param_type_begin()
   param_type_iterator param_type_end() const {
-    return llvm::map_iterator(parameters().end(),
-                              get_type_fun(&ParmVarDecl::getType));
+    return llvm::map_iterator(parameters().end(), GetTypeFn());
   }
 
   // For debugging purposes only
index e56fe2c..7e8d516 100644 (file)
@@ -719,7 +719,7 @@ CodeGenTypes::arrangeLLVMFunctionInfo(CanQualType resultType,
                      ArrayRef<FunctionProtoType::ExtParameterInfo> paramInfos,
                                       RequiredArgs required) {
   assert(std::all_of(argTypes.begin(), argTypes.end(),
-                     std::mem_fun_ref(&CanQualType::isCanonicalAsParam)));
+                     [](CanQualType T) { return T.isCanonicalAsParam(); }));
 
   // Lookup or create unique function info.
   llvm::FoldingSetNodeID ID;
index 1677d34..057e43f 100644 (file)
@@ -744,7 +744,9 @@ void Sema::ActOnEndOfTranslationUnit() {
   UnusedFileScopedDecls.erase(
       std::remove_if(UnusedFileScopedDecls.begin(nullptr, true),
                      UnusedFileScopedDecls.end(),
-                     std::bind1st(std::ptr_fun(ShouldRemoveFromUnused), this)),
+                     [this](const DeclaratorDecl *DD) {
+                       return ShouldRemoveFromUnused(this, DD);
+                     }),
       UnusedFileScopedDecls.end());
 
   if (TUKind == TU_Prefix) {