diff options
author | Edwin Vane <edwin.vane@intel.com> | 2013-04-02 18:15:55 +0000 |
---|---|---|
committer | Edwin Vane <edwin.vane@intel.com> | 2013-04-02 18:15:55 +0000 |
commit | 7b69cd09440976d6b93a0db661a770b2337be8d2 (patch) | |
tree | ab43b4ad51d422f8e3075190f555123aff475357 /unittests | |
parent | 8b0822b3043f91a113d39da7aa9bb0634db69807 (diff) |
Adding a hasLocalQualifiers() AST Matcher.
Updated tests and docs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178556 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ASTMatchers/ASTMatchersTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp index 14824d018b..301b4f7c8a 100644 --- a/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -1356,6 +1356,17 @@ TEST(QualType, hasCanonicalType) { varDecl(hasType(qualType(hasCanonicalType(referenceType())))))); } +TEST(QualType, hasLocalQualifiers) { + EXPECT_TRUE(notMatches("typedef const int const_int; const_int i = 1;", + varDecl(hasType(hasLocalQualifiers())))); + EXPECT_TRUE(matches("int *const j = nullptr;", + varDecl(hasType(hasLocalQualifiers())))); + EXPECT_TRUE(matches("int *volatile k;", + varDecl(hasType(hasLocalQualifiers())))); + EXPECT_TRUE(notMatches("int m;", + varDecl(hasType(hasLocalQualifiers())))); +} + TEST(HasParameter, CallsInnerMatcher) { EXPECT_TRUE(matches("class X { void x(int) {} };", methodDecl(hasParameter(0, varDecl())))); |