[libc-commits] [PATCH] D143595: [libc][NFC] reorganize structs in printf

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Feb 8 12:08:55 PST 2023


lntue added inline comments.


================
Comment at: libc/src/stdio/printf_core/core_structs.h:93
+template <typename T>
+LIBC_INLINE static constexpr TypeDesc type_desc_from_type() {
+  if constexpr (cpp::is_same_v<T, void>) {
----------------
You can drop `static` here.


================
Comment at: libc/src/stdio/printf_core/core_structs.h:97
+  } else {
+    constexpr bool isPointer = cpp::is_same_v<T, void *>;
+    constexpr bool isFloat =
----------------
Use `is_pointer_v` from https://github.com/llvm/llvm-project/blob/main/libc/src/__support/CPP/type_traits.h#L80


================
Comment at: libc/src/stdio/printf_core/core_structs.h:98
+    constexpr bool isPointer = cpp::is_same_v<T, void *>;
+    constexpr bool isFloat =
+        cpp::is_same_v<T, double> || cpp::is_same_v<T, long double>;
----------------
Use `cpp::is_floating_point_v` from https://github.com/llvm/llvm-project/blob/main/libc/src/__support/CPP/type_traits.h#L92


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143595



More information about the libc-commits mailing list