Changeset 10a7775 for src/CodeGen
- Timestamp:
- Jun 3, 2016, 2:02:29 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:
- e365cb5
- Parents:
- e01bfbc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/CodeGen/CodeGenerator.cc ¶
re01bfbc r10a7775 33 33 #include "OperatorTable.h" 34 34 #include "GenType.h" 35 36 #include "InitTweak/InitTweak.h" 35 37 36 38 using namespace std; … … 255 257 std::list< Expression* >::iterator arg = applicationExpr->get_args().begin(); 256 258 switch ( opInfo.type ) { 259 case OT_CTOR: 260 case OT_DTOR: 261 { 262 // if the first argument's type is const then GCC complains. In this 263 // case, output an explicit ctor/dtor call and exit, rather than following 264 // the normal path 265 assert( arg != applicationExpr->get_args().end() ); 266 assert( (*arg)->get_results().size() >= 1 ); 267 Type * baseType = InitTweak::getPointerBase( (*arg)->get_results().front() ); 268 if ( baseType->get_isConst() ) { 269 // cast away the qualifiers, to eliminate warnings 270 Type * newType = baseType->clone(); 271 newType->get_qualifiers() = Type::Qualifiers(); 272 *arg = new CastExpr( *arg, new PointerType( Type::Qualifiers(), newType ) ); 273 varExpr->accept( *this ); 274 output << "("; 275 genCommaList( applicationExpr->get_args().begin(), applicationExpr->get_args().end() ); 276 output << ")"; 277 return; 278 } 279 } 280 // intentional fallthrough - instrinsic ctor/dtor for non-const objects should 281 // be handled the same way as assignment 257 282 case OT_PREFIXASSIGN: 258 283 case OT_POSTFIXASSIGN: 259 284 case OT_INFIXASSIGN: 260 case OT_CTOR:261 case OT_DTOR:262 285 { 263 286 assert( arg != applicationExpr->get_args().end() ); … … 269 292 UntypedExpr *newExpr = new UntypedExpr( new NameExpr( "*?" ) ); 270 293 newExpr->get_args().push_back( *arg ); 294 assert( (*arg)->get_results().size() == 1 ); 295 Type * type = InitTweak::getPointerBase( (*arg)->get_results().front() ); 296 assert( type ); 297 newExpr->get_results().push_back( type ); 271 298 *arg = newExpr; 272 299 } // if
Note: See TracChangeset
for help on using the changeset viewer.