Changeset a0c7dc36 for src/CodeGen


Ignore:
Timestamp:
Sep 12, 2017, 5:14:32 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:
70d826cd
Parents:
96f9ef5
Message:

Convert PolyGenericCalculator? to PassVisitor? and generate size/align variables for opaque type declarations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r96f9ef5 ra0c7dc36  
    258258
    259259        void CodeGenerator::visit( TraitDecl * traitDecl ) {
    260                 assertf( ! genC, "TraitDecl nodes should not reach code generation." );
     260                assertf( ! genC, "TraitDecls should not reach code generation." );
    261261                extension( traitDecl );
    262262                handleAggregate( traitDecl, "trait " );
     
    271271
    272272        void CodeGenerator::visit( TypeDecl * typeDecl ) {
    273                 if ( genC ) {
    274                         // really, we should mutate this into something that isn't a TypeDecl but that requires large-scale changes,
    275                         // still to be done
    276                         extension( typeDecl );
    277                         output << "extern unsigned long " << typeDecl->get_name();
    278                         if ( typeDecl->get_base() ) {
    279                                 output << " = sizeof( " << genType( typeDecl->get_base(), "", pretty, genC ) << " )";
    280                         } // if
    281                 } else {
    282                         output << typeDecl->genTypeString() << " " << typeDecl->get_name();
    283                         if ( typeDecl->get_kind() != TypeDecl::Any && typeDecl->get_sized() ) {
    284                                 output << " | sized(" << typeDecl->get_name() << ")";
    285                         }
    286                         if ( ! typeDecl->get_assertions().empty() ) {
    287                                 output << " | { ";
    288                                 genCommaList( typeDecl->get_assertions().begin(), typeDecl->get_assertions().end() );
    289                                 output << " }";
    290                         }
     273                assertf( ! genC, "TypeDecls should not reach code generation." );
     274                output << typeDecl->genTypeString() << " " << typeDecl->get_name();
     275                if ( typeDecl->get_kind() != TypeDecl::Any && typeDecl->get_sized() ) {
     276                        output << " | sized(" << typeDecl->get_name() << ")";
     277                }
     278                if ( ! typeDecl->get_assertions().empty() ) {
     279                        output << " | { ";
     280                        genCommaList( typeDecl->get_assertions().begin(), typeDecl->get_assertions().end() );
     281                        output << " }";
    291282                }
    292283        }
Note: See TracChangeset for help on using the changeset viewer.