diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2015-12-02 15:23:59 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2015-12-02 15:23:59 +0000 |
commit | a60bcdab921ce2aad55a3ef2e3686e6801a30f0f (patch) | |
tree | 2a8ec9067bfebfa494b4db2cc51a87fe37b93684 /clang/unittests/ASTMatchers/ASTMatchersTest.cpp | |
parent | 08dd61de24f58f2df26306ebd833bc805fe73b7e (diff) | |
download | bcm5719-llvm-a60bcdab921ce2aad55a3ef2e3686e6801a30f0f.tar.gz bcm5719-llvm-a60bcdab921ce2aad55a3ef2e3686e6801a30f0f.zip |
Add a narrowing AST matcher that matches on a FunctionDecl with a non-throwing exception specification.
llvm-svn: 254516
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index 51233e91303..9aefb078091 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -1716,6 +1716,15 @@ TEST(IsDeleted, MatchesDeletedFunctionDeclarations) { functionDecl(hasName("Func"), isDeleted()))); } +TEST(IsNoThrow, MatchesNoThrowFunctionDeclarations) { + EXPECT_TRUE(notMatches("void f();", functionDecl(isNoThrow()))); + EXPECT_TRUE(notMatches("void f() throw(int);", functionDecl(isNoThrow()))); + EXPECT_TRUE( + notMatches("void f() noexcept(false);", functionDecl(isNoThrow()))); + EXPECT_TRUE(matches("void f() throw();", functionDecl(isNoThrow()))); + EXPECT_TRUE(matches("void f() noexcept;", functionDecl(isNoThrow()))); +} + TEST(isConstexpr, MatchesConstexprDeclarations) { EXPECT_TRUE(matches("constexpr int foo = 42;", varDecl(hasName("foo"), isConstexpr()))); |