[llvm] 5953233 - [ADT] Simplify IsSizeLessThanThreshold (NFC) (#160642)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 25 08:51:35 PDT 2025
Author: Kazu Hirata
Date: 2025-09-25T08:51:31-07:00
New Revision: 5953233edeb8af419b67116cefbeee8b15940cb9
URL: https://github.com/llvm/llvm-project/commit/5953233edeb8af419b67116cefbeee8b15940cb9
DIFF: https://github.com/llvm/llvm-project/commit/5953233edeb8af419b67116cefbeee8b15940cb9.diff
LOG: [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.
Added:
Modified:
llvm/include/llvm/ADT/FunctionExtras.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/FunctionExtras.h b/llvm/include/llvm/ADT/FunctionExtras.h
index 12a2dc36e1af0..2498cb7796f1f 100644
--- a/llvm/include/llvm/ADT/FunctionExtras.h
+++ b/llvm/include/llvm/ADT/FunctionExtras.h
@@ -90,13 +90,12 @@ template <typename ReturnT, typename... ParamTs> class UniqueFunctionBase {
template <typename T> struct AdjustedParamTBase {
static_assert(!std::is_reference<T>::value,
"references should be handled by template specialization");
- template <typename U>
- using IsSizeLessThanThresholdT =
- std::bool_constant<sizeof(U) <= 2 * sizeof(void *)>;
+ static constexpr bool IsSizeLessThanThreshold =
+ sizeof(T) <= 2 * sizeof(void *);
using type =
std::conditional_t<std::is_trivially_copy_constructible<T>::value &&
std::is_trivially_move_constructible<T>::value &&
- IsSizeLessThanThresholdT<T>::value,
+ IsSizeLessThanThreshold,
T, T &>;
};
More information about the llvm-commits
mailing list