Changeset 6f95000 for src/ResolvExpr


Ignore:
Timestamp:
Mar 16, 2017, 6:14:27 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:
395fc37
Parents:
d6d747d
Message:

more cleanup for bit-field type usage and create struct forward for typedef

Location:
src/ResolvExpr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CommonType.cc

    rd6d747d r6f95000  
    1010// Created On       : Sun May 17 06:59:27 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 17:35:34 2016
    13 // Update Count     : 3
     12// Last Modified On : Thu Mar 16 16:24:31 2017
     13// Update Count     : 7
    1414//
    1515
     
    7171                                                        if ( unifyExact( type1, type->get_base(), env, have, need, newOpen, indexer ) ) {
    7272                                                                result = type1->clone();
    73                                                                 result->get_qualifiers() = tq1 + tq2;
     73                                                                result->get_qualifiers() = tq1 | tq2;
    7474                                                        } // if
    7575                                                        type1->get_qualifiers() = tq1;
     
    133133                        BasicType::Kind newType = combinedType[ basicType->get_kind() ][ otherBasic->get_kind() ];
    134134                        if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= otherBasic->get_qualifiers() ) || widenFirst ) && ( ( newType == otherBasic->get_kind() && basicType->get_qualifiers() <= otherBasic->get_qualifiers() ) || widenSecond ) ) {
    135                                 result = new BasicType( basicType->get_qualifiers() + otherBasic->get_qualifiers(), newType );
     135                                result = new BasicType( basicType->get_qualifiers() | otherBasic->get_qualifiers(), newType );
    136136                        } // if
    137137                } else if ( dynamic_cast< EnumInstType * > ( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) {
     
    139139                        BasicType::Kind newType = combinedType[ basicType->get_kind() ][ BasicType::SignedInt ];
    140140                        if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= type2->get_qualifiers() ) || widenFirst ) && ( ( newType != basicType->get_kind() && basicType->get_qualifiers() <= type2->get_qualifiers() ) || widenSecond ) ) {
    141                                 result = new BasicType( basicType->get_qualifiers() + type2->get_qualifiers(), newType );
     141                                result = new BasicType( basicType->get_qualifiers() | type2->get_qualifiers(), newType );
    142142                        } // if
    143143                } // if
     
    154154                }
    155155                result = voidPointer->clone();
    156                 result->get_qualifiers() += otherPointer->get_qualifiers();
     156                result->get_qualifiers() |= otherPointer->get_qualifiers();
    157157        }
    158158
     
    176176                                                result = otherPointer->clone();
    177177                                        } // if
    178                                         result->get_qualifiers() = tq1 + tq2;
     178                                        result->get_qualifiers() = tq1 | tq2;
    179179                                } else {
    180180                                        /// std::cout << "place for ptr-to-type" << std::endl;
     
    185185                } else if ( widenSecond && dynamic_cast< ZeroType* >( type2 ) ) {
    186186                        result = pointerType->clone();
    187                         result->get_qualifiers() += type2->get_qualifiers();
     187                        result->get_qualifiers() |= type2->get_qualifiers();
    188188                } // if
    189189        }
     
    230230                                        if ( unifyExact( type->get_base(), type2, env, have, need, newOpen, indexer ) ) {
    231231                                                result = type2->clone();
    232                                                 result->get_qualifiers() = tq1 + tq2;
     232                                                result->get_qualifiers() = tq1 | tq2;
    233233                                        } // if
    234234                                        type2->get_qualifiers() = tq2;
     
    250250                                if ( widenSecond || zeroType->get_qualifiers() <= type2->get_qualifiers() ) {
    251251                                        result = type2->clone();
    252                                         result->get_qualifiers() += zeroType->get_qualifiers();
     252                                        result->get_qualifiers() |= zeroType->get_qualifiers();
    253253                                }
    254254                        } else if ( widenSecond && dynamic_cast< OneType* >( type2 ) ) {
    255255                                result = new BasicType( zeroType->get_qualifiers(), BasicType::SignedInt );
    256                                 result->get_qualifiers() += type2->get_qualifiers();
     256                                result->get_qualifiers() |= type2->get_qualifiers();
    257257                        }
    258258                }
     
    264264                                if ( widenSecond || oneType->get_qualifiers() <= type2->get_qualifiers() ) {
    265265                                        result = type2->clone();
    266                                         result->get_qualifiers() += oneType->get_qualifiers();
     266                                        result->get_qualifiers() |= oneType->get_qualifiers();
    267267                                }
    268268                        } else if ( widenSecond && dynamic_cast< ZeroType* >( type2 ) ) {
    269269                                result = new BasicType( oneType->get_qualifiers(), BasicType::SignedInt );
    270                                 result->get_qualifiers() += type2->get_qualifiers();
     270                                result->get_qualifiers() |= type2->get_qualifiers();
    271271                        }
    272272                }
  • src/ResolvExpr/Unify.cc

    rd6d747d r6f95000  
    1010// Created On       : Sun May 17 12:27:10 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 07:59:59 2017
    13 // Update Count     : 40
     12// Last Modified On : Thu Mar 16 16:22:54 2017
     13// Update Count     : 42
    1414//
    1515
     
    353353#endif
    354354                        if ( ( common = commonType( type1, type2, widenMode.widenFirst, widenMode.widenSecond, indexer, env, openVars ) ) ) {
    355                                 common->get_qualifiers() = tq1 + tq2;
     355                                common->get_qualifiers() = tq1 | tq2;
    356356#ifdef DEBUG
    357357                                std::cerr << "unifyInexact: common type is ";
     
    370370                                if ( ( tq1 > tq2 || widenMode.widenFirst ) && ( tq2 > tq1 || widenMode.widenSecond ) ) {
    371371                                        common = type1->clone();
    372                                         common->get_qualifiers() = tq1 + tq2;
     372                                        common->get_qualifiers() = tq1 | tq2;
    373373                                        result = true;
    374374                                } else {
Note: See TracChangeset for help on using the changeset viewer.