Ignore:
Timestamp:
Feb 4, 2022, 10:10:34 PM (4 years ago)
Author:
Fangren Yu <f37yu@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r5f3ba11 rb56ad5e  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 19:00:42 2021
    13 // Update Count     : 536
     12// Last Modified On : Wed Feb  2 20:30:30 2022
     13// Update Count     : 541
    1414//
    1515#include "CodeGenerator.h"
     
    4242        bool wantSpacing( Statement * stmt) {
    4343                return dynamic_cast< IfStmt * >( stmt ) || dynamic_cast< CompoundStmt * >( stmt ) ||
    44                         dynamic_cast< WhileStmt * >( stmt ) || dynamic_cast< ForStmt * >( stmt ) || dynamic_cast< SwitchStmt *>( stmt );
     44                        dynamic_cast< WhileDoStmt * >( stmt ) || dynamic_cast< ForStmt * >( stmt ) || dynamic_cast< SwitchStmt *>( stmt );
    4545        }
    4646
     
    955955                output << " ) ";
    956956
    957                 ifStmt->get_thenPart()->accept( *visitor );
    958 
    959                 if ( ifStmt->get_elsePart() != 0) {
     957                ifStmt->get_then()->accept( *visitor );
     958
     959                if ( ifStmt->get_else() != 0) {
    960960                        output << " else ";
    961                         ifStmt->get_elsePart()->accept( *visitor );
     961                        ifStmt->get_else()->accept( *visitor );
    962962                } // if
    963963        }
     
    10201020                        output << "fallthru";
    10211021                        break;
     1022                  default: ;                                                                    // prevent warning
    10221023                } // switch
    10231024                // print branch target for labelled break/continue/fallthru in debug mode
     
    11251126        }
    11261127
    1127         void CodeGenerator::postvisit( WhileStmt * whileStmt ) {
    1128                 if ( whileStmt->get_isDoWhile() ) {
     1128        void CodeGenerator::postvisit( WhileDoStmt * whileDoStmt ) {
     1129                if ( whileDoStmt->get_isDoWhile() ) {
    11291130                        output << "do";
    11301131                } else {
    11311132                        output << "while (";
    1132                         whileStmt->get_condition()->accept( *visitor );
     1133                        whileDoStmt->get_condition()->accept( *visitor );
    11331134                        output << ")";
    11341135                } // if
    11351136                output << " ";
    11361137
    1137                 output << CodeGenerator::printLabels( whileStmt->get_body()->get_labels() );
    1138                 whileStmt->get_body()->accept( *visitor );
     1138                output << CodeGenerator::printLabels( whileDoStmt->get_body()->get_labels() );
     1139                whileDoStmt->get_body()->accept( *visitor );
    11391140
    11401141                output << indent;
    11411142
    1142                 if ( whileStmt->get_isDoWhile() ) {
     1143                if ( whileDoStmt->get_isDoWhile() ) {
    11431144                        output << " while (";
    1144                         whileStmt->get_condition()->accept( *visitor );
     1145                        whileDoStmt->get_condition()->accept( *visitor );
    11451146                        output << ");";
    11461147                } // if
Note: See TracChangeset for help on using the changeset viewer.