diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2015-08-18 19:55:20 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2015-08-18 19:55:20 +0000 |
| commit | 11825f25923a9776ac8e575cf8736fc6c5e2d33b (patch) | |
| tree | 200d17f7617845cc95859d9acfd95dd78105a785 /clang/unittests/ASTMatchers/ASTMatchersTest.cpp | |
| parent | 29f11b381f3a4162f41cd396be6ab3d1eb6fec2f (diff) | |
| download | bcm5719-llvm-11825f25923a9776ac8e575cf8736fc6c5e2d33b.tar.gz bcm5719-llvm-11825f25923a9776ac8e575cf8736fc6c5e2d33b.zip | |
Add AST narrowing matchers for inline and anonymous namespaces. Since the inline keyword can also be specified on a FunctionDecl, this is a polymorphic matcher.
llvm-svn: 245337
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
| -rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index f0eede8a788..c04f0fb82d4 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -4352,6 +4352,11 @@ TEST(NullStatement, SimpleCases) { EXPECT_TRUE(notMatches("void f() {int i;}", nullStmt())); } +TEST(NS, Anonymous) { + EXPECT_TRUE(notMatches("namespace N {}", namespaceDecl(isAnonymous()))); + EXPECT_TRUE(matches("namespace {}", namespaceDecl(isAnonymous()))); +} + TEST(NNS, MatchesTypes) { NestedNameSpecifierMatcher Matcher = nestedNameSpecifier( specifiesType(hasDeclaration(recordDecl(hasName("A"))))); @@ -4771,6 +4776,13 @@ TEST(TypeDefDeclMatcher, Match) { typedefDecl(hasName("typedefDeclTest")))); } +TEST(IsInlineMatcher, IsInline) { + EXPECT_TRUE(matches("void g(); inline void f();", + functionDecl(isInline(), hasName("f")))); + EXPECT_TRUE(matches("namespace n { inline namespace m {} }", + namespaceDecl(isInline(), hasName("m")))); +} + // FIXME: Figure out how to specify paths so the following tests pass on Windows. #ifndef LLVM_ON_WIN32 |

