[PATCH] D63668: [Support] Improve zero-size allocation with safe_malloc, etc.
Alex Brachet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 23 20:42:34 PDT 2019
abrachet added a comment.
Good find!
I don't believe this is the right way to go, however. As you point out malloc(0) is undefined behavior, I get you are trying to define it here, but I'm not sure it fits in with the ethos of this routine being 'safe', in my opinion. I would think that asking for 0 bytes would be indicative of a bug that can be found in testing debug builds. Personally, `assert(Sz && "Tried to allocate 0")` seems like it would suffice, but I see why you went in this direction.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63668/new/
https://reviews.llvm.org/D63668
More information about the llvm-commits
mailing list