[PATCH] D56358: [AST] Move back BasePathSize to the bit-fields of CastExpr

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 7 01:25:09 PST 2019


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

LG in principle.



================
Comment at: include/clang/AST/Expr.h:3029
+    assert((CastExprBits.BasePathSize == BasePathSize) &&
+           "BasePathSize overflow!");
     assert(CastConsistency());
----------------
rjmccall wrote:
> riccibruno wrote:
> > lebedev.ri wrote:
> > > riccibruno wrote:
> > > > It cannot overflow now, but someone in the future is going
> > > > to shrink `CastExprBitfields::BasePathSize`.
> > > Can you move that static assert here instead of deleting it?
> > I am not sure it is really useful since when someone will want to
> > shrink it, it will be stored as `unsigned BasePathSite : x;`. What we
> > don't want is having `x` too small. However `numeric_limits` will
> > be based on the underlying type of the bit-field and so will never fail.
> > 
> > Storing it as something other than an unsigned, say a short, would work,
> > but it will pack poorly with MSVC.
> > 
> > Hopefully the comment in `CastExprBitfields` will tell people to not shrink it
> > mindlessly.
> I agree that the type-based numeric limit is not useful if we're anticipating
> it becoming a bit-field.  The comment seems fine since it's in the code that
> would need to be edited.
I'm just worried that now there will be less of a test coverage,
The actual run-time test already does not test template instantiation with depth of `16384`, but much less.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56358





More information about the cfe-commits mailing list