Changeset 8a3ecb9 for src/SymTab


Ignore:
Timestamp:
Jul 17, 2018, 5:13:51 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
2f84692
Parents:
6da49249
Message:

Pass type qualifiers from qualified type to actual type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r6da49249 r8a3ecb9  
    363363                                auto base = td->base;
    364364                                assert( base );
    365                                 return base->clone();
     365                                Type * ret = base->clone();
     366                                ret->get_qualifiers() = qualType->get_qualifiers();
     367                                return ret;
    366368                        } else {
    367369                                // .T => T is not a type name
     
    383385                                        if ( StructDecl * aggr = dynamic_cast< StructDecl * >( member ) ) {
    384386                                                if ( aggr->name == inst->name ) {
     387                                                        // TODO: is this case, and other non-TypeInstType cases, necessary?
    385388                                                        return new StructInstType( qualType->get_qualifiers(), aggr );
    386389                                                }
     
    399402                                        }
    400403                                } else if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( child ) ) {
    401                                         // struct typedefs are being replaced by forward decls too early; move it to hoist struct
     404                                        // name on the right is a typedef
    402405                                        if ( NamedTypeDecl * aggr = dynamic_cast< NamedTypeDecl * > ( member ) ) {
    403406                                                if ( aggr->name == inst->name ) {
    404407                                                        assert( aggr->base );
    405                                                         return aggr->base->clone();
     408                                                        Type * ret = aggr->base->clone();
     409                                                        ret->get_qualifiers() = qualType->get_qualifiers();
     410                                                        return ret;
    406411                                                }
    407412                                        }
Note: See TracChangeset for help on using the changeset viewer.