Changeset 5f642e38 for src


Ignore:
Timestamp:
Apr 19, 2017, 12:08:40 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
e3987770
Parents:
7069652
Message:

more work on codegen output

Location:
src/CodeGen
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r7069652 r5f642e38  
    172172        }
    173173
    174         void CodeGenerator::handleAggregate( AggregateDecl * aggDecl ) {
     174        void CodeGenerator::handleAggregate( AggregateDecl * aggDecl, const std::string & kind ) {
    175175                genAttributes( aggDecl->get_attributes() );
    176176
     
    182182                }
    183183
     184                output << kind;
    184185                if ( aggDecl->get_name() != "" )
    185186                        output << aggDecl->get_name();
     
    204205        void CodeGenerator::visit( StructDecl * structDecl ) {
    205206                extension( structDecl );
    206                 output << "struct ";
    207                 handleAggregate( structDecl );
     207                handleAggregate( structDecl, "struct " );
    208208        }
    209209
    210210        void CodeGenerator::visit( UnionDecl * unionDecl ) {
    211211                extension( unionDecl );
    212                 output << "union ";
    213                 handleAggregate( unionDecl );
     212                handleAggregate( unionDecl, "union " );
    214213        }
    215214
     
    578577                extension( memberExpr );
    579578                memberExpr->get_aggregate()->accept( *this );
    580                 output << "." << memberExpr->get_member();
     579                output << ".";
     580                memberExpr->get_member()->accept( *this );
    581581        }
    582582
  • src/CodeGen/CodeGenerator.h

    r7069652 r5f642e38  
    125125                void printDesignators( std::list< Expression * > & );
    126126                void handleStorageClass( DeclarationWithType *decl );
    127                 void handleAggregate( AggregateDecl *aggDecl );
     127                void handleAggregate( AggregateDecl *aggDecl, const std::string & kind );
    128128                void handleTypedef( NamedTypeDecl *namedType );
    129129                std::string mangleName( DeclarationWithType * decl );
  • src/CodeGen/GenType.cc

    r7069652 r5f642e38  
    186186                        funcType->get_returnVals().front()->get_type()->accept( *this );
    187187                } // if
     188
     189                // add forall
     190                if( ! funcType->get_forall().empty() && ! genC ) {
     191                        // assertf( ! genC, "Aggregate type parameters should not reach code generation." );
     192                        std::ostringstream os;
     193                        CodeGenerator cg( os, pretty, genC );
     194                        os << "forall(";
     195                        cg.genCommaList( funcType->get_forall().begin(), funcType->get_forall().end() );
     196                        os << ")" << std::endl;
     197                        typeString = os.str() + typeString;
     198                }
    188199        }
    189200
Note: See TracChangeset for help on using the changeset viewer.