summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/SourceLocationTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/AST/SourceLocationTest.cpp')
-rw-r--r--clang/unittests/AST/SourceLocationTest.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp
index 4c77def61bc..9fae8d862ae 100644
--- a/clang/unittests/AST/SourceLocationTest.cpp
+++ b/clang/unittests/AST/SourceLocationTest.cpp
@@ -542,5 +542,43 @@ TEST(ObjCMessageExpr, CXXConstructExprRange) {
cxxConstructExpr(), Lang_OBJCXX));
}
+TEST(FunctionDecl, FunctionDeclWithThrowSpecification) {
+ RangeVerifier<FunctionDecl> Verifier;
+ Verifier.expectRange(1, 1, 1, 16);
+ EXPECT_TRUE(Verifier.match(
+ "void f() throw();\n",
+ functionDecl()));
+}
+
+TEST(FunctionDecl, FunctionDeclWithNoExceptSpecification) {
+ RangeVerifier<FunctionDecl> Verifier;
+ Verifier.expectRange(1, 1, 1, 24);
+ EXPECT_TRUE(Verifier.match(
+ "void f() noexcept(false);\n",
+ functionDecl(),
+ Language::Lang_CXX11));
+}
+
+TEST(CXXMethodDecl, CXXMethodDeclWithThrowSpecification) {
+ RangeVerifier<FunctionDecl> Verifier;
+ Verifier.expectRange(2, 1, 2, 16);
+ EXPECT_TRUE(Verifier.match(
+ "class A {\n"
+ "void f() throw();\n"
+ "};\n",
+ functionDecl()));
+}
+
+TEST(CXXMethodDecl, CXXMethodDeclWithNoExceptSpecification) {
+ RangeVerifier<FunctionDecl> Verifier;
+ Verifier.expectRange(2, 1, 2, 24);
+ EXPECT_TRUE(Verifier.match(
+ "class A {\n"
+ "void f() noexcept(false);\n"
+ "};\n",
+ functionDecl(),
+ Language::Lang_CXX11));
+}
+
} // end namespace ast_matchers
} // end namespace clang
OpenPOWER on IntegriCloud