khazem updated this revision to Diff 76272. khazem added a comment. (added more context)
https://reviews.llvm.org/D26105 Files: include/clang/AST/Stmt.h lib/AST/ASTImporter.cpp 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) { 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<Stmt*>(lhs); SubExprs[RHS] = reinterpret_cast<Stmt*>(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) { 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<Stmt*>(lhs); SubExprs[RHS] = reinterpret_cast<Stmt*>(rhs); EllipsisLoc = ellipsisLoc;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits