Changeset 9e7236f4 for src/SymTab


Ignore:
Timestamp:
May 2, 2022, 3:18:32 AM (3 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
24ceace
Parents:
2686bc7
Message:

Resolution of struct enum. The codegen of struct enum will be in the next commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r2686bc7 r9e7236f4  
    760760                } // if
    761761        }
    762 
    763762        void LinkReferenceToTypes_old::postvisit( StructInstType * structInst ) {
    764763                const StructDecl * st = local_indexer->lookupStruct( structInst->name );
     
    886885        void LinkReferenceToTypes_old::postvisit( EnumDecl * enumDecl ) {
    887886                // visit enum members first so that the types of self-referencing members are updated properly
     887                // Replace the enum base; right now it works only for StructEnum
     888                if ( enumDecl->base && dynamic_cast<TypeInstType*>(enumDecl->base) ) {
     889                        std::string baseName = static_cast<TypeInstType*>(enumDecl->base)->name;
     890                        const StructDecl * st = local_indexer->lookupStruct( baseName );
     891                        if ( st ) {
     892                                enumDecl->base = new StructInstType(Type::Qualifiers(),const_cast<StructDecl *>(st)); // Just linking in the node
     893                        }
     894                }
    888895                if ( enumDecl->body ) {
    889896                        ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->name );
Note: See TracChangeset for help on using the changeset viewer.