diff options
author | Gabor Horvath <xazax.hun@gmail.com> | 2017-10-18 09:25:18 +0000 |
---|---|---|
committer | Gabor Horvath <xazax.hun@gmail.com> | 2017-10-18 09:25:18 +0000 |
commit | aed3a60e367b760d907954563f404458f9dbd478 (patch) | |
tree | d2bca0be6746fb22aab7d8ae6947e98f92fcbca5 /unittests | |
parent | 635ffc9d026d28c788250e4b0c801d59c2599412 (diff) |
[ASTImporter] Import SubStmt of CaseStmt
Patch by: Rafael Stahl!
Differential Revision: https://reviews.llvm.org/D38943
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/AST/ASTImporterTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/unittests/AST/ASTImporterTest.cpp b/unittests/AST/ASTImporterTest.cpp index 485cf252c1..aea5bfa39e 100644 --- a/unittests/AST/ASTImporterTest.cpp +++ b/unittests/AST/ASTImporterTest.cpp @@ -97,6 +97,10 @@ testImport(const std::string &FromCode, Language FromLang, llvm::raw_svector_ostream ToNothing(ImportChecker); ToCtx.getTranslationUnitDecl()->print(ToNothing); + // This traverses the AST to catch certain bugs like poorly or not + // implemented subtrees. + Imported->dump(ToNothing); + return Verifier.match(Imported, AMatcher); } @@ -267,6 +271,15 @@ TEST(ImportExpr, ImportParenListExpr) { hasUnaryOperand(cxxThisExpr())))))))))))))))))))))))); } +TEST(ImportExpr, ImportSwitch) { + MatchVerifier<Decl> Verifier; + EXPECT_TRUE( + testImport("void declToImport() { int b; switch (b) { case 1: break; } }", + Lang_CXX, "", Lang_CXX, Verifier, + functionDecl(hasBody(compoundStmt( + has(switchStmt(has(compoundStmt(has(caseStmt())))))))))); +} + TEST(ImportExpr, ImportStmtExpr) { MatchVerifier<Decl> Verifier; // NOTE: has() ignores implicit casts, using hasDescendant() to match it |