Changeset 44a81853 for src/CodeGen
- Timestamp:
- Jan 18, 2017, 4:57:52 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:
- 5ded739
- Parents:
- 1267fb1
- Location:
- src/CodeGen
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r1267fb1 r44a81853 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 13 14:51:27 201613 // Update Count : 36212 // Last Modified On : Wed Jan 18 15:23:08 2017 13 // Update Count : 414 14 14 // 15 15 … … 111 111 } 112 112 113 void CodeGenerator::genAttributes( std::list< Attribute * > & attributes ) { 114 if ( ! attributes.empty() ) { 115 output << "__attribute__ (("; 116 for ( Attribute *& attr : attributes ) { 117 if ( ! attr->empty() ) { 118 output << attr->get_name() << "("; 119 genCommaList( attr->get_parameters().begin(), attr->get_parameters().end() ); 120 output << ")"; 121 } // if 122 output << ","; 123 } // for 124 output << ")) "; 125 } // if 126 } 113 void CodeGenerator::genAttributes( list< Attribute * > & attributes ) { 114 if ( attributes.empty() ) return; 115 output << "__attribute__ (("; 116 for ( list< Attribute * >::iterator attr( attributes.begin() );; ) { 117 output << (*attr)->get_name(); 118 if ( ! (*attr)->get_parameters().empty() ) { 119 output << "("; 120 genCommaList( (*attr)->get_parameters().begin(), (*attr)->get_parameters().end() ); 121 output << ")"; 122 } // if 123 if ( ++attr == attributes.end() ) break; 124 output << ","; // separator 125 } // for 126 output << ")) "; 127 } // CodeGenerator::genAttributes 127 128 128 129 -
src/CodeGen/CodeGenerator.h
r1267fb1 r44a81853 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 13 13:51:53 201613 // Update Count : 3912 // Last Modified On : Tue Jan 17 16:55:40 2017 13 // Update Count : 48 14 14 // 15 15 … … 114 114 void extension( Declaration *decl ); 115 115 private: 116 117 116 Indenter indent; 118 117 int cur_indent; … … 131 130 template< class Iterator > 132 131 void CodeGenerator::genCommaList( Iterator begin, Iterator end ) { 133 if ( begin == end ) return; 134 132 if ( begin == end ) return; 135 133 for ( ;; ) { 136 134 (*begin++)->accept( *this ); 137 if ( begin == end ) return;138 output << ", "; 135 if ( begin == end ) break; 136 output << ", "; // separator 139 137 } // for 140 } 138 } // genCommaList 141 139 142 140 inline bool doSemicolon( Declaration* decl ) { … … 145 143 } // if 146 144 return true; 147 } 145 } // doSemicolon 148 146 149 147 /// returns C-compatible name of declaration
Note: See TracChangeset
for help on using the changeset viewer.