forked from OSchip/llvm-project
[Builtins] Teach Clang about memccpy
Summary: Hopefully, -fno-builtin-memccpy will work now. Required for https://reviews.llvm.org/D67986. Reviewers: aaron.ballman, rsmith Reviewed By: aaron.ballman Subscribers: RKSimon, kristina, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68377
This commit is contained in:
parent
97e3626070
commit
dfece0a108
|
@ -979,6 +979,7 @@ LIBBUILTIN(longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES)
|
|||
// when these functions are used in non-GNU mode. PR16138.
|
||||
LIBBUILTIN(alloca, "v*z", "f", "stdlib.h", ALL_GNU_LANGUAGES)
|
||||
// POSIX string.h
|
||||
LIBBUILTIN(memccpy, "v*v*vC*iz", "f", "string.h", ALL_GNU_LANGUAGES)
|
||||
LIBBUILTIN(stpcpy, "c*c*cC*", "f", "string.h", ALL_GNU_LANGUAGES)
|
||||
LIBBUILTIN(stpncpy, "c*c*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
|
||||
LIBBUILTIN(strdup, "c*cC*", "f", "string.h", ALL_GNU_LANGUAGES)
|
||||
|
|
|
@ -4,6 +4,7 @@ typedef __WCHAR_TYPE__ wchar_t;
|
|||
typedef __SIZE_TYPE__ size_t;
|
||||
|
||||
void *memcpy(void *, void const *, size_t);
|
||||
void *memccpy(void *, void const *, int, size_t);
|
||||
|
||||
// CHECK: @test1
|
||||
// CHECK: call void @llvm.memset.p0i8.i32
|
||||
|
@ -118,3 +119,9 @@ void test12() {
|
|||
// CHECK: call void @llvm.memcpy{{.*}}(
|
||||
memcpy(&dest_array, &dest_array, 2);
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @test13
|
||||
void test13(char *d, char *s, int c, size_t n) {
|
||||
// CHECK: call i8* @memccpy
|
||||
memccpy(d, s, c, n);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -fno-builtin-memccpy -emit-llvm < %s| FileCheck %s
|
||||
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
|
||||
void *memccpy(void *, void const *, int, size_t);
|
||||
|
||||
void test13(char *d, char *s, int c, size_t n) {
|
||||
// CHECK: call i8* @memccpy{{.*}} #2
|
||||
memccpy(d, s, c, n);
|
||||
}
|
||||
|
||||
// CHECK: attributes #2 = { nobuiltin }
|
Loading…
Reference in New Issue