Changeset 5b51f5e for src/ResolvExpr/CommonType.cc
- Timestamp:
- Jan 5, 2018, 3:21:42 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:
- 65deb18, cae28da
- Parents:
- 5c4f2c2 (diff), b834e98 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/CommonType.cc
r5c4f2c2 r5b51f5e 91 91 // special case where one type has a reference depth of 1 larger than the other 92 92 if ( diff > 0 || diff < 0 ) { 93 // std::cerr << "reference depth diff: " << diff << std::endl; 93 94 Type * result = nullptr; 94 if ( ReferenceType * ref1 = dynamic_cast< ReferenceType * >( type1 ) ) { 95 ReferenceType * ref1 = dynamic_cast< ReferenceType * >( type1 ); 96 ReferenceType * ref2 = dynamic_cast< ReferenceType * >( type2 ); 97 if ( diff > 0 ) { 98 // deeper on the left 99 assert( ref1 ); 100 result = handleReference( ref1->base, type2, widenFirst, widenSecond, indexer, env, openVars ); 101 } else { 102 // deeper on the right 103 assert( ref2 ); 104 result = handleReference( type1, ref2->base, widenFirst, widenSecond, indexer, env, openVars ); 105 } 106 if ( result && ref1 ) { 95 107 // formal is reference, so result should be reference 96 result = handleReference( ref1->base, type2, widenFirst, widenSecond, indexer, env, openVars ); 97 if ( result ) result = new ReferenceType( ref1->get_qualifiers(), result ); 98 } else { 99 // formal is value, so result should be value 100 ReferenceType * ref2 = strict_dynamic_cast< ReferenceType * > ( type2 ); 101 result = handleReference( type1, ref2->base, widenFirst, widenSecond, indexer, env, openVars ); 108 // std::cerr << "formal is reference; result should be reference" << std::endl; 109 result = new ReferenceType( ref1->get_qualifiers(), result ); 102 110 } 103 111 // std::cerr << "common type of reference [" << type1 << "] and [" << type2 << "] is [" << result << "]" << std::endl; … … 180 188 } 181 189 182 void CommonType::visit( __attribute((unused)) VoidType *voidType) {}190 void CommonType::visit( VoidType * ) {} 183 191 184 192 void CommonType::visit( BasicType *basicType ) { … … 246 254 } 247 255 248 void CommonType::visit( __attribute((unused)) ArrayType *arrayType) {}256 void CommonType::visit( ArrayType * ) {} 249 257 250 258 void CommonType::visit( ReferenceType *refType ) { … … 283 291 } 284 292 285 void CommonType::visit( __attribute((unused)) FunctionType *functionType) {}286 void CommonType::visit( __attribute((unused)) StructInstType *aggregateUseType) {}287 void CommonType::visit( __attribute((unused)) UnionInstType *aggregateUseType) {}293 void CommonType::visit( FunctionType * ) {} 294 void CommonType::visit( StructInstType * ) {} 295 void CommonType::visit( UnionInstType * ) {} 288 296 289 297 void CommonType::visit( EnumInstType *enumInstType ) { … … 296 304 } 297 305 298 void CommonType::visit( __attribute((unused)) TraitInstType *aggregateUseType) {306 void CommonType::visit( TraitInstType * ) { 299 307 } 300 308 … … 321 329 } 322 330 323 void CommonType::visit( __attribute((unused)) TupleType *tupleType) {}324 void CommonType::visit( __attribute((unused)) VarArgsType *varArgsType) {}331 void CommonType::visit( TupleType * ) {} 332 void CommonType::visit( VarArgsType * ) {} 325 333 326 334 void CommonType::visit( ZeroType *zeroType ) {
Note:
See TracChangeset
for help on using the changeset viewer.