Ignore:
Timestamp:
May 19, 2015, 4:58:14 PM (11 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
843054c2
Parents:
01aeade
Message:

licencing: sixth groups of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/ControlStruct/ForExprMutator.cc

    r01aeade ra08ba92  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // XXX.cc --
     7// ForExprMutator.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By :
    12 // Last Modified On :
    13 // Update Count     : 0
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue May 19 15:31:47 2015
     13// Update Count     : 2
    1414//
     15
    1516#include "SynTree/Mutator.h"
    1617#include "SynTree/Statement.h"
     
    1819
    1920namespace ControlStruct {
    20     Statement *ForExprMutator::mutate( ForStmt *forStmt ) {
    21         // recurse down all nest for loops to hoist any initializer declarations to make them C89 (rather than C99)
    22         forStmt->set_body( forStmt->get_body()->acceptMutator( *this ) );
    23         if ( DeclStmt *decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() ) ) {
    24             // create compound statement, move initializer declaration outside, leave _for_ as-is
    25             CompoundStmt *block = new CompoundStmt( std::list< Label >() );
    26             std::list<Statement *> &stmts = block->get_kids();
     21        Statement *ForExprMutator::mutate( ForStmt *forStmt ) {
     22                // recurse down all nest for loops to hoist any initializer declarations to make them C89 (rather than C99)
     23                forStmt->set_body( forStmt->get_body()->acceptMutator( *this ) );
     24                if ( DeclStmt *decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() ) ) {
     25                        // create compound statement, move initializer declaration outside, leave _for_ as-is
     26                        CompoundStmt *block = new CompoundStmt( std::list< Label >() );
     27                        std::list<Statement *> &stmts = block->get_kids();
    2728
    28             stmts.push_back( decl );
    29             forStmt->set_initialization( 0 );
    30             stmts.push_back( forStmt );
     29                        stmts.push_back( decl );
     30                        forStmt->set_initialization( 0 );
     31                        stmts.push_back( forStmt );
    3132
    32             return block;
    33         } // if
     33                        return block;
     34                } // if
    3435
    35         return forStmt;
    36     }
     36                return forStmt;
     37        }
    3738} // namespace ControlStruct
     39
    3840// Local Variables: //
    3941// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.