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 c11e31c was
c11e31c,
checked in by Peter A. Buhr <pabuhr@…>, 9 years ago
|
add inline and attribute qualifiers, cfa.y comment formatting, fix error message in isIntegralType
|
-
Property mode set to
100644
|
File size:
844 bytes
|
Line | |
---|
1 | #include "SynTree/Mutator.h" |
---|
2 | #include "SynTree/Statement.h" |
---|
3 | #include "ForExprMutator.h" |
---|
4 | |
---|
5 | namespace ControlStruct { |
---|
6 | Statement *ForExprMutator::mutate( ForStmt *forStmt ) { |
---|
7 | // recurse down all nest for loops to hoist any initializer declarations to make them C89 (rather than C99) |
---|
8 | forStmt->set_body( forStmt->get_body()->acceptMutator( *this ) ); |
---|
9 | if ( DeclStmt *decl = dynamic_cast< DeclStmt * > ( forStmt->get_initialization() ) ) { |
---|
10 | // create compound statement, move initializer declaration outside, leave _for_ as-is |
---|
11 | CompoundStmt *block = new CompoundStmt( std::list< Label >() ); |
---|
12 | std::list<Statement *> &stmts = block->get_kids(); |
---|
13 | |
---|
14 | stmts.push_back( decl ); |
---|
15 | forStmt->set_initialization( 0 ); |
---|
16 | stmts.push_back( forStmt ); |
---|
17 | |
---|
18 | return block; |
---|
19 | } // if |
---|
20 | |
---|
21 | return forStmt; |
---|
22 | } |
---|
23 | } // namespace ControlStruct |
---|
Note: See
TracBrowser
for help on using the repository browser.