[PATCH] D86120: [NFC][llvm] Make the constructors of `ElementCount` private.

David Zarzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 02:53:15 PDT 2020


davezarzycki added a comment.

Why were static "get" methods preferred over simply marking the constructor `explicit`? For example, if the constructor is marked explicit, then this is what users see:

      llvm::ElementCount EC = {vector->getNumElements(), /*scalable*/ false};
                         ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/dave/s/n/llvm/include/llvm/Support/TypeSize.h:37:12: note: explicit constructor declared here
    explicit ElementCount(unsigned Min, bool Scalable) : Min(Min), Scalable(Scalable) {}
             ^
  1 error generated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86120



More information about the llvm-commits mailing list