[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / allocs-fns-allocsize.c
blobf3580bd097274e034d6b5443dbabd53a163e1a0f
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm < %s | FileCheck %s
3 typedef __SIZE_TYPE__ size_t;
5 void *malloc(size_t);
6 void *calloc(size_t, size_t);
7 void *realloc(void *, size_t);
8 void *aligned_alloc(size_t, size_t);
9 void *memalign(size_t, size_t);
11 void *malloc_test(size_t n) {
12 return malloc(n);
15 void *calloc_test(size_t e, size_t n) {
16 return calloc(e, n);
19 void *realloc_test(void *p, size_t n) {
20 return realloc(p, n);
23 void *aligned_alloc_test(size_t n, size_t a) {
24 return aligned_alloc(a, n);
27 void *memalign_test(size_t n, size_t a) {
28 return memalign(a, n);
31 // CHECK: @malloc(i64 noundef) #1
32 // CHECK: @calloc(i64 noundef, i64 noundef) #2
33 // CHECK: @realloc(ptr noundef, i64 noundef) #3
34 // CHECK: @aligned_alloc(i64 noundef, i64 noundef) #3
35 // CHECK: @memalign(i64 noundef, i64 noundef) #3
37 // CHECK: attributes #1 = { allocsize(0)
38 // CHECK: attributes #2 = { allocsize(0,1)
39 // CHECK: attributes #3 = { allocsize(1)