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 | 480892b75fc15ee435b4b689a0021bb5f5fd7166 (patch) | |
tree | 4ede1f257c809dcebf58016253e88e35c751d0a0 /clang/unittests/AST/ASTImporterTest.cpp | |
parent | a4ca931336adb72a10b41d10f82df2e9345c67a7 (diff) | |
download | bcm5719-llvm-480892b75fc15ee435b4b689a0021bb5f5fd7166.tar.gz bcm5719-llvm-480892b75fc15ee435b4b689a0021bb5f5fd7166.zip |
[ASTImporter] Import SubStmt of CaseStmt
Patch by: Rafael Stahl!
Differential Revision: https://reviews.llvm.org/D38943
llvm-svn: 316069
Diffstat (limited to 'clang/unittests/AST/ASTImporterTest.cpp')
-rw-r--r-- | clang/unittests/AST/ASTImporterTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 485cf252c15..aea5bfa39e8 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/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 |