Changeset ba3706f for src/GenPoly/Box.cc
- Timestamp:
- Nov 30, 2017, 4:43:59 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- c50d54d
- Parents:
- 4429b04
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r4429b04 rba3706f 49 49 #include "SynTree/Expression.h" // for ApplicationExpr, UntypedExpr 50 50 #include "SynTree/Initializer.h" // for SingleInit, Initializer, Lis... 51 #include "SynTree/Label.h" // for Label , noLabels51 #include "SynTree/Label.h" // for Label 52 52 #include "SynTree/Mutator.h" // for maybeMutate, Mutator, mutateAll 53 53 #include "SynTree/Statement.h" // for ExprStmt, DeclStmt, ReturnStmt … … 293 293 FunctionDecl *layoutDecl = new FunctionDecl( layoutofName( typeDecl ), 294 294 functionNesting > 0 ? Type::StorageClasses() : Type::StorageClasses( Type::Static ), 295 LinkageSpec::AutoGen, layoutFnType, new CompoundStmt( noLabels),295 LinkageSpec::AutoGen, layoutFnType, new CompoundStmt(), 296 296 std::list< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) ); 297 297 layoutDecl->fixUniqueId(); … … 321 321 /// makes an if-statement with a single-expression if-block and no then block 322 322 Statement *makeCond( Expression *cond, Expression *ifPart ) { 323 return new IfStmt( noLabels, cond, new ExprStmt( noLabels,ifPart ), 0 );323 return new IfStmt( cond, new ExprStmt( ifPart ), 0 ); 324 324 } 325 325 … … 340 340 /// adds an expression to a compound statement 341 341 void addExpr( CompoundStmt *stmts, Expression *expr ) { 342 stmts->get_kids().push_back( new ExprStmt( noLabels,expr ) );342 stmts->get_kids().push_back( new ExprStmt( expr ) ); 343 343 } 344 344 … … 629 629 ObjectDecl *Pass1::makeTemporary( Type *type ) { 630 630 ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, type, 0 ); 631 stmtsToAddBefore.push_back( new DeclStmt( n oLabels, newObj ) );631 stmtsToAddBefore.push_back( new DeclStmt( newObj ) ); 632 632 return newObj; 633 633 } … … 740 740 ObjectDecl *newObj = ObjectDecl::newObject( tempNamer.newName(), newType, nullptr ); 741 741 newObj->get_type()->get_qualifiers() = Type::Qualifiers(); // TODO: is this right??? 742 stmtsToAddBefore.push_back( new DeclStmt( n oLabels, newObj ) );742 stmtsToAddBefore.push_back( new DeclStmt( newObj ) ); 743 743 UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) ); // TODO: why doesn't this just use initialization syntax? 744 744 assign->get_args().push_back( new VariableExpr( newObj ) ); 745 745 assign->get_args().push_back( arg ); 746 stmtsToAddBefore.push_back( new ExprStmt( noLabels,assign ) );746 stmtsToAddBefore.push_back( new ExprStmt( assign ) ); 747 747 arg = new AddressExpr( new VariableExpr( newObj ) ); 748 748 } // if … … 888 888 // void return 889 889 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars ); 890 bodyStmt = new ExprStmt( noLabels,adapteeApp );890 bodyStmt = new ExprStmt( adapteeApp ); 891 891 } else if ( isDynType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) { 892 892 // return type T … … 900 900 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars ); 901 901 assign->get_args().push_back( adapteeApp ); 902 bodyStmt = new ExprStmt( noLabels,assign );902 bodyStmt = new ExprStmt( assign ); 903 903 } else { 904 904 // adapter for a function that returns a monomorphic value 905 905 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars ); 906 bodyStmt = new ReturnStmt( noLabels,adapteeApp );906 bodyStmt = new ReturnStmt( adapteeApp ); 907 907 } // if 908 CompoundStmt *adapterBody = new CompoundStmt( noLabels);908 CompoundStmt *adapterBody = new CompoundStmt(); 909 909 adapterBody->get_kids().push_back( bodyStmt ); 910 910 std::string adapterName = makeAdapterName( mangleName ); … … 952 952 std::pair< AdapterIter, bool > answer = adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, newAdapter ) ); 953 953 adapter = answer.first; 954 stmtsToAddBefore.push_back( new DeclStmt( n oLabels, newAdapter ) );954 stmtsToAddBefore.push_back( new DeclStmt( newAdapter ) ); 955 955 } // if 956 956 assert( adapter != adapters.end() ); … … 1279 1279 retval->set_name( "_retval" ); 1280 1280 } 1281 functionDecl->get_statements()->get_kids().push_front( new DeclStmt( noLabels,retval ) );1281 functionDecl->get_statements()->get_kids().push_front( new DeclStmt( retval ) ); 1282 1282 DeclarationWithType * newRet = retval->clone(); // for ownership purposes 1283 1283 ftype->get_returnVals().front() = newRet; … … 1519 1519 // (alloca was previously used, but can't be safely used in loops) 1520 1520 ObjectDecl *newBuf = ObjectDecl::newObject( bufNamer.newName(), polyToMonoType( objectDecl->type ), nullptr ); 1521 stmtsToAddBefore.push_back( new DeclStmt( n oLabels, newBuf ) );1521 stmtsToAddBefore.push_back( new DeclStmt( newBuf ) ); 1522 1522 1523 1523 delete objectDecl->get_init(); … … 1598 1598 ObjectDecl *PolyGenericCalculator::makeVar( const std::string &name, Type *type, Initializer *init ) { 1599 1599 ObjectDecl *newObj = new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, 0, type, init ); 1600 stmtsToAddBefore.push_back( new DeclStmt( n oLabels, newObj ) );1600 stmtsToAddBefore.push_back( new DeclStmt( newObj ) ); 1601 1601 return newObj; 1602 1602 } … … 1677 1677 addOtypeParamsToLayoutCall( layoutCall, otypeParams ); 1678 1678 1679 stmtsToAddBefore.push_back( new ExprStmt( noLabels,layoutCall ) );1679 stmtsToAddBefore.push_back( new ExprStmt( layoutCall ) ); 1680 1680 } 1681 1681 … … 1703 1703 addOtypeParamsToLayoutCall( layoutCall, otypeParams ); 1704 1704 1705 stmtsToAddBefore.push_back( new ExprStmt( noLabels,layoutCall ) );1705 stmtsToAddBefore.push_back( new ExprStmt( layoutCall ) ); 1706 1706 1707 1707 return true;
Note: See TracChangeset
for help on using the changeset viewer.