Changeset d7312ac for src/CodeGen


Ignore:
Timestamp:
May 5, 2018, 9:33:28 AM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
7867eb9
Parents:
43c461d
Message:

make directives work and use them to remove warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r43c461d rd7312ac  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep  3 20:42:52 2017
    13 // Update Count     : 490
     12// Last Modified On : Sat May  5 09:08:32 2018
     13// Update Count     : 494
    1414//
    1515#include "CodeGenerator.h"
     
    370370
    371371        void CodeGenerator::postvisit( Constant * constant ) {
    372                 output << constant->get_value() ;
     372                output << constant->get_value();
    373373        }
    374374
     
    587587                output << "(";
    588588                if ( castExpr->get_result()->isVoid() ) {
    589                         output << "(void)" ;
     589                        output << "(void)";
    590590                } else {
    591591                        // at least one result type of cast.
     
    878878                        } // for
    879879                } // if
    880                 output << " );" ;
     880                output << " );";
    881881        }
    882882
     
    886886                output << "( ";
    887887                if ( asmStmt->get_instruction() ) asmStmt->get_instruction()->accept( *visitor );
    888                 output << " )" ;
     888                output << " )";
    889889        }
    890890
    891891        void CodeGenerator::postvisit( DirectiveStmt * dirStmt ) {
    892                 output << dirStmt->directive;
     892                output << endl << dirStmt->directive;                   // endl prevents spaces before directive
    893893        }
    894894
     
    907907
    908908        void CodeGenerator::postvisit( SwitchStmt * switchStmt ) {
    909                 output << "switch ( " ;
     909                output << "switch ( ";
    910910                switchStmt->get_condition()->accept( *visitor );
    911911                output << " ) ";
     
    933933                ++indent;
    934934                for ( std::list<Statement *>::iterator i = sts.begin(); i != sts.end();  i++) {
    935                         output << indent << printLabels( (*i)->get_labels() )  ;
     935                        output << indent << printLabels( (*i)->get_labels() ) ;
    936936                        (*i)->accept( *visitor );
    937937                        output << endl;
     
    10701070        void CodeGenerator::postvisit( WhileStmt * whileStmt ) {
    10711071                if ( whileStmt->get_isDoWhile() ) {
    1072                         output << "do" ;
    1073                 } else {
    1074                         output << "while (" ;
     1072                        output << "do";
     1073                } else {
     1074                        output << "while (";
    10751075                        whileStmt->get_condition()->accept( *visitor );
    10761076                        output << ")";
     
    10841084
    10851085                if ( whileStmt->get_isDoWhile() ) {
    1086                         output << " while (" ;
     1086                        output << " while (";
    10871087                        whileStmt->get_condition()->accept( *visitor );
    10881088                        output << ");";
Note: See TracChangeset for help on using the changeset viewer.