1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

Remove usages of deprecated std::unary_function and std::binary_function.

These are removed in C++17. We still have some users of
unary_function::argument_type, so just spell that typedef out. No
functionality change intended.

Note that many of the argument types are actually wrong :)

llvm-svn: 313287
This commit is contained in:
Benjamin Kramer 2017-09-14 18:33:25 +00:00
parent f18ea9e4aa
commit b6a866ac7b
7 changed files with 12 additions and 13 deletions

View File

@ -56,8 +56,8 @@ using ValueOfRange = typename std::remove_reference<decltype(
// Extra additions to <functional>
//===----------------------------------------------------------------------===//
template<class Ty>
struct identity : public std::unary_function<Ty, Ty> {
template <class Ty> struct identity {
using argument_type = Ty;
Ty &operator()(Ty &self) const {
return self;
}
@ -66,15 +66,13 @@ struct identity : public std::unary_function<Ty, Ty> {
}
};
template<class Ty>
struct less_ptr : public std::binary_function<Ty, Ty, bool> {
template <class Ty> struct less_ptr {
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> {
template <class Ty> struct greater_ptr {
bool operator()(const Ty* left, const Ty* right) const {
return *right < *left;
}

View File

@ -22,7 +22,7 @@ namespace llvm {
class LatencyPriorityQueue;
/// Sorting functions for the Available queue.
struct latency_sort : public std::binary_function<SUnit*, SUnit*, bool> {
struct latency_sort {
LatencyPriorityQueue *PQ;
explicit latency_sort(LatencyPriorityQueue *pq) : PQ(pq) {}

View File

@ -762,8 +762,8 @@ private:
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 *;
unsigned operator()(const MachineBasicBlock *MBB) const {
return MBB->getNumber();
}

View File

@ -28,7 +28,7 @@ namespace llvm {
class ResourcePriorityQueue;
/// Sorting functions for the Available queue.
struct resource_sort : public std::binary_function<SUnit*, SUnit*, bool> {
struct resource_sort {
ResourcePriorityQueue *PQ;
explicit resource_sort(ResourcePriorityQueue *pq) : PQ(pq) {}

View File

@ -1124,7 +1124,8 @@ public:
};
// This is useful when building IndexedMaps keyed on virtual registers
struct VirtReg2IndexFunctor : public std::unary_function<unsigned, unsigned> {
struct VirtReg2IndexFunctor {
using argument_type = unsigned;
unsigned operator()(unsigned Reg) const {
return TargetRegisterInfo::virtReg2Index(Reg);
}

View File

@ -1575,7 +1575,7 @@ void ScheduleDAGRRList::ListScheduleBottomUp() {
namespace {
class RegReductionPQBase;
struct queue_sort : public std::binary_function<SUnit*, SUnit*, bool> {
struct queue_sort {
bool isReady(SUnit* SU, unsigned CurCycle) const { return true; }
};

View File

@ -37,7 +37,7 @@ class SequenceToOffsetTable {
// 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 {
Less L;
bool operator()(const SeqT &A, const SeqT &B) const {
return std::lexicographical_compare(A.rbegin(), A.rend(),