Add an AST matcher for real floating-point types. e.g., float, double, long double, but not complex.
llvm-svn: 261221
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index 9b586ab..eb871f9 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -4415,6 +4415,15 @@
cxxMethodDecl(returns(voidType()))));
}
+TEST(TypeMatching, MatchesRealFloats) {
+ EXPECT_TRUE(matches("struct S { float func(); };",
+ cxxMethodDecl(returns(realFloatingPointType()))));
+ EXPECT_TRUE(notMatches("struct S { int func(); };",
+ cxxMethodDecl(returns(realFloatingPointType()))));
+ EXPECT_TRUE(matches("struct S { long double func(); };",
+ cxxMethodDecl(returns(realFloatingPointType()))));
+}
+
TEST(TypeMatching, MatchesArrayTypes) {
EXPECT_TRUE(matches("int a[] = {2,3};", arrayType()));
EXPECT_TRUE(matches("int a[42];", arrayType()));