[libc-commits] [PATCH] D79256: [libc] Improve information printed on failure of a math test which uses MPFR.

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon May 4 19:55:45 PDT 2020


abrachet added inline comments.


================
Comment at: libc/utils/CPP/TypeTraits.h:57
+
+template <typename T> using RemoveCVType = typename RemoveCV<T>::Type;
+
----------------
I believe that `typename` shouldn't be required and `RemoveCV<T>::Type` should be enough.


================
Comment at: libc/utils/MPFRWrapper/MPFRUtils.cpp:11
 
-#include <iostream>
+#include "llvm/Support/raw_ostream.h"
+
----------------
No longer needed, I believe


================
Comment at: libc/utils/MPFRWrapper/MPFRUtils.cpp:29-41
+  template <typename XType,
+            cpp::EnableIfType<cpp::IsSame<float, XType>::Value, int> = 0>
+  explicit MPFRNumber(XType x) {
     mpfr_init2(value, mpfrPrecision);
     mpfr_set_flt(value, x, MPFR_RNDN);
   }
 
----------------
Do these need to be enable if specializations could they just be overloads?


================
Comment at: libc/utils/MPFRWrapper/MPFRUtils.cpp:43-44
+
+  template <typename XType,
+            cpp::EnableIfType<cpp::IsFloatingPointType<XType>::Value, int> = 0>
+  MPFRNumber(Operation op, XType rawValue) {
----------------
Could this also be just a static_assert?


================
Comment at: libc/utils/MPFRWrapper/MPFRUtils.h:75-77
+template <typename T,
+          __llvm_libc::cpp::EnableIfType<
+              __llvm_libc::cpp::IsFloatingPointType<T>::Value, int> = 0>
----------------
Can this one also be `static_assert`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79256/new/

https://reviews.llvm.org/D79256





More information about the libc-commits mailing list