Index: include/clang/AST/Stmt.h =================================================================== --- include/clang/AST/Stmt.h +++ include/clang/AST/Stmt.h @@ -693,9 +693,10 @@ // GNU "case 1 ... 4" extension public: CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc, - SourceLocation ellipsisLoc, SourceLocation colonLoc) + SourceLocation ellipsisLoc, SourceLocation colonLoc, + Stmt *SubStmt=nullptr) : SwitchCase(CaseStmtClass, caseLoc, colonLoc) { - SubExprs[SUBSTMT] = nullptr; + SubExprs[SUBSTMT] = SubStmt; SubExprs[LHS] = reinterpret_cast(lhs); SubExprs[RHS] = reinterpret_cast(rhs); EllipsisLoc = ellipsisLoc; Index: lib/AST/ASTImporter.cpp =================================================================== --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -5102,12 +5102,15 @@ Expr *ToRHS = Importer.Import(S->getRHS()); if (!ToRHS && S->getRHS()) return nullptr; + Stmt *SubStmt = Importer.Import(S->getSubStmt()); + if (!SubStmt && S->getSubStmt()) + return nullptr; SourceLocation ToCaseLoc = Importer.Import(S->getCaseLoc()); SourceLocation ToEllipsisLoc = Importer.Import(S->getEllipsisLoc()); SourceLocation ToColonLoc = Importer.Import(S->getColonLoc()); - return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS, - ToCaseLoc, ToEllipsisLoc, - ToColonLoc); + return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS, ToCaseLoc, + ToEllipsisLoc, ToColonLoc, + SubStmt); } Stmt *ASTNodeImporter::VisitDefaultStmt(DefaultStmt *S) {