The MallocAllocator Allocate function is defined as:
LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate(size_t Size,
size_t /*Alignment*/) {
return malloc(Size);
}
…but malloc can totally return NULL? What’s up?
I assume this is intended to be an optimization/warning silencer? (i.e. LLVM just normally doesn’t handle OOM) …but this can cause security issues (via nullptr deref)?
On a related note, maybe Allocate should be marked as LLVM_ATTRIBUTE_RETURNS_NOALIAS?