Changeset 10a9479d for src/CodeGen


Ignore:
Timestamp:
Nov 23, 2024, 8:28:37 PM (10 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
956b389
Parents:
b006c51e (diff), de7b7a5 (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:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cpp

    rb006c51e r10a9479d  
    680680        extension( expr );
    681681        output << "(";
    682         if ( expr->result->isVoid() ) {
    683                 output << "(void)";
    684         } else {
    685                 output << "(";
     682        switch ( expr->kind ) {
     683        case ast::CCast:
     684                if ( expr->result->isVoid() ) {
     685                        output << "(void)";
     686                } else {
     687                        output << "(";
     688                        output << genType( expr->result, "", options );
     689                        output << ")";
     690                }
     691                break;
     692        case ast::CoerceCast:
     693                assertf( ast::CoerceCast != expr->kind, "Coercion cast is not implemented." );
     694                // And likely shouldn't reach code generation when it is implemented.
     695                break;
     696        case ast::ReturnCast:
     697                // This should be invisible in the resulting C code.
     698                // Can we insert a check here?
     699                //assert( ResolvExpr::typesCompatable(???) );
     700                if ( options.genC ) break;
     701                output << "(return ";
    686702                output << genType( expr->result, "", options );
    687703                output << ")";
     704                break;
    688705        }
    689706        expr->arg->accept( *visitor );
Note: See TracChangeset for help on using the changeset viewer.