Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r3ed994e r13073be  
    119119
    120120        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 != "" ) {
    123124                        // need to incorporate scope level in order to differentiate names for destructors
    124125                        return decl->get_scopedMangleName();
    125126                } else {
    126                         return decl->get_name();
     127                        return decl->name;
    127128                } // if
    128129        }
     
    171172        // *** Declarations
    172173        void CodeGenerator::postvisit( FunctionDecl * functionDecl ) {
    173                 // deleted decls should never be used, so don't print them
    174                 if ( functionDecl->isDeleted && genC ) return;
    175174                extension( functionDecl );
    176175                genAttributes( functionDecl->get_attributes() );
     
    186185                        functionDecl->get_statements()->accept( *visitor );
    187186                } // if
    188                 if ( functionDecl->isDeleted ) {
    189                         output << " = void";
    190                 }
    191187        }
    192188
    193189        void CodeGenerator::postvisit( ObjectDecl * objectDecl ) {
    194                 // deleted decls should never be used, so don't print them
    195                 if ( objectDecl->isDeleted && genC ) return;
    196190                if (objectDecl->get_name().empty() && genC ) {
    197191                        // only generate an anonymous name when generating C code, otherwise it clutters the output too much
     
    212206                        objectDecl->get_init()->accept( *visitor );
    213207                } // if
    214                 if ( objectDecl->isDeleted ) {
    215                         output << " = void";
    216                 }
    217208
    218209                if ( objectDecl->get_bitfieldWidth() ) {
     
    836827                expr->expr->accept( *visitor );
    837828        }
    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 
    861829
    862830        // *** Statements
Note: See TracChangeset for help on using the changeset viewer.