Changeset af18713 for src/SynTree


Ignore:
Timestamp:
May 11, 2016, 1:09:37 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
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:
228851d, 3e8fb3b
Parents:
cb4c607 (diff), 03e5d14 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/SynTree
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.h

    rcb4c607 raf18713  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Declaration.h -- 
     7// Declaration.h --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 17:28:11 2016
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Fri May 06 15:39:02 2016
    1313// Update Count     : 33
    1414//
     
    106106        typedef DeclarationWithType Parent;
    107107  public:
    108         FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn );
     108        // temporary - merge this into general GCC attributes
     109        struct Attribute {
     110                enum Type {
     111                        NoAttribute, Constructor, Destructor,
     112                } type;
     113                enum Priority {
     114                        // priorities 0-100 are reserved by gcc, so it's okay to use 100 an exceptional case
     115                        Default = 100, High,
     116                } priority;
     117                Attribute(Type t = NoAttribute, Priority p = Default) : type(t), priority(p) {};
     118        };
     119
     120        FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, Attribute attribute = Attribute() );
    109121        FunctionDecl( const FunctionDecl &other );
    110122        virtual ~FunctionDecl();
     
    119131        std::list< std::string >& get_oldIdents() { return oldIdents; }
    120132        std::list< Declaration* >& get_oldDecls() { return oldDecls; }
     133        Attribute get_attribute() const { return attribute; }
     134        void set_attribute( Attribute newValue ) { attribute = newValue; }
    121135
    122136        virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); }
     
    130144        std::list< std::string > oldIdents;
    131145        std::list< Declaration* > oldDecls;
     146        Attribute attribute;
    132147};
    133148
  • src/SynTree/FunctionDecl.cc

    rcb4c607 raf18713  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FunctionDecl.cc -- 
     7// FunctionDecl.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul 13 18:11:44 2015
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Fri May 06 15:41:05 2016
    1313// Update Count     : 19
    1414//
     
    2121#include "Common/utility.h"
    2222
    23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn )
    24                 : Parent( name, sc, linkage ), type( type ), statements( statements ) {
     23FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, Attribute attribute )
     24                : Parent( name, sc, linkage ), type( type ), statements( statements ), attribute( attribute ) {
    2525        set_isInline( isInline );
    2626        set_isNoreturn( isNoreturn );
     
    3232
    3333FunctionDecl::FunctionDecl( const FunctionDecl &other )
    34         : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
     34        : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ), attribute( other.attribute ) {
    3535}
    3636
     
    5252        using std::endl;
    5353        using std::string;
    54        
     54
    5555        if ( get_name() != "" ) {
    5656                os << get_name() << ": ";
     
    6565                os << "_Noreturn ";
    6666        } // if
     67        switch ( attribute.type ) {
     68                case Attribute::Constructor:
     69                        os << "Global Constructor ";
     70                        break;
     71                case Attribute::Destructor:
     72                        os << "Global Destructor ";
     73                        break;
     74                default:
     75                        break;
     76        }
     77        if ( attribute.priority != Attribute::Default ) {
     78                os << "with priority " << attribute.priority << " ";
     79        }
    6780        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    6881                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
     
    94107        using std::endl;
    95108        using std::string;
    96        
     109
    97110        if ( get_name() != "" ) {
    98111                os << get_name() << ": ";
     
    104117                os << "_Noreturn ";
    105118        } // if
     119        switch ( attribute.type ) {
     120                case Attribute::Constructor:
     121                        os << " Global Constructor ";
     122                        break;
     123                case Attribute::Destructor:
     124                        os << " Global Destructor ";
     125                        break;
     126                default:
     127                        break;
     128        }
     129        if ( attribute.priority != Attribute::Default ) {
     130                os << "with priority " << attribute.priority << " ";
     131        }
    106132        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    107133                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
Note: See TracChangeset for help on using the changeset viewer.