[PATCH] D86892: Improve error handling for SmallVector programming errors.

Geoffrey Martin-Noble via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 14:53:05 PDT 2020


GMNGeoffrey marked an inline comment as done.
GMNGeoffrey added a comment.

If y'all are good with this now (and think that others will not have objects), could one of you land it for me? I don't have commit access.



================
Comment at: llvm/include/llvm/ADT/SmallVector.h:276
+                         std::to_string(this->SizeTypeMax()) + ")";
+#ifdef LLVM_ENABLE_EXCEPTIONS
+    throw std::length_error(Reason);
----------------
MaskRay wrote:
> 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.
Ok done :-)


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