[clang] [Sema] Call ActOnFields before late parsing in ParseStructUnionBody (PR #187166)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 9 04:54:19 PDT 2026


zmodem wrote:

> Move the call to ActOnFields() before ParseLexedCAttributeList() in ParseStructUnionBody for reordering so that the struct type is complete when late-parsed attributes like counted_by get evaluated.

Someone who knows the parser better can correct me here, but intuitively the new ordering seems odd to me. Shouldn't `ActOnFields()` be able to assume that the fields have been fully parsed, including their attributes?

Maybe the real problem is that the code that evaluates the counted_by expression runs too early? Is it running during parsing rather than during semantic analysis?

https://github.com/llvm/llvm-project/pull/187166


More information about the cfe-commits mailing list