Changes in src/Virtual/Tables.cc [b583113:69c5c00]
- File:
-
- 1 edited
-
src/Virtual/Tables.cc (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Virtual/Tables.cc
rb583113 r69c5c00 10 10 // Created On : Mon Aug 31 11:11:00 2020 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Apr 21 15:36:00 202113 // Update Count : 212 // 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 … … 50 34 } 51 35 52 std::string concurrentDefaultVTableName() {53 return "_default_vtable";54 }55 56 36 bool isVTableInstanceName( std::string const & name ) { 57 37 // There are some delicate length calculations here. … … 61 41 62 42 static ObjectDecl * makeVtableDeclaration( 63 std::string const & name,64 43 StructInstType * type, Initializer * init ) { 44 std::string const & name = instanceName( type->name ); 65 45 Type::StorageClasses storage = noStorageClasses; 66 46 if ( nullptr == init ) { … … 77 57 } 78 58 79 ObjectDecl * makeVtableForward( std::string const & name,StructInstType * type ) {59 ObjectDecl * makeVtableForward( StructInstType * type ) { 80 60 assert( type ); 81 return makeVtableDeclaration( name,type, nullptr );61 return makeVtableDeclaration( type, nullptr ); 82 62 } 83 63 84 64 ObjectDecl * makeVtableInstance( 85 std::string const & name, StructInstType * vtableType, 86 Type * objectType, Initializer * init ) { 65 StructInstType * vtableType, Type * objectType, Initializer * init ) { 87 66 assert( vtableType ); 88 67 assert( objectType ); … … 102 81 inits.push_back( 103 82 new SingleInit( new AddressExpr( new NameExpr( parentInstance ) ) ) ); 104 } else if ( std::string( "__cfavir_typeid" ) == field->name ) {105 std::string const & baseType = baseTypeName( vtableType->name );106 std::string const & typeId = typeIdName( baseType );107 inits.push_back( new SingleInit( new AddressExpr( new NameExpr( typeId ) ) ) );108 83 } else if ( std::string( "size" ) == field->name ) { 109 84 inits.push_back( new SingleInit( new SizeofExpr( objectType->clone() ) ) ); … … 120 95 assert(false); 121 96 } 122 return makeVtableDeclaration( name,vtableType, init );97 return makeVtableDeclaration( vtableType, init ); 123 98 } 124 99 … … 172 147 } 173 148 174 Attribute * linkonce( const std::string & subsection ) {175 const std::string section = ".gnu.linkonce." + subsection;176 return new Attribute( "section", {177 new ConstantExpr( Constant::from_string( section ) ),178 } );179 149 } 180 181 ObjectDecl * makeTypeIdInstance( StructInstType const * typeIdType ) {182 assert( typeIdType );183 StructInstType * type = typeIdType->clone();184 type->tq.is_const = true;185 std::string const & typeid_name = typeIdTypeToInstance( typeIdType->name );186 return new ObjectDecl(187 typeid_name,188 noStorageClasses,189 LinkageSpec::Cforall,190 /* bitfieldWidth */ nullptr,191 type,192 new ListInit( { new SingleInit(193 new AddressExpr( new NameExpr( "__cfatid_exception_t" ) )194 ) } ),195 { linkonce( typeid_name ) },196 noFuncSpecifiers197 );198 }199 200 }
Note:
See TracChangeset
for help on using the changeset viewer.