[PATCH] D36049: [Resubmitted] Remove uses of deprecated std::unary_function, binary_function, and pointer_to_unary_function.

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 11:24:01 PDT 2017


This LGTM.

Brent Lewis via Phabricator <reviews at reviews.llvm.org> writes:
> coder0xff created this revision.
> Herald added a subscriber: MatzeB.
>
> https://reviews.llvm.org/D36049
>
> Files:
>   include/llvm/ADT/STLExtras.h
>   include/llvm/CodeGen/LatencyPriorityQueue.h
>   include/llvm/CodeGen/MachineBasicBlock.h
>   include/llvm/CodeGen/ResourcePriorityQueue.h
>   include/llvm/IR/Instructions.h
>   include/llvm/Target/TargetRegisterInfo.h
>   lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
>   utils/TableGen/SequenceToOffsetTable.h
>
> Index: utils/TableGen/SequenceToOffsetTable.h
> ===================================================================
> --- utils/TableGen/SequenceToOffsetTable.h
> +++ utils/TableGen/SequenceToOffsetTable.h
> @@ -37,7 +37,11 @@
>  
>    // Define a comparator for SeqT that sorts a suffix immediately before a
>    // sequence with that suffix.
> -  struct SeqLess : public std::binary_function<SeqT, SeqT, bool> {
> +  struct SeqLess {
> +    using first_argument_type = SeqT;
> +    using second_argument_type = SeqT;
> +    using result_type = bool;
> +
>      Less L;
>      bool operator()(const SeqT &A, const SeqT &B) const {
>        return std::lexicographical_compare(A.rbegin(), A.rend(),
> Index: lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
> ===================================================================
> --- lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
> +++ lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
> @@ -1563,7 +1563,11 @@
>  namespace {
>  class RegReductionPQBase;
>  
> -struct queue_sort : public std::binary_function<SUnit*, SUnit*, bool> {
> +struct queue_sort {
> +  using first_argument_type = SUnit*;
> +  using second_argument_type = SUnit*;
> +  using result_type = bool;
> +
>    bool isReady(SUnit* SU, unsigned CurCycle) const { return true; }
>  };
>  
> Index: include/llvm/Target/TargetRegisterInfo.h
> ===================================================================
> --- include/llvm/Target/TargetRegisterInfo.h
> +++ include/llvm/Target/TargetRegisterInfo.h
> @@ -1114,7 +1114,10 @@
>  };
>  
>  // This is useful when building IndexedMaps keyed on virtual registers
> -struct VirtReg2IndexFunctor : public std::unary_function<unsigned, unsigned> {
> +struct VirtReg2IndexFunctor {
> +  using argument_type = unsigned;
> +  using result_type = unsigned;
> +
>    unsigned operator()(unsigned Reg) const {
>      return TargetRegisterInfo::virtReg2Index(Reg);
>    }
> Index: include/llvm/IR/Instructions.h
> ===================================================================
> --- include/llvm/IR/Instructions.h
> +++ include/llvm/IR/Instructions.h
> @@ -4195,11 +4195,10 @@
>    }
>  
>  public:
> -  using DerefFnTy = std::pointer_to_unary_function<Value *, BasicBlock *>;
> +  using DerefFnTy = BasicBlock* (*)(Value *);
>    using handler_iterator = mapped_iterator<op_iterator, DerefFnTy>;
>    using handler_range = iterator_range<handler_iterator>;
> -  using ConstDerefFnTy =
> -      std::pointer_to_unary_function<const Value *, const BasicBlock *>;
> +  using ConstDerefFnTy = const BasicBlock* (*)(const Value *);
>    using const_handler_iterator =
>        mapped_iterator<const_op_iterator, ConstDerefFnTy>;
>    using const_handler_range = iterator_range<const_handler_iterator>;
> Index: include/llvm/CodeGen/ResourcePriorityQueue.h
> ===================================================================
> --- include/llvm/CodeGen/ResourcePriorityQueue.h
> +++ include/llvm/CodeGen/ResourcePriorityQueue.h
> @@ -28,7 +28,11 @@
>    class ResourcePriorityQueue;
>  
>    /// Sorting functions for the Available queue.
> -  struct resource_sort : public std::binary_function<SUnit*, SUnit*, bool> {
> +  struct resource_sort {
> +    using first_argument_type = SUnit*;
> +    using second_argument_type = SUnit*;
> +    using result_type = bool;
> +
>      ResourcePriorityQueue *PQ;
>      explicit resource_sort(ResourcePriorityQueue *pq) : PQ(pq) {}
>  
> Index: include/llvm/CodeGen/MachineBasicBlock.h
> ===================================================================
> --- include/llvm/CodeGen/MachineBasicBlock.h
> +++ include/llvm/CodeGen/MachineBasicBlock.h
> @@ -762,8 +762,10 @@
>  raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB);
>  
>  // This is useful when building IndexedMaps keyed on basic block pointers.
> -struct MBB2NumberFunctor :
> -  public std::unary_function<const MachineBasicBlock*, unsigned> {
> +struct MBB2NumberFunctor {
> +  using argument_type = const MachineBasicBlock*;
> +  using result_type = unsigned;
> +
>    unsigned operator()(const MachineBasicBlock *MBB) const {
>      return MBB->getNumber();
>    }
> Index: include/llvm/CodeGen/LatencyPriorityQueue.h
> ===================================================================
> --- include/llvm/CodeGen/LatencyPriorityQueue.h
> +++ include/llvm/CodeGen/LatencyPriorityQueue.h
> @@ -22,7 +22,11 @@
>    class LatencyPriorityQueue;
>  
>    /// Sorting functions for the Available queue.
> -  struct latency_sort : public std::binary_function<SUnit*, SUnit*, bool> {
> +  struct latency_sort {
> +    using first_argument_type = SUnit*;
> +    using second_argument_type = SUnit*;
> +    using result_Type = bool;
> +
>      LatencyPriorityQueue *PQ;
>      explicit latency_sort(LatencyPriorityQueue *pq) : PQ(pq) {}
>  
> Index: include/llvm/ADT/STLExtras.h
> ===================================================================
> --- include/llvm/ADT/STLExtras.h
> +++ include/llvm/ADT/STLExtras.h
> @@ -57,7 +57,10 @@
>  //===----------------------------------------------------------------------===//
>  
>  template<class Ty>
> -struct identity : public std::unary_function<Ty, Ty> {
> +struct identity {
> +  using argument_type = Ty;
> +  using result_type = Ty;
> +
>    Ty &operator()(Ty &self) const {
>      return self;
>    }
> @@ -67,14 +70,22 @@
>  };
>  
>  template<class Ty>
> -struct less_ptr : public std::binary_function<Ty, Ty, bool> {
> +struct less_ptr {
> +  using first_argument_type = Ty;
> +  using second_argument_type = Ty;
> +  using result_Type = bool;
> +
>    bool operator()(const Ty* left, const Ty* right) const {
>      return *left < *right;
>    }
>  };
>  
>  template<class Ty>
> -struct greater_ptr : public std::binary_function<Ty, Ty, bool> {
> +struct greater_ptr {
> +  using first_argument_type = Ty;
> +  using second_argument_type = Ty;
> +  using result_Type = bool;
> +
>    bool operator()(const Ty* left, const Ty* right) const {
>      return *right < *left;
>    }


More information about the llvm-commits mailing list