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

Guillaume Chatelet via All-commits all-commits at lists.llvm.org
Tue Aug 8 13:39:32 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 910cc05aae85a6b31e2a2ed87d3dd46db46fce04
      https://github.com/llvm/llvm-project/commit/910cc05aae85a6b31e2a2ed87d3dd46db46fce04
  Author: Guillaume Chatelet <gchatelet at google.com>
  Date:   2023-08-08 (Tue, 08 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