forked from OSchip/llvm-project
[libc] Add restrict qualifiers to string library; give consistent naming scheme to TableGen files.
Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D85945
This commit is contained in:
parent
537f5483fe
commit
79ce64ea08
|
@ -1,22 +1,22 @@
|
|||
def SigSetType : NamedType<"sigset_t">;
|
||||
def SigSetPtrType : PtrType<SigSetType>;
|
||||
def ConstSigSetPtrType : ConstType<SigSetPtrType>;
|
||||
def RestrictSigSetType : RestrictedPtrType<SigSetType>;
|
||||
def ConstRestrictSigSetType : ConstType<RestrictSigSetType>;
|
||||
def RestrictedSigSetType : RestrictedPtrType<SigSetType>;
|
||||
def ConstRestrictedSigSetType : ConstType<RestrictedSigSetType>;
|
||||
|
||||
def StructSigaction : NamedType<"struct sigaction">;
|
||||
def StructSigactionPtr : PtrType<StructSigaction>;
|
||||
def ConstStructSigactionPtr : ConstType<StructSigactionPtr>;
|
||||
def RestrictStructSigactionPtr : RestrictedPtrType<StructSigaction>;
|
||||
def ConstRestrictStructSigactionPtr : ConstType<RestrictStructSigactionPtr>;
|
||||
def RestrictedStructSigactionPtr : RestrictedPtrType<StructSigaction>;
|
||||
def ConstRestrictedStructSigactionPtr : ConstType<RestrictedStructSigactionPtr>;
|
||||
|
||||
def POSIX : StandardSpec<"POSIX"> {
|
||||
// TODO: Change naming so that they're consistent with other files.
|
||||
PtrType CharPtr = PtrType<CharType>;
|
||||
ConstType ConstCharPtr = ConstType<CharPtr>;
|
||||
RestrictedPtrType RestrictedCharPtr = RestrictedPtrType<CharType>;
|
||||
ConstType ConstRestrictedCharPtr = ConstType<RestrictedCharPtr>;
|
||||
RestrictedPtrType CharRestrictedDoublePtr = RestrictedPtrType<CharPtr>;
|
||||
ConstType ConstCharPtr = ConstType<CharPtr>;
|
||||
ConstType ConstRestrictedCharPtr = ConstType<RestrictedCharPtr>;
|
||||
|
||||
NamedType OffTType = NamedType<"off_t">;
|
||||
NamedType SSizeTType = NamedType<"ssize_t">;
|
||||
|
||||
|
@ -160,8 +160,8 @@ def POSIX : StandardSpec<"POSIX"> {
|
|||
"sigaction",
|
||||
RetValSpec<IntType>,
|
||||
[ArgSpec<IntType>,
|
||||
ArgSpec<ConstRestrictStructSigactionPtr>,
|
||||
ArgSpec<RestrictStructSigactionPtr>]
|
||||
ArgSpec<ConstRestrictedStructSigactionPtr>,
|
||||
ArgSpec<RestrictedStructSigactionPtr>]
|
||||
>,
|
||||
FunctionSpec<
|
||||
"sigdelset",
|
||||
|
@ -172,7 +172,7 @@ def POSIX : StandardSpec<"POSIX"> {
|
|||
FunctionSpec<
|
||||
"sigprocmask",
|
||||
RetValSpec<IntType>,
|
||||
[ArgSpec<IntType>, ArgSpec<ConstRestrictSigSetType>, ArgSpec<RestrictSigSetType>]
|
||||
[ArgSpec<IntType>, ArgSpec<ConstRestrictedSigSetType>, ArgSpec<RestrictedSigSetType>]
|
||||
>,
|
||||
FunctionSpec<
|
||||
"sigemptyset",
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
namespace __llvm_libc {
|
||||
|
||||
char *LLVM_LIBC_ENTRYPOINT(strcat)(char *dest, const char *src) {
|
||||
char *LLVM_LIBC_ENTRYPOINT(strcat)(char *__restrict dest,
|
||||
const char *__restrict src) {
|
||||
__llvm_libc::strcpy(dest + __llvm_libc::strlen(dest), src);
|
||||
return dest;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace __llvm_libc {
|
||||
|
||||
char *strcat(char *dest, const char *src);
|
||||
char *strcat(char *__restrict dest, const char *__restrict src);
|
||||
|
||||
} // namespace __llvm_libc
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
namespace __llvm_libc {
|
||||
|
||||
char *LLVM_LIBC_ENTRYPOINT(strcpy)(char *dest, const char *src) {
|
||||
char *LLVM_LIBC_ENTRYPOINT(strcpy)(char *__restrict dest,
|
||||
const char *__restrict src) {
|
||||
return reinterpret_cast<char *>(
|
||||
__llvm_libc::memcpy(dest, src, __llvm_libc::strlen(src) + 1));
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace __llvm_libc {
|
||||
|
||||
char *strcpy(char *dest, const char *src);
|
||||
char *strcpy(char *__restrict dest, const char *__restrict src);
|
||||
|
||||
} // namespace __llvm_libc
|
||||
|
||||
|
|
|
@ -37,8 +37,9 @@ static inline size_t complementary_span(const char *src, const char *segment) {
|
|||
// is found is then stored within 'context' for subsequent calls. Subsequent
|
||||
// calls will use 'context' when a nullptr is passed in for 'src'. Once the null
|
||||
// terminating character is reached, returns a nullptr.
|
||||
static inline char *string_token(char *src, const char *delimiter_string,
|
||||
char **saveptr) {
|
||||
static inline char *string_token(char *__restrict src,
|
||||
const char *__restrict delimiter_string,
|
||||
char **__restrict saveptr) {
|
||||
cpp::Bitset<256> delimiter_set;
|
||||
for (; *delimiter_string; ++delimiter_string)
|
||||
delimiter_set.set(*delimiter_string);
|
||||
|
|
|
@ -15,9 +15,8 @@ namespace __llvm_libc {
|
|||
|
||||
static char *strtok_str = nullptr;
|
||||
|
||||
// TODO: Place restrict qualifier where necessary for this and other function
|
||||
// arguments.
|
||||
char *LLVM_LIBC_ENTRYPOINT(strtok)(char *src, const char *delimiter_string) {
|
||||
char *LLVM_LIBC_ENTRYPOINT(strtok)(char *__restrict src,
|
||||
const char *__restrict delimiter_string) {
|
||||
return internal::string_token(src, delimiter_string, &strtok_str);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace __llvm_libc {
|
||||
|
||||
char *strtok(char *src, const char *delimiter_string);
|
||||
char *strtok(char *__restrict src, const char *__restrict delimiter_string);
|
||||
|
||||
} // namespace __llvm_libc
|
||||
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
|
||||
namespace __llvm_libc {
|
||||
|
||||
char *LLVM_LIBC_ENTRYPOINT(strtok_r)(char *src, const char *delimiter_string,
|
||||
char **saveptr) {
|
||||
char *LLVM_LIBC_ENTRYPOINT(strtok_r)(char *__restrict src,
|
||||
const char *__restrict delimiter_string,
|
||||
char **__restrict saveptr) {
|
||||
return internal::string_token(src, delimiter_string, saveptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
|
||||
namespace __llvm_libc {
|
||||
|
||||
char *strtok_r(char *src, const char *delimiter_string, char **saveptr);
|
||||
char *strtok_r(char *__restrict src, const char *__restrict delimiter_string,
|
||||
char **__restrict saveptr);
|
||||
|
||||
} // namespace __llvm_libc
|
||||
|
||||
|
|
Loading…
Reference in New Issue