Changeset c715e5f for src/ControlStruct


Ignore:
Timestamp:
May 25, 2022, 5:51:24 PM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
c3b9d639
Parents:
5024df4
Message:

Removed most of the exception macros (EHM_ group). Made changes to the exception declaration pass to do so.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/ControlStruct/ExceptDecl.cc

    r5024df4 rc715e5f  
    99// Author           : Henry Xue
    1010// Created On       : Tue Jul 20 04:10:50 2021
    11 // Last Modified By : Henry Xue
    12 // Last Modified On : Tue Aug 03 10:42:26 2021
    13 // Update Count     : 4
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed May 25 16:43:00 2022
     13// Update Count     : 5
    1414//
    1515
     
    3939}
    4040
    41 TypeInstType * makeExceptInstType(
    42         const std::string & exceptionName,
    43         const std::list< Expression *> & parameters
    44 ) {
    45         TypeInstType * exceptInstType = new TypeInstType(
     41StructInstType * makeExceptInstType(
     42        const std::string & exceptionName,
     43        const std::list< Expression *> & parameters
     44) {
     45        StructInstType * exceptInstType = new StructInstType(
    4646                noQualifiers,
    47                 exceptionName,
    48                 false
     47                exceptionName
    4948        );
    5049        cloneAll( parameters, exceptInstType->parameters );
     
    151150                nullptr,
    152151                new PointerType( noQualifiers,
    153                         new TypeInstType( Type::Const, "__cfavir_type_info", false ) ),
     152                        new StructInstType( Type::Const, "__cfavir_type_info" ) ),
    154153                nullptr
    155154        ) );
     
    257256        const std::string & exceptionName,
    258257        const std::list< TypeDecl *> & forallClause,
    259         const std::list< Expression *> & parameters, 
     258        const std::list< Expression *> & parameters,
    260259        const std::list< Declaration *> & members
    261260) {
     
    302301ObjectDecl * ehmExternVtable(
    303302        const std::string & exceptionName,
    304         const std::list< Expression *> & parameters, 
     303        const std::list< Expression *> & parameters,
    305304        const std::string & tableName
    306305) {
     
    457456}
    458457
     458class VTableCore : public WithDeclsToAdd {
     459public:
     460        // Remove any remaining vtable type nodes in the tree.
     461        Type * postmutate( VTableType * vtableType );
     462};
     463
     464Type * 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
    459475void translateExcept( std::list< Declaration *> & translationUnit ) {
    460476        PassVisitor<ExceptDeclCore> translator;
    461477        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.