Ignore:
Timestamp:
Apr 19, 2018, 5:54:41 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
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, with_gc
Children:
8633f060
Parents:
e16294d (diff), da9d79b (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.cc

    re16294d rb03eed6  
    116116        }
    117117
    118         CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks ) : indent( CodeGenerator::tabsize ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ), endl( *this ) {}
     118        CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks, bool printExprTypes ) : indent( CodeGenerator::tabsize ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ), printExprTypes( printExprTypes ), endl( *this ) {}
    119119
    120120        string CodeGenerator::mangleName( DeclarationWithType * decl ) {
     
    157157                node->print( ss );
    158158                assertf( false, "Unhandled node reached in CodeGenerator: %s", ss.str().c_str() );
     159        }
     160
     161        // *** Expression
     162        void CodeGenerator::previsit( Expression * node ) {
     163                previsit( (BaseSyntaxNode *)node );
     164                GuardAction( [this, node](){
     165                        if ( printExprTypes ) {
     166                                output << " /* " << genType( node->result, "", pretty, genC ) << " */ ";
     167                        }
     168                } );
    159169        }
    160170
     
    586596                        output << ")";
    587597                } // if
    588                 castExpr->get_arg()->accept( *visitor );
     598                castExpr->arg->accept( *visitor );
     599                output << ")";
     600        }
     601
     602        void CodeGenerator::postvisit( KeywordCastExpr * castExpr ) {
     603                assertf( ! genC, "KeywordCast should not reach code generation." );
     604                extension( castExpr );
     605                output << "((" << castExpr->targetString() << " &)";
     606                castExpr->arg->accept( *visitor );
    589607                output << ")";
    590608        }
Note: See TracChangeset for help on using the changeset viewer.