source: translator/ControlStruct/ForExprMutator.cc @ 6c3744e

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 6c3744e was d9a0e76, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

remove Parser.old, add -XCFA to driver, copy ptrdiff_t from stddef.h in preclude, remove casts from initialization constants, adjust formatting

  • Property mode set to 100644
File size: 711 bytes
Line 
1#include "SynTree/Mutator.h"
2#include "SynTree/Statement.h"
3#include "ForExprMutator.h"
4
5namespace ControlStruct {
6    Statement *ForExprMutator::mutate( ForStmt *forStmt ) {
7        DeclStmt *decl;
8        if (( decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() )) != 0 ) {
9            // create compound statement, move declaration outside, leave _for_ as-is
10            CompoundStmt *block = new CompoundStmt( std::list< Label >() );
11            std::list<Statement *> &stmts = block->get_kids();
12
13            stmts.push_back( decl );
14            forStmt->set_initialization( 0 );
15            stmts.push_back( forStmt );
16
17            return block;
18        } // if
19        // ForStmt still needs to be fixed
20        else
21            return forStmt;
22    }
23} // namespace ControlStruct
Note: See TracBrowser for help on using the repository browser.