[PATCH] D20052: Add new ASTMatcher that matches dynamic exception specifications.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 12:51:19 PDT 2016


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:3229
@@ +3228,3 @@
+///   matches the declarations of j, k, and l, but not f, g, h, or i.
+AST_MATCHER(FunctionDecl, hasDynamicExceptionSpec) {
+  if (const auto *FnTy = Node.getType()->getAs<FunctionProtoType>())
----------------
hintonda wrote:
> aaron.ballman wrote:
> > It's a bit odd to expose this on the declaration instead of the type since the AST carries this information on the type, not the declaration. I definitely see the utility in not having to go from the decl to the type in an AST matcher, though. Can you expose it on both FunctionDecl and FunctionProtoType instead?
> It's modeled on the isNoThrow matcher directly below which used FunctionDecl, so I used it for this one too.
> 
> Did you want me change this one to use FunctionProtoType or add 2 matchers, one using FunctionDecl and another one using FunctionProtoType?
Ah, good point about isNoThrow. I would say leave it as FunctionDecl for now and maybe a follow-on patch (not requesting you do this work, btw) can convert it to be a polymorphic matcher that accepts FunctionDecl and FunctionProtoType.


http://reviews.llvm.org/D20052





More information about the cfe-commits mailing list