yihanaa added a comment. In D122248#3403349 <https://reviews.llvm.org/D122248#3403349>, @erichkeane wrote:
> In D122248#3403343 <https://reviews.llvm.org/D122248#3403343>, @yihanaa wrote: > >> In D122248#3403315 <https://reviews.llvm.org/D122248#3403315>, >> @aaron.ballman wrote: >> >>> In D122248#3403143 <https://reviews.llvm.org/D122248#3403143>, @yihanaa >>> wrote: >>> >>>> 1. Support zero-width bitfield, named bitfield and unnamed bitfield. >>>> 2. Add a release notes. >>>> >>>> The builtin function __builtin_dump_struct behaves for zero-width bitfield >>>> and unnamed bitfield as follows >>>> >>>> int printf(const char *fmt, ...); >>>> >>>> void foo(void) { >>>> struct Bar { >>>> unsigned c : 1; >>>> unsigned : 3; >>>> unsigned : 0; >>>> unsigned b; >>>> }; >>>> >>>> struct Bar a = { >>>> .c = 1, >>>> .b = 2022, >>>> }; >>>> >>>> __builtin_dump_struct(&a, &printf); >>>> } >>>> >>>> int main() { >>>> foo(); >>>> return 0; >>>> } >>>> >>>> Output: >>>> >>>> struct Bar { >>>> unsigned int c : 1 >>>> unsigned int : 0 >>>> unsigned int b : 2022 >>>> } >>> >>> Thank you for the release note and additional test coverage. I'm wondering >>> why we handle the zero-width bit-field differently from the anonymous one >>> (e.g., why do we not have `unsigned int : 3` before the `unsigned int : 0`? >>> It seems a bit odd to drop that from the output. >> >> Thanks, I don't know what the value of this zero-width bitfield should >> output, can it be a empty value as same as unnamed-bitfield’ she field name? >> >> for example: >> >> struct Bar { >> unsigned int c : 1 >> unsigned int : 0 >> unsigned int : >> unsigned int b : 2022 >> } > > I would definitely expect this, yes. I will try to modify it according to this rule. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122248/new/ https://reviews.llvm.org/D122248 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits