[PATCH] D23035: [Support] Add LLVM_BITFIELD_WIDTH and LLVM_CHECKED_BITFIELD_ASSIGN macros.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 1 17:22:52 PDT 2016
jlebar added a comment.
> I think we should just encourage this pattern
Do you think it would be an improvement to rewrite clang's Expr.h to this pattern? Or, more to my point, https://reviews.llvm.org/D23036? It seems kind of wordy to me, but I'm open to thoughts.
I don't like that this macro obfuscates the code, but I do like that we don't have to rely on people writing correct check-in-range code. Like, it wasn't at all obvious to me that `foo.x = y; assert(foo.x == y);` was correct, or that it *wouldn't* be correct if the bitfield were signed. The macro gets that stuff right, which I like.
https://reviews.llvm.org/D23035
More information about the llvm-commits
mailing list