[PATCH] AST matcher for catch(...)

Aaron Ballman aaron at aaronballman.com
Wed Jul 1 14:16:18 PDT 2015


I was making a brief foray into AST matchers over exception handling
code today, and I noticed there's no way (that I could find) to match
only catch-all exception handlers. Eg)

try {
} catch (int) {
} catch (...) { // Only want to match this
}

The attached patch adds the matcher, test case, and documentation for
such a thing. I am not strongly tied to "catch all" as the name, but
alternatives like "handlesAnyType" sound like it would match
catch(int) as well as catch(...). If there's a better name, I'd be
happy to make use of it.

Thanks!

~Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: catchAll.patch
Type: application/octet-stream
Size: 3441 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150701/c15874ba/attachment.obj>


More information about the cfe-commits mailing list