Changeset 29bc63e for src/InitTweak
- Timestamp:
- Sep 22, 2017, 5:46:04 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:
- aec3e6b
- Parents:
- 22bc276
- git-author:
- Rob Schluntz <rschlunt@…> (09/22/17 17:45:24)
- git-committer:
- Rob Schluntz <rschlunt@…> (09/22/17 17:46:04)
- Location:
- src/InitTweak
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r22bc276 r29bc63e 58 58 #include "SynTree/TypeSubstitution.h" // for TypeSubstitution, operator<< 59 59 #include "SynTree/Visitor.h" // for acceptAll, maybeAccept 60 #include "Tuples/Tuples.h" // for isTtype61 60 62 61 bool ctordtorp = false; // print all debug … … 368 367 } 369 368 370 bool ResolveCopyCtors::skipCopyConstruct( Type * type ) { 371 return dynamic_cast< VarArgsType * >( type ) || dynamic_cast< ReferenceType * >( type ) || GenPoly::getFunctionType( type ) || Tuples::isTtype( type ); 372 } 369 bool ResolveCopyCtors::skipCopyConstruct( Type * type ) { return ! isConstructable( type ); } 373 370 374 371 Expression * ResolveCopyCtors::makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg ) { -
src/InitTweak/GenInit.cc
r22bc276 r29bc63e 130 130 // hands off if the function returns a reference - we don't want to allocate a temporary if a variable's address 131 131 // is being returned 132 if ( returnStmt->get_expr() && returnVals.size() == 1 && tryConstruct( returnVals.front() ) ) {132 if ( returnStmt->get_expr() && returnVals.size() == 1 && isConstructable( returnVals.front()->get_type() ) ) { 133 133 // explicitly construct the return value using the return expression and the retVal object 134 134 assertf( returnVals.front()->get_name() != "", "Function %s has unnamed return value\n", funcName.c_str() ); -
src/InitTweak/InitTweak.cc
r22bc276 r29bc63e 22 22 #include "SynTree/Type.h" // for FunctionType, ArrayType, PointerType 23 23 #include "SynTree/Visitor.h" // for Visitor, maybeAccept 24 #include "Tuples/Tuples.h" // for Tuples::isTtype 24 25 25 26 class UntypedValofExpr; … … 276 277 ( objDecl->get_init() != nullptr && objDecl->get_init()->get_maybeConstructed() )) 277 278 && ! objDecl->get_storageClasses().is_extern 278 && ! dynamic_cast< ReferenceType * >( objDecl->type ); 279 && isConstructable( objDecl->type ); 280 } 281 282 bool isConstructable( Type * type ) { 283 return ! dynamic_cast< VarArgsType * >( type ) && ! dynamic_cast< ReferenceType * >( type ) && ! dynamic_cast< FunctionType * >( type ) && ! Tuples::isTtype( type ); 279 284 } 280 285 -
src/InitTweak/InitTweak.h
r22bc276 r29bc63e 35 35 /// True if the resolver should try to construct dwt 36 36 bool tryConstruct( DeclarationWithType * dwt ); 37 38 /// True if the type can have a user-defined constructor 39 bool isConstructable( Type * t ); 37 40 38 41 /// True if the Initializer contains designations
Note: See TracChangeset
for help on using the changeset viewer.