Changeset c850687 for src/CodeGen/GenType.cc
- Timestamp:
- May 11, 2017, 11:07:58 AM (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:
- 8514fe19
- Parents:
- 29cf9c8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/GenType.cc
r29cf9c8 rc850687 28 28 class GenType : public Visitor { 29 29 public: 30 GenType( const std::string &typeString, bool pretty = false, bool genC = false );30 GenType( const std::string &typeString, bool pretty = false, bool genC = false, bool lineMarks = false ); 31 31 std::string get_typeString() const { return typeString; } 32 32 void set_typeString( const std::string &newValue ) { typeString = newValue; } … … 54 54 bool pretty = false; // pretty print 55 55 bool genC = false; // generating C code? 56 bool lineMarks = false; 56 57 }; 57 58 58 std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC ) {59 GenType gt( baseString, pretty, genC );59 std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC , bool lineMarks ) { 60 GenType gt( baseString, pretty, genC, lineMarks ); 60 61 std::ostringstream os; 61 62 62 63 if ( ! type->get_attributes().empty() ) { 63 CodeGenerator cg( os, pretty, genC );64 CodeGenerator cg( os, pretty, genC, lineMarks ); 64 65 cg.genAttributes( type->get_attributes() ); 65 66 } // if … … 73 74 } 74 75 75 GenType::GenType( const std::string &typeString, bool pretty, bool genC ) : typeString( typeString ), pretty( pretty ), genC( genC) {}76 GenType::GenType( const std::string &typeString, bool pretty, bool genC, bool lineMarks ) : typeString( typeString ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {} 76 77 77 78 void GenType::visit( VoidType *voidType ) { … … 114 115 } // if 115 116 if ( dimension != 0 ) { 116 CodeGenerator cg( os, pretty, genC );117 CodeGenerator cg( os, pretty, genC, lineMarks ); 117 118 dimension->accept( cg ); 118 119 } else if ( isVarLen ) { … … 168 169 } // if 169 170 } else { 170 CodeGenerator cg( os, pretty, genC );171 CodeGenerator cg( os, pretty, genC, lineMarks ); 171 172 os << "(" ; 172 173 … … 191 192 // assertf( ! genC, "Aggregate type parameters should not reach code generation." ); 192 193 std::ostringstream os; 193 CodeGenerator cg( os, pretty, genC );194 CodeGenerator cg( os, pretty, genC, lineMarks ); 194 195 os << "forall("; 195 196 cg.genCommaList( funcType->get_forall().begin(), funcType->get_forall().end() ); … … 202 203 if ( ! refType->get_parameters().empty() ) { 203 204 std::ostringstream os; 204 CodeGenerator cg( os, pretty, genC );205 CodeGenerator cg( os, pretty, genC, lineMarks ); 205 206 os << "("; 206 207 cg.genCommaList( refType->get_parameters().begin(), refType->get_parameters().end() ); … … 242 243 for ( Type * t : *tupleType ) { 243 244 i++; 244 os << genType( t, "", pretty, genC ) << (i == tupleType->size() ? "" : ", ");245 os << genType( t, "", pretty, genC, lineMarks ) << (i == tupleType->size() ? "" : ", "); 245 246 } 246 247 os << "]";
Note: See TracChangeset
for help on using the changeset viewer.