Changeset b56ad5e for src/CodeGen/CodeGenerator.cc
- Timestamp:
- Feb 4, 2022, 10:10:34 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- f8143a6
- Parents:
- 5f3ba11 (diff), 67e86ae6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r5f3ba11 rb56ad5e 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 12 19:00:42 202113 // Update Count : 5 3612 // Last Modified On : Wed Feb 2 20:30:30 2022 13 // Update Count : 541 14 14 // 15 15 #include "CodeGenerator.h" … … 42 42 bool wantSpacing( Statement * stmt) { 43 43 return dynamic_cast< IfStmt * >( stmt ) || dynamic_cast< CompoundStmt * >( stmt ) || 44 dynamic_cast< While Stmt * >( stmt ) || dynamic_cast< ForStmt * >( stmt ) || dynamic_cast< SwitchStmt *>( stmt );44 dynamic_cast< WhileDoStmt * >( stmt ) || dynamic_cast< ForStmt * >( stmt ) || dynamic_cast< SwitchStmt *>( stmt ); 45 45 } 46 46 … … 955 955 output << " ) "; 956 956 957 ifStmt->get_then Part()->accept( *visitor );958 959 if ( ifStmt->get_else Part() != 0) {957 ifStmt->get_then()->accept( *visitor ); 958 959 if ( ifStmt->get_else() != 0) { 960 960 output << " else "; 961 ifStmt->get_else Part()->accept( *visitor );961 ifStmt->get_else()->accept( *visitor ); 962 962 } // if 963 963 } … … 1020 1020 output << "fallthru"; 1021 1021 break; 1022 default: ; // prevent warning 1022 1023 } // switch 1023 1024 // print branch target for labelled break/continue/fallthru in debug mode … … 1125 1126 } 1126 1127 1127 void CodeGenerator::postvisit( While Stmt * whileStmt ) {1128 if ( while Stmt->get_isDoWhile() ) {1128 void CodeGenerator::postvisit( WhileDoStmt * whileDoStmt ) { 1129 if ( whileDoStmt->get_isDoWhile() ) { 1129 1130 output << "do"; 1130 1131 } else { 1131 1132 output << "while ("; 1132 while Stmt->get_condition()->accept( *visitor );1133 whileDoStmt->get_condition()->accept( *visitor ); 1133 1134 output << ")"; 1134 1135 } // if 1135 1136 output << " "; 1136 1137 1137 output << CodeGenerator::printLabels( while Stmt->get_body()->get_labels() );1138 while Stmt->get_body()->accept( *visitor );1138 output << CodeGenerator::printLabels( whileDoStmt->get_body()->get_labels() ); 1139 whileDoStmt->get_body()->accept( *visitor ); 1139 1140 1140 1141 output << indent; 1141 1142 1142 if ( while Stmt->get_isDoWhile() ) {1143 if ( whileDoStmt->get_isDoWhile() ) { 1143 1144 output << " while ("; 1144 while Stmt->get_condition()->accept( *visitor );1145 whileDoStmt->get_condition()->accept( *visitor ); 1145 1146 output << ");"; 1146 1147 } // if
Note:
See TracChangeset
for help on using the changeset viewer.