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

Richard via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 5 22:04:00 PST 2016


LegalizeAdulthood added inline comments.

================
Comment at: unittests/ASTMatchers/ASTMatchersTest.cpp:4282
@@ +4281,3 @@
+  EXPECT_TRUE(matches("void f(int i);", functionProtoType()));
+  EXPECT_TRUE(matches("void f();", functionProtoType(parameterCountIs(0))));
+  EXPECT_TRUE(
----------------
aaron.ballman wrote:
> This isn't quite what I had in mind. The test you added is a good one to add, but I wanted a test that functionProtoType() does *not* match f() (because it has no prototype), and another test for parameterCountIs() that it does't explode on a function without a prototype in C.
I don't  understand what would be tested by adding a test for `parameterCountIs()` on a function that doesn't have a prototype since it is a nested matcher passed to `functionProtoType()` and since the function doesn't have a prototype, that outer matcher won't match.


http://reviews.llvm.org/D8149





More information about the cfe-commits mailing list