When a variable-length array is being captured in a lambda, the AST
contains two captures, the first one having a null init expression.
Visiting that one triggers an assertion, so skip it.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Unit Tests
Event Timeline
Comment Actions
this relates to https://reviews.llvm.org/D82740 too, but comes with a test which is good. personally I would place the check directly within Visit to make it more generically prevent a crash on invalid input, but that's probably a subjective design decision.
Comment Actions
I suppose it boils down to whether the visit() function is supposed to accept null arguments or not. Since I don't know the answer to that, I added the check at the caller. From the description of the linked patch, it appears that other places are also calling the function with a null pointer, but that could just mean that these should be fixed independently. Someone with better knowledge of the code would have to make that decision.