Changeset 6f95000 for src/ResolvExpr
- Timestamp:
- Mar 16, 2017, 6:14:27 PM (8 years ago)
- 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
- Location:
- src/ResolvExpr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/ResolvExpr/CommonType.cc ¶
rd6d747d r6f95000 10 10 // Created On : Sun May 17 06:59:27 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:35:34 201613 // Update Count : 312 // Last Modified On : Thu Mar 16 16:24:31 2017 13 // Update Count : 7 14 14 // 15 15 … … 71 71 if ( unifyExact( type1, type->get_base(), env, have, need, newOpen, indexer ) ) { 72 72 result = type1->clone(); 73 result->get_qualifiers() = tq1 +tq2;73 result->get_qualifiers() = tq1 | tq2; 74 74 } // if 75 75 type1->get_qualifiers() = tq1; … … 133 133 BasicType::Kind newType = combinedType[ basicType->get_kind() ][ otherBasic->get_kind() ]; 134 134 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 ); 136 136 } // if 137 137 } else if ( dynamic_cast< EnumInstType * > ( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) { … … 139 139 BasicType::Kind newType = combinedType[ basicType->get_kind() ][ BasicType::SignedInt ]; 140 140 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 ); 142 142 } // if 143 143 } // if … … 154 154 } 155 155 result = voidPointer->clone(); 156 result->get_qualifiers() += otherPointer->get_qualifiers();156 result->get_qualifiers() |= otherPointer->get_qualifiers(); 157 157 } 158 158 … … 176 176 result = otherPointer->clone(); 177 177 } // if 178 result->get_qualifiers() = tq1 +tq2;178 result->get_qualifiers() = tq1 | tq2; 179 179 } else { 180 180 /// std::cout << "place for ptr-to-type" << std::endl; … … 185 185 } else if ( widenSecond && dynamic_cast< ZeroType* >( type2 ) ) { 186 186 result = pointerType->clone(); 187 result->get_qualifiers() += type2->get_qualifiers();187 result->get_qualifiers() |= type2->get_qualifiers(); 188 188 } // if 189 189 } … … 230 230 if ( unifyExact( type->get_base(), type2, env, have, need, newOpen, indexer ) ) { 231 231 result = type2->clone(); 232 result->get_qualifiers() = tq1 +tq2;232 result->get_qualifiers() = tq1 | tq2; 233 233 } // if 234 234 type2->get_qualifiers() = tq2; … … 250 250 if ( widenSecond || zeroType->get_qualifiers() <= type2->get_qualifiers() ) { 251 251 result = type2->clone(); 252 result->get_qualifiers() += zeroType->get_qualifiers();252 result->get_qualifiers() |= zeroType->get_qualifiers(); 253 253 } 254 254 } else if ( widenSecond && dynamic_cast< OneType* >( type2 ) ) { 255 255 result = new BasicType( zeroType->get_qualifiers(), BasicType::SignedInt ); 256 result->get_qualifiers() += type2->get_qualifiers();256 result->get_qualifiers() |= type2->get_qualifiers(); 257 257 } 258 258 } … … 264 264 if ( widenSecond || oneType->get_qualifiers() <= type2->get_qualifiers() ) { 265 265 result = type2->clone(); 266 result->get_qualifiers() += oneType->get_qualifiers();266 result->get_qualifiers() |= oneType->get_qualifiers(); 267 267 } 268 268 } else if ( widenSecond && dynamic_cast< ZeroType* >( type2 ) ) { 269 269 result = new BasicType( oneType->get_qualifiers(), BasicType::SignedInt ); 270 result->get_qualifiers() += type2->get_qualifiers();270 result->get_qualifiers() |= type2->get_qualifiers(); 271 271 } 272 272 } -
TabularUnified src/ResolvExpr/Unify.cc ¶
rd6d747d r6f95000 10 10 // Created On : Sun May 17 12:27:10 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 16 07:59:59201713 // Update Count : 4 012 // Last Modified On : Thu Mar 16 16:22:54 2017 13 // Update Count : 42 14 14 // 15 15 … … 353 353 #endif 354 354 if ( ( common = commonType( type1, type2, widenMode.widenFirst, widenMode.widenSecond, indexer, env, openVars ) ) ) { 355 common->get_qualifiers() = tq1 +tq2;355 common->get_qualifiers() = tq1 | tq2; 356 356 #ifdef DEBUG 357 357 std::cerr << "unifyInexact: common type is "; … … 370 370 if ( ( tq1 > tq2 || widenMode.widenFirst ) && ( tq2 > tq1 || widenMode.widenSecond ) ) { 371 371 common = type1->clone(); 372 common->get_qualifiers() = tq1 +tq2;372 common->get_qualifiers() = tq1 | tq2; 373 373 result = true; 374 374 } else {
Note: See TracChangeset
for help on using the changeset viewer.