[libc-commits] [libc] [libc] Templatize the scanf Reader interface (PR #131037)

via libc-commits libc-commits at lists.llvm.org
Wed Mar 12 20:50:04 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff be0215d7456f85e7df6c07b982704c7bfa943278 bcb6d61a4fb05d66ac9dd4aca2f1ba675f66f61c --extensions cpp,h -- libc/src/stdio/scanf_core/converter.h libc/src/stdio/scanf_core/current_pos_converter.h libc/src/stdio/scanf_core/float_converter.h libc/src/stdio/scanf_core/int_converter.h libc/src/stdio/scanf_core/ptr_converter.h libc/src/stdio/scanf_core/reader.h libc/src/stdio/scanf_core/scanf_main.h libc/src/stdio/scanf_core/string_converter.h libc/src/stdio/scanf_core/vfscanf_internal.h libc/src/stdio/sscanf.cpp libc/src/stdio/vsscanf.cpp libc/test/src/stdio/scanf_core/converter_test.cpp libc/test/src/stdio/scanf_core/reader_test.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/test/src/stdio/scanf_core/reader_test.cpp b/libc/test/src/stdio/scanf_core/reader_test.cpp
index fa3260d556..2ba95d84f5 100644
--- a/libc/test/src/stdio/scanf_core/reader_test.cpp
+++ b/libc/test/src/stdio/scanf_core/reader_test.cpp
@@ -15,12 +15,14 @@ TEST(LlvmLibcScanfStringReaderTest, Constructor) {
   char str[10];
   // buff_len justneeds to be a big number. The specific value isn't important
   // in the real world.
-  LIBC_NAMESPACE::scanf_core::StringReader reader(const_cast<char *>(str), 1000000);
+  LIBC_NAMESPACE::scanf_core::StringReader reader(const_cast<char *>(str),
+                                                  1000000);
 }
 
 TEST(LlvmLibcScanfStringReaderTest, SimpleRead) {
   const char *str = "abc";
-  LIBC_NAMESPACE::scanf_core::StringReader reader(const_cast<char *>(str), 1000000);
+  LIBC_NAMESPACE::scanf_core::StringReader reader(const_cast<char *>(str),
+                                                  1000000);
 
   for (size_t i = 0; i < sizeof("abc"); ++i) {
     ASSERT_EQ(str[i], reader.getc());
@@ -29,7 +31,8 @@ TEST(LlvmLibcScanfStringReaderTest, SimpleRead) {
 
 TEST(LlvmLibcScanfStringReaderTest, ReadAndReverse) {
   const char *str = "abcDEF123";
-  LIBC_NAMESPACE::scanf_core::StringReader reader(const_cast<char *>(str), 1000000);
+  LIBC_NAMESPACE::scanf_core::StringReader reader(const_cast<char *>(str),
+                                                  1000000);
 
   for (size_t i = 0; i < 5; ++i) {
     ASSERT_EQ(str[i], reader.getc());

``````````

</details>


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


More information about the libc-commits mailing list