[llvm] 03c3c2d - [llvm] Use std::remove_reference_t (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 3 23:27:54 PDT 2022
Author: Kazu Hirata
Date: 2022-09-03T23:27:22-07:00
New Revision: 03c3c2db103053d734ac420d82dcd9a686776922
URL: https://github.com/llvm/llvm-project/commit/03c3c2db103053d734ac420d82dcd9a686776922
DIFF: https://github.com/llvm/llvm-project/commit/03c3c2db103053d734ac420d82dcd9a686776922.diff
LOG: [llvm] Use std::remove_reference_t (NFC)
Added:
Modified:
llvm/include/llvm/ADT/ImmutableList.h
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/ADT/STLFunctionalExtras.h
llvm/include/llvm/ADT/SmallVector.h
llvm/include/llvm/Support/Error.h
llvm/lib/Passes/PassBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/ImmutableList.h b/llvm/include/llvm/ADT/ImmutableList.h
index 185634cc8885b..0b6f5e4d16368 100644
--- a/llvm/include/llvm/ADT/ImmutableList.h
+++ b/llvm/include/llvm/ADT/ImmutableList.h
@@ -94,7 +94,7 @@ class ImmutableList {
bool operator==(const iterator& I) const { return L == I.L; }
bool operator!=(const iterator& I) const { return L != I.L; }
const value_type& operator*() const { return L->getHead(); }
- const typename std::remove_reference<value_type>::type* operator->() const {
+ const std::remove_reference_t<value_type> *operator->() const {
return &L->getHead();
}
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 4149071279c16..34c5058806b19 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -57,8 +57,8 @@ template <typename RangeT>
using IterOfRange = decltype(std::begin(std::declval<RangeT &>()));
template <typename RangeT>
-using ValueOfRange = typename std::remove_reference<decltype(
- *std::begin(std::declval<RangeT &>()))>::type;
+using ValueOfRange =
+ std::remove_reference_t<decltype(*std::begin(std::declval<RangeT &>()))>;
} // end namespace detail
@@ -359,8 +359,7 @@ template <typename Ty> class has_rbegin_impl {
/// Metafunction to determine if T& or T has a member called rbegin().
template <typename Ty>
-struct has_rbegin : has_rbegin_impl<typename std::remove_reference<Ty>::type> {
-};
+struct has_rbegin : has_rbegin_impl<std::remove_reference_t<Ty>> {};
// Returns an iterator_range over the given container which iterates in reverse.
template <typename ContainerTy> auto reverse(ContainerTy &&C) {
@@ -785,7 +784,7 @@ auto deref_or_none(const Iter &I, const Iter &End) -> llvm::Optional<
template <typename Iter> struct ZipLongestItemType {
using type = llvm::Optional<std::remove_const_t<
- typename std::remove_reference<decltype(*std::declval<Iter>())>::type>>;
+ std::remove_reference_t<decltype(*std::declval<Iter>())>>>;
};
template <typename... Iters> struct ZipLongestTupleType {
diff --git a/llvm/include/llvm/ADT/STLFunctionalExtras.h b/llvm/include/llvm/ADT/STLFunctionalExtras.h
index ebe1b1521a5d7..6d7e5b53f2a2d 100644
--- a/llvm/include/llvm/ADT/STLFunctionalExtras.h
+++ b/llvm/include/llvm/ADT/STLFunctionalExtras.h
@@ -61,7 +61,7 @@ class function_ref<Ret(Params...)> {
std::is_convertible<decltype(std::declval<Callable>()(
std::declval<Params>()...)),
Ret>::value> * = nullptr)
- : callback(callback_fn<typename std::remove_reference<Callable>::type>),
+ : callback(callback_fn<std::remove_reference_t<Callable>>),
callable(reinterpret_cast<intptr_t>(&callable)) {}
Ret operator()(Params ...params) const {
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index fbb42ce40e24f..7770e3b5b1992 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -1271,8 +1271,8 @@ inline size_t capacity_in_bytes(const SmallVector<T, N> &X) {
template <typename RangeType>
using ValueTypeFromRangeType =
- std::remove_const_t<typename std::remove_reference<decltype(*std::begin(
- std::declval<RangeType &>()))>::type>;
+ std::remove_const_t<std::remove_reference_t<decltype(*std::begin(
+ std::declval<RangeType &>()))>>;
/// Given a range of type R, iterate the entire range and return a
/// SmallVector with elements of the vector. This is useful, for example,
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index fe56341b3083e..1eb498fbd9131 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -822,8 +822,8 @@ T& cantFail(Expected<T&> ValOrErr, const char *Msg = nullptr) {
/// ErrorInfo types.
template <typename HandlerT>
class ErrorHandlerTraits
- : public ErrorHandlerTraits<decltype(
- &std::remove_reference<HandlerT>::type::operator())> {};
+ : public ErrorHandlerTraits<
+ decltype(&std::remove_reference_t<HandlerT>::operator())> {};
// Specialization functions of the form 'Error (const ErrT&)'.
template <typename ErrT> class ErrorHandlerTraits<Error (&)(ErrT &)> {
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 1de1d89d8512d..0f30191182600 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -1189,12 +1189,12 @@ Error PassBuilder::parseModulePass(ModulePassManager &MPM,
if (Name == "require<" NAME ">") { \
MPM.addPass( \
RequireAnalysisPass< \
- std::remove_reference<decltype(CREATE_PASS)>::type, Module>()); \
+ std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
return Error::success(); \
} \
if (Name == "invalidate<" NAME ">") { \
MPM.addPass(InvalidateAnalysisPass< \
- std::remove_reference<decltype(CREATE_PASS)>::type>()); \
+ std::remove_reference_t<decltype(CREATE_PASS)>>()); \
return Error::success(); \
}
#define CGSCC_PASS(NAME, CREATE_PASS) \
@@ -1323,14 +1323,14 @@ Error PassBuilder::parseCGSCCPass(CGSCCPassManager &CGPM,
#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
if (Name == "require<" NAME ">") { \
CGPM.addPass(RequireAnalysisPass< \
- std::remove_reference<decltype(CREATE_PASS)>::type, \
+ std::remove_reference_t<decltype(CREATE_PASS)>, \
LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
CGSCCUpdateResult &>()); \
return Error::success(); \
} \
if (Name == "invalidate<" NAME ">") { \
CGPM.addPass(InvalidateAnalysisPass< \
- std::remove_reference<decltype(CREATE_PASS)>::type>()); \
+ std::remove_reference_t<decltype(CREATE_PASS)>>()); \
return Error::success(); \
}
#define FUNCTION_PASS(NAME, CREATE_PASS) \
@@ -1445,12 +1445,12 @@ Error PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
if (Name == "require<" NAME ">") { \
FPM.addPass( \
RequireAnalysisPass< \
- std::remove_reference<decltype(CREATE_PASS)>::type, Function>()); \
+ std::remove_reference_t<decltype(CREATE_PASS)>, Function>()); \
return Error::success(); \
} \
if (Name == "invalidate<" NAME ">") { \
FPM.addPass(InvalidateAnalysisPass< \
- std::remove_reference<decltype(CREATE_PASS)>::type>()); \
+ std::remove_reference_t<decltype(CREATE_PASS)>>()); \
return Error::success(); \
}
// FIXME: UseMemorySSA is set to false. Maybe we could do things like:
@@ -1541,14 +1541,14 @@ Error PassBuilder::parseLoopPass(LoopPassManager &LPM,
#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
if (Name == "require<" NAME ">") { \
LPM.addPass(RequireAnalysisPass< \
- std::remove_reference<decltype(CREATE_PASS)>::type, Loop, \
+ std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
LoopAnalysisManager, LoopStandardAnalysisResults &, \
LPMUpdater &>()); \
return Error::success(); \
} \
if (Name == "invalidate<" NAME ">") { \
LPM.addPass(InvalidateAnalysisPass< \
- std::remove_reference<decltype(CREATE_PASS)>::type>()); \
+ std::remove_reference_t<decltype(CREATE_PASS)>>()); \
return Error::success(); \
}
#include "PassRegistry.def"
@@ -1564,13 +1564,13 @@ bool PassBuilder::parseAAPassName(AAManager &AA, StringRef Name) {
#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
if (Name == NAME) { \
AA.registerModuleAnalysis< \
- std::remove_reference<decltype(CREATE_PASS)>::type>(); \
+ std::remove_reference_t<decltype(CREATE_PASS)>>(); \
return true; \
}
#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
if (Name == NAME) { \
AA.registerFunctionAnalysis< \
- std::remove_reference<decltype(CREATE_PASS)>::type>(); \
+ std::remove_reference_t<decltype(CREATE_PASS)>>(); \
return true; \
}
#include "PassRegistry.def"
More information about the llvm-commits
mailing list