diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2016-05-16 16:49:01 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2016-05-16 16:49:01 +0000 |
commit | abdbbbc51ff8723f8c8fd1a905b57323f66df47b (patch) | |
tree | 25f5fa3c2515f4c31ed303e3b7ef6d4979b25621 /clang/unittests/ASTMatchers/ASTMatchersTest.cpp | |
parent | b171a59bfd152346ca068c73ccb61fe28643d024 (diff) | |
download | bcm5719-llvm-abdbbbc51ff8723f8c8fd1a905b57323f66df47b.tar.gz bcm5719-llvm-abdbbbc51ff8723f8c8fd1a905b57323f66df47b.zip |
Add the hasDynamicExceptionSpec() AST matcher to match function declarations that have a dynamic exception specification.
Patch by Don Hinton.
llvm-svn: 269662
Diffstat (limited to 'clang/unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index 0db16d692f0..a934ac028d8 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -3571,6 +3571,22 @@ TEST(HasDestinationType, MatchesSimpleCase) { pointsTo(TypeMatcher(anything())))))); } +TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) { + EXPECT_TRUE(notMatches("void f();", functionDecl(hasDynamicExceptionSpec()))); + EXPECT_TRUE(notMatches("void g() noexcept;", + functionDecl(hasDynamicExceptionSpec()))); + EXPECT_TRUE(notMatches("void h() noexcept(true);", + functionDecl(hasDynamicExceptionSpec()))); + EXPECT_TRUE(notMatches("void i() noexcept(false);", + functionDecl(hasDynamicExceptionSpec()))); + EXPECT_TRUE( + matches("void j() throw();", functionDecl(hasDynamicExceptionSpec()))); + EXPECT_TRUE( + matches("void k() throw(int);", functionDecl(hasDynamicExceptionSpec()))); + EXPECT_TRUE( + matches("void l() throw(...);", functionDecl(hasDynamicExceptionSpec()))); +} + TEST(HasImplicitDestinationType, MatchesSimpleCase) { // This test creates an implicit const cast. EXPECT_TRUE(matches("int x; const int i = x;", |