aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/AST/SourceLocationTest.cpp
diff options
context:
space:
mode:
authorAbramo Bagnara <abramo.bagnara@bugseng.com>2012-11-08 14:44:42 +0000
committerAbramo Bagnara <abramo.bagnara@bugseng.com>2012-11-08 14:44:42 +0000
commit341ab737e99b827e7c7c9e7963253ff5d2bb8744 (patch)
tree71fb58ac5b0efbc7732cb4b428b0a35688407a20 /clang/unittests/AST/SourceLocationTest.cpp
parent08be41adbf6a3671a9ae1fe2927481609121e18f (diff)
downloadllvm-341ab737e99b827e7c7c9e7963253ff5d2bb8744.zip
llvm-341ab737e99b827e7c7c9e7963253ff5d2bb8744.tar.gz
llvm-341ab737e99b827e7c7c9e7963253ff5d2bb8744.tar.bz2
Fixed converted ConstantArrayTypeLoc range. Added a missing testcase for ConstructorDecl source range.
llvm-svn: 167583
Diffstat (limited to 'clang/unittests/AST/SourceLocationTest.cpp')
-rw-r--r--clang/unittests/AST/SourceLocationTest.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp
index c1651bc..953cb9e 100644
--- a/clang/unittests/AST/SourceLocationTest.cpp
+++ b/clang/unittests/AST/SourceLocationTest.cpp
@@ -29,7 +29,7 @@ using clang::tooling::newFrontendActionFactory;
using clang::tooling::runToolOnCodeWithArgs;
using clang::tooling::FrontendActionFactory;
-enum Language { Lang_C, Lang_CXX };
+enum Language { Lang_C, Lang_C89, Lang_CXX };
/// \brief Base class for verifying some property of nodes found by a matcher.
///
@@ -78,6 +78,10 @@ testing::AssertionResult MatchVerifier<NodeType>::match(
Args.push_back("-std=c99");
FileName = "input.c";
break;
+ case Lang_C89:
+ Args.push_back("-std=c89");
+ FileName = "input.c";
+ break;
case Lang_CXX:
Args.push_back("-std=c++98");
FileName = "input.cc";
@@ -262,5 +266,18 @@ TEST(MemberExpr, ImplicitMemberRange) {
memberExpr()));
}
+TEST(VarDecl, VMTypeFixedVarDeclRange) {
+ RangeVerifier<VarDecl> Verifier;
+ Verifier.expectRange(1, 1, 1, 23);
+ EXPECT_TRUE(Verifier.match("int a[(int)(void*)1234];",
+ varDecl(), Lang_C89));
+}
+
+TEST(CXXConstructorDecl, NoRetFunTypeLocRange) {
+ RangeVerifier<CXXConstructorDecl> Verifier;
+ Verifier.expectRange(1, 11, 1, 13);
+ EXPECT_TRUE(Verifier.match("class C { C(); };", functionDecl()));
+}
+
} // end namespace ast_matchers
} // end namespace clang