[PATCH] Use returns_nonnull in BumpPtrAllocator and MallocAllocator to avoid null-check in placement new

Hans Wennborg hans at chromium.org
Thu Aug 21 10:18:59 PDT 2014


================
Comment at: include/llvm/Support/Allocator.h:93
@@ -92,2 +92,3 @@
 
-  void *Allocate(size_t Size, size_t /*Alignment*/) { return malloc(Size); }
+  void LLVM_ATTRIBUTE_RETURNS_NONNULL *Allocate(size_t Size,
+                                                size_t /*Alignment*/) {
----------------
Chandler Carruth wrote:
> Why is this attribute in a different location?
Oops, that was not intentional.

http://reviews.llvm.org/D4989






More information about the llvm-commits mailing list