- Timestamp:
- Mar 15, 2016, 3:16:53 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- dac0aa9
- Parents:
- 972e6f7
- Location:
- src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r972e6f7 r5b40f30 212 212 printDesignators( init->get_designators() ); 213 213 output << "{ "; 214 genCommaList( init->begin_initializers(), init->end_initializers() ); 214 if ( init->begin_initializers() == init->end_initializers() ) { 215 // illegal to leave initializer list empty for scalar initializers, 216 // but always legal to have 0 217 output << "0"; 218 } else { 219 genCommaList( init->begin_initializers(), init->end_initializers() ); 220 } 215 221 output << " }"; 216 222 } -
src/InitTweak/FixInit.cc
r972e6f7 r5b40f30 48 48 } 49 49 50 // in the case where an object has an initializer and a polymorphic type, insert an assignment immediately after the51 // declaration. This will (seemingly) cause the later phases to do the right thing with the assignment52 50 ObjectDecl *FixInit::mutate( ObjectDecl *objDecl ) { 53 51 if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) { … … 79 77 if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( exprStmt->get_expr() ) ) { 80 78 if ( VariableExpr * function = dynamic_cast< VariableExpr * >( appExpr->get_function() ) ) { 79 // check for Intrinsic only - don't want to remove all overridable dtors because autogenerated dtor 80 // will call all member dtors, and some members may have a user defined dtor. 81 81 if ( function->get_var()->get_name() == "^?{}" && function->get_var()->get_linkage() == LinkageSpec::Intrinsic ) { 82 82 statements.erase(it++); -
src/InitTweak/RemoveInit.cc
r972e6f7 r5b40f30 29 29 namespace { 30 30 const std::list<Label> noLabels; 31 const std::list<Expression *> noDesignators; 31 32 } 32 33 … … 112 113 // hands off if the function returns an lvalue - we don't want to allocate a temporary if a variable's address 113 114 // is being returned 114 // xxx - this should construct rather than assign115 115 if ( returnStmt->get_expr() && returnVals.size() == 1 && funcName != "?=?" && ! returnVals.front()->get_type()->get_isLvalue() ) { 116 ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, returnVals.front()->get_type()->clone(), 0 ); 116 // ensure return value is not destructed by explicitly creating 117 // an empty SingleInit node wherein maybeConstruct is false 118 ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, returnVals.front()->get_type()->clone(), new ListInit( std::list<Initializer*>(), noDesignators, false ) ); 117 119 stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) ); 118 120 119 UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) ); 120 assign->get_args().push_back( new AddressExpr (new NameExpr( newObj->get_name() ) ) ); 121 assign->get_args().push_back( returnStmt->get_expr() ); 122 stmtsToAdd.push_back(new ExprStmt(noLabels, assign)); 121 // and explicitly create the constructor expression separately 122 UntypedExpr *construct = new UntypedExpr( new NameExpr( "?{}" ) ); 123 construct->get_args().push_back( new AddressExpr (new NameExpr( newObj->get_name() ) ) ); 124 construct->get_args().push_back( returnStmt->get_expr() ); 125 stmtsToAdd.push_back(new ExprStmt(noLabels, construct)); 123 126 124 127 returnStmt->set_expr( new VariableExpr( newObj ) ); -
src/SymTab/Autogen.cc
r972e6f7 r5b40f30 80 80 fExpr->get_args().push_back( dstselect ); 81 81 82 Expression *srcselect = new MemberExpr( member, new VariableExpr( srcParam ) ); 83 fExpr->get_args().push_back( srcselect ); 82 if ( srcParam ) { 83 Expression *srcselect = new MemberExpr( member, new VariableExpr( srcParam ) ); 84 fExpr->get_args().push_back( srcselect ); 85 } 84 86 85 87 *out++ = new ExprStmt( noLabels, fExpr ); -
src/SynTree/Initializer.cc
r972e6f7 r5b40f30 54 54 } 55 55 56 ListInit::ListInit( std::list<Initializer*> &_initializers, const std::list<Expression *> &_designators, bool maybeConstructed )56 ListInit::ListInit( const std::list<Initializer*> &_initializers, const std::list<Expression *> &_designators, bool maybeConstructed ) 57 57 : Initializer( maybeConstructed), initializers( _initializers ), designators( _designators ) { 58 58 } -
src/SynTree/Initializer.h
r972e6f7 r5b40f30 82 82 class ListInit : public Initializer { 83 83 public: 84 ListInit( std::list<Initializer*> &,84 ListInit( const std::list<Initializer*> &initializers, 85 85 const std::list<Expression *> &designators, bool maybeConstructed = false ); 86 86 virtual ~ListInit();
Note: See TracChangeset
for help on using the changeset viewer.