From 370db67f7d16fd09d037d9cf3b7ff8f6cd41c0a4 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Tue, 30 Aug 2022 16:49:44 -0700 Subject: Remove use of std::unary_function and std::binary_function These types were deprecated in C++11 and removed in C++17. Upstream libc++ now removes the declarations for new-enough C++ modes. Bug: http://b/175635923 Test: treehugger Change-Id: Ib863ef20c69ed9da115c0427dc38a61ecdec2606 --- include/llvm/ADT/STLExtras.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index abd39dacc671..a032efa5cee2 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -36,7 +36,11 @@ namespace llvm { //===----------------------------------------------------------------------===// template -struct identity : public std::unary_function { +struct identity { + // Android: In upstream LLVM, identity used to inherit from + // std::unary_function, so use Ty here instead of Ty&. + using argument_type = Ty; + using result_type = Ty; Ty &operator()(Ty &self) const { return self; } @@ -46,14 +50,24 @@ struct identity : public std::unary_function { }; template -struct less_ptr : public std::binary_function { +struct less_ptr { + // Android: In upstream LLVM, less_ptr used to inherit from + // std::binary_function, so use Ty here instead of const Ty*. + 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 -struct greater_ptr : public std::binary_function { +struct greater_ptr { + // Android: In upstream LLVM, greater_ptr used to inherit from + // std::binary_function, so use Ty here instead of const Ty*. + 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; } -- cgit v1.2.3