diff options
author | Peter Szecsi <szepet95@gmail.com> | 2018-05-07 12:08:27 +0000 |
---|---|---|
committer | Peter Szecsi <szepet95@gmail.com> | 2018-05-07 12:08:27 +0000 |
commit | ce7f318f217914b6435e4aa44e17c65279b5ee3a (patch) | |
tree | eda2e657e90a6f5e71098dee6bb432a46719c6a0 /clang/unittests/AST/ASTImporterTest.cpp | |
parent | f3ae50fca2673a7cfa301b8a6c46f16a6aa1f70a (diff) | |
download | bcm5719-llvm-ce7f318f217914b6435e4aa44e17c65279b5ee3a.tar.gz bcm5719-llvm-ce7f318f217914b6435e4aa44e17c65279b5ee3a.zip |
[ASTImporter] Support importing UnresolvedMemberExpr, DependentNameType, DependentScopeDeclRefExpr
The visit callback implementations for the 3 C++ AST Node added to the ASTImporter.
Differential Revision: https://reviews.llvm.org/D38845
llvm-svn: 331630
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r-- | clang/unittests/AST/ASTImporterTest.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 9c0d6a3617c..0e3105b5104 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -1709,5 +1709,60 @@ TEST(ImportDecl, ImportEnumSequential) { "main.c", enumDecl(), VerificationMatcher); } +const internal::VariadicDynCastAllOfMatcher<Expr, DependentScopeDeclRefExpr> + dependentScopeDeclRefExpr; + +TEST(ImportExpr, DependentScopeDeclRefExpr) { + MatchVerifier<Decl> Verifier; + testImport("template <typename T> struct S { static T foo; };" + "template <typename T> void declToImport() {" + " (void) S<T>::foo;" + "}" + "void instantiate() { declToImport<int>(); }", + Lang_CXX11, "", Lang_CXX11, Verifier, + functionTemplateDecl(has(functionDecl(has(compoundStmt( + has(cStyleCastExpr(has(dependentScopeDeclRefExpr()))))))))); + + testImport("template <typename T> struct S {" + "template<typename S> static void foo(){};" + "};" + "template <typename T> void declToImport() {" + " S<T>::template foo<T>();" + "}" + "void instantiate() { declToImport<int>(); }", + Lang_CXX11, "", Lang_CXX11, Verifier, + functionTemplateDecl(has(functionDecl(has(compoundStmt( + has(callExpr(has(dependentScopeDeclRefExpr()))))))))); +} + +const internal::VariadicDynCastAllOfMatcher<Type, DependentNameType> + dependentNameType; + +TEST(ImportExpr, DependentNameType) { + MatchVerifier<Decl> Verifier; + testImport("template <typename T> struct declToImport {" + " typedef typename T::type dependent_name;" + "};", + Lang_CXX11, "", Lang_CXX11, Verifier, + classTemplateDecl(has( + cxxRecordDecl(has(typedefDecl(has(dependentNameType()))))))); +} + +const internal::VariadicDynCastAllOfMatcher<Expr, UnresolvedMemberExpr> + unresolvedMemberExpr; + +TEST(ImportExpr, UnresolvedMemberExpr) { + MatchVerifier<Decl> Verifier; + testImport("struct S { template <typename T> void mem(); };" + "template <typename U> void declToImport() {" + " S s;" + " s.mem<U>();" + "}" + "void instantiate() { declToImport<int>(); }", + Lang_CXX11, "", Lang_CXX11, Verifier, + functionTemplateDecl(has(functionDecl(has( + compoundStmt(has(callExpr(has(unresolvedMemberExpr()))))))))); +} + } // end namespace ast_matchers } // end namespace clang |