[PATCH] D129466: [clang-format][NFC] Replace most of std::vector with SmallVector

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 15 17:48:23 PDT 2022


owenpan added inline comments.


================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:40
 static unsigned getLengthToMatchingParen(const FormatToken &Tok,
-                                         const std::vector<ParenState> &Stack) {
+                                         const SmallVector<ParenState> &Stack) {
   // Normally whether or not a break before T is possible is calculated and
----------------
curdeius wrote:
> owenpan wrote:
> > curdeius wrote:
> > > Sorry for a late comment. I think that in a parameter list, we should use `SmallVectorBase` to avoid changing the type if the inplace element count changes. That's not important now though.
> > Hmm. I can't find an example of `SmallVectorBase` in llvm-project sources, though.
> Typo, it's Impl: https://llvm.org/doxygen/classllvm_1_1SmallVectorImpl.html
Good catch, though `ArrayRef` is more appropriate in this case. See https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h. Fixed in a7789d6.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129466



More information about the cfe-commits mailing list