[PATCH] D86892: Improve error handling for SmallVector programming errors.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 2 14:45:31 PDT 2020
MaskRay added inline comments.
================
Comment at: llvm/include/llvm/ADT/SmallVector.h:276
+ std::to_string(this->SizeTypeMax()) + ")";
+#ifdef LLVM_ENABLE_EXCEPTIONS
+ throw std::length_error(Reason);
----------------
GMNGeoffrey wrote:
> MaskRay wrote:
> > If you want to use `#ifdef LLVM_ENABLE_EXCEPTIONS`
> >
> > ```
> > #ifdef LLVM_ENABLE_EXCEPTIONS
> > #else
> > #endif
> > ```
> You mean
>
> ```
> #ifdef LLVM_ENABLE_EXCEPTIONS
> throw std::length_error(Reason);
> #else
> report_fatal_error(Reason);
> #endif
> ```
>
> ?
>
> Why? Shouldn't throwing break us out of the control flow here?
In both libstdc++ and libc++, they don't call abort or __builtin_abort after `throw`...
`#else` will match the standard interface better.
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