[llvm] [Support] Give llvm_strlcpy restrict semantics (PR #78168)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 15 07:29:40 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-support
Author: AtariDreams (AtariDreams)
<details>
<summary>Changes</summary>
strlcpy has restrict semantics, so llvm_strlcpy should have them too.
Source: https://man.freebsd.org/cgi/man.cgi?strlcpy
---
Full diff: https://github.com/llvm/llvm-project/pull/78168.diff
2 Files Affected:
- (modified) llvm/lib/Support/regex_impl.h (+1-1)
- (modified) llvm/lib/Support/regstrlcpy.c (+1-1)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/78168
More information about the llvm-commits
mailing list