Ignore:
Timestamp:
Jun 7, 2016, 3:59:15 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
d0f8b19
Parents:
db175c8
Message:

change type of enumerator to EnumInstType?, allow casting between EnumInstType? and BasicType?, add common type code for EnumInstType? and BasicType?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CommonType.cc

    rdb175c8 ra436947  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // CommonType.cc -- 
     7// CommonType.cc --
    88//
    99// Author           : Richard C. Bilson
     
    134134                                result = new BasicType( basicType->get_qualifiers() + otherBasic->get_qualifiers(), newType );
    135135                        } // if
     136                } else if ( EnumInstType *enumInstType = dynamic_cast< EnumInstType * > ( type2 ) ) {
     137                        // use signed int in lieu of the enum type
     138                        BasicType::Kind newType = combinedType[ basicType->get_kind() ][ BasicType::SignedInt ];
     139                        if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= enumInstType->get_qualifiers() ) || widenFirst ) && ( ( newType != basicType->get_kind() && basicType->get_qualifiers() <= enumInstType->get_qualifiers() ) || widenSecond ) ) {
     140                                result = new BasicType( basicType->get_qualifiers() + enumInstType->get_qualifiers(), newType );
     141                        } // if
    136142                } // if
    137143        }
     
    183189        }
    184190
    185         void CommonType::visit( EnumInstType *aggregateUseType ) {
     191        void CommonType::visit( EnumInstType *enumInstType ) {
     192                if ( dynamic_cast< BasicType * >( type2 ) ) {
     193                        // reuse BasicType, EnumInstType code by swapping type2 with enumInstType
     194                        Type * temp = type2;
     195                        type2 = enumInstType;
     196                        temp->accept( *this );
     197                        type2 = temp;
     198                } // if
    186199        }
    187200
Note: See TracChangeset for help on using the changeset viewer.