Changes in src/Virtual/Tables.cc [b91bfde:69c5c00]
- File:
-
- 1 edited
-
src/Virtual/Tables.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Virtual/Tables.cc
rb91bfde r69c5c00 10 10 // Created On : Mon Aug 31 11:11:00 2020 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : T hr Apr 8 15:51:00 202113 // Update Count : 112 // Last Modified On : Tue Sep 3 14:56:00 2020 13 // Update Count : 0 14 14 // 15 15 … … 22 22 namespace Virtual { 23 23 24 std::string typeIdType( std::string const & type_name ) {25 return "__cfatid_struct_" + type_name;26 }27 28 std::string typeIdName( std::string const & type_name ) {29 return "__cfatid_" + type_name;30 }31 32 static std::string typeIdTypeToInstance( std::string const & type_name ) {33 return typeIdName(type_name.substr(16));34 }35 36 24 std::string vtableTypeName( std::string const & name ) { 37 25 return name + "_vtable"; 38 }39 40 std::string baseTypeName( std::string const & vtable_type_name ) {41 return vtable_type_name.substr(0, vtable_type_name.size() - 7);42 26 } 43 27 … … 97 81 inits.push_back( 98 82 new SingleInit( new AddressExpr( new NameExpr( parentInstance ) ) ) ); 99 } else if ( std::string( "__cfavir_typeid" ) == field->name ) {100 std::string const & baseType = baseTypeName( vtableType->name );101 std::string const & typeId = typeIdName( baseType );102 inits.push_back( new SingleInit( new AddressExpr( new NameExpr( typeId ) ) ) );103 83 } else if ( std::string( "size" ) == field->name ) { 104 84 inits.push_back( new SingleInit( new SizeofExpr( objectType->clone() ) ) ); … … 167 147 } 168 148 169 ObjectDecl * makeTypeIdForward() {170 return nullptr;171 149 } 172 173 Attribute * linkonce( const std::string & subsection ) {174 const std::string section = ".gnu.linkonce." + subsection;175 return new Attribute( "section", {176 new ConstantExpr( Constant::from_string( section ) ),177 } );178 }179 180 ObjectDecl * makeTypeIdInstance( StructInstType const * typeIdType ) {181 assert( typeIdType );182 StructInstType * type = typeIdType->clone();183 type->tq.is_const = true;184 std::string const & typeid_name = typeIdTypeToInstance( typeIdType->name );185 return new ObjectDecl(186 typeid_name,187 noStorageClasses,188 LinkageSpec::Cforall,189 /* bitfieldWidth */ nullptr,190 type,191 new ListInit( { new SingleInit(192 new AddressExpr( new NameExpr( "__cfatid_exception_t" ) )193 ) } ),194 { linkonce( typeid_name ) },195 noFuncSpecifiers196 );197 }198 199 }
Note:
See TracChangeset
for help on using the changeset viewer.