[PATCH] D86892: Improve error handling for SmallVector programming errors.
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 31 13:44:22 PDT 2020
mehdi_amini added a comment.
> I disagree. report_bad_alloc_error reports an OOM, which this is not. There is no amount of system memory that would make this not an error.
What would `new` do?
LGTM overall.
================
Comment at: llvm/lib/Support/ErrorHandling.cpp:172
char OOMMessage[] = "LLVM ERROR: out of memory\n";
ssize_t written = ::write(2, OOMMessage, strlen(OOMMessage));
+ written = ::write(2, Reason, strlen(Reason));
----------------
GMNGeoffrey wrote:
> GMNGeoffrey wrote:
> > MaskRay wrote:
> > > If the return value is to be ignored, the variable can be removed, i.e. `(void)::write(...)`
> > Yeah I wasn't clear why this variable was here, but was just following the existing code. Happy to drop it.
> I assume it's to guard against some sort of MUST_USE_RETURN_VALUE check. I'm not sure whether casting directly to void without a variable will avoid that.
Casting will do.
================
Comment at: llvm/lib/Support/SmallVector.cpp:53
+ report_fatal_error("SmallVector unable to grow. Requested capacity (" +
+ std::to_string(MinCapacity) +
+ ") is larger than maximum capacity for size type (" +
----------------
This use to be banned from LLVM because some stdlib we supported were buggy with this (Android maybe?)
In general I use instead Twine.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86892/new/
https://reviews.llvm.org/D86892
More information about the llvm-commits
mailing list