Changeset 293dc1c for src/InitTweak
- Timestamp:
- Nov 3, 2020, 4:06:20 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 4406887
- Parents:
- daefe93
- Location:
- src/InitTweak
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixGlobalInit.cc
rdaefe93 r293dc1c 109 109 } 110 110 111 void fixGlobalInit( std::list<ast::ptr<ast::Decl>>& translationUnit, bool inLibrary) {111 void fixGlobalInit(ast::TranslationUnit & translationUnit, bool inLibrary) { 112 112 ast::Pass<GlobalFixer_new> fixer; 113 113 accept_all(translationUnit, fixer); … … 119 119 ast::Storage::Static, ast::Linkage::C, {new ast::Attribute("constructor", std::move(ctorParams))}); 120 120 121 translationUnit. emplace_back( initFunction );121 translationUnit.decls.emplace_back( initFunction ); 122 122 } // if 123 123 … … 128 128 ast::Storage::Static, ast::Linkage::C, {new ast::Attribute("destructor", std::move(dtorParams))}); 129 129 130 translationUnit. emplace_back(destroyFunction);130 translationUnit.decls.emplace_back(destroyFunction); 131 131 } // if 132 132 } -
src/InitTweak/FixGlobalInit.h
rdaefe93 r293dc1c 29 29 /// function is for library code. 30 30 void fixGlobalInit( std::list< Declaration * > & translationUnit, bool inLibrary ); 31 void fixGlobalInit( std::list< ast::ptr<ast::Decl> >& translationUnit, bool inLibrary );31 void fixGlobalInit( ast::TranslationUnit & translationUnit, bool inLibrary ); 32 32 } // namespace 33 33 -
src/InitTweak/FixInit.h
rdaefe93 r293dc1c 19 19 #include <string> // for string 20 20 21 #include <AST/Fwd.hpp>22 23 21 class Declaration; 22 namespace ast { 23 class TranslationUnit; 24 } 24 25 25 26 namespace InitTweak { … … 27 28 void fix( std::list< Declaration * > & translationUnit, bool inLibrary ); 28 29 29 void fix( std::list<ast::ptr<ast::Decl>>& translationUnit, bool inLibrary);30 void fix( ast::TranslationUnit & translationUnit, bool inLibrary); 30 31 } // namespace 31 32 -
src/InitTweak/FixInitNew.cpp
rdaefe93 r293dc1c 179 179 /// expand each object declaration to use its constructor after it is declared. 180 180 struct FixInit : public ast::WithStmtsToAdd<> { 181 static void fixInitializers( std::list< ast::ptr<ast::Decl> >&translationUnit );181 static void fixInitializers( ast::TranslationUnit &translationUnit ); 182 182 183 183 const ast::DeclWithType * postvisit( const ast::ObjectDecl *objDecl ); … … 225 225 } // namespace 226 226 227 void fix( std::list< ast::ptr<ast::Decl> >& translationUnit, bool inLibrary ) {227 void fix( ast::TranslationUnit & translationUnit, bool inLibrary ) { 228 228 ast::Pass<SelfAssignChecker>::run( translationUnit ); 229 229 … … 308 308 } 309 309 310 void FixInit::fixInitializers( std::list< ast::ptr<ast::Decl> >& translationUnit ) {310 void FixInit::fixInitializers( ast::TranslationUnit & translationUnit ) { 311 311 ast::Pass<FixInit> fixer; 312 312 … … 314 314 // can't use DeclMutator, because sometimes need to insert IfStmt, etc. 315 315 SemanticErrorException errors; 316 for ( auto i = translationUnit. begin(); i != translationUnit.end(); ++i ) {316 for ( auto i = translationUnit.decls.begin(); i != translationUnit.decls.end(); ++i ) { 317 317 try { 318 318 // maybeAccept( *i, fixer ); translationUnit should never contain null 319 319 *i = (*i)->accept(fixer); 320 translationUnit. splice( i, fixer.core.staticDtorDecls );320 translationUnit.decls.splice( i, fixer.core.staticDtorDecls ); 321 321 } catch( SemanticErrorException &e ) { 322 322 errors.append( e );
Note:
See TracChangeset
for help on using the changeset viewer.