[PATCH] D112175: [NFC] Add llvm::StaticVector ADT

James Player via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 20 14:14:21 PDT 2021


jplayer-nv added a comment.

In D112175#3076343 <https://reviews.llvm.org/D112175#3076343>, @tschuett wrote:

> could fallible operations ala `push_back` return an `llvm::error`?

I would think it better to return an `llvm::Expected<reference>` in that case so we can still return the newly inserted reference to the user.  It would also break API compatibility with `llvm::SmallVector`, requiring more refactoring than simply changing the container type.

Additionally seems like unwanted overhead in a class which is meant to be a leaned version of `SmallVector` when we know the max capacity at host compile time.

If we follow through on this, I'd prefer add to the API rather than change the existing member functions (i.e. add member function `push_back_fallible()`, so users can opt-in to `llvm::Expected` return).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112175/new/

https://reviews.llvm.org/D112175



More information about the llvm-commits mailing list