[libc-commits] [clang] [libc] [llvm] [AMDGPU] Implement variadic functions by IR lowering (PR #93362)

via libc-commits libc-commits at lists.llvm.org
Fri May 31 08:57:01 PDT 2024


================
@@ -10,6 +10,50 @@
 
 #include "test/UnitTest/Test.h"
 
+#include "src/__support/OSUtil/io.h"
+#include "src/__support/integer_to_string.h"
+using namespace LIBC_NAMESPACE;
+
+namespace {
+
+void nl() { write_to_stderr("\n"); }
+void dump(const char *s) {
+  write_to_stderr(s);
+  nl();
+}
+
+void dump(int32_t s) {
----------------
lntue wrote:

Probably it's better to do:
```
template <typename T>
cpp::enable_if_t<cpp::is_integral_v<T>, void> dump(T s) {
  auto x = IntegerToString<T>(s);
  write_to_stderr(x.view());
  nl();
}
```
Then all the usages below could be changed to `dump(s.*);`

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


More information about the libc-commits mailing list