diff options
author | Aleksei Sidorin <a.sidorin@samsung.com> | 2018-01-09 16:40:40 +0000 |
---|---|---|
committer | Aleksei Sidorin <a.sidorin@samsung.com> | 2018-01-09 16:40:40 +0000 |
commit | e267a0f3428f3f02471be5f70fc9cc6cf403ef63 (patch) | |
tree | b60143d4e79ff2a61a0e97edf742dbbe1e94e111 /clang/unittests/AST/ASTImporterTest.cpp | |
parent | 72b0bb1405f3c32acfe14c4c2648c851262ad45e (diff) | |
download | bcm5719-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.cpp | 35 |
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 |