We wanted to write the following check in clang-tidy: find all alloca calls inside a loop, but not those captured by a block.
Finding all alloca calls inside a loop is very easy with the matcher, but to exclude those in a block, we wanted to walk the AST from the alloca call to the loop in the checker.
One way to achieve that was to patch ParentMap, because it didn't go inside blocks. See the attached patch.
Is that approach correct or does anyone have a better suggestion ?
Cheers,
Xavier
0001-ParentMap-add-support-for-BlockExpr.patch (943 Bytes)