Changeset 5f642e38 for src/CodeGen
- Timestamp:
- Apr 19, 2017, 12:08:40 PM (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:
- e3987770
- Parents:
- 7069652
- Location:
- src/CodeGen
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r7069652 r5f642e38 172 172 } 173 173 174 void CodeGenerator::handleAggregate( AggregateDecl * aggDecl ) {174 void CodeGenerator::handleAggregate( AggregateDecl * aggDecl, const std::string & kind ) { 175 175 genAttributes( aggDecl->get_attributes() ); 176 176 … … 182 182 } 183 183 184 output << kind; 184 185 if ( aggDecl->get_name() != "" ) 185 186 output << aggDecl->get_name(); … … 204 205 void CodeGenerator::visit( StructDecl * structDecl ) { 205 206 extension( structDecl ); 206 output << "struct "; 207 handleAggregate( structDecl ); 207 handleAggregate( structDecl, "struct " ); 208 208 } 209 209 210 210 void CodeGenerator::visit( UnionDecl * unionDecl ) { 211 211 extension( unionDecl ); 212 output << "union "; 213 handleAggregate( unionDecl ); 212 handleAggregate( unionDecl, "union " ); 214 213 } 215 214 … … 578 577 extension( memberExpr ); 579 578 memberExpr->get_aggregate()->accept( *this ); 580 output << "." << memberExpr->get_member(); 579 output << "."; 580 memberExpr->get_member()->accept( *this ); 581 581 } 582 582 -
src/CodeGen/CodeGenerator.h
r7069652 r5f642e38 125 125 void printDesignators( std::list< Expression * > & ); 126 126 void handleStorageClass( DeclarationWithType *decl ); 127 void handleAggregate( AggregateDecl *aggDecl );127 void handleAggregate( AggregateDecl *aggDecl, const std::string & kind ); 128 128 void handleTypedef( NamedTypeDecl *namedType ); 129 129 std::string mangleName( DeclarationWithType * decl ); -
src/CodeGen/GenType.cc
r7069652 r5f642e38 186 186 funcType->get_returnVals().front()->get_type()->accept( *this ); 187 187 } // if 188 189 // add forall 190 if( ! funcType->get_forall().empty() && ! genC ) { 191 // assertf( ! genC, "Aggregate type parameters should not reach code generation." ); 192 std::ostringstream os; 193 CodeGenerator cg( os, pretty, genC ); 194 os << "forall("; 195 cg.genCommaList( funcType->get_forall().begin(), funcType->get_forall().end() ); 196 os << ")" << std::endl; 197 typeString = os.str() + typeString; 198 } 188 199 } 189 200
Note: See TracChangeset
for help on using the changeset viewer.