Changes in / [4406887:3c80ccc]
- Location:
- src
- Files:
-
- 12 edited
-
AST/Convert.cpp (modified) (3 diffs)
-
AST/Convert.hpp (modified) (1 diff)
-
AST/Fwd.hpp (modified) (1 diff)
-
AST/Pass.hpp (modified) (3 diffs)
-
AST/Pass.impl.hpp (modified) (2 diffs)
-
AST/Pass.proto.hpp (modified) (1 diff)
-
InitTweak/FixGlobalInit.cc (modified) (3 diffs)
-
InitTweak/FixGlobalInit.h (modified) (1 diff)
-
InitTweak/FixInit.h (modified) (2 diffs)
-
InitTweak/FixInitNew.cpp (modified) (4 diffs)
-
ResolvExpr/Resolver.cc (modified) (1 diff)
-
ResolvExpr/Resolver.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r4406887 r3c80ccc 25 25 #include "AST/Init.hpp" 26 26 #include "AST/Stmt.hpp" 27 #include "AST/TranslationUnit.hpp"28 27 #include "AST/TypeSubstitution.hpp" 29 28 … … 1405 1404 }; 1406 1405 1407 std::list< Declaration * > convert( const ast::TranslationUnit&& translationUnit ) {1406 std::list< Declaration * > convert( const std::list< ast::ptr< ast::Decl > > && translationUnit ) { 1408 1407 ConverterNewToOld c; 1409 1408 std::list< Declaration * > decls; 1410 for(auto d : translationUnit .decls) {1409 for(auto d : translationUnit) { 1411 1410 decls.emplace_back( c.decl( d ) ); 1412 1411 } … … 2804 2803 #undef GET_ACCEPT_1 2805 2804 2806 ast::TranslationUnitconvert( const std::list< Declaration * > && translationUnit ) {2805 std::list< ast::ptr< ast::Decl > > convert( const std::list< Declaration * > && translationUnit ) { 2807 2806 ConverterOldToNew c; 2808 ast::TranslationUnit unit;2807 std::list< ast::ptr< ast::Decl > > decls; 2809 2808 for(auto d : translationUnit) { 2810 2809 d->accept( c ); 2811 unit.decls.emplace_back( c.decl() );2810 decls.emplace_back( c.decl() ); 2812 2811 } 2813 2812 deleteAll(translationUnit); 2814 return unit;2813 return decls; 2815 2814 } -
src/AST/Convert.hpp
r4406887 r3c80ccc 18 18 #include <list> 19 19 20 #include "AST/Node.hpp" 21 20 22 class Declaration; 21 23 namespace ast { 22 class TranslationUnit;24 class Decl; 23 25 }; 24 26 25 std::list< Declaration * > convert( const ast::TranslationUnit&& translationUnit );26 ast::TranslationUnitconvert( const std::list< Declaration * > && translationUnit );27 std::list< Declaration * > convert( const std::list< ast::ptr< ast::Decl > > && translationUnit ); 28 std::list< ast::ptr< ast::Decl > > convert( const std::list< Declaration * > && translationUnit ); -
src/AST/Fwd.hpp
r4406887 r3c80ccc 137 137 typedef unsigned int UniqueId; 138 138 139 class TranslationUnit;140 // TODO: Get from the TranslationUnit:141 139 extern Type * sizeType; 142 140 extern FunctionDecl * dereferenceOperator; -
src/AST/Pass.hpp
r4406887 r3c80ccc 103 103 /// Construct and run a pass on a translation unit. 104 104 template< typename... Args > 105 static void run( TranslationUnit& decls, Args &&... args ) {105 static void run( std::list< ptr<Decl> > & decls, Args &&... args ) { 106 106 Pass<core_t> visitor( std::forward<Args>( args )... ); 107 107 accept_all( decls, visitor ); … … 119 119 // Versions of the above for older compilers. 120 120 template< typename... Args > 121 static void run( TranslationUnit& decls ) {121 static void run( std::list< ptr<Decl> > & decls ) { 122 122 Pass<core_t> visitor; 123 123 accept_all( decls, visitor ); … … 303 303 void accept_all( std::list< ast::ptr<ast::Decl> > &, ast::Pass<core_t> & visitor ); 304 304 305 template<typename core_t>306 void accept_all( ast::TranslationUnit &, ast::Pass<core_t> & visitor );307 308 305 //------------------------------------------------------------------------------------------------- 309 306 // PASS ACCESSORIES -
src/AST/Pass.impl.hpp
r4406887 r3c80ccc 20 20 #include <unordered_map> 21 21 22 #include "AST/TranslationUnit.hpp"23 22 #include "AST/TypeSubstitution.hpp" 24 23 … … 431 430 pass_visitor_stats.depth--; 432 431 if ( !errors.isEmpty() ) { throw errors; } 433 }434 435 template< typename core_t >436 inline void ast::accept_all( ast::TranslationUnit & unit, ast::Pass< core_t > & visitor ) {437 return ast::accept_all( unit.decls, visitor );438 432 } 439 433 -
src/AST/Pass.proto.hpp
r4406887 r3c80ccc 22 22 template<typename core_t> 23 23 class Pass; 24 25 class TranslationUnit;26 24 27 25 struct PureVisitor; -
src/InitTweak/FixGlobalInit.cc
r4406887 r3c80ccc 109 109 } 110 110 111 void fixGlobalInit( ast::TranslationUnit& translationUnit, bool inLibrary) {111 void fixGlobalInit(std::list<ast::ptr<ast::Decl>> & 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. decls.emplace_back( initFunction );121 translationUnit.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. decls.emplace_back(destroyFunction);130 translationUnit.emplace_back(destroyFunction); 131 131 } // if 132 132 } -
src/InitTweak/FixGlobalInit.h
r4406887 r3c80ccc 29 29 /// function is for library code. 30 30 void fixGlobalInit( std::list< Declaration * > & translationUnit, bool inLibrary ); 31 void fixGlobalInit( ast::TranslationUnit& translationUnit, bool inLibrary );31 void fixGlobalInit( std::list< ast::ptr<ast::Decl> > & translationUnit, bool inLibrary ); 32 32 } // namespace 33 33 -
src/InitTweak/FixInit.h
r4406887 r3c80ccc 19 19 #include <string> // for string 20 20 21 #include <AST/Fwd.hpp> 22 21 23 class Declaration; 22 namespace ast {23 class TranslationUnit;24 }25 24 26 25 namespace InitTweak { … … 28 27 void fix( std::list< Declaration * > & translationUnit, bool inLibrary ); 29 28 30 void fix( ast::TranslationUnit& translationUnit, bool inLibrary);29 void fix( std::list<ast::ptr<ast::Decl>> & translationUnit, bool inLibrary); 31 30 } // namespace 32 31 -
src/InitTweak/FixInitNew.cpp
r4406887 r3c80ccc 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( ast::TranslationUnit&translationUnit );181 static void fixInitializers( std::list< ast::ptr<ast::Decl> > &translationUnit ); 182 182 183 183 const ast::DeclWithType * postvisit( const ast::ObjectDecl *objDecl ); … … 225 225 } // namespace 226 226 227 void fix( ast::TranslationUnit& translationUnit, bool inLibrary ) {227 void fix( std::list< ast::ptr<ast::Decl> > & translationUnit, bool inLibrary ) { 228 228 ast::Pass<SelfAssignChecker>::run( translationUnit ); 229 229 … … 308 308 } 309 309 310 void FixInit::fixInitializers( ast::TranslationUnit& translationUnit ) {310 void FixInit::fixInitializers( std::list< ast::ptr<ast::Decl> > & 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. decls.begin(); i != translationUnit.decls.end(); ++i ) {316 for ( auto i = translationUnit.begin(); i != translationUnit.end(); ++i ) { 317 317 try { 318 318 // maybeAccept( *i, fixer ); translationUnit should never contain null 319 319 *i = (*i)->accept(fixer); 320 translationUnit. decls.splice( i, fixer.core.staticDtorDecls );320 translationUnit.splice( i, fixer.core.staticDtorDecls ); 321 321 } catch( SemanticErrorException &e ) { 322 322 errors.append( e ); -
src/ResolvExpr/Resolver.cc
r4406887 r3c80ccc 1274 1274 // size_t Resolver_new::traceId = Stats::Heap::new_stacktrace_id("Resolver"); 1275 1275 1276 void resolve( ast::TranslationUnit& translationUnit ) {1276 void resolve( std::list< ast::ptr< ast::Decl > >& translationUnit ) { 1277 1277 ast::Pass< Resolver_new >::run( translationUnit ); 1278 1278 } -
src/ResolvExpr/Resolver.h
r4406887 r3c80ccc 35 35 class StmtExpr; 36 36 class SymbolTable; 37 class TranslationUnit;38 37 class Type; 39 38 class TypeEnvironment; … … 56 55 57 56 /// Checks types and binds syntactic constructs to typed representations 58 void resolve( ast::TranslationUnit& translationUnit );57 void resolve( std::list< ast::ptr<ast::Decl> >& translationUnit ); 59 58 /// Searches expr and returns the first DeletedExpr found, otherwise nullptr 60 59 const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr ); … … 70 69 const ast::Expr * untyped, const ast::SymbolTable & symtab); 71 70 /// Resolves a constructor init expression 72 ast::ptr< ast::Init > resolveCtorInit( 71 ast::ptr< ast::Init > resolveCtorInit( 73 72 const ast::ConstructorInit * ctorInit, const ast::SymbolTable & symtab ); 74 73 /// Resolves a statement expression 75 ast::ptr< ast::Expr > resolveStmtExpr( 74 ast::ptr< ast::Expr > resolveStmtExpr( 76 75 const ast::StmtExpr * stmtExpr, const ast::SymbolTable & symtab ); 77 76 } // namespace ResolvExpr
Note:
See TracChangeset
for help on using the changeset viewer.