Changes in / [76e9498:57f408e]


Ignore:
Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CommonType.cc

    r76e9498 r57f408e  
    4242                virtual void visit( OneType *oneType );
    4343
    44                 void getCommonWithVoidPointer( PointerType* voidPointer, PointerType* otherPointer );
    4544                template< typename RefType > void handleRefType( RefType *inst, Type *other );
    4645
     
    146145        }
    147146
    148         void CommonType::getCommonWithVoidPointer( PointerType* voidPointer, PointerType* otherPointer ) {
    149                 if ( TypeInstType* var = dynamic_cast< TypeInstType* >( otherPointer->get_base() ) ) {
    150                         OpenVarSet::const_iterator entry = openVars.find( var->get_name() );
    151                         if ( entry != openVars.end() ) {
    152                                 AssertionSet need, have;
    153                                 WidenMode widen( widenFirst, widenSecond );
    154                                 if ( entry != openVars.end() && ! bindVar(var, voidPointer->get_base(), entry->second, env, need, have, openVars, widen, indexer ) ) return;
    155                         }
    156                 }
    157                 result = voidPointer->clone();
    158                 result->get_qualifiers() += otherPointer->get_qualifiers();
    159         }
    160        
    161147        void CommonType::visit( PointerType *pointerType ) {
    162148                if ( PointerType *otherPointer = dynamic_cast< PointerType* >( type2 ) ) {
    163149                        if ( widenFirst && dynamic_cast< VoidType* >( otherPointer->get_base() ) && ! isFtype(pointerType->get_base(), indexer) ) {
    164                                 getCommonWithVoidPointer( otherPointer, pointerType );
     150                                result = otherPointer->clone();
     151                                result->get_qualifiers() += pointerType->get_qualifiers();
    165152                        } else if ( widenSecond && dynamic_cast< VoidType* >( pointerType->get_base() ) && ! isFtype(otherPointer->get_base(), indexer) ) {
    166                                 getCommonWithVoidPointer( pointerType, otherPointer );
     153                                result = pointerType->clone();
     154                                result->get_qualifiers() += otherPointer->get_qualifiers();
    167155                        } else if ( ( pointerType->get_base()->get_qualifiers() >= otherPointer->get_base()->get_qualifiers() || widenFirst )
    168156                                           && ( pointerType->get_base()->get_qualifiers() <= otherPointer->get_base()->get_qualifiers() || widenSecond ) ) {
  • src/ResolvExpr/Unify.cc

    r76e9498 r57f408e  
    3131
    3232namespace ResolvExpr {
     33        struct WidenMode {
     34                WidenMode( bool widenFirst, bool widenSecond ): widenFirst( widenFirst ), widenSecond( widenSecond ) {}
     35                WidenMode &operator|=( const WidenMode &other ) { widenFirst |= other.widenFirst; widenSecond |= other.widenSecond; return *this; }
     36                WidenMode &operator&=( const WidenMode &other ) { widenFirst &= other.widenFirst; widenSecond &= other.widenSecond; return *this; }
     37                WidenMode operator|( const WidenMode &other ) { WidenMode newWM( *this ); newWM |= other; return newWM; }
     38                WidenMode operator&( const WidenMode &other ) { WidenMode newWM( *this ); newWM &= other; return newWM; }
     39                operator bool() { return widenFirst && widenSecond; }
     40
     41                bool widenFirst : 1, widenSecond : 1;
     42        };
    3343
    3444        class Unify : public Visitor {
  • src/ResolvExpr/Unify.h

    r76e9498 r57f408e  
    2727
    2828namespace ResolvExpr {
    29         struct WidenMode {
    30                 WidenMode( bool widenFirst, bool widenSecond ): widenFirst( widenFirst ), widenSecond( widenSecond ) {}
    31                 WidenMode &operator|=( const WidenMode &other ) { widenFirst |= other.widenFirst; widenSecond |= other.widenSecond; return *this; }
    32                 WidenMode &operator&=( const WidenMode &other ) { widenFirst &= other.widenFirst; widenSecond &= other.widenSecond; return *this; }
    33                 WidenMode operator|( const WidenMode &other ) { WidenMode newWM( *this ); newWM |= other; return newWM; }
    34                 WidenMode operator&( const WidenMode &other ) { WidenMode newWM( *this ); newWM &= other; return newWM; }
    35                 operator bool() { return widenFirst && widenSecond; }
    36 
    37                 bool widenFirst : 1, widenSecond : 1;
    38         };
    39        
    40         bool bindVar( TypeInstType *typeInst, Type *other, TypeDecl::Kind kind, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
    4129        bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
    4230        bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, Type *&commonType );
  • src/libcfa/prelude.cf

    r76e9498 r57f408e  
    273273forall( ftype FT ) signed int ?!=?( FT *, FT * );
    274274
    275 // forall( dtype DT ) signed int ?==?( const volatile DT   *, const volatile void * );
    276 // forall( dtype DT ) signed int ?==?( const volatile void *, const volatile DT * );
    277 // forall( dtype DT ) signed int ?!=?( const volatile DT   *, const volatile void * );
    278 // forall( dtype DT ) signed int ?!=?( const volatile void *, const volatile DT * );
     275forall( dtype DT ) signed int ?==?( const volatile DT   *, const volatile void * );
     276forall( dtype DT ) signed int ?==?( const volatile void *, const volatile DT * );
     277forall( dtype DT ) signed int ?!=?( const volatile DT   *, const volatile void * );
     278forall( dtype DT ) signed int ?!=?( const volatile void *, const volatile DT * );
    279279
    280280// forall( dtype DT ) signed int ?==?( const volatile DT *, forall( dtype DT2 )const DT2 * );
Note: See TracChangeset for help on using the changeset viewer.