[PATCH] D135311: [LLVM][Support] Support for `llvm::cl::list`'s default values

Markus Böck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 14:08:38 PDT 2022


zero9178 added inline comments.


================
Comment at: llvm/include/llvm/Support/CommandLine.h:440
 
+template <class Ty> struct initializer_list {
+  const llvm::ArrayRef<Ty> &Inits;
----------------
The naming here is a bit unfortunate since it sort of clashes with the common C++ vocabulary that is `std::initializer_list` but I don't have a lot of better ideas :( 


================
Comment at: llvm/include/llvm/Support/CommandLine.h:441
+template <class Ty> struct initializer_list {
+  const llvm::ArrayRef<Ty> &Inits;
+  initializer_list(const llvm::ArrayRef<Ty> &Vals) : Inits(Vals) {}
----------------
All these `const llvm::ArrayRef<Ty>&` ought to be able to just be `llvm::ArrayRef<Ty>` (both in the `struct` here and the function parameters below). `ArrayRef` essentially already acts as a view/reference to some storage and is cheap and trivially copyable. I believe you can also drop the `llvm::` namespace qualifier


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135311



More information about the llvm-commits mailing list