Changeset cbce272 for src/Virtual
- Timestamp:
- Aug 9, 2017, 2:08:14 PM (8 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:
- 65cdc1e
- Parents:
- e195093
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/Virtual/ExpandCasts.cc ¶
re195093 rcbce272 10 10 // Created On : Mon Jul 24 13:59:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jul 26 14:16:00 201713 // Update Count : 012 // Last Modified On : Tus Aug 2 14:59:00 2017 13 // Update Count : 1 14 14 // 15 15 … … 78 78 79 79 void VirtualCastCore::premutate( FunctionDecl * functionDecl ) { 80 if ( (! vcast_decl) && functionDecl->get_statements() &&80 if ( (! vcast_decl) && 81 81 functionDecl->get_name() == "__cfa__virtual_cast" ) { 82 82 vcast_decl = functionDecl; … … 101 101 assertf( castExpr->get_result(), "Virtual Cast target not found before expansion." ); 102 102 103 //assert( vcast_decl );103 assert( vcast_decl ); 104 104 assert( pvt_decl ); 105 105 106 106 // May only cast to a pointer or reference type. 107 107 // A earlier validation should give a syntax error, this is 108 // just to make sure errors don't creep in. 108 // just to make sure errors don't creep during translation. 109 // Move to helper with more detailed error messages. 109 110 PointerType * target_type = 110 111 dynamic_cast<PointerType *>( castExpr->get_result() ); 111 112 assert( target_type ); 112 113 113 114 StructInstType * target_struct = 114 115 dynamic_cast<StructInstType *>( target_type->get_base() ); 116 assert( target_struct ); 117 115 118 StructDecl * target_decl = target_struct->get_baseStruct(); 116 119 … … 124 127 125 128 Expression * result = new CastExpr( 126 //new ApplicationExpr( new VariableExpr( vcast_decl ), { 129 //new ApplicationExpr( 130 //new AddressExpr( new VariableExpr( vcast_decl ) ), 131 //new CastExpr( new VariableExpr( vcast_decl ), 132 // new PointerType( noQualifiers, 133 // vcast_decl->get_type()->clone() 134 // ) 135 // ), 127 136 new UntypedExpr( new NameExpr( "__cfa__virtual_cast" ), { 128 new CastExpr(129 new AddressExpr( new VariableExpr( table ) ),130 pointer_to_pvt(1)131 ),132 new CastExpr(133 castExpr->get_arg(),134 pointer_to_pvt(2)135 ) }136 ),137 castExpr->get_result() 137 new CastExpr( 138 new AddressExpr( new VariableExpr( table ) ), 139 pointer_to_pvt(1) 140 ), 141 new CastExpr( 142 castExpr->get_arg(), 143 pointer_to_pvt(2) 144 ) 145 } ), 146 castExpr->get_result()->clone() 138 147 ); 139 148
Note: See TracChangeset
for help on using the changeset viewer.