Changeset 4406887
- Timestamp:
- Nov 3, 2020, 8:48:53 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- a3f5208a
- Parents:
- 3c80ccc (diff), 293dc1c (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
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r3c80ccc r4406887 25 25 #include "AST/Init.hpp" 26 26 #include "AST/Stmt.hpp" 27 #include "AST/TranslationUnit.hpp" 27 28 #include "AST/TypeSubstitution.hpp" 28 29 … … 1404 1405 }; 1405 1406 1406 std::list< Declaration * > convert( const std::list< ast::ptr< ast::Decl > >&& translationUnit ) {1407 std::list< Declaration * > convert( const ast::TranslationUnit && translationUnit ) { 1407 1408 ConverterNewToOld c; 1408 1409 std::list< Declaration * > decls; 1409 for(auto d : translationUnit ) {1410 for(auto d : translationUnit.decls) { 1410 1411 decls.emplace_back( c.decl( d ) ); 1411 1412 } … … 2803 2804 #undef GET_ACCEPT_1 2804 2805 2805 std::list< ast::ptr< ast::Decl > >convert( const std::list< Declaration * > && translationUnit ) {2806 ast::TranslationUnit convert( const std::list< Declaration * > && translationUnit ) { 2806 2807 ConverterOldToNew c; 2807 std::list< ast::ptr< ast::Decl > > decls;2808 ast::TranslationUnit unit; 2808 2809 for(auto d : translationUnit) { 2809 2810 d->accept( c ); 2810 decls.emplace_back( c.decl() );2811 unit.decls.emplace_back( c.decl() ); 2811 2812 } 2812 2813 deleteAll(translationUnit); 2813 return decls;2814 return unit; 2814 2815 } -
src/AST/Convert.hpp
r3c80ccc r4406887 18 18 #include <list> 19 19 20 #include "AST/Node.hpp"21 22 20 class Declaration; 23 21 namespace ast { 24 class Decl;22 class TranslationUnit; 25 23 }; 26 24 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 );25 std::list< Declaration * > convert( const ast::TranslationUnit && translationUnit ); 26 ast::TranslationUnit convert( const std::list< Declaration * > && translationUnit ); -
src/AST/Fwd.hpp
r3c80ccc r4406887 137 137 typedef unsigned int UniqueId; 138 138 139 class TranslationUnit; 140 // TODO: Get from the TranslationUnit: 139 141 extern Type * sizeType; 140 142 extern FunctionDecl * dereferenceOperator; -
src/AST/Pass.hpp
r3c80ccc r4406887 103 103 /// Construct and run a pass on a translation unit. 104 104 template< typename... Args > 105 static void run( std::list< ptr<Decl> >& decls, Args &&... args ) {105 static void run( TranslationUnit & 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( std::list< ptr<Decl> >& decls ) {121 static void run( TranslationUnit & 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 305 308 //------------------------------------------------------------------------------------------------- 306 309 // PASS ACCESSORIES -
src/AST/Pass.impl.hpp
r3c80ccc r4406887 20 20 #include <unordered_map> 21 21 22 #include "AST/TranslationUnit.hpp" 22 23 #include "AST/TypeSubstitution.hpp" 23 24 … … 430 431 pass_visitor_stats.depth--; 431 432 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 ); 432 438 } 433 439 -
src/AST/Pass.proto.hpp
r3c80ccc r4406887 22 22 template<typename core_t> 23 23 class Pass; 24 25 class TranslationUnit; 24 26 25 27 struct PureVisitor; -
src/InitTweak/FixGlobalInit.cc
r3c80ccc r4406887 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
r3c80ccc r4406887 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
r3c80ccc r4406887 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
r3c80ccc r4406887 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 ); -
src/ResolvExpr/Resolver.cc
r3c80ccc r4406887 1274 1274 // size_t Resolver_new::traceId = Stats::Heap::new_stacktrace_id("Resolver"); 1275 1275 1276 void resolve( std::list< ast::ptr< ast::Decl > >& translationUnit ) {1276 void resolve( ast::TranslationUnit& translationUnit ) { 1277 1277 ast::Pass< Resolver_new >::run( translationUnit ); 1278 1278 } -
src/ResolvExpr/Resolver.h
r3c80ccc r4406887 35 35 class StmtExpr; 36 36 class SymbolTable; 37 class TranslationUnit; 37 38 class Type; 38 39 class TypeEnvironment; … … 55 56 56 57 /// Checks types and binds syntactic constructs to typed representations 57 void resolve( std::list< ast::ptr<ast::Decl> >& translationUnit );58 void resolve( ast::TranslationUnit& translationUnit ); 58 59 /// Searches expr and returns the first DeletedExpr found, otherwise nullptr 59 60 const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr ); … … 69 70 const ast::Expr * untyped, const ast::SymbolTable & symtab); 70 71 /// Resolves a constructor init expression 71 ast::ptr< ast::Init > resolveCtorInit( 72 ast::ptr< ast::Init > resolveCtorInit( 72 73 const ast::ConstructorInit * ctorInit, const ast::SymbolTable & symtab ); 73 74 /// Resolves a statement expression 74 ast::ptr< ast::Expr > resolveStmtExpr( 75 ast::ptr< ast::Expr > resolveStmtExpr( 75 76 const ast::StmtExpr * stmtExpr, const ast::SymbolTable & symtab ); 76 77 } // namespace ResolvExpr
Note: See TracChangeset
for help on using the changeset viewer.