[PATCH] D47440: Use uniform mechanism for OOM errors handling

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 28 09:59:03 PDT 2018


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm

Factoring all this checking out seems like a win.



================
Comment at: include/llvm/Support/MemAlloc.h:25
+
+LLVM_ATTRIBUTE_RETURNS_NONNULL inline void *safe_malloc(size_t Sz) {
+  void *Result = std::malloc(Sz);
----------------
I'm not totally happy with the name "safe" here. They're really no "safer", they just have a different failure mode that is hookable. I kind of like `mallocOrDie` or `malloc_or_die`, which is the naming used by the sanitizer libraries. Let's leave it alone for now, though.


Repository:
  rL LLVM

https://reviews.llvm.org/D47440





More information about the llvm-commits mailing list