Index: include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -3212,6 +3212,25 @@ return Node.isDefaulted(); } +/// \brief Matches functions that have a dynamic exception specification. +/// +/// Given: +/// \code +/// void f(); +/// void g() noexcept; +/// void h() throw(); +/// void i() throw(int); +/// void j() throw(...); +/// void k() noexcept(false); +/// \endcode +/// functionDecl(hasDynamicExceptionSpec()) +/// matches the declarations of h, i, and j, but not f, g or k. +AST_MATCHER(FunctionDecl, hasDynamicExceptionSpec) { + if (const auto *FnTy = Node.getType()->getAs()) + return FnTy->hasDynamicExceptionSpec(); + return false; +} + /// \brief Matches functions that have a non-throwing exception specification. /// /// Given: