Ignore:
Timestamp:
Aug 17, 2017, 3:42:21 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
e50e9ff
Parents:
97e3296 (diff), 21f0aa8 (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/Parser/StatementNode.cc

    r97e3296 r6ac5223  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 11 21:23:15 2017
    13 // Update Count     : 331
    14 //
    15 
    16 #include <list>
    17 #include <algorithm>
    18 #include <cassert>
    19 
    20 #include "ParseNode.h"
    21 #include "SynTree/Statement.h"
    22 #include "SynTree/Expression.h"
    23 #include "parserutility.h"
    24 #include "Common/utility.h"
     12// Last Modified On : Wed Aug 16 16:39:43 2017
     13// Update Count     : 340
     14//
     15
     16#include <cassert>                 // for assert, safe_dynamic_cast, assertf
     17#include <list>                    // for list
     18#include <memory>                  // for unique_ptr
     19#include <string>                  // for string
     20
     21#include "Common/SemanticError.h"  // for SemanticError
     22#include "Common/utility.h"        // for maybeMoveBuild, maybeBuild
     23#include "ParseNode.h"             // for StatementNode, ExpressionNode, bui...
     24#include "SynTree/Expression.h"    // for Expression, ConstantExpr
     25#include "SynTree/Label.h"         // for Label, noLabels
     26#include "SynTree/Statement.h"     // for Statement, BranchStmt, CaseStmt
     27#include "parserutility.h"         // for notZeroExpr
     28
     29class Declaration;
    2530
    2631using namespace std;
     
    7479}
    7580
    76 Statement *build_if( ExpressionNode *ctl, StatementNode *then_stmt, StatementNode *else_stmt ) {
     81Statement *build_if( IfCtl * ctl, StatementNode *then_stmt, StatementNode *else_stmt ) {
    7782        Statement *thenb, *elseb = 0;
    7883        std::list< Statement * > branches;
     
    8792                elseb = branches.front();
    8893        } // if
    89         return new IfStmt( noLabels, notZeroExpr( maybeMoveBuild< Expression >(ctl) ), thenb, elseb );
     94       
     95        std::list< Statement * > init;
     96        if ( ctl->init != 0 ) {
     97                buildMoveList( ctl->init, init );
     98        } // if
     99
     100        return new IfStmt( noLabels, notZeroExpr(
     101                                                           /*ctl->condition
     102                                                                 ?*/ maybeMoveBuild< Expression >(ctl->condition)
     103                                                                 /*: new VariableExpr( init.end() )*/ )
     104                                                   , thenb, elseb );
     105        // ret->initialization = init;
     106        // delete ctl;
     107        // assert( ret );
     108        // return ret;
    90109}
    91110
Note: See TracChangeset for help on using the changeset viewer.