[libc-commits] [libc] ab07fd9 - [libc][Obvious] Add the LIBC_INLINE tag to a function define in a.h file.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Sat Mar 4 19:00:47 PST 2023


Author: Siva Chandra Reddy
Date: 2023-03-05T02:58:45Z
New Revision: ab07fd9ffa3a76a4608ee7ac884960c982972d8c

URL: https://github.com/llvm/llvm-project/commit/ab07fd9ffa3a76a4608ee7ac884960c982972d8c
DIFF: https://github.com/llvm/llvm-project/commit/ab07fd9ffa3a76a4608ee7ac884960c982972d8c.diff

LOG: [libc][Obvious] Add the LIBC_INLINE tag to a function define in a.h file.

Added: 
    

Modified: 
    libc/src/string/CMakeLists.txt
    libc/src/string/allocating_string_utils.h

Removed: 
    


################################################################################
diff  --git a/libc/src/string/CMakeLists.txt b/libc/src/string/CMakeLists.txt
index 13b9e0179e51f..6dfb6d7bb8e04 100644
--- a/libc/src/string/CMakeLists.txt
+++ b/libc/src/string/CMakeLists.txt
@@ -20,6 +20,7 @@ add_header_library(
     .memory_utils.memcpy_implementation
     libc.include.stdlib
     libc.src.__support.CPP.optional
+    libc.src.__support.macros.config
 )
 
 add_entrypoint_object(

diff  --git a/libc/src/string/allocating_string_utils.h b/libc/src/string/allocating_string_utils.h
index 93d1c7ac8e351..71fab3d152066 100644
--- a/libc/src/string/allocating_string_utils.h
+++ b/libc/src/string/allocating_string_utils.h
@@ -11,6 +11,7 @@
 
 #include "src/__support/CPP/new.h"
 #include "src/__support/CPP/optional.h"
+#include "src/__support/macros/config.h"
 #include "src/string/memory_utils/memcpy_implementations.h" // For string_length
 #include "src/string/string_utils.h"
 
@@ -19,7 +20,7 @@
 namespace __llvm_libc {
 namespace internal {
 
-cpp::optional<char *> strdup(const char *src) {
+LIBC_INLINE cpp::optional<char *> strdup(const char *src) {
   if (src == nullptr)
     return cpp::nullopt;
   size_t len = string_length(src) + 1;


        


More information about the libc-commits mailing list