diff options
author | Manuel Klimek <klimek@google.com> | 2013-06-07 11:27:57 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-06-07 11:27:57 +0000 |
commit | 8122830a673e868fc8f7da63cb76b2672085db4e (patch) | |
tree | f6e25931d5631866736486901664c4ed0a485c71 /clang/unittests | |
parent | e29ec9680a6650b80cede7ecb68480283c41f1ff (diff) | |
download | bcm5719-llvm-8122830a673e868fc8f7da63cb76b2672085db4e.tar.gz bcm5719-llvm-8122830a673e868fc8f7da63cb76b2672085db4e.zip |
Adds a test that verifies angle bracket locations.
Regression test to make sure TemplateSpecializationTypeLocs have the
correct locations for angle brackets.
llvm-svn: 183514
Diffstat (limited to 'clang/unittests')
-rw-r--r-- | clang/unittests/AST/SourceLocationTest.cpp | 19 |
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 |