[libc-commits] [PATCH] D141237: [libc] Move b* string functions to strings.h

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Sun Jan 8 14:05:50 PST 2023


abrachet created this revision.
abrachet added reviewers: sivachandra, gchatelet.
Herald added subscribers: ecnelises, tschuett.
Herald added a project: All.
abrachet requested review of this revision.

Traditionally these functions are exposed in string*s*.h not string.h


https://reviews.llvm.org/D141237

Files:
  libc/include/CMakeLists.txt
  libc/include/strings.h.def
  libc/spec/llvm_libc_ext.td


Index: libc/spec/llvm_libc_ext.td
===================================================================
--- libc/spec/llvm_libc_ext.td
+++ libc/spec/llvm_libc_ext.td
@@ -1,6 +1,6 @@
 def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> {
-  HeaderSpec String = HeaderSpec<
-      "string.h",
+  HeaderSpec Strings = HeaderSpec<
+      "strings.h",
       [], // Macros
       [], // Types
       [], // Enumerations
@@ -52,7 +52,7 @@
   >;
 
   let Headers = [
-    String,
+    Strings,
     Sched,
     Assert,
   ];
Index: libc/include/strings.h.def
===================================================================
--- /dev/null
+++ libc/include/strings.h.def
@@ -0,0 +1,16 @@
+//===-- C standard library header strings.h -------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_STRINGS_H
+#define LLVM_LIBC_STRINGS_H
+
+#include <__llvm-libc-common.h>
+
+%%public_api()
+
+#endif // LLVM_LIBC_STRINGS_H
Index: libc/include/CMakeLists.txt
===================================================================
--- libc/include/CMakeLists.txt
+++ libc/include/CMakeLists.txt
@@ -95,6 +95,15 @@
     .llvm-libc-types.size_t
 )
 
+add_gen_header(
+  strings
+  DEF_FILE strings.h.def
+  GEN_HDR strings.h
+  DEPENDS
+    .llvm_libc_common_h
+    .llvm-libc-types.size_t
+)
+
 add_gen_header(
   time
   DEF_FILE time.h.def


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141237.487231.patch
Type: text/x-patch
Size: 1611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230108/023cca6e/attachment.bin>


More information about the libc-commits mailing list