Ignore:
Timestamp:
May 11, 2017, 11:07:58 AM (7 years ago)
Author:
Andrew Beach <ajbeach@…>
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, resolv-new, with_gc
Children:
8514fe19
Parents:
29cf9c8
Message:

Add -L flag to turn of line marks. Updated the keyword list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/GenType.cc

    r29cf9c8 rc850687  
    2828        class GenType : public Visitor {
    2929          public:
    30                 GenType( const std::string &typeString, bool pretty = false, bool genC = false );
     30                GenType( const std::string &typeString, bool pretty = false, bool genC = false, bool lineMarks = false );
    3131                std::string get_typeString() const { return typeString; }
    3232                void set_typeString( const std::string &newValue ) { typeString = newValue; }
     
    5454                bool pretty = false; // pretty print
    5555                bool genC = false;   // generating C code?
     56                bool lineMarks = false;
    5657        };
    5758
    58         std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC ) {
    59                 GenType gt( baseString, pretty, genC );
     59        std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC , bool lineMarks ) {
     60                GenType gt( baseString, pretty, genC, lineMarks );
    6061                std::ostringstream os;
    6162
    6263                if ( ! type->get_attributes().empty() ) {
    63                         CodeGenerator cg( os, pretty, genC );
     64                        CodeGenerator cg( os, pretty, genC, lineMarks );
    6465                        cg.genAttributes( type->get_attributes() );
    6566                } // if
     
    7374  }
    7475
    75         GenType::GenType( const std::string &typeString, bool pretty, bool genC ) : typeString( typeString ), pretty( pretty ), genC( genC ) {}
     76        GenType::GenType( const std::string &typeString, bool pretty, bool genC, bool lineMarks ) : typeString( typeString ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {}
    7677
    7778        void GenType::visit( VoidType *voidType ) {
     
    114115                } // if
    115116                if ( dimension != 0 ) {
    116                         CodeGenerator cg( os, pretty, genC );
     117                        CodeGenerator cg( os, pretty, genC, lineMarks );
    117118                        dimension->accept( cg );
    118119                } else if ( isVarLen ) {
     
    168169                        } // if
    169170                } else {
    170                         CodeGenerator cg( os, pretty, genC );
     171                        CodeGenerator cg( os, pretty, genC, lineMarks );
    171172                        os << "(" ;
    172173
     
    191192                        // assertf( ! genC, "Aggregate type parameters should not reach code generation." );
    192193                        std::ostringstream os;
    193                         CodeGenerator cg( os, pretty, genC );
     194                        CodeGenerator cg( os, pretty, genC, lineMarks );
    194195                        os << "forall(";
    195196                        cg.genCommaList( funcType->get_forall().begin(), funcType->get_forall().end() );
     
    202203                if ( ! refType->get_parameters().empty() ) {
    203204                        std::ostringstream os;
    204                         CodeGenerator cg( os, pretty, genC );
     205                        CodeGenerator cg( os, pretty, genC, lineMarks );
    205206                        os << "(";
    206207                        cg.genCommaList( refType->get_parameters().begin(), refType->get_parameters().end() );
     
    242243                for ( Type * t : *tupleType ) {
    243244                        i++;
    244                         os << genType( t, "", pretty, genC ) << (i == tupleType->size() ? "" : ", ");
     245                        os << genType( t, "", pretty, genC, lineMarks ) << (i == tupleType->size() ? "" : ", ");
    245246                }
    246247                os << "]";
Note: See TracChangeset for help on using the changeset viewer.