xiongzile wrote:

@vhscampos,

I handled `bool` and `_BitInt` separately.

- For `bool`, I changed the occupied size to `min(declared_bits, type_size)` 
instead of `min(declared_bits, getIntWidth())`, on both LE and BE.
- For `_BitInt`, I only changed the BE case to protect `min(declared_bits, 
type_size)`. The LE behavior is unchanged.

There is one concern here: for `bool`, the current LE implementation 
effectively protects only one bit because `getIntWidth(bool) == 1`. GCC appears 
to preserve the whole declared bit-field width instead. This may be a 
historical Clang behavior (or an intentional design difference), and I'm not 
sure whether changing the LE `bool` behavior should be part of this PR.

For `_BitInt`, the BE change is based on Clang's current CodeGen layout(protect 
all bits, include sign-extension bit). I'm not sure for LE whether we should 
also protect more bits or leave it as ``getIntWidth``

The code looks ugly but I don't find a better way to handle it:)


https://github.com/llvm/llvm-project/pull/225494
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to