[cfe-dev] ParentMap: add support for BlockExpr

Xavier Chantry via cfe-dev cfe-dev at lists.llvm.org
Mon Jan 18 09:53:42 PST 2016


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ParentMap-add-support-for-BlockExpr.patch
Type: text/x-patch
Size: 943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160118/fe0277b9/attachment.bin>


More information about the cfe-dev mailing list