Skip to content

Commit

Permalink
[libc][NFC] rename str_conv_utils to str_to_integer
Browse files Browse the repository at this point in the history
rename str_conv_utils to str_to_integer to be more
in line with str_to_float.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D113061
  • Loading branch information
michaelrj-google committed Nov 3, 2021
1 parent a7fc39f commit 31d797f
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 31 deletions.
15 changes: 13 additions & 2 deletions libc/src/__support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,22 @@ add_header_library(
)

add_header_library(
str_conv_utils
str_to_integer
HDRS
str_to_integer.h
DEPENDS
.ctype_utils
libc.include.errno
libc.src.errno.__errno_location
libc.src.__support.CPP.standalone_cpp
)

add_header_library(
str_to_float
HDRS
str_conv_utils.h
str_to_float.h
DEPENDS
.str_to_integer
.ctype_utils
.high_precision_decimal
libc.include.errno
Expand Down
2 changes: 1 addition & 1 deletion libc/src/__support/detailed_powers_of_ten.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace internal {
// and contains the 128 bit mantissa approximations of the powers of 10 from
// -348 to 347. The exponents are implied by a linear expression with slope
// 217706.0/65536.0 ≈ log(10)/log(2). This is used by the Eisel-Lemire algorithm
// in str_conv_utils.h.
// in str_to_float.h.

constexpr int32_t DETAILED_POWERS_OF_TEN_MIN_EXP_10 = -348;
constexpr int32_t DETAILED_POWERS_OF_TEN_MAX_EXP_10 = 347;
Expand Down
2 changes: 1 addition & 1 deletion libc/src/__support/high_precision_decimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define LIBC_SRC_SUPPORT_HIGH_PRECISION_DECIMAL_H

#include "src/__support/ctype_utils.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"
#include <stdint.h>

namespace __llvm_libc {
Expand Down
2 changes: 1 addition & 1 deletion libc/src/__support/str_to_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "src/__support/ctype_utils.h"
#include "src/__support/detailed_powers_of_ten.h"
#include "src/__support/high_precision_decimal.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"
#include <errno.h>

namespace __llvm_libc {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//===-- Stdlib utils --------------------------------------------*- C++ -*-===//
//===-- String to integer conversion utils ----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LIBC_SRC_STDLIB_STDLIB_UTILS_H
#define LIBC_SRC_STDLIB_STDLIB_UTILS_H
#ifndef LIBC_SRC_SUPPORT_STR_TO_INTEGER_H
#define LIBC_SRC_SUPPORT_STR_TO_INTEGER_H

#include "src/__support/CPP/Limits.h"
#include "src/__support/ctype_utils.h"
Expand Down Expand Up @@ -148,4 +148,4 @@ static inline T strtointeger(const char *__restrict src,
} // namespace internal
} // namespace __llvm_libc

#endif // LIBC_SRC_STDLIB_STDLIB_UTILS_H
#endif // LIBC_SRC_SUPPORT_STR_TO_INTEGER_H
4 changes: 2 additions & 2 deletions libc/src/inttypes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ add_entrypoint_object(
HDRS
strtoimax.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_integer
)

add_entrypoint_object(
Expand All @@ -15,7 +15,7 @@ add_entrypoint_object(
HDRS
strtoumax.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_integer
)

add_entrypoint_object(
Expand Down
2 changes: 1 addition & 1 deletion libc/src/inttypes/strtoimax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "src/inttypes/strtoimax.h"
#include "src/__support/common.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"

namespace __llvm_libc {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/inttypes/strtoumax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "src/inttypes/strtoumax.h"
#include "src/__support/common.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"

namespace __llvm_libc {

Expand Down
20 changes: 10 additions & 10 deletions libc/src/stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ add_entrypoint_object(
HDRS
atoi.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_integer
)

add_entrypoint_object(
Expand All @@ -15,7 +15,7 @@ add_entrypoint_object(
HDRS
atof.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_float
)

add_entrypoint_object(
Expand All @@ -25,7 +25,7 @@ add_entrypoint_object(
HDRS
atol.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_integer
)

add_entrypoint_object(
Expand All @@ -35,7 +35,7 @@ add_entrypoint_object(
HDRS
atoll.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_integer
)

add_entrypoint_object(
Expand All @@ -45,7 +45,7 @@ add_entrypoint_object(
HDRS
strtof.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_float
)

add_entrypoint_object(
Expand All @@ -55,7 +55,7 @@ add_entrypoint_object(
HDRS
strtod.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_float
)

add_entrypoint_object(
Expand All @@ -65,7 +65,7 @@ add_entrypoint_object(
HDRS
strtol.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_integer
)

add_entrypoint_object(
Expand All @@ -75,7 +75,7 @@ add_entrypoint_object(
HDRS
strtoll.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_integer
)

add_entrypoint_object(
Expand All @@ -85,7 +85,7 @@ add_entrypoint_object(
HDRS
strtoul.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_integer
)

add_entrypoint_object(
Expand All @@ -95,7 +95,7 @@ add_entrypoint_object(
HDRS
strtoull.h
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_integer
)

add_entrypoint_object(
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/atoi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "src/stdlib/atoi.h"
#include "src/__support/common.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"

namespace __llvm_libc {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/atol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "src/stdlib/atol.h"
#include "src/__support/common.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"

namespace __llvm_libc {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/atoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "src/stdlib/atoll.h"
#include "src/__support/common.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"

namespace __llvm_libc {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/strtol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "src/stdlib/strtol.h"
#include "src/__support/common.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"

namespace __llvm_libc {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/strtoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "src/stdlib/strtoll.h"
#include "src/__support/common.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"

namespace __llvm_libc {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/strtoul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "src/stdlib/strtoul.h"
#include "src/__support/common.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"

namespace __llvm_libc {

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/strtoull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "src/stdlib/strtoull.h"
#include "src/__support/common.h"
#include "src/__support/str_conv_utils.h"
#include "src/__support/str_to_integer.h"

namespace __llvm_libc {

Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/__support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ add_libc_unittest(
SRCS
str_to_float_test.cpp
DEPENDS
libc.src.__support.str_conv_utils
libc.src.__support.str_to_float
)

add_executable(
Expand Down

0 comments on commit 31d797f

Please sign in to comment.