Changeset acdfb45 for src/CodeGen


Ignore:
Timestamp:
Sep 18, 2017, 1:24:06 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:
9857e8d
Parents:
b11d8e2
Message:

Remove ImplicitCtorDtorStmt? before codegen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/Generate.cc

    rb11d8e2 racdfb45  
    3333                /// Removes misc. nodes that should not exist in CodeGen
    3434                struct TreeCleaner {
    35                         void previsit( CompoundStmt * stmt );
     35                        void premutate( CompoundStmt * stmt );
     36                        Statement * postmutate( ImplicitCtorDtorStmt * stmt );
    3637
    3738                        static bool shouldClean( Declaration * );
     
    4142                        PassVisitor<TreeCleaner> cleaner;
    4243                        filter( translationUnit, [](Declaration * decl) { return TreeCleaner::shouldClean(decl); }, false );
    43                         acceptAll( translationUnit, cleaner );
     44                        mutateAll( translationUnit, cleaner );
    4445                } // cleanTree
    4546        } // namespace
     
    6566                        os << CodeGen::genPrettyType( type, "" );
    6667                } else {
    67                         CodeGen::CodeGenerator cgv( os, true, false, false );
     68                        PassVisitor<CodeGenerator> cgv( os, true, false, false );
    6869                        node->accept( cgv );
    6970                }
     
    7273
    7374        namespace {
    74                 void TreeCleaner::previsit( CompoundStmt * cstmt ) {
     75                void TreeCleaner::premutate( CompoundStmt * cstmt ) {
    7576                        filter( cstmt->kids, [](Statement * stmt) {
    7677                                if ( DeclStmt * declStmt = dynamic_cast< DeclStmt * >( stmt ) ) {
     
    7980                                return false;
    8081                        }, false );
     82                }
     83
     84                Statement * TreeCleaner::postmutate( ImplicitCtorDtorStmt * stmt ) {
     85                        Statement * callStmt = nullptr;
     86                        std::swap( stmt->callStmt, callStmt );
     87                        delete stmt;
     88                        return callStmt;
    8189                }
    8290
Note: See TracChangeset for help on using the changeset viewer.