Changes in src/CodeGen/CodeGenerator.cc [13073be:3ed994e]
- File:
-
- 1 edited
-
src/CodeGen/CodeGenerator.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r13073be r3ed994e 119 119 120 120 string CodeGenerator::mangleName( DeclarationWithType * decl ) { 121 // GCC builtins should always be printed unmangled 122 if ( pretty || decl->linkage.is_gcc_builtin ) return decl->name; 123 if ( decl->mangleName != "" ) { 121 if ( pretty ) return decl->get_name(); 122 if ( decl->get_mangleName() != "" ) { 124 123 // need to incorporate scope level in order to differentiate names for destructors 125 124 return decl->get_scopedMangleName(); 126 125 } else { 127 return decl-> name;126 return decl->get_name(); 128 127 } // if 129 128 } … … 172 171 // *** Declarations 173 172 void CodeGenerator::postvisit( FunctionDecl * functionDecl ) { 173 // deleted decls should never be used, so don't print them 174 if ( functionDecl->isDeleted && genC ) return; 174 175 extension( functionDecl ); 175 176 genAttributes( functionDecl->get_attributes() ); … … 185 186 functionDecl->get_statements()->accept( *visitor ); 186 187 } // if 188 if ( functionDecl->isDeleted ) { 189 output << " = void"; 190 } 187 191 } 188 192 189 193 void CodeGenerator::postvisit( ObjectDecl * objectDecl ) { 194 // deleted decls should never be used, so don't print them 195 if ( objectDecl->isDeleted && genC ) return; 190 196 if (objectDecl->get_name().empty() && genC ) { 191 197 // only generate an anonymous name when generating C code, otherwise it clutters the output too much … … 206 212 objectDecl->get_init()->accept( *visitor ); 207 213 } // if 214 if ( objectDecl->isDeleted ) { 215 output << " = void"; 216 } 208 217 209 218 if ( objectDecl->get_bitfieldWidth() ) { … … 827 836 expr->expr->accept( *visitor ); 828 837 } 838 839 void CodeGenerator::postvisit( GenericExpr * expr ) { 840 assertf( ! genC, "C11 _Generic expressions should not reach code generation." ); 841 output << "_Generic("; 842 expr->control->accept( *visitor ); 843 output << ", "; 844 unsigned int numAssocs = expr->associations.size(); 845 unsigned int i = 0; 846 for ( GenericExpr::Association & assoc : expr->associations ) { 847 if (assoc.isDefault) { 848 output << "default: "; 849 } else { 850 output << genType( assoc.type, "", pretty, genC ) << ": "; 851 } 852 assoc.expr->accept( *visitor ); 853 if ( i+1 != numAssocs ) { 854 output << ", "; 855 } 856 i++; 857 } 858 output << ")"; 859 } 860 829 861 830 862 // *** Statements
Note:
See TracChangeset
for help on using the changeset viewer.