[all-commits] [llvm/llvm-project] b55591: [libc] Better IntegerToString API

Guillaume Chatelet via All-commits all-commits at lists.llvm.org
Wed Aug 9 00:33:59 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b555912e705924630de1f65b77d0139a20b5338b
      https://github.com/llvm/llvm-project/commit/b555912e705924630de1f65b77d0139a20b5338b
  Author: Guillaume Chatelet <gchatelet at google.com>
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
    M libc/src/__support/CMakeLists.txt
    M libc/src/__support/CPP/string.h
    M libc/src/__support/CPP/stringstream.h
    M libc/src/__support/FPUtil/fpbits_str.h
    M libc/src/__support/StringUtil/error_to_string.cpp
    M libc/src/__support/StringUtil/signal_to_string.cpp
    M libc/src/__support/integer_to_string.h
    M libc/src/__support/libc_assert.h
    M libc/src/__support/threads/linux/thread.cpp
    M libc/src/stdio/printf_core/float_dec_converter.h
    M libc/src/stdio/printf_core/int_converter.h
    M libc/test/UnitTest/LibcTest.cpp
    M libc/test/UnitTest/TestLogger.cpp
    M libc/test/src/__support/integer_to_string_test.cpp
    M utils/bazel/llvm-project-overlay/libc/BUILD.bazel

  Log Message:
  -----------
  [libc] Better IntegerToString API

This patch is an alternative to D155902. It provides the following benefits:
 - No buffer manual allocation and error handling for the general case
 - More flexible API : width specifier, sign and prefix handling
 - Simpler code

The more flexible API removes the need for manually tweaking the buffer afterwards, and so prevents relying on implementation details of IntegerToString.

Reviewed By: michaelrj, jhuber6

Differential Revision: https://reviews.llvm.org/D156981




More information about the All-commits mailing list