summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/ASTImporterTest.cpp
diff options
context:
space:
mode:
authorAleksei Sidorin <a.sidorin@samsung.com>2018-01-09 16:40:40 +0000
committerAleksei Sidorin <a.sidorin@samsung.com>2018-01-09 16:40:40 +0000
commite267a0f3428f3f02471be5f70fc9cc6cf403ef63 (patch)
treeb60143d4e79ff2a61a0e97edf742dbbe1e94e111 /clang/unittests/AST/ASTImporterTest.cpp
parent72b0bb1405f3c32acfe14c4c2648c851262ad45e (diff)
downloadbcm5719-llvm-e267a0f3428f3f02471be5f70fc9cc6cf403ef63.tar.gz
bcm5719-llvm-e267a0f3428f3f02471be5f70fc9cc6cf403ef63.zip
[ASTImporter] Support importing CXXUnresolvedConstructExpr and UnresolvedLookupExpr
* Note: This solution is based on https://github.com/haoNoQ/clang/blob/summary-ipa-draft/lib/AST/ASTImporter.cpp#L7605. Patch by Peter Szecsi! Differential Revision: https://reviews.llvm.org/D38694 llvm-svn: 322091
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r--clang/unittests/AST/ASTImporterTest.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index a6ec304ff1a..5b87876989a 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -656,5 +656,40 @@ TEST(ImportDecl, ImportUsingShadowDecl) {
namespaceDecl(has(usingShadowDecl())));
}
+TEST(ImportExpr, ImportUnresolvedLookupExpr) {
+ MatchVerifier<Decl> Verifier;
+ testImport("template<typename T> int foo();"
+ "template <typename T> void declToImport() {"
+ " ::foo<T>;"
+ " ::template foo<T>;"
+ "}"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX, "", Lang_CXX, Verifier,
+ functionTemplateDecl(has(functionDecl(has(
+ compoundStmt(has(unresolvedLookupExpr())))))));
+}
+
+TEST(ImportExpr, ImportCXXUnresolvedConstructExpr) {
+ MatchVerifier<Decl> Verifier;
+ testImport("template <typename T> class C { T t; };"
+ "template <typename T> void declToImport() {"
+ " C<T> d;"
+ " d.t = T();"
+ "}"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX, "", Lang_CXX, Verifier,
+ functionTemplateDecl(has(functionDecl(has(compoundStmt(has(
+ binaryOperator(has(cxxUnresolvedConstructExpr())))))))));
+ testImport("template <typename T> class C { T t; };"
+ "template <typename T> void declToImport() {"
+ " C<T> d;"
+ " (&d)->t = T();"
+ "}"
+ "void instantiate() { declToImport<int>(); }",
+ Lang_CXX, "", Lang_CXX, Verifier,
+ functionTemplateDecl(has(functionDecl(has(compoundStmt(has(
+ binaryOperator(has(cxxUnresolvedConstructExpr())))))))));
+}
+
} // end namespace ast_matchers
} // end namespace clang
OpenPOWER on IntegriCloud