aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/AST/SourceLocationTest.cpp
diff options
context:
space:
mode:
authorEnea Zaffanella <zaffanella@cs.unipr.it>2013-07-06 18:54:58 +0000
committerEnea Zaffanella <zaffanella@cs.unipr.it>2013-07-06 18:54:58 +0000
commita90af72e8f7e4d88f16148ff2c995c68d67f496c (patch)
treed9f52f998a0f2f9886225f01c9bec38209849df3 /clang/unittests/AST/SourceLocationTest.cpp
parente557da26db4cd4824e9051a8e517e80a82a9bdaa (diff)
downloadllvm-a90af72e8f7e4d88f16148ff2c995c68d67f496c.zip
llvm-a90af72e8f7e4d88f16148ff2c995c68d67f496c.tar.gz
llvm-a90af72e8f7e4d88f16148ff2c995c68d67f496c.tar.bz2
Fixed source location info for UnaryTransformTypeLoc nodes.
llvm-svn: 185765
Diffstat (limited to 'clang/unittests/AST/SourceLocationTest.cpp')
-rw-r--r--clang/unittests/AST/SourceLocationTest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp
index 669fcd4..be63085 100644
--- a/clang/unittests/AST/SourceLocationTest.cpp
+++ b/clang/unittests/AST/SourceLocationTest.cpp
@@ -180,5 +180,26 @@ TEST(CXXNewExpr, TypeParenRange) {
EXPECT_TRUE(Verifier.match("int* a = new (int);", newExpr()));
}
+class UnaryTransformTypeLocParensRangeVerifier : public RangeVerifier<TypeLoc> {
+protected:
+ virtual SourceRange getRange(const TypeLoc &Node) {
+ UnaryTransformTypeLoc T =
+ Node.getUnqualifiedLoc().castAs<UnaryTransformTypeLoc>();
+ assert(!T.isNull());
+ return SourceRange(T.getLParenLoc(), T.getRParenLoc());
+ }
+};
+
+TEST(UnaryTransformTypeLoc, ParensRange) {
+ UnaryTransformTypeLocParensRangeVerifier Verifier;
+ Verifier.expectRange(3, 26, 3, 28);
+ EXPECT_TRUE(Verifier.match(
+ "template <typename T>\n"
+ "struct S {\n"
+ "typedef __underlying_type(T) type;\n"
+ "};",
+ loc(unaryTransformType())));
+}
+
} // end namespace ast_matchers
} // end namespace clang