[libc] [llvm] [libc] Fix lint message (PR #73956)

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 08:02:15 PST 2023


https://github.com/gchatelet created https://github.com/llvm/llvm-project/pull/73956

None

>From ccd27bcf7ae616bc13bcbc4c030d1850ba9bb587 Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Thu, 30 Nov 2023 16:01:12 +0000
Subject: [PATCH] [libc] Fix lint message

---
 libc/src/__support/CMakeLists.txt                 |  2 ++
 libc/src/__support/str_to_num_result.h            | 13 ++++++++-----
 utils/bazel/llvm-project-overlay/libc/BUILD.bazel |  3 +--
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index a76b22960f5a504..decd6ed2dbd2bd7 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -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(
diff --git a/libc/src/__support/str_to_num_result.h b/libc/src/__support/str_to_num_result.h
index 9ba704c690655ee..b32fbdeeb580fee 100644
--- a/libc/src/__support/str_to_num_result.h
+++ b/libc/src/__support/str_to_num_result.h
@@ -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 {
@@ -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
 
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index a0a6a4366ea7537..fdd620a4d415c09 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -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(



More information about the llvm-commits mailing list