Changeset 7e08acf for src/SymTab


Ignore:
Timestamp:
Sep 7, 2018, 3:10:49 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
e15ba975
Parents:
0982a05
Message:

Apply generic substitution to qualified typedefs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r0982a05 r7e08acf  
    403403                        assert( aggr ); // TODO: need to handle forward declarations
    404404                        for ( Declaration * member : aggr->members ) {
    405                                 if ( StructInstType * inst = dynamic_cast< StructInstType * >( child ) ) {
    406                                         if ( StructDecl * aggr = dynamic_cast< StructDecl * >( member ) ) {
    407                                                 if ( aggr->name == inst->name ) {
    408                                                         // TODO: is this case, and other non-TypeInstType cases, necessary?
    409                                                         return new StructInstType( qualType->get_qualifiers(), aggr );
    410                                                 }
    411                                         }
    412                                 } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( child ) ) {
    413                                         if ( UnionDecl * aggr = dynamic_cast< UnionDecl * > ( member ) ) {
    414                                                 if ( aggr->name == inst->name ) {
    415                                                         return new UnionInstType( qualType->get_qualifiers(), aggr );
    416                                                 }
    417                                         }
    418                                 } else if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( child ) ) {
    419                                         if ( EnumDecl * aggr = dynamic_cast< EnumDecl * > ( member ) ) {
    420                                                 if ( aggr->name == inst->name ) {
    421                                                         return new EnumInstType( qualType->get_qualifiers(), aggr );
    422                                                 }
    423                                         }
    424                                 } else if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( child ) ) {
     405                                if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( child ) ) {
    425406                                        // name on the right is a typedef
    426407                                        if ( NamedTypeDecl * aggr = dynamic_cast< NamedTypeDecl * > ( member ) ) {
     
    429410                                                        Type * ret = aggr->base->clone();
    430411                                                        ret->get_qualifiers() = qualType->get_qualifiers();
     412                                                        TypeSubstitution sub = parent->genericSubstitution();
     413                                                        sub.apply(ret);
    431414                                                        return ret;
    432415                                                }
Note: See TracChangeset for help on using the changeset viewer.