[PATCH] D90713: [TypeSize] Extend UnivariateLinearPolyBase with getWithIncrement/Decrement methods
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 5 03:22:25 PST 2020
sdesmalen added inline comments.
================
Comment at: llvm/include/llvm/Support/TypeSize.h:241
+ LeafTy getWithIncrement(ScalarTy RHS) {
+ return static_cast<LeafTy>(
+ UnivariateLinearPolyBase(Value + RHS, UnivariateDim));
----------------
dmgreen wrote:
> I'm pretty sure my C++ has gotten worse since I started working on compilers.
>
> Is the static_cast here needed? Will that end up just calling the new conversion constructor. Can it just create a LeafTy directly?
That's a fair question, I played around a bit with the options here. In the end went for a static_cast because it otherwise forces LeafTy to have a constructor of a certain shape (i.e. of whatever is called in this function). Otherwise it depends on a conversion constructor from parent -> child class, which always has the same form.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90713/new/
https://reviews.llvm.org/D90713
More information about the llvm-commits
mailing list