[PATCH] D123298: [NFC] [AST] Reduce the size of TemplateParmPosition

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 04:21:20 PDT 2022


aaron.ballman added a comment.

Still LG to me, but please watch the build bots and issues list closely for any new template instantiation depth/position related issues over the next short while given that we're making a best guess at the bit widths here.



================
Comment at: clang/include/clang/AST/DeclTemplate.h:1156-1157
 
-  TemplateParmPosition(unsigned D, unsigned P) : Depth(D), Position(P) {}
+  static constexpr unsigned MaxDepth = (1l << DEPTH_BITWIDTH) - 1;
+  static constexpr unsigned MaxPosition = (1l << POSITION_BITWIDTH) - 1;
+
----------------
ChuanqiXu wrote:
> aaron.ballman wrote:
> > ChuanqiXu wrote:
> > > I don't find standard way to generate the maximum value for bit fields.. So I choose to calculate it by hand. 
> > Since we're adding 1 everywhere we look at these values, would it make more sense to drop the -1 here and the +1 elsewhere?
> Maybe we're able to drop the -1 here. But I feel it breaks the semantics. So I feel it is not good.
I don't insist. :-)


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

https://reviews.llvm.org/D123298



More information about the cfe-commits mailing list