Changeset cf18eea for src/InitTweak
- Timestamp:
- Apr 25, 2016, 3:53:15 PM (9 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:
- 5382492
- Parents:
- add371c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
radd371c rcf18eea 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Mon Apr 25 1 4:44:21201612 // Last Modified On : Mon Apr 25 15:16:12 2016 13 13 // Update Count : 30 14 14 // … … 27 27 #include "SymTab/Indexer.h" 28 28 #include "GenPoly/PolyMutator.h" 29 #include "GenPoly/GenPoly.h" 29 30 30 31 bool ctordtorp = false; … … 58 59 /// create and resolve ctor/dtor expression: fname(var, [cpArg]) 59 60 ApplicationExpr * makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg = NULL ); 61 /// true if type does not need to be copy constructed to ensure correctness 62 bool skipCopyConstruct( Type * ); 60 63 }; 61 64 … … 150 153 } 151 154 155 bool ResolveCopyCtors::skipCopyConstruct( Type * type ) { 156 return dynamic_cast< VarArgsType * >( type ) || GenPoly::getFunctionType( type ); 157 } 158 152 159 ApplicationExpr * ResolveCopyCtors::makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg ) { 153 160 assert( var ); … … 180 187 // xxx - need to handle tuple arguments 181 188 assert( ! arg->get_results().empty() ); 182 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, arg->get_results().front()->clone(), 0 ); 189 Type * result = arg->get_results().front(); 190 if ( skipCopyConstruct( result ) ) continue; // skip certain non-copyable types 191 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result->clone(), 0 ); 183 192 tmp->get_type()->set_isConst( false ); 184 193
Note: See TracChangeset
for help on using the changeset viewer.