Changeset 262f085f
- Timestamp:
- May 5, 2017, 11:05:12 AM (8 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:
- 45a4ea7
- Parents:
- bdd0755
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rbdd0755 r262f085f 772 772 void CodeGenerator::visit( ExprStmt * exprStmt ) { 773 773 assert( exprStmt ); 774 // cast the top-level expression to void to reduce gcc warnings. 775 Expression * expr = new CastExpr( exprStmt->get_expr() ); 774 Expression * expr = exprStmt->get_expr(); 775 if ( genC ) { 776 // cast the top-level expression to void to reduce gcc warnings. 777 expr = new CastExpr( expr ); 778 } 776 779 expr->accept( *this ); 777 780 output << ";"; -
src/CodeGen/Generate.cc
rbdd0755 r262f085f 22 22 #include "SynTree/Declaration.h" 23 23 #include "CodeGenerator.h" 24 #include "Tuples/Tuples.h" 24 #include "GenType.h" 25 #include "SynTree/SynTree.h" 26 #include "SynTree/Type.h" 27 #include "SynTree/BaseSyntaxNode.h" 28 // #include "Tuples/Tuples.h" 25 29 26 30 using namespace std; … … 39 43 } // for 40 44 } 45 46 void generate( BaseSyntaxNode * node, std::ostream & os ) { 47 if ( Type * type = dynamic_cast< Type * >( node ) ) { 48 os << CodeGen::genPrettyType( type, "" ); 49 } else { 50 CodeGen::CodeGenerator cgv( os, true, false ); 51 node->accept( cgv ); 52 } 53 os << std::endl; 54 } 41 55 } // namespace CodeGen 42 56 -
src/CodeGen/Generate.h
rbdd0755 r262f085f 25 25 /// Generates code. doIntrinsics determines if intrinsic functions are printed, pretty formats output nicely (e.g., uses unmangled names, etc.), generateC is true when the output must consist only of C code (allows some assertions, etc.) 26 26 void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false ); 27 28 /// Generate code for a single node -- helpful for debugging in gdb 29 void generate( BaseSyntaxNode * node, std::ostream & os ); 27 30 } // namespace CodeGen 28 31 -
src/SynTree/BaseSyntaxNode.h
rbdd0755 r262f085f 18 18 19 19 #include "Common/utility.h" 20 #include "Visitor.h" 20 21 21 22 class BaseSyntaxNode { 22 23 public: 23 24 CodeLocation location; 25 26 virtual void accept( Visitor & v ) = 0; // temporary -- needs to be here so that BaseSyntaxNode is polymorphic and can be dynamic_cast 24 27 }; 25 28 -
src/SynTree/SynTree.h
rbdd0755 r262f085f 21 21 #include <map> 22 22 #include <iostream> 23 24 class BaseSyntaxNode; 23 25 24 26 class Declaration;
Note: See TracChangeset
for help on using the changeset viewer.