Ignore:
Timestamp:
Dec 8, 2016, 5:39:11 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
b58a5772
Parents:
3874269 (diff), 76e9498 (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 plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CommonType.cc

    r3874269 rfda7e90  
    4242                virtual void visit( OneType *oneType );
    4343
     44                void getCommonWithVoidPointer( PointerType* voidPointer, PointerType* otherPointer );
    4445                template< typename RefType > void handleRefType( RefType *inst, Type *other );
    4546
     
    145146        }
    146147
     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       
    147161        void CommonType::visit( PointerType *pointerType ) {
    148162                if ( PointerType *otherPointer = dynamic_cast< PointerType* >( type2 ) ) {
    149163                        if ( widenFirst && dynamic_cast< VoidType* >( otherPointer->get_base() ) && ! isFtype(pointerType->get_base(), indexer) ) {
    150                                 result = otherPointer->clone();
    151                                 result->get_qualifiers() += pointerType->get_qualifiers();
     164                                getCommonWithVoidPointer( otherPointer, pointerType );
    152165                        } else if ( widenSecond && dynamic_cast< VoidType* >( pointerType->get_base() ) && ! isFtype(otherPointer->get_base(), indexer) ) {
    153                                 result = pointerType->clone();
    154                                 result->get_qualifiers() += otherPointer->get_qualifiers();
     166                                getCommonWithVoidPointer( pointerType, otherPointer );
    155167                        } else if ( ( pointerType->get_base()->get_qualifiers() >= otherPointer->get_base()->get_qualifiers() || widenFirst )
    156168                                           && ( pointerType->get_base()->get_qualifiers() <= otherPointer->get_base()->get_qualifiers() || widenSecond ) ) {
Note: See TracChangeset for help on using the changeset viewer.