@@ -325,37 +325,6 @@ void CodegenCVisitor::visit_update_dt(const ast::UpdateDt& node) {
325325/* Common helper routines */
326326/* ***************************************************************************************/
327327
328-
329- /* *
330- * \details Certain statements like unit, comment, solve can/need to be skipped
331- * during code generation. Note that solve block is wrapped in expression
332- * statement and hence we have to check inner expression. It's also true
333- * for the initial block defined inside net receive block.
334- */
335- bool CodegenCVisitor::statement_to_skip (const Statement& node) const {
336- // clang-format off
337- if (node.is_unit_state ()
338- || node.is_line_comment ()
339- || node.is_block_comment ()
340- || node.is_solve_block ()
341- || node.is_conductance_hint ()
342- || node.is_table_statement ()) {
343- return true ;
344- }
345- // clang-format on
346- if (node.is_expression_statement ()) {
347- auto expression = dynamic_cast <const ExpressionStatement*>(&node)->get_expression ();
348- if (expression->is_solve_block ()) {
349- return true ;
350- }
351- if (expression->is_initial_block ()) {
352- return true ;
353- }
354- }
355- return false ;
356- }
357-
358-
359328/* *
360329 * \details When floating point data type is not default (i.e. double) then we
361330 * have to copy old array to new type (for range variables).
@@ -974,8 +943,8 @@ void CodegenCVisitor::print_nrn_cur_matrix_shadow_update() {
974943 printer->add_line (" shadow_rhs[id] = rhs;" );
975944 printer->add_line (" shadow_d[id] = g;" );
976945 } else {
977- auto rhs_op = operator_for_rhs ();
978- auto d_op = operator_for_d ();
946+ const auto & rhs_op = info. operator_for_rhs ();
947+ const auto & d_op = info. operator_for_d ();
979948 print_atomic_reduction_pragma ();
980949 printer->add_line (" vec_rhs[node_id] {} rhs;" _format (rhs_op));
981950 print_atomic_reduction_pragma ();
@@ -986,8 +955,8 @@ void CodegenCVisitor::print_nrn_cur_matrix_shadow_update() {
986955
987956
988957void CodegenCVisitor::print_nrn_cur_matrix_shadow_reduction () {
989- auto rhs_op = operator_for_rhs ();
990- auto d_op = operator_for_d ();
958+ const auto & rhs_op = info. operator_for_rhs ();
959+ const auto & d_op = info. operator_for_d ();
991960 if (channel_task_dependency_enabled ()) {
992961 auto rhs = get_variable_name (" ml_rhs" );
993962 auto d = get_variable_name (" ml_d" );
@@ -1167,7 +1136,7 @@ void CodegenCVisitor::print_statement_block(const ast::StatementBlock& node,
11671136
11681137 auto statements = node.get_statements ();
11691138 for (const auto & statement: statements) {
1170- if (statement_to_skip (*statement)) {
1139+ if (info. statement_to_skip (*statement)) {
11711140 continue ;
11721141 }
11731142 // / not necessary to add indent for verbatim block (pretty-printing)
@@ -4337,8 +4306,8 @@ void CodegenCVisitor::print_fast_imem_calculation() {
43374306 return ;
43384307 }
43394308 std::string rhs, d;
4340- auto rhs_op = operator_for_rhs ();
4341- auto d_op = operator_for_d ();
4309+ const auto & rhs_op = info. operator_for_rhs ();
4310+ const auto & d_op = info. operator_for_d ();
43424311 if (channel_task_dependency_enabled ()) {
43434312 rhs = get_variable_name (" ml_rhs" );
43444313 d = get_variable_name (" ml_d" );
0 commit comments