[libc] [llvm] [libc] Remove UB specializations of type traits for `BigInt` (PR #84035)

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 13:01:51 PST 2024


================
@@ -38,7 +38,8 @@ TestLogger &operator<<(TestLogger &logger, Location Loc) {
 // When the value is UInt128, __uint128_t or wider, show its hexadecimal
 // digits.
 template <typename T>
-cpp::enable_if_t<cpp::is_integral_v<T> && (sizeof(T) > sizeof(uint64_t)),
+cpp::enable_if_t<(cpp::is_integral_v<T> && (sizeof(T) > sizeof(uint64_t))) ||
+                     cpp::is_big_int_v<T>,
----------------
nickdesaulniers wrote:

> And cpp::is_big_int_v<T> means BigInt instantiation.

Ah!

> (that's the purpose of this patch)

Ok, now I see how it all fits together.  Sorry for being slow on the uptake, but I do appreciate the patient explanations!

---

There's no equivalent to `is_big_int_v` in the `std::` namespace.  I was under the impression that our `cpp::` is meant to mirror things in `std::`?  As that was the intent behind these todos added in https://github.com/llvm/llvm-project/pull/84035/commits/48b0bc837085a38ff1de33010d9222363f70238f.  If those should be moved out of bit.h, should they (and `cpp::is_big_int<T>`) also be moved out of the `cpp::` namespace?

https://libc.llvm.org/dev/code_style.html#setting-errno-from-runtime-code was the only reference I found to any kind of `cpp::` convention; you would know better than I what our project's intent is with `cpp::`.

Or, perhaps am I conflating what does/does not belong under `libc/src/__support/CPP` with what does/does not belong in the `cpp::` namespace?

https://github.com/llvm/llvm-project/pull/84035


More information about the llvm-commits mailing list