Changeset 03e5d14 for src/CodeGen


Ignore:
Timestamp:
May 6, 2016, 3:45:23 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
9e2c1f0, af18713, fac84be
Parents:
37024fd
Message:

add support for constructor/destructor attribute priority and set priority for library constructors to high

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r37024fd r03e5d14  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Fri May 06 14:57:16 2016
     12// Last Modified On : Fri May 06 15:40:35 2016
    1313// Update Count     : 243
    1414//
     
    7676        void CodeGenerator::visit( FunctionDecl *functionDecl ) {
    7777                // generalize this
    78                 switch ( functionDecl->get_attribute() ) {
    79                         case FunctionDecl::Constructor:
    80                                 output << "__attribute__ ((constructor)) ";
     78                FunctionDecl::Attribute attr = functionDecl->get_attribute();
     79                switch ( attr.type ) {
     80                        case FunctionDecl::Attribute::Constructor:
     81                                output << "__attribute__ ((constructor";
     82                                if ( attr.priority != FunctionDecl::Attribute::Default ) {
     83                                        output << "(" << attr.priority << ")";
     84                                }
     85                                output << ")) ";
    8186                                break;
    82                         case FunctionDecl::Destructor:
    83                                 output << "__attribute__ ((destructor)) ";
     87                        case FunctionDecl::Attribute::Destructor:
     88                                output << "__attribute__ ((destructor";
     89                                if ( attr.priority != FunctionDecl::Attribute::Default ) {
     90                                        output << "(" << attr.priority << ")";
     91                                }
     92                                output << ")) ";
    8493                                break;
    8594                        default:
Note: See TracChangeset for help on using the changeset viewer.