LLVM: include/llvm/Support/MemAlloc.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef LLVM_SUPPORT_MEMALLOC_H
17#define LLVM_SUPPORT_MEMALLOC_H
18
21#include
22
23namespace llvm {
24
26 void *Result = std::malloc(Sz);
27 if (Result == nullptr) {
28
29
30
31 if (Sz == 0)
34 }
35 return Result;
36}
37
39 size_t Sz) {
40 void *Result = std::calloc(Count, Sz);
41 if (Result == nullptr) {
42
43
44
45 if (Count == 0 || Sz == 0)
48 }
49 return Result;
50}
51
53 void *Result = std::realloc(Ptr, Sz);
54 if (Result == nullptr) {
55
56
57
58 if (Sz == 0)
61 }
62 return Result;
63}
64
65
66
67
68
69
70
71
72
73
76
77
78
79
80
81
82
83
85
86}
87#endif
#define LLVM_ATTRIBUTE_RETURNS_NOALIAS
\macro LLVM_ATTRIBUTE_RETURNS_NOALIAS Used to mark a function as returning a pointer that does not al...
#define LLVM_ATTRIBUTE_RETURNS_NONNULL
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_calloc(size_t Count, size_t Sz)
Definition MemAlloc.h:38
LLVM_ABI LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * allocate_buffer(size_t Size, size_t Alignment)
Allocate a buffer of memory with the given size and alignment.
LLVM_ABI void deallocate_buffer(void *Ptr, size_t Size, size_t Alignment)
Deallocate a buffer of memory with the given size and alignment.
FunctionAddr VTableAddr Count
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
Definition MemAlloc.h:25
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_realloc(void *Ptr, size_t Sz)
Definition MemAlloc.h:52
LLVM_ABI void report_bad_alloc_error(const char *Reason, bool GenCrashDiag=true)
Reports a bad alloc error, calling any user defined bad alloc error handler.