Changeset 46da46b for src/ResolvExpr/ConversionCost.cc
- Timestamp:
- May 2, 2023, 3:44:31 AM (13 months ago)
- Branches:
- ast-experimental, master
- Children:
- 0c840fc
- Parents:
- 1ab773e0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cc
r1ab773e0 r46da46b 702 702 703 703 cost = costCalc( refType->base, dst, srcIsLvalue, symtab, env ); 704 705 // xxx - should qualifiers be considered in pass-by-value? 706 /* 704 707 if ( refType->base->qualifiers == dst->qualifiers ) { 705 708 cost.incReference(); … … 709 712 cost.incUnsafe(); 710 713 } 714 */ 715 cost.incReference(); 711 716 } 712 717 … … 792 797 cost.incSign( signMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ] ); 793 798 } 799 // this has the effect of letting any expr such as x+0, x+1 to be typed 800 // the same as x, instead of at least int. are we willing to sacrifice this little 801 // bit of coherence with C? 802 // TODO: currently this does not work when no zero/one overloads exist. Find a fix for it. 803 // cost = Cost::zero; 794 804 } else if ( dynamic_cast< const ast::PointerType * >( dst ) ) { 795 805 cost = Cost::zero; 796 806 // +1 for zero_t ->, +1 for disambiguation 797 807 cost.incSafe( maxIntCost + 2 ); 808 // assuming 0p is supposed to be used for pointers? 798 809 } 799 810 } … … 804 815 cost = Cost::zero; 805 816 } else if ( const ast::BasicType * dstAsBasic = 806 dynamic_cast< const ast::BasicType * >( dst ) ) { 817 dynamic_cast< const ast::BasicType * >( dst ) ) { 807 818 int tableResult = costMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ]; 808 819 if ( -1 == tableResult ) { … … 813 824 cost.incSign( signMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ] ); 814 825 } 826 827 // cost = Cost::zero; 815 828 } 816 829 }
Note: See TracChangeset
for help on using the changeset viewer.