summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/ASTImporterTest.cpp
diff options
context:
space:
mode:
authorAleksei Sidorin <a.sidorin@samsung.com>2017-12-27 17:04:42 +0000
committerAleksei Sidorin <a.sidorin@samsung.com>2017-12-27 17:04:42 +0000
commit7f758b6af54b4eaaa22310bea9b8c58604d036c7 (patch)
tree872bf16f2c3bce108ba58e92b74df3da585b1639 /clang/unittests/AST/ASTImporterTest.cpp
parent9439f54902860be9c097db22a22d3456b83afc14 (diff)
downloadbcm5719-llvm-7f758b6af54b4eaaa22310bea9b8c58604d036c7.tar.gz
bcm5719-llvm-7f758b6af54b4eaaa22310bea9b8c58604d036c7.zip
[ASTImporter] Support importing FunctionTemplateDecl and CXXDependentScopeMemberExpr
* Also introduces ImportTemplateArgumentListInfo facility (A. Sidorin) This re-commits r320942 after fixing the behaviour on '-fdelayed-template-parsing' option and adding additional checks. Patch by Peter Szecsi! Differential Revision: https://reviews.llvm.org/D38692 llvm-svn: 321492
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r--clang/unittests/AST/ASTImporterTest.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index 83556572f72..a6ec304ff1a 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -495,6 +495,36 @@ TEST(ImportType, ImportAtomicType) {
has(atomicType())))))))));
}
+TEST(ImportDecl, ImportFunctionTemplateDecl) {
+ MatchVerifier<Decl> Verifier;
+ testImport("template <typename T> void declToImport() { };", Lang_CXX, "",
+ Lang_CXX, Verifier, functionTemplateDecl());
+}
+
+const internal::VariadicDynCastAllOfMatcher<Expr, CXXDependentScopeMemberExpr>
+ cxxDependentScopeMemberExpr;
+
+TEST(ImportExpr, ImportCXXDependentScopeMemberExpr) {
+ MatchVerifier<Decl> Verifier;
+ testImport("template <typename T> struct C { T t; };"
+ "template <typename T> void declToImport() {"
+ " C<T> d;"
+ " d.t;"
+ "}"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX, "", Lang_CXX, Verifier,
+ functionTemplateDecl(has(functionDecl(
+ has(compoundStmt(has(cxxDependentScopeMemberExpr())))))));
+ testImport("template <typename T> struct C { T t; };"
+ "template <typename T> void declToImport() {"
+ " C<T> d;"
+ " (&d)->t;"
+ "}"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX, "", Lang_CXX, Verifier,
+ functionTemplateDecl(has(functionDecl(
+ has(compoundStmt(has(cxxDependentScopeMemberExpr())))))));
+}
TEST(ImportType, ImportTypeAliasTemplate) {
MatchVerifier<Decl> Verifier;
OpenPOWER on IntegriCloud