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.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp
index f6c0edc9271..55356f11dad 100644
--- a/clang/unittests/AST/SourceLocationTest.cpp
+++ b/clang/unittests/AST/SourceLocationTest.cpp
@@ -155,5 +155,24 @@ TEST(InitListExpr, VectorLiteralInitListParens) {
"constant int2 i2 = (int2)(1, 2);", initListExpr(), Lang_OpenCL));
}
+class TemplateAngleBracketLocRangeVerifier : public RangeVerifier<TypeLoc> {
+protected:
+ virtual SourceRange getRange(const TypeLoc &Node) {
+ TemplateSpecializationTypeLoc T =
+ Node.castAs<TemplateSpecializationTypeLoc>();
+ assert(!T.isNull());
+ return SourceRange(T.getLAngleLoc(), T.getRAngleLoc());
+ }
+};
+
+TEST(TemplateSpecializationTypeLoc, AngleBracketLocations) {
+ TemplateAngleBracketLocRangeVerifier Verifier;
+ Verifier.expectRange(2, 8, 2, 10);
+ EXPECT_TRUE(Verifier.match(
+ "template<typename T> struct A {}; struct B{}; void f(\n"
+ "const A<B>&);",
+ loc(templateSpecializationType())));
+}
+
} // end namespace ast_matchers
} // end namespace clang
OpenPOWER on IntegriCloud