Changes in src/CodeGen/CodeGenerator.cc [3ed994e:13073be]
- File:
-
- 1 edited
-
src/CodeGen/CodeGenerator.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r3ed994e r13073be 119 119 120 120 string CodeGenerator::mangleName( DeclarationWithType * decl ) { 121 if ( pretty ) return decl->get_name(); 122 if ( decl->get_mangleName() != "" ) { 121 // GCC builtins should always be printed unmangled 122 if ( pretty || decl->linkage.is_gcc_builtin ) return decl->name; 123 if ( decl->mangleName != "" ) { 123 124 // need to incorporate scope level in order to differentiate names for destructors 124 125 return decl->get_scopedMangleName(); 125 126 } else { 126 return decl-> get_name();127 return decl->name; 127 128 } // if 128 129 } … … 171 172 // *** Declarations 172 173 void CodeGenerator::postvisit( FunctionDecl * functionDecl ) { 173 // deleted decls should never be used, so don't print them174 if ( functionDecl->isDeleted && genC ) return;175 174 extension( functionDecl ); 176 175 genAttributes( functionDecl->get_attributes() ); … … 186 185 functionDecl->get_statements()->accept( *visitor ); 187 186 } // if 188 if ( functionDecl->isDeleted ) {189 output << " = void";190 }191 187 } 192 188 193 189 void CodeGenerator::postvisit( ObjectDecl * objectDecl ) { 194 // deleted decls should never be used, so don't print them195 if ( objectDecl->isDeleted && genC ) return;196 190 if (objectDecl->get_name().empty() && genC ) { 197 191 // only generate an anonymous name when generating C code, otherwise it clutters the output too much … … 212 206 objectDecl->get_init()->accept( *visitor ); 213 207 } // if 214 if ( objectDecl->isDeleted ) {215 output << " = void";216 }217 208 218 209 if ( objectDecl->get_bitfieldWidth() ) { … … 836 827 expr->expr->accept( *visitor ); 837 828 } 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 861 829 862 830 // *** Statements
Note:
See TracChangeset
for help on using the changeset viewer.