Ignore:
Timestamp:
Apr 19, 2022, 3:00:04 PM (3 years ago)
Author:
m3zulfiq <m3zulfiq@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
5b84a321
Parents:
ba897d21 (diff), bb7c77d (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:

added benchmark and evaluations chapter to thesis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ConversionCost.cc

    rba897d21 r2e9b59b  
    333333                } else if ( dynamic_cast< const EnumInstType * >( dest ) ) {
    334334                        // xxx - not positive this is correct, but appears to allow casting int => enum
    335                         cost = Cost::unsafe;
     335                        // TODO
     336                        EnumDecl * decl = dynamic_cast< const EnumInstType * >( dest )->baseEnum;
     337                        if ( decl->base ) {
     338                                cost = Cost::infinity;
     339                        } else {
     340                                cost = Cost::unsafe;
     341                        } // if
    336342                } // if
    337343                // no cases for zero_t/one_t because it should not be possible to convert int, etc. to zero_t/one_t.
     
    610616        } else if ( dynamic_cast< const ast::EnumInstType * >( dst ) ) {
    611617                // xxx - not positive this is correct, but appears to allow casting int => enum
    612                 cost = Cost::unsafe;
     618                const ast::EnumDecl * decl = (dynamic_cast< const ast::EnumInstType * >( dst ))->base.get();
     619                if ( decl->base ) {
     620                        cost = Cost::infinity;
     621                } else {
     622                        cost = Cost::unsafe;
     623                } // if
    613624        }
    614625}
Note: See TracChangeset for help on using the changeset viewer.