Fixed source range for functional cast and unresolved construct expr nodes.
Added testcases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185773 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/AST/SourceLocationTest.cpp b/unittests/AST/SourceLocationTest.cpp
index be63085..697c6a0 100644
--- a/unittests/AST/SourceLocationTest.cpp
+++ b/unittests/AST/SourceLocationTest.cpp
@@ -201,5 +201,26 @@
loc(unaryTransformType())));
}
+TEST(CXXFunctionalCastExpr, SourceRange) {
+ RangeVerifier<CXXFunctionalCastExpr> Verifier;
+ Verifier.expectRange(2, 10, 2, 14);
+ EXPECT_TRUE(Verifier.match(
+ "int foo() {\n"
+ " return int{};\n"
+ "}",
+ functionalCastExpr(), Lang_CXX11));
+}
+
+TEST(CXXUnresolvedConstructExpr, SourceRange) {
+ RangeVerifier<CXXUnresolvedConstructExpr> Verifier;
+ Verifier.expectRange(3, 10, 3, 12);
+ EXPECT_TRUE(Verifier.match(
+ "template <typename U>\n"
+ "U foo() {\n"
+ " return U{};\n"
+ "}",
+ unresolvedConstructExpr(), Lang_CXX11));
+}
+
} // end namespace ast_matchers
} // end namespace clang