Changeset 6726a3a for src/CodeGen
- Timestamp:
- Jul 20, 2022, 2:37:57 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 6bf35d1, e6662f5
- Parents:
- d677355 (diff), 2fd0de0 (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. - Location:
- src/CodeGen
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/FixNames.cc
rd677355 r6726a3a 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FixNames.cc -- 7 // FixNames.cc -- Adjustments to typed declarations. 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 : Fri Oct 29 15:49:00 202113 // Update Count : 2 312 // Last Modified On : Wed Jul 20 11:49:00 2022 13 // Update Count : 24 14 14 // 15 15 … … 87 87 88 88 /// Does work with the main function and scopeLevels. 89 class FixNames_new : public ast::WithGuards{89 class FixNames_new final { 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;105 if ( FixMain::isMain( functionDecl ) ) { 106 auto mutDecl = ast::mutate( functionDecl ); 107 107 108 if ( shouldSetScopeLevel( functionDecl ) ) { 109 mutDecl = ast::mutate( functionDecl ); 110 mutDecl->scopeLevel = scopeLevel; 111 } 112 113 if ( FixMain::isMain( functionDecl ) ) { 114 if ( !mutDecl ) { mutDecl = ast::mutate( functionDecl ); } 108 if ( shouldSetScopeLevel( mutDecl ) ) { 109 mutDecl->scopeLevel = scopeLevel; 110 } 115 111 116 112 int nargs = mutDecl->params.size(); … … 124 120 ) 125 121 ); 122 123 return mutDecl; 124 } else if ( shouldSetScopeLevel( functionDecl ) ) { 125 return ast::mutate_field( functionDecl, &ast::FunctionDecl::scopeLevel, scopeLevel ); 126 } else { 127 return functionDecl; 126 128 } 127 return mutDecl ? mutDecl : functionDecl;128 129 } 129 130 130 131 void previsit( const ast::CompoundStmt * ) { 131 GuardValue( scopeLevel ) += 1; 132 scopeLevel += 1; 133 } 134 135 void postvisit( const ast::CompoundStmt * ) { 136 scopeLevel -= 1; 132 137 } 133 138 }; -
src/CodeGen/FixNames.h
rd677355 r6726a3a 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FixNames.h -- 7 // FixNames.h -- Adjustments to typed declarations. 8 8 // 9 9 // Author : Richard C. Bilson … … 26 26 /// mangles object and function names 27 27 void fixNames( std::list< Declaration* > & translationUnit ); 28 void fixNames( ast::TranslationUnit & translationUnit ); 28 /// Sets scope levels and fills in main's default return. 29 void fixNames( ast::TranslationUnit & translationUnit ); 29 30 } // namespace CodeGen 30 31
Note: See TracChangeset
for help on using the changeset viewer.