Changeset b91bfde for src/Virtual
- Timestamp:
- Apr 12, 2021, 11:53:30 AM (2 years ago)
- Branches:
- arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 73f4d08
- Parents:
- ecfd758
- Location:
- src/Virtual
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Virtual/ExpandCasts.cc
recfd758 rb91bfde 77 77 78 78 class VirtualCastCore { 79 Type * pointer_to_pvt(int level_of_indirection) {79 CastExpr * cast_to_type_id( Expression * expr, int level_of_indirection ) { 80 80 Type * type = new StructInstType( 81 81 Type::Qualifiers( Type::Const ), pvt_decl ); … … 83 83 type = new PointerType( noQualifiers, type ); 84 84 } 85 return type;85 return new CastExpr( expr, type ); 86 86 } 87 87 … … 253 253 Expression * result = new CastExpr( 254 254 new ApplicationExpr( VariableExpr::functionPointer( vcast_decl ), { 255 new CastExpr( 256 new AddressExpr( new VariableExpr( type_id ) ), 257 pointer_to_pvt(1) 258 ), 259 new CastExpr( 260 castExpr->get_arg(), 261 pointer_to_pvt(2) 262 ) 255 cast_to_type_id( new AddressExpr( new VariableExpr( type_id ) ), 1 ), 256 cast_to_type_id( castExpr->get_arg(), 2 ), 263 257 } ), 264 258 castExpr->get_result()->clone() -
src/Virtual/Tables.cc
recfd758 rb91bfde 172 172 173 173 Attribute * linkonce( const std::string & subsection ) { 174 const std::string section = "\".gnu.linkonce." + subsection + "\""; 175 // Adjust for terminator and quotes. 176 size_t str_size = section.size() + 1 - 2; 174 const std::string section = ".gnu.linkonce." + subsection; 177 175 return new Attribute( "section", { 178 new ConstantExpr( Constant( 179 new ArrayType( 180 noQualifiers, 181 new BasicType( noQualifiers, BasicType::Char ), 182 new ConstantExpr( Constant::from_ulong( str_size ) ), 183 false, false ), 184 section, 185 std::nullopt 186 ) ), 176 new ConstantExpr( Constant::from_string( section ) ), 187 177 } ); 188 178 }
Note: See TracChangeset
for help on using the changeset viewer.