Meinersbur added inline comments.

================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:12579
   Stmt *Body = nullptr;
-  SmallVector<Stmt *, 4> OriginalInits;
+  SmallVector<std::vector<llvm::PointerUnion<Stmt *, Decl *>>, 4> 
OriginalInits(1);
   if (!OMPLoopBasedDirective::doForAllLoops(
----------------
ABataev wrote:
> Why still `std::vector`?
I didn't notice that the vector type was changed, only notices the added 
argument for one pre-allocated element.

The motivation for `std::vector` is lower memory requirement. `SmallVectorImpl` 
cannot be used because it it is nested in the template. `SmallVector` will 
pre-allocate a large amount of memory (times 4) and expensive to move when the 
outer SmallVector has to be resized.

However, I could also use `SmallVector<T, 0>`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102180

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to