summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/SourceLocationTest.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2016-01-12 21:04:22 +0000
committerAaron Ballman <aaron@aaronballman.com>2016-01-12 21:04:22 +0000
commit580ccaf82797de3d1c29bb9e3a43c18d22be1174 (patch)
treea3a091c48bfe7bd0e4ee5f007f44714353abc426 /clang/unittests/AST/SourceLocationTest.cpp
parent793038d31b25f2b9c9b41237f7ed5b3beb29be8c (diff)
downloadbcm5719-llvm-580ccaf82797de3d1c29bb9e3a43c18d22be1174.tar.gz
bcm5719-llvm-580ccaf82797de3d1c29bb9e3a43c18d22be1174.zip
Properly track the end location of an exception specification.
Patch by Adrian ZgorzaƂek llvm-svn: 257521
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