- Timestamp:
- May 25, 2022, 5:51:24 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- c3b9d639
- Parents:
- 5024df4
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/GenType.cc
r5024df4 rc715e5f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 1 15:24:00 201913 // Update Count : 2 312 // Last Modified On : Fri May 20 11:18:00 2022 13 // Update Count : 24 14 14 // 15 15 #include "GenType.h" … … 50 50 void postvisit( TraitInstType * inst ); 51 51 void postvisit( TypeofType * typeof ); 52 void postvisit( VTableType * vtable ); 52 53 void postvisit( QualifiedType * qualType ); 53 54 … … 259 260 if ( options.genC ) { 260 261 typeString = "enum " + typeString; 261 } 262 } 262 } 263 } 263 264 handleQualifiers( enumInst ); 264 265 } 265 266 266 267 void GenType::postvisit( TypeInstType * typeInst ) { 268 assertf( ! options.genC, "Type instance types should not reach code generation." ); 267 269 typeString = typeInst->name + " " + typeString; 268 270 handleQualifiers( typeInst ); … … 320 322 } 321 323 324 void GenType::postvisit( VTableType * vtable ) { 325 assertf( ! options.genC, "Virtual table types should not reach code generation." ); 326 std::ostringstream os; 327 os << "vtable(" << genType( vtable->base, "", options ) << ") " << typeString; 328 typeString = os.str(); 329 handleQualifiers( vtable ); 330 } 331 322 332 void GenType::postvisit( QualifiedType * qualType ) { 323 333 assertf( ! options.genC, "Qualified types should not reach code generation." ); -
src/ControlStruct/ExceptDecl.cc
r5024df4 rc715e5f 9 9 // Author : Henry Xue 10 10 // Created On : Tue Jul 20 04:10:50 2021 11 // Last Modified By : Henry Xue12 // Last Modified On : Tue Aug 03 10:42:26 202113 // Update Count : 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 25 16:43:00 2022 13 // Update Count : 5 14 14 // 15 15 … … 39 39 } 40 40 41 TypeInstType * makeExceptInstType(42 const std::string & exceptionName, 43 const std::list< Expression *> & parameters 44 ) { 45 TypeInstType * exceptInstType = new TypeInstType(41 StructInstType * makeExceptInstType( 42 const std::string & exceptionName, 43 const std::list< Expression *> & parameters 44 ) { 45 StructInstType * exceptInstType = new StructInstType( 46 46 noQualifiers, 47 exceptionName, 48 false 47 exceptionName 49 48 ); 50 49 cloneAll( parameters, exceptInstType->parameters ); … … 151 150 nullptr, 152 151 new PointerType( noQualifiers, 153 new TypeInstType( Type::Const, "__cfavir_type_info", false) ),152 new StructInstType( Type::Const, "__cfavir_type_info" ) ), 154 153 nullptr 155 154 ) ); … … 257 256 const std::string & exceptionName, 258 257 const std::list< TypeDecl *> & forallClause, 259 const std::list< Expression *> & parameters, 258 const std::list< Expression *> & parameters, 260 259 const std::list< Declaration *> & members 261 260 ) { … … 302 301 ObjectDecl * ehmExternVtable( 303 302 const std::string & exceptionName, 304 const std::list< Expression *> & parameters, 303 const std::list< Expression *> & parameters, 305 304 const std::string & tableName 306 305 ) { … … 457 456 } 458 457 458 class VTableCore : public WithDeclsToAdd { 459 public: 460 // Remove any remaining vtable type nodes in the tree. 461 Type * postmutate( VTableType * vtableType ); 462 }; 463 464 Type * VTableCore::postmutate( VTableType * vtableType ) { 465 auto inst = strict_dynamic_cast<ReferenceToType *>( vtableType->base ); 466 467 std::string vtableName = Virtual::vtableTypeName( inst->name ); 468 StructInstType * newType = new StructInstType( noQualifiers, vtableName ); 469 cloneAll( inst->parameters, newType->parameters ); 470 471 delete vtableType; 472 return newType; 473 } 474 459 475 void translateExcept( std::list< Declaration *> & translationUnit ) { 460 476 PassVisitor<ExceptDeclCore> translator; 461 477 mutateAll( translationUnit, translator ); 462 } 463 464 } 478 PassVisitor<VTableCore> typeTranslator; 479 mutateAll( translationUnit, typeTranslator ); 480 } 481 482 }
Note:
See TracChangeset
for help on using the changeset viewer.