Upgrade to 2022-era LLVM LIBCXX

This commit is contained in:
Justine Tunney 2024-05-27 02:12:27 -07:00
parent 2f4ca71f26
commit 8e68384e15
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2078 changed files with 165657 additions and 65010 deletions

View file

@ -1,5 +1,5 @@
// -*- C++ -*-
//===--------------------------- string.h ---------------------------------===//
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -10,14 +10,6 @@
#ifndef _LIBCPP_STRING_H
#define _LIBCPP_STRING_H
#include "third_party/libcxx/__config"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include "libc/isystem/string.h"
/*
string.h synopsis
@ -59,82 +51,60 @@ size_t strlen(const char* s);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
#if __has_include_next(<string.h>)
# include_next <string.h>
#endif
// MSVCRT, GNU libc and its derivates may already have the correct prototype in
// <string.h>. This macro can be defined by users if their C library provides
// the right signature.
#if defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || defined(_LIBCPP_MSVCRT) || \
defined(__sun__) || defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
#if defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || defined(_LIBCPP_MSVCRT) || defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
#define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS
#endif
#if defined(__cplusplus) && !defined(_LIBCPP_STRING_H_HAS_CONST_OVERLOADS) && \
defined(_LIBCPP_PREFERRED_OVERLOAD)
#if defined(__cplusplus) && !defined(_LIBCPP_STRING_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
extern "C++" {
inline _LIBCPP_INLINE_VISIBILITY char* __libcpp_strchr(const char* __s,
int __c) {
return (char*)strchr(__s, __c);
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strchr(const char* __s, int __c) {
return __builtin_strchr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD const char*
strchr(const char* __s, int __c) {
return __libcpp_strchr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD char*
strchr(char* __s, int __c) {
return __libcpp_strchr(__s, __c);
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strchr(char* __s, int __c) {
return __builtin_strchr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY char* __libcpp_strpbrk(const char* __s1,
const char* __s2) {
return (char*)strpbrk(__s1, __s2);
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strpbrk(const char* __s1, const char* __s2) {
return __builtin_strpbrk(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD const char*
strpbrk(const char* __s1, const char* __s2) {
return __libcpp_strpbrk(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD char*
strpbrk(char* __s1, const char* __s2) {
return __libcpp_strpbrk(__s1, __s2);
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strpbrk(char* __s1, const char* __s2) {
return __builtin_strpbrk(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY char* __libcpp_strrchr(const char* __s,
int __c) {
return (char*)strrchr(__s, __c);
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strrchr(const char* __s, int __c) {
return __builtin_strrchr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD const char*
strrchr(const char* __s, int __c) {
return __libcpp_strrchr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD char*
strrchr(char* __s, int __c) {
return __libcpp_strrchr(__s, __c);
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strrchr(char* __s, int __c) {
return __builtin_strrchr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY void* __libcpp_memchr(const void* __s, int __c,
size_t __n) {
return (void*)memchr(__s, __c, __n);
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const void* memchr(const void* __s, int __c, size_t __n) {
return __builtin_memchr(__s, __c, __n);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD const void*
memchr(const void* __s, int __c, size_t __n) {
return __libcpp_memchr(__s, __c, __n);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD void*
memchr(void* __s, int __c, size_t __n) {
return __libcpp_memchr(__s, __c, __n);
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD void* memchr(void* __s, int __c, size_t __n) {
return __builtin_memchr(__s, __c, __n);
}
inline _LIBCPP_INLINE_VISIBILITY char* __libcpp_strstr(const char* __s1,
const char* __s2) {
return (char*)strstr(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD const char*
strstr(const char* __s1, const char* __s2) {
return __libcpp_strstr(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD char*
strstr(char* __s1, const char* __s2) {
return __libcpp_strstr(__s1, __s2);
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strstr(const char* __s1, const char* __s2) {
return __builtin_strstr(__s1, __s2);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strstr(char* __s1, const char* __s2) {
return __builtin_strstr(__s1, __s2);
}
} // extern "C++"
#endif
#endif // _LIBCPP_STRING_H