Index: docs/LibASTMatchersReference.html =================================================================== --- docs/LibASTMatchersReference.html +++ docs/LibASTMatchersReference.html @@ -2403,22 +2403,6 @@ -Matcher<FunctionDecl>hasDynamicExceptionSpec -
Matches functions that have a dynamic exception specification.
-
-Given:
-  void f();
-  void g() noexcept;
-  void h() noexcept(true);
-  void i() noexcept(false);
-  void j() throw();
-  void k() throw(int);
-  void l() throw(...);
-functionDecl(hasDynamicExceptionSpec())
-  matches the declarations of j, k, and l, but not f, g, h, or i.
-
- - Matcher<FunctionDecl>hasOverloadedOperatorNameStringRef Name
Matches overloaded operator names.
 
@@ -2616,6 +2600,22 @@
 
+Matcher<FunctionType>hasDynamicExceptionSpec +
Matches functions that have a dynamic exception specification.
+
+Given:
+  void f();
+  void g() noexcept;
+  void h() noexcept(true);
+  void i() noexcept(false);
+  void j() throw();
+  void k() throw(int);
+  void l() throw(...);
+functionType(hasDynamicExceptionSpec())
+  matches the declarations of j, k, and l, but not f, g, h, or i.
+
+ + Matcher<IntegerLiteral>equalsValueT Value
Matches literals that are equal to the given value.
 
Index: include/clang/ASTMatchers/ASTMatchers.h
===================================================================
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -3245,10 +3245,10 @@
 ///   void k() throw(int);
 ///   void l() throw(...);
 /// \endcode
-/// functionDecl(hasDynamicExceptionSpec())
+/// functionType(hasDynamicExceptionSpec())
 ///   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())
+AST_MATCHER(FunctionType, hasDynamicExceptionSpec) {
+  if (const auto *FnTy = dyn_cast(&Node))
     return FnTy->hasDynamicExceptionSpec();
   return false;
 }
Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===================================================================
--- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1383,19 +1383,19 @@
 }
 
 TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) {
-  EXPECT_TRUE(notMatches("void f();", functionDecl(hasDynamicExceptionSpec())));
+  EXPECT_TRUE(notMatches("void f();", functionType(hasDynamicExceptionSpec())));
   EXPECT_TRUE(notMatches("void g() noexcept;",
-                         functionDecl(hasDynamicExceptionSpec())));
+                         functionType(hasDynamicExceptionSpec())));
   EXPECT_TRUE(notMatches("void h() noexcept(true);",
-                         functionDecl(hasDynamicExceptionSpec())));
+                         functionType(hasDynamicExceptionSpec())));
   EXPECT_TRUE(notMatches("void i() noexcept(false);",
-                         functionDecl(hasDynamicExceptionSpec())));
+                         functionType(hasDynamicExceptionSpec())));
   EXPECT_TRUE(
-      matches("void j() throw();", functionDecl(hasDynamicExceptionSpec())));
+      matches("void j() throw();", functionType(hasDynamicExceptionSpec())));
   EXPECT_TRUE(
-      matches("void k() throw(int);", functionDecl(hasDynamicExceptionSpec())));
+      matches("void k() throw(int);", functionType(hasDynamicExceptionSpec())));
   EXPECT_TRUE(
-      matches("void l() throw(...);", functionDecl(hasDynamicExceptionSpec())));
+      matches("void l() throw(...);", functionType(hasDynamicExceptionSpec())));
 }
 
 TEST(HasObjectExpression, DoesNotMatchMember) {