[libc-commits] [libc] 42294bf - Revert "[libc] Add {,r}index"

Alex Brachet via libc-commits libc-commits at lists.llvm.org
Mon Apr 10 18:27:44 PDT 2023


Author: Alex Brachet
Date: 2023-04-11T01:26:42Z
New Revision: 42294bf16f767f10b30089b8e9cb963ae7b3ecb2

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

LOG: Revert "[libc] Add {,r}index"

This reverts commit a0a141fcbe1dfd35032fa5c052e6906180a37fb1.

Added: 
    

Modified: 
    libc/config/linux/aarch64/entrypoints.txt
    libc/config/linux/arm/entrypoints.txt
    libc/config/linux/riscv64/entrypoints.txt
    libc/config/linux/x86_64/entrypoints.txt
    libc/spec/bsd_ext.td
    libc/src/string/CMakeLists.txt
    libc/test/src/string/CMakeLists.txt

Removed: 
    libc/src/string/index.cpp
    libc/src/string/index.h
    libc/src/string/rindex.cpp
    libc/src/string/rindex.h
    libc/test/src/string/index_test.cpp
    libc/test/src/string/rindex_test.cpp


################################################################################
diff  --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 7d76e83d27a36..6fb32065856d4 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -33,7 +33,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.bcmp
     libc.src.string.bcopy
     libc.src.string.bzero
-    libc.src.string.index
     libc.src.string.memccpy
     libc.src.string.memchr
     libc.src.string.memcmp
@@ -42,7 +41,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.mempcpy
     libc.src.string.memrchr
     libc.src.string.memset
-    libc.src.string.rindex
     libc.src.string.stpcpy
     libc.src.string.stpncpy
     libc.src.string.strcasecmp

diff  --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 5ed49d03eb9c9..4ae8b0f44a8be 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -24,7 +24,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.bcmp
     libc.src.string.bcopy
     libc.src.string.bzero
-    libc.src.string.index
     libc.src.string.memccpy
     libc.src.string.memchr
     libc.src.string.memcmp
@@ -33,7 +32,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.mempcpy
     libc.src.string.memrchr
     libc.src.string.memset
-    libc.src.string.rindex
     libc.src.string.stpcpy
     libc.src.string.stpncpy
     libc.src.string.strcasecmp

diff  --git a/libc/config/linux/riscv64/entrypoints.txt b/libc/config/linux/riscv64/entrypoints.txt
index 936949f779af7..0c59d91cc0c50 100644
--- a/libc/config/linux/riscv64/entrypoints.txt
+++ b/libc/config/linux/riscv64/entrypoints.txt
@@ -33,7 +33,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.bcmp
     libc.src.string.bcopy
     libc.src.string.bzero
-    libc.src.string.index
     libc.src.string.memccpy
     libc.src.string.memchr
     libc.src.string.memcmp
@@ -42,7 +41,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.mempcpy
     libc.src.string.memrchr
     libc.src.string.memset
-    libc.src.string.rindex
     libc.src.string.stpcpy
     libc.src.string.stpncpy
     libc.src.string.strcasecmp

diff  --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 9e450eadc9d4e..13c788df6400e 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -33,7 +33,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.bcmp
     libc.src.string.bcopy
     libc.src.string.bzero
-    libc.src.string.index
     libc.src.string.memccpy
     libc.src.string.memchr
     libc.src.string.memcmp
@@ -42,7 +41,6 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.string.mempcpy
     libc.src.string.memrchr
     libc.src.string.memset
-    libc.src.string.rindex
     libc.src.string.stpcpy
     libc.src.string.stpncpy
     libc.src.string.strcasecmp

diff  --git a/libc/spec/bsd_ext.td b/libc/spec/bsd_ext.td
index 3829e57e9765a..3420c2098449f 100644
--- a/libc/spec/bsd_ext.td
+++ b/libc/spec/bsd_ext.td
@@ -39,16 +39,6 @@ def BsdExtensions : StandardSpec<"BSDExtensions"> {
             RetValSpec<IntType>,
             [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
         >,
-        FunctionSpec<
-            "index",
-            RetValSpec<CharPtr>,
-            [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
-        >,
-        FunctionSpec<
-            "rindex",
-            RetValSpec<CharPtr>,
-            [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
-        >,
       ]
   >;
 

diff  --git a/libc/src/string/CMakeLists.txt b/libc/src/string/CMakeLists.txt
index d719fad1921c8..f6980ca632bb9 100644
--- a/libc/src/string/CMakeLists.txt
+++ b/libc/src/string/CMakeLists.txt
@@ -31,16 +31,6 @@ add_entrypoint_object(
     bcopy.h
 )
 
-add_entrypoint_object(
-  index
-  SRCS
-    index.cpp
-  HDRS
-    index.h
-  DEPENDS
-    .memory_utils.strchr_implementation
-)
-
 add_entrypoint_object(
   memccpy
   SRCS
@@ -77,16 +67,6 @@ add_entrypoint_object(
     memrchr.h
 )
 
-add_entrypoint_object(
-  rindex
-  SRCS
-    rindex.cpp
-  HDRS
-    rindex.h
-  DEPENDS
-    .memory_utils.strchr_implementation
-)
-
 add_entrypoint_object(
   stpcpy
   SRCS

diff  --git a/libc/src/string/index.cpp b/libc/src/string/index.cpp
deleted file mode 100644
index 109b1ec52570c..0000000000000
--- a/libc/src/string/index.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//===-- Implementation of index -------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/string/index.h"
-
-#include "src/__support/common.h"
-#include "src/string/memory_utils/strchr_implementations.h"
-
-namespace __llvm_libc {
-
-LLVM_LIBC_FUNCTION(char *, index, (const char *src, int c)) {
-  return strchr_implementation(src, c);
-}
-
-} // namespace __llvm_libc

diff  --git a/libc/src/string/index.h b/libc/src/string/index.h
deleted file mode 100644
index 7b246109d46f9..0000000000000
--- a/libc/src/string/index.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- Implementation header for index -------------------------*- C++ -*-===//
-//
-// 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_SRC_STRING_INDEX_H
-#define LLVM_LIBC_SRC_STRING_INDEX_H
-
-namespace __llvm_libc {
-
-char *index(const char *src, int c);
-
-} // namespace __llvm_libc
-
-#endif // LLVM_LIBC_SRC_STRING_INDEX_H

diff  --git a/libc/src/string/rindex.cpp b/libc/src/string/rindex.cpp
deleted file mode 100644
index 7f2f87442eb44..0000000000000
--- a/libc/src/string/rindex.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//===-- Implementation of rindex ------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/string/rindex.h"
-
-#include "src/__support/common.h"
-#include "src/string/memory_utils/strchr_implementations.h"
-
-namespace __llvm_libc {
-
-LLVM_LIBC_FUNCTION(char *, rindex, (const char *src, int c)) {
-  return strrchr_implementation(src, c);
-}
-
-} // namespace __llvm_libc

diff  --git a/libc/src/string/rindex.h b/libc/src/string/rindex.h
deleted file mode 100644
index 976d6bac93131..0000000000000
--- a/libc/src/string/rindex.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- Implementation header for rindex ------------------------*- C++ -*-===//
-//
-// 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_SRC_STRING_RINDEX_H
-#define LLVM_LIBC_SRC_STRING_RINDEX_H
-
-namespace __llvm_libc {
-
-char *rindex(const char *src, int c);
-
-} // namespace __llvm_libc
-
-#endif // LLVM_LIBC_SRC_STRING_RINDEX_H

diff  --git a/libc/test/src/string/CMakeLists.txt b/libc/test/src/string/CMakeLists.txt
index 6bb4c562a239a..ed9d38aa482a1 100644
--- a/libc/test/src/string/CMakeLists.txt
+++ b/libc/test/src/string/CMakeLists.txt
@@ -14,23 +14,6 @@ add_libc_unittest(
     LibcMemoryHelpers
 )
 
-add_header_library(
-  strchr_test_support
-  HDRS
-    StrchrTest.h
-)
-
-add_libc_unittest(
-  index_test
-  SUITE
-    libc_string_unittests
-  SRCS
-    index_test.cpp
-  DEPENDS
-    libc.src.string.index
-    .strchr_test_support
-)
-
 add_libc_unittest(
   memccpy_test
   SUITE
@@ -71,17 +54,6 @@ add_libc_unittest(
     libc.src.string.memrchr
 )
 
-add_libc_unittest(
-  rindex_test
-  SUITE
-    libc_string_unittests
-  SRCS
-    rindex_test.cpp
-  DEPENDS
-    libc.src.string.rindex
-    .strchr_test_support
-)
-
 add_libc_unittest(
   stpcpy_test
   SUITE
@@ -112,6 +84,12 @@ add_libc_unittest(
     libc.src.string.strcat
 )
 
+add_header_library(
+  strchr_test_support
+  HDRS
+    StrchrTest.h
+)
+
 add_libc_unittest(
   strchr_test
   SUITE

diff  --git a/libc/test/src/string/index_test.cpp b/libc/test/src/string/index_test.cpp
deleted file mode 100644
index 22202f0fc8346..0000000000000
--- a/libc/test/src/string/index_test.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-//===-- Unittests for index -----------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "StrchrTest.h"
-
-#include "src/string/index.h"
-#include "test/UnitTest/Test.h"
-
-STRCHR_TEST(Index, __llvm_libc::index)

diff  --git a/libc/test/src/string/rindex_test.cpp b/libc/test/src/string/rindex_test.cpp
deleted file mode 100644
index 1e5969653d5e7..0000000000000
--- a/libc/test/src/string/rindex_test.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-//===-- Unittests for rindex ----------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "StrchrTest.h"
-
-#include "src/string/rindex.h"
-#include "test/UnitTest/Test.h"
-
-STRRCHR_TEST(Rindex, __llvm_libc::rindex)


        


More information about the libc-commits mailing list