[PATCH] D34433: [Sanitizers] 32 bit allocator respects allocator_may_return_null flag

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 21 16:44:47 PDT 2017


alekseyshl added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_allocator_local_cache.h:147
     PerClass *c = &per_class_[class_id];
-    if (UNLIKELY(c->count == 0))
-      Refill(allocator, class_id);
+    if (UNLIKELY(c->count == 0 && !Refill(allocator, class_id)))
+      return nullptr;
----------------
eugenis wrote:
> alekseyshl wrote:
> > cryptoad wrote:
> > > Doing it this way, we are losing the 'unlikeliness' of `c->count == 0`.
> > > I am not sure this will matter much though.
> > Let's bring it back then.
> unnecessary {} 
I'd rather keep those, I prefer to add {} when if body is more than one line. This one is.


https://reviews.llvm.org/D34433





More information about the llvm-commits mailing list