[clang] [analyzer] Fix crash in PaddingChecker on dependent field types (PR #232986)

Manuel Sainz de Baranda y Goñi via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 17 05:58:33 PDT 2026


redcode wrote:

> I think your check is correct. I think your comment is not. Dependent types can have layout T&& for example.

Ooopss... :sweat:

> However, I suspect this is a bug in SEMA. It appears that the lambda stays LDK_Unknown. If so, Sema probably should treat it as dependent, and this checker guard could become a defensive backstop. A FIXME pointing at the issue inside ActOnLambdaExpressionAfterIntroducer would be good. As well as a github issue maybe?

Thanks for the review. I'll modify the comment and add a FIXME in `ActOnLambdaExpressionAfterIntroducer` pointing at the issue, and open a separate issue for the Sema bug.

One thing: the guard skips records with dependent fields silently. That means it can also mask future Sema bugs that leave a record non-dependent but with a dependent field, turning a loud crash into a silently missed warning. Should I add an `assert` alongside the guard, so this still fires in assert-enabled builds while the guard keeps release builds from crashing? Or is the FIXME plus a separate issue enough tracking for now?


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


More information about the cfe-commits mailing list