From 7414769da6aaff79887b5ba53406f442df9da33f Mon Sep 17 00:00:00 2001 From: Tuowen Zhao Date: Thu, 6 Oct 2016 23:41:15 -0600 Subject: further cleanup --- src/printer/cfamily.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/printer/cfamily.cpp') diff --git a/src/printer/cfamily.cpp b/src/printer/cfamily.cpp index d0f8030..552947a 100644 --- a/src/printer/cfamily.cpp +++ b/src/printer/cfamily.cpp @@ -180,9 +180,9 @@ void CFamily::printS(std::string ident, chillAST_ForStmt *n, std::ostream &o) { o << "// " << n->metacomment << "\n"; o << "for ("; print(ident, n->getInit(), o); - o << ";"; + o << "; "; print(ident, n->getCond(), o); - o << ";"; + o << "; "; print(ident, n->getInc(), o); o << ") "; if (n->getBody()->isCompoundStmt()) { @@ -232,6 +232,9 @@ void CFamily::printS(std::string ident, chillAST_IfStmt *n, std::ostream &o) { if (!(n->getThen()->isCompoundStmt())) CHILL_ERROR("Then part is not a CompoundStmt!\n"); if (n->getElse()) { + if (n->getThen()->getNumChildren() == 1) + o<getElse(), o); } -- cgit v1.2.3-70-g09d2