[clang] [clang-tools-extra] [clang][AST] Fix crash in MatchChildASTVisitor::TraverseLambdaExpr (PR #70962)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 16 05:36:19 PST 2023


AaronBallman wrote:

> Would be nice to simply not crash in such case, whatever someone will fix origin issue later is up to debate. I would like to see this change on 17.0.6 (that means 2 weeks left to merge this). Unless someone fixes this somewere in lower layers.

The worry with pushing this as a fix is that it seems to be papering over a real issue; if we "fix" it this way, 1) less incentive to go fix the actual issue, and 2) easy to forget to come tear this code back out when we do fix it and that makes future maintenance harder.

I don't think this should change for 17.0.6 unless we have a correct fix that we agree is *definitely* safe and correct.

Unfortunately, I think we need to spend some time looking into the root cause more (not certain when I'll have the time to poke at that myself, but it would likely be in the next year timeframe for me at this point due to holidays coming up).

You can definitely see the NULL entry in the AST in https://godbolt.org/z/bax6Ghj3n but the code also seems to behave correctly and the assembly generated seems reasonable. I think the issue is likely near here: https://github.com/llvm/llvm-project/blob/108380da357e2db513f016d33adede0d58636bea/clang/include/clang/AST/RecursiveASTVisitor.h#L2657

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


More information about the cfe-commits mailing list