Handle sizeof expressions.
I was a bit unsure here about alignment, but the rest is pretty self-explanatory I think.
Differential D133934
[clang][Interp] Handle sizeof() expressions tbaeder on Sep 15 2022, 3:47 AM. Authored by
Details Handle sizeof expressions. I was a bit unsure here about alignment, but the rest is pretty self-explanatory I think.
Diff Detail Event Timeline
Comment Actions I can see that HandleSizeOf() uses 1 for void and function types as a gcc extension, but I can't reproduce that: https://godbolt.org/z/njG9zh6PM
Comment Actions C code allows the construct: https://godbolt.org/z/5KfY9PPqa Worth keeping in mind: C2x has support for constexpr objects, so we are going to have to care about this. We've not started doing the work to enable constexpr for C yet, so there's some wiggle room in terms of *when* we have to care, but we should try to keep C in mind when working on the new interpreter as much as is reasonable.
|
At some point, do we want to rename this (and int) to use uint32_t/int32_t?