[libc-commits] [PATCH] D147231: [libc] Adds string and TestLogger classes, use them in LibcTest

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Sat Apr 1 08:54:32 PDT 2023


sivachandra added inline comments.


================
Comment at: libc/test/UnitTest/TestLogger.cpp:11
+template <>
+TestLogger &TestLogger::operator<< <cpp::string>(cpp::string String) {
+  __llvm_libc::write_to_stderr(String.c_str());
----------------
Nit: `s/String/str` and `s/CString/cstr` here and below.


================
Comment at: libc/test/UnitTest/TestLogger.cpp:30
+// char specialization
+template <> TestLogger &TestLogger::operator<<(char Char) {
+  const char CString[] = {Char, '\0'};
----------------
`ch`


================
Comment at: libc/test/UnitTest/TestLogger.cpp:32
+  const char CString[] = {Char, '\0'};
+  return *this << CString;
+}
----------------
Nit: `*this << cpp::string_view(&ch, 1);`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147231



More information about the libc-commits mailing list