Changeset acdfb45 for src/CodeGen
- Timestamp:
- Sep 18, 2017, 1:24:06 PM (7 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/Generate.cc
rb11d8e2 racdfb45 33 33 /// Removes misc. nodes that should not exist in CodeGen 34 34 struct TreeCleaner { 35 void previsit( CompoundStmt * stmt ); 35 void premutate( CompoundStmt * stmt ); 36 Statement * postmutate( ImplicitCtorDtorStmt * stmt ); 36 37 37 38 static bool shouldClean( Declaration * ); … … 41 42 PassVisitor<TreeCleaner> cleaner; 42 43 filter( translationUnit, [](Declaration * decl) { return TreeCleaner::shouldClean(decl); }, false ); 43 acceptAll( translationUnit, cleaner );44 mutateAll( translationUnit, cleaner ); 44 45 } // cleanTree 45 46 } // namespace … … 65 66 os << CodeGen::genPrettyType( type, "" ); 66 67 } else { 67 CodeGen::CodeGeneratorcgv( os, true, false, false );68 PassVisitor<CodeGenerator> cgv( os, true, false, false ); 68 69 node->accept( cgv ); 69 70 } … … 72 73 73 74 namespace { 74 void TreeCleaner::pre visit( CompoundStmt * cstmt ) {75 void TreeCleaner::premutate( CompoundStmt * cstmt ) { 75 76 filter( cstmt->kids, [](Statement * stmt) { 76 77 if ( DeclStmt * declStmt = dynamic_cast< DeclStmt * >( stmt ) ) { … … 79 80 return false; 80 81 }, 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; 81 89 } 82 90
Note: See TracChangeset
for help on using the changeset viewer.