Ignore:
Timestamp:
Aug 23, 2017, 6:22:07 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
87e08e24, cb811ac
Parents:
9f07232 (diff), bd37119 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CastCost.cc

    r9f07232 rd3e4d6c  
    4949                                assert( type );
    5050                                if ( type->get_base() ) {
    51                                         return castCost( src, type->get_base(), indexer, env ) + Cost( 0, 0, 1 );
     51                                        return castCost( src, type->get_base(), indexer, env ) + Cost::safe;
    5252                                } // if
    5353                        } // if
    5454                } // if
    5555                if ( typesCompatibleIgnoreQualifiers( src, dest, indexer, env ) ) {
    56                         return Cost( 0, 0, 0 );
     56                        return Cost::zero;
    5757                } else if ( dynamic_cast< VoidType* >( dest ) ) {
    58                         return Cost( 0, 0, 1 );
     58                        return Cost::safe;
     59                } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * > ( dest ) ) {
     60                        return convertToReferenceCost( src, refType, indexer, env );
    5961                } else {
    6062                        CastCost converter( dest, indexer, env );
     
    6466                        } else {
    6567                                // xxx - why are we adding cost 0 here?
    66                                 return converter.get_cost() + Cost( 0, 0, 0 );
     68                                return converter.get_cost() + Cost::zero;
    6769                        } // if
    6870                } // if
     
    7779                if ( destAsPointer && basicType->isInteger() ) {
    7880                        // necessary for, e.g. unsigned long => void*
    79                         cost = Cost( 1, 0, 0 );
     81                        cost = Cost::unsafe;
    8082                } else {
    81                         ConversionCost::visit( basicType );
     83                        cost = conversionCost( basicType, dest, indexer, env );
    8284                } // if
    8385        }
     
    8688                if ( PointerType *destAsPtr = dynamic_cast< PointerType* >( dest ) ) {
    8789                        if ( pointerType->get_qualifiers() <= destAsPtr->get_qualifiers() && typesCompatibleIgnoreQualifiers( pointerType->get_base(), destAsPtr->get_base(), indexer, env ) ) {
    88                                 cost = Cost( 0, 0, 1 );
     90                                cost = Cost::safe;
    8991                        } else {
    9092                                TypeEnvironment newEnv( env );
     
    9395                                int castResult = ptrsCastable( pointerType->get_base(), destAsPtr->get_base(), newEnv, indexer );
    9496                                if ( castResult > 0 ) {
    95                                         cost = Cost( 0, 0, 1 );
     97                                        cost = Cost::safe;
    9698                                } else if ( castResult < 0 ) {
    9799                                        cost = Cost::infinity;
     
    101103                        if ( destAsBasic->isInteger() ) {
    102104                                // necessary for, e.g. void* => unsigned long
    103                                 cost = Cost( 1, 0, 0 );
     105                                cost = Cost::unsafe;
    104106                        } // if
    105107                }
Note: See TracChangeset for help on using the changeset viewer.