Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.h

    rf326f99 r03e5d14  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Mon Apr 11 16:55:12 2016
    13 // Update Count     : 36
     12// Last Modified On : Fri May 06 15:39:02 2016
     13// Update Count     : 33
    1414//
    1515
     
    2222#include "Parser/LinkageSpec.h"
    2323#include "Parser/ParseNode.h"
    24 #include <string>
    2524
    2625class Declaration {
     
    6867        void set_mangleName( std::string newValue ) { mangleName = newValue; }
    6968
    70         std::string get_scopedMangleName() const { return mangleName + "_" + std::to_string(scopeLevel); }
    71 
    72         int get_scopeLevel() const { return scopeLevel; }
    73         void set_scopeLevel( int newValue ) { scopeLevel = newValue; }
    74 
    7569        virtual DeclarationWithType *clone() const = 0;
    7670        virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0;
     
    8175        // this represents the type with all types and typedefs expanded it is generated by SymTab::Validate::Pass2
    8276        std::string mangleName;
    83         // need to remember the scope level at which the variable was declared, so that
    84         // shadowed identifiers can be accessed
    85         int scopeLevel = 0;
    8677};
    8778
     
    115106        typedef DeclarationWithType Parent;
    116107  public:
    117         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() );
    118121        FunctionDecl( const FunctionDecl &other );
    119122        virtual ~FunctionDecl();
     
    128131        std::list< std::string >& get_oldIdents() { return oldIdents; }
    129132        std::list< Declaration* >& get_oldDecls() { return oldDecls; }
     133        Attribute get_attribute() const { return attribute; }
     134        void set_attribute( Attribute newValue ) { attribute = newValue; }
    130135
    131136        virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); }
     
    139144        std::list< std::string > oldIdents;
    140145        std::list< Declaration* > oldDecls;
     146        Attribute attribute;
    141147};
    142148
Note: See TracChangeset for help on using the changeset viewer.