Skip to content

Commit 5953233

Browse files
[ADT] Simplify IsSizeLessThanThreshold (NFC) (#160642)
IsSizeLessThanThreshold is used only in AdjustedParamTBase, just a few lines below the declaration. This patch simplifies IsSizeLessThanThreshold by substituting U with T, stripping away the template, and switching to "static constexpr bool.
1 parent f2c268f commit 5953233

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/include/llvm/ADT/FunctionExtras.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,12 @@ template <typename ReturnT, typename... ParamTs> class UniqueFunctionBase {
9090
template <typename T> struct AdjustedParamTBase {
9191
static_assert(!std::is_reference<T>::value,
9292
"references should be handled by template specialization");
93-
template <typename U>
94-
using IsSizeLessThanThresholdT =
95-
std::bool_constant<sizeof(U) <= 2 * sizeof(void *)>;
93+
static constexpr bool IsSizeLessThanThreshold =
94+
sizeof(T) <= 2 * sizeof(void *);
9695
using type =
9796
std::conditional_t<std::is_trivially_copy_constructible<T>::value &&
9897
std::is_trivially_move_constructible<T>::value &&
99-
IsSizeLessThanThresholdT<T>::value,
98+
IsSizeLessThanThreshold,
10099
T, T &>;
101100
};
102101

0 commit comments

Comments
 (0)