Skip to content

Commit 9557fcc

Browse files
authored
[libc] Fix lint message (#73956)
1 parent d48d1ed commit 9557fcc

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

libc/src/__support/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ add_header_library(
7979
str_to_num_result
8080
HDRS
8181
str_to_num_result.h
82+
DEPENDS
83+
libc.src.__support.macros.attributes
8284
)
8385

8486
add_header_library(

libc/src/__support/str_to_num_result.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef LLVM_LIBC_SRC___SUPPORT_STR_TO_NUM_RESULT_H
1010
#define LLVM_LIBC_SRC___SUPPORT_STR_TO_NUM_RESULT_H
1111

12+
#include "src/__support/macros/attributes.h" // LIBC_INLINE
13+
1214
#include <stddef.h>
1315

1416
namespace LIBC_NAMESPACE {
@@ -18,15 +20,16 @@ template <typename T> struct StrToNumResult {
1820
int error;
1921
ptrdiff_t parsed_len;
2022

21-
constexpr StrToNumResult(T value) : value(value), error(0), parsed_len(0) {}
22-
constexpr StrToNumResult(T value, ptrdiff_t parsed_len)
23+
LIBC_INLINE constexpr StrToNumResult(T value)
24+
: value(value), error(0), parsed_len(0) {}
25+
LIBC_INLINE constexpr StrToNumResult(T value, ptrdiff_t parsed_len)
2326
: value(value), error(0), parsed_len(parsed_len) {}
24-
constexpr StrToNumResult(T value, ptrdiff_t parsed_len, int error)
27+
LIBC_INLINE constexpr StrToNumResult(T value, ptrdiff_t parsed_len, int error)
2528
: value(value), error(error), parsed_len(parsed_len) {}
2629

27-
constexpr bool has_error() { return error != 0; }
30+
LIBC_INLINE constexpr bool has_error() { return error != 0; }
2831

29-
constexpr operator T() { return value; }
32+
LIBC_INLINE constexpr operator T() { return value; }
3033
};
3134
} // namespace LIBC_NAMESPACE
3235

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,7 @@ libc_support_library(
474474
libc_support_library(
475475
name = "__support_str_to_num_result",
476476
hdrs = ["src/__support/str_to_num_result.h"],
477-
deps = [
478-
],
477+
deps = [":__support_macros_attributes"],
479478
)
480479

481480
libc_support_library(

0 commit comments

Comments
 (0)