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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Guillaume Chatelet (gchatelet)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/73956.diff


3 Files Affected:

- (modified) libc/src/__support/CMakeLists.txt (+2) 
- (modified) libc/src/__support/str_to_num_result.h (+8-5) 
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+1-2) 


``````````diff
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(

``````````

</details>


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


More information about the llvm-commits mailing list