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

James Player via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 27 11:24:01 PDT 2021


jplayer-nv added a comment.

In D112175#3080023 <https://reviews.llvm.org/D112175#3080023>, @mgorny wrote:

> I'd grep for `std::array<llvm::Optional<...>, ...>` — I suppose this would be a good replacement for at least some instances of that.

I only found one instance of this construct in DWARF code.  As far as I could tell, the array was being accessed at ad-hoc indexes and therefore isn't ideal for a conversion to `StaticVector` (i.e. you don't get to drop the `Optional` on the `value_type`).  If you know of any more specific examples of above, let me know!

I'm not giving up here... but it doesn't seem like there are many more obvious + simple conversions.  Unfortunately, the common construct I've converted in other code bases in the past is a C-array with a separate variable tracking the number of valid elements in that array.  This is difficult / if not impossible to grep for.

My hope is that developers would run with this container if made available.  So maybe this patch can just sit here until a suitable use is identified.


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