[llvm] [Support] Give llvm_strlcpy restrict semantics (PR #78168)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 15 07:29:13 PST 2024
https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/78168
strlcpy has restrict semantics, so llvm_strlcpy should have them too.
Source: https://man.freebsd.org/cgi/man.cgi?strlcpy
>From 1cbc56a63c97f6ab65b4ba81d4fed3c34e9ec0be Mon Sep 17 00:00:00 2001
From: Rose <83477269+AtariDreams at users.noreply.github.com>
Date: Mon, 15 Jan 2024 10:28:43 -0500
Subject: [PATCH] [Support] Give llvm_strlcpy restrict semantics
strlcpy has restrict semantics, so llvm_strlcpy should have them too.
Source: https://man.freebsd.org/cgi/man.cgi?strlcpy
---
llvm/lib/Support/regex_impl.h | 2 +-
llvm/lib/Support/regstrlcpy.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Support/regex_impl.h b/llvm/lib/Support/regex_impl.h
index 8f0c532205edc3..6b780da10e35fe 100644
--- a/llvm/lib/Support/regex_impl.h
+++ b/llvm/lib/Support/regex_impl.h
@@ -99,7 +99,7 @@ size_t llvm_regerror(int, const llvm_regex_t *, char *, size_t);
int llvm_regexec(const llvm_regex_t *, const char *, size_t,
llvm_regmatch_t [], int);
void llvm_regfree(llvm_regex_t *);
-size_t llvm_strlcpy(char *dst, const char *src, size_t siz);
+size_t llvm_strlcpy(char *__restrict dst, const char * __restrict src, size_t siz);
#ifdef __cplusplus
}
diff --git a/llvm/lib/Support/regstrlcpy.c b/llvm/lib/Support/regstrlcpy.c
index 8b68afdf75f16a..1e55c4f36af7b9 100644
--- a/llvm/lib/Support/regstrlcpy.c
+++ b/llvm/lib/Support/regstrlcpy.c
@@ -26,7 +26,7 @@
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
size_t
-llvm_strlcpy(char *dst, const char *src, size_t siz)
+llvm_strlcpy(char *__restrict dst, const char *__restrict src, size_t siz)
{
char *d = dst;
const char *s = src;
More information about the llvm-commits
mailing list