[PATCH] Add hasUnderlyingType narrowing matcher for TypedefDecls, functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes

Manuel Klimek klimek at google.com
Mon May 18 07:47:46 PDT 2015


LG after:

- fixing nits above
- running:

$ cd docs/tools
$ ./dump_ast_matchers.py


================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:2669-2670
@@ -2653,3 +2668,4 @@
 
-/// \brief Matches \c FunctionDecls that have a specific parameter count.
+/// \brief Matches \c FunctionDecls and FunctionProtoTypes that have a specific
+/// parameter count.
 ///
----------------
\c FunctionProtoTypes

================
Comment at: unittests/ASTMatchers/ASTMatchersTest.cpp:4677-4680
@@ -4670,1 +4676,6 @@
 
+TEST(HasUnderlyingTypeMatcher, Match) {
+  EXPECT_TRUE(matches("typedef int hasUnderlyingTypeTest;",
+                      typedefDecl(hasUnderlyingType(asString("int")))));
+}
+
----------------
Can you add a negative test with hasUnderlyingType(asString("float")) or something?

http://reviews.llvm.org/D8149

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list