summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/ASTImporterTest.cpp
diff options
context:
space:
mode:
authorAleksei Sidorin <a.sidorin@samsung.com>2018-02-14 11:18:00 +0000
committerAleksei Sidorin <a.sidorin@samsung.com>2018-02-14 11:18:00 +0000
commit4c05f1427134a524e1c84ccd57f59a96ffdffe59 (patch)
treea68dd867c600c4f830b320a19f0c78b9668f80ac /clang/unittests/AST/ASTImporterTest.cpp
parent918f60056a57aa2aa1322ff3a6207b79e40a56e3 (diff)
downloadbcm5719-llvm-4c05f1427134a524e1c84ccd57f59a96ffdffe59.tar.gz
bcm5719-llvm-4c05f1427134a524e1c84ccd57f59a96ffdffe59.zip
[ASTImporter] Fix lexical DC for templated decls; support VarTemplatePartialSpecDecl
Also minor refactoring in related functions was done. Differential Revision: https://reviews.llvm.org/D43012 llvm-svn: 325116
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r--clang/unittests/AST/ASTImporterTest.cpp40
1 files changed, 26 insertions, 14 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index 41134f96efe..feadd94dded 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -542,20 +542,32 @@ TEST(ImportExpr, ImportCXXDependentScopeMemberExpr) {
TEST(ImportType, ImportTypeAliasTemplate) {
MatchVerifier<Decl> Verifier;
- testImport("template <int K>"
- "struct dummy { static const int i = K; };"
- "template <int K> using dummy2 = dummy<K>;"
- "int declToImport() { return dummy2<3>::i; }",
- Lang_CXX11, "", Lang_CXX11, Verifier,
- functionDecl(
- hasBody(
- compoundStmt(
- has(
- returnStmt(
- has(
- implicitCastExpr(
- has(
- declRefExpr())))))))));
+ testImport(
+ "template <int K>"
+ "struct dummy { static const int i = K; };"
+ "template <int K> using dummy2 = dummy<K>;"
+ "int declToImport() { return dummy2<3>::i; }",
+ Lang_CXX11, "", Lang_CXX11, Verifier,
+ functionDecl(
+ hasBody(compoundStmt(
+ has(returnStmt(has(implicitCastExpr(has(declRefExpr()))))))),
+ unless(hasAncestor(translationUnitDecl(has(typeAliasDecl()))))));
+}
+
+const internal::VariadicDynCastAllOfMatcher<Decl, VarTemplateSpecializationDecl>
+ varTemplateSpecializationDecl;
+
+TEST(ImportDecl, ImportVarTemplate) {
+ MatchVerifier<Decl> Verifier;
+ testImport(
+ "template <typename T>"
+ "T pi = T(3.1415926535897932385L);"
+ "void declToImport() { pi<int>; }",
+ Lang_CXX11, "", Lang_CXX11, Verifier,
+ functionDecl(
+ hasBody(has(declRefExpr(to(varTemplateSpecializationDecl())))),
+ unless(hasAncestor(translationUnitDecl(has(varDecl(
+ hasName("pi"), unless(varTemplateSpecializationDecl()))))))));
}
TEST(ImportType, ImportPackExpansion) {
OpenPOWER on IntegriCloud