summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
authorEdwin Vane <edwin.vane@intel.com>2013-04-01 18:33:34 +0000
committerEdwin Vane <edwin.vane@intel.com>2013-04-01 18:33:34 +0000
commitec0748068ed3bc261ccd1fc83a1423ace88d2567 (patch)
tree28227d433cb731125177c4a70e7136d58a99163b /clang/unittests/ASTMatchers/ASTMatchersTest.cpp
parentc2eddb0d02e5cadf3afbf73d8d4fe15c7d2010b4 (diff)
downloadbcm5719-llvm-ec0748068ed3bc261ccd1fc83a1423ace88d2567.tar.gz
bcm5719-llvm-ec0748068ed3bc261ccd1fc83a1423ace88d2567.zip
Adding parenType() and innerType() AST Matchers
Updated docs and tests. llvm-svn: 178487
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index 2e2a824f8fe..14824d018ba 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -3387,6 +3387,19 @@ TEST(TypeMatching, MatchesFunctionTypes) {
EXPECT_TRUE(matches("void f(int i) {}", functionType()));
}
+TEST(TypeMatching, MatchesParenType) {
+ EXPECT_TRUE(
+ matches("int (*array)[4];", varDecl(hasType(pointsTo(parenType())))));
+ EXPECT_TRUE(notMatches("int *array[4];", varDecl(hasType(parenType()))));
+
+ EXPECT_TRUE(matches(
+ "int (*ptr_to_func)(int);",
+ varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
+ EXPECT_TRUE(notMatches(
+ "int (*ptr_to_array)[4];",
+ varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
+}
+
TEST(TypeMatching, PointerTypes) {
// FIXME: Reactive when these tests can be more specific (not matching
// implicit code on certain platforms), likely when we have hasDescendant for
OpenPOWER on IntegriCloud