Changes in / [b56c17c:8b11840]
- Location:
- src/InitTweak
- Files:
-
- 4 edited
-
FixInit.cc (modified) (2 diffs)
-
GenInit.cc (modified) (2 diffs)
-
InitTweak.cc (modified) (2 diffs)
-
InitTweak.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
rb56c17c r8b11840 58 58 #include "SynTree/TypeSubstitution.h" // for TypeSubstitution, operator<< 59 59 #include "SynTree/Visitor.h" // for acceptAll, maybeAccept 60 #include "Tuples/Tuples.h" // for isTtype 60 61 61 62 bool ctordtorp = false; // print all debug … … 367 368 } 368 369 369 bool ResolveCopyCtors::skipCopyConstruct( Type * type ) { return ! isConstructable( type ); } 370 bool ResolveCopyCtors::skipCopyConstruct( Type * type ) { 371 return dynamic_cast< VarArgsType * >( type ) || dynamic_cast< ReferenceType * >( type ) || GenPoly::getFunctionType( type ) || Tuples::isTtype( type ); 372 } 370 373 371 374 Expression * ResolveCopyCtors::makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg ) { -
src/InitTweak/GenInit.cc
rb56c17c r8b11840 75 75 // that need to be constructed or destructed 76 76 void previsit( StructDecl *aggregateDecl ); 77 void pre visit( AggregateDecl * ) { visit_children = false; }78 void pre visit( NamedTypeDecl * ) { visit_children = false; }77 void premutate( AggregateDecl * ) { visit_children = false; } 78 void premutate( NamedTypeDecl * ) { visit_children = false; } 79 79 void previsit( FunctionType * ) { visit_children = false; } 80 80 … … 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 && isConstructable( returnVals.front()->get_type() ) ) {132 if ( returnStmt->get_expr() && returnVals.size() == 1 && tryConstruct( returnVals.front() ) ) { 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
rb56c17c r8b11840 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::isTtype25 24 26 25 class UntypedValofExpr; … … 277 276 ( objDecl->get_init() != nullptr && objDecl->get_init()->get_maybeConstructed() )) 278 277 && ! objDecl->get_storageClasses().is_extern 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 ); 278 && ! dynamic_cast< ReferenceType * >( objDecl->type ); 284 279 } 285 280 -
src/InitTweak/InitTweak.h
rb56c17c r8b11840 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 constructor39 bool isConstructable( Type * t );40 37 41 38 /// True if the Initializer contains designations
Note:
See TracChangeset
for help on using the changeset viewer.