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

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 5 13:32:04 PST 2019


riccibruno marked an inline comment as done.
riccibruno added inline comments.


================
Comment at: include/clang/AST/Expr.h:3029
+    assert((CastExprBits.BasePathSize == BasePathSize) &&
+           "BasePathSize overflow!");
     assert(CastConsistency());
----------------
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.


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