Changes in src/CodeGen/FixNames.cc [2fd0de0:0c577f7]
- File:
-
- 1 edited
-
src/CodeGen/FixNames.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/FixNames.cc
r2fd0de0 r0c577f7 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FixNames.cc -- Adjustments to typed declarations.7 // FixNames.cc -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jul 20 11:49:00 202213 // Update Count : 2 412 // Last Modified On : Fri Oct 29 15:49:00 2021 13 // Update Count : 23 14 14 // 15 15 … … 87 87 88 88 /// Does work with the main function and scopeLevels. 89 class FixNames_new final{89 class FixNames_new : public ast::WithGuards { 90 90 int scopeLevel = 1; 91 91 … … 103 103 104 104 const ast::FunctionDecl *postvisit( const ast::FunctionDecl *functionDecl ) { 105 // This store is used to ensure a maximum of one call to mutate. 106 ast::FunctionDecl * mutDecl = nullptr; 107 108 if ( shouldSetScopeLevel( functionDecl ) ) { 109 mutDecl = ast::mutate( functionDecl ); 110 mutDecl->scopeLevel = scopeLevel; 111 } 112 105 113 if ( FixMain::isMain( functionDecl ) ) { 106 auto mutDecl = ast::mutate( functionDecl ); 107 108 if ( shouldSetScopeLevel( mutDecl ) ) { 109 mutDecl->scopeLevel = scopeLevel; 110 } 114 if ( !mutDecl ) { mutDecl = ast::mutate( functionDecl ); } 111 115 112 116 int nargs = mutDecl->params.size(); … … 120 124 ) 121 125 ); 122 123 return mutDecl;124 } else if ( shouldSetScopeLevel( functionDecl ) ) {125 return ast::mutate_field( functionDecl, &ast::FunctionDecl::scopeLevel, scopeLevel );126 } else {127 return functionDecl;128 126 } 127 return mutDecl ? mutDecl : functionDecl; 129 128 } 130 129 131 130 void previsit( const ast::CompoundStmt * ) { 132 scopeLevel += 1; 133 } 134 135 void postvisit( const ast::CompoundStmt * ) { 136 scopeLevel -= 1; 131 GuardValue( scopeLevel ) += 1; 137 132 } 138 133 };
Note:
See TracChangeset
for help on using the changeset viewer.