summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksei Sidorin <a.sidorin@samsung.com>2017-12-03 16:04:07 +0000
committerAleksei Sidorin <a.sidorin@samsung.com>2017-12-03 16:04:07 +0000
commit9d8ba2e1aed9890d760a1e2f6e351fa7c808762c (patch)
treeedac2248a9a42063d6c994a6a3d129066cd51667
parent0bf99c69544785186ff1e84b6ff90cb9bf7d81ce (diff)
downloadbcm5719-llvm-9d8ba2e1aed9890d760a1e2f6e351fa7c808762c.tar.gz
bcm5719-llvm-9d8ba2e1aed9890d760a1e2f6e351fa7c808762c.zip
[ASTImporter] Add unit tests for UsingDecl and UsingShadowDecl
Patch by Kareem Khazem! Differential Revision: https://reviews.llvm.org/D27181 llvm-svn: 319632
-rw-r--r--clang/unittests/AST/ASTImporterTest.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp
index 86518e132d4..64dd4fc9536 100644
--- a/clang/unittests/AST/ASTImporterTest.cpp
+++ b/clang/unittests/AST/ASTImporterTest.cpp
@@ -583,5 +583,46 @@ TEST(ImportExpr, ImportCXXPseudoDestructorExpr) {
callExpr(has(cxxPseudoDestructorExpr()))))))));
}
+TEST(ImportDecl, ImportUsingDecl) {
+ MatchVerifier<Decl> Verifier;
+ EXPECT_TRUE(
+ testImport(
+ "namespace foo { int bar; }"
+ "int declToImport(){ using foo::bar; }",
+ Lang_CXX, "", Lang_CXX, Verifier,
+ functionDecl(
+ has(
+ compoundStmt(
+ has(
+ declStmt(
+ has(
+ usingDecl()))))))));
+}
+
+/// \brief Matches shadow declarations introduced into a scope by a
+/// (resolved) using declaration.
+///
+/// Given
+/// \code
+/// namespace n { int f; }
+/// namespace declToImport { using n::f; }
+/// \endcode
+/// usingShadowDecl()
+/// matches \code f \endcode
+const internal::VariadicDynCastAllOfMatcher<Decl,
+ UsingShadowDecl> usingShadowDecl;
+
+TEST(ImportDecl, ImportUsingShadowDecl) {
+ MatchVerifier<Decl> Verifier;
+ EXPECT_TRUE(
+ testImport(
+ "namespace foo { int bar; }"
+ "namespace declToImport { using foo::bar; }",
+ Lang_CXX, "", Lang_CXX, Verifier,
+ namespaceDecl(
+ has(
+ usingShadowDecl()))));
+}
+
} // end namespace ast_matchers
} // end namespace clang
OpenPOWER on IntegriCloud