Skip to content

[libc] Fix lint message #73956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libc/src/__support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ add_header_library(
str_to_num_result
HDRS
str_to_num_result.h
DEPENDS
libc.src.__support.macros.attributes
)

add_header_library(
Expand Down
13 changes: 8 additions & 5 deletions libc/src/__support/str_to_num_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_STR_TO_NUM_RESULT_H
#define LLVM_LIBC_SRC___SUPPORT_STR_TO_NUM_RESULT_H

#include "src/__support/macros/attributes.h" // LIBC_INLINE

#include <stddef.h>

namespace LIBC_NAMESPACE {
Expand All @@ -18,15 +20,16 @@ template <typename T> struct StrToNumResult {
int error;
ptrdiff_t parsed_len;

constexpr StrToNumResult(T value) : value(value), error(0), parsed_len(0) {}
constexpr StrToNumResult(T value, ptrdiff_t parsed_len)
LIBC_INLINE constexpr StrToNumResult(T value)
: value(value), error(0), parsed_len(0) {}
LIBC_INLINE constexpr StrToNumResult(T value, ptrdiff_t parsed_len)
: value(value), error(0), parsed_len(parsed_len) {}
constexpr StrToNumResult(T value, ptrdiff_t parsed_len, int error)
LIBC_INLINE constexpr StrToNumResult(T value, ptrdiff_t parsed_len, int error)
: value(value), error(error), parsed_len(parsed_len) {}

constexpr bool has_error() { return error != 0; }
LIBC_INLINE constexpr bool has_error() { return error != 0; }

constexpr operator T() { return value; }
LIBC_INLINE constexpr operator T() { return value; }
};
} // namespace LIBC_NAMESPACE

Expand Down
3 changes: 1 addition & 2 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,7 @@ libc_support_library(
libc_support_library(
name = "__support_str_to_num_result",
hdrs = ["src/__support/str_to_num_result.h"],
deps = [
],
deps = [":__support_macros_attributes"],
)

libc_support_library(
Expand Down