Changeset b3f252a for src/CodeGen/CodeGenerator.cc
- Timestamp:
- Sep 7, 2017, 10:36:35 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:
- e0886db
- Parents:
- 871cdb4 (diff), 416cc86 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r871cdb4 rb3f252a 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Fri Aug 18 15:34:00201713 // Update Count : 4 8811 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Sep 3 20:42:52 2017 13 // Update Count : 490 14 14 // 15 15 #include "CodeGenerator.h" … … 59 59 60 60 void CodeGenerator::asmName( DeclarationWithType * decl ) { 61 if ( ConstantExpr * asmName = d ecl->get_asmName() ) {61 if ( ConstantExpr * asmName = dynamic_cast<ConstantExpr *>(decl->get_asmName()) ) { 62 62 output << " asm ( " << asmName->get_constant()->get_value() << " )"; 63 63 } // if … … 195 195 } 196 196 197 output << kind; 198 if ( aggDecl->get_name() != "" ) 199 output << aggDecl->get_name(); 197 output << kind << aggDecl->get_name(); 200 198 201 199 if ( aggDecl->has_body() ) { … … 233 231 genAttributes( enumDecl->get_attributes() ); 234 232 235 if ( enumDecl->get_name() != "" ) 236 output << enumDecl->get_name(); 233 output << enumDecl->get_name(); 237 234 238 235 std::list< Declaration* > &memb = enumDecl->get_members(); … … 260 257 } 261 258 262 void CodeGenerator::visit( __attribute__((unused)) TraitDecl * traitDecl ) {} 259 void CodeGenerator::visit( TraitDecl * traitDecl ) { 260 assertf( ! genC, "TraitDecl nodes should not reach code generation." ); 261 extension( traitDecl ); 262 handleAggregate( traitDecl, "trait " ); 263 } 263 264 264 265 void CodeGenerator::visit( TypedefDecl * typeDecl ) { … … 545 546 extension( addressExpr ); 546 547 output << "(&"; 547 // this hack makes sure that we don't convert "constant_zero" to "0" if we're taking its address 548 if ( VariableExpr * variableExpr = dynamic_cast< VariableExpr* >( addressExpr->get_arg() ) ) { 549 output << mangleName( variableExpr->get_var() ); 550 } else { 551 addressExpr->get_arg()->accept( *this ); 552 } // if 548 addressExpr->arg->accept( *this ); 553 549 output << ")"; 550 } 551 552 void CodeGenerator::visit( LabelAddressExpr *addressExpr ) { 553 extension( addressExpr ); 554 output << "(&&" << addressExpr->arg << ")"; 554 555 } 555 556 … … 760 761 for ( Statement * stmt : stmts ) { 761 762 updateLocation( stmt ); 762 output << printLabels( stmt->get_labels() );763 output << indent << printLabels( stmt->get_labels() ); 763 764 if ( i+1 == numStmts ) { 764 765 // last statement in a statement expression needs to be handled specially -
Note: See TracChangeset
for help on using the changeset viewer.