Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.h

    r03e5d14 rf326f99  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Fri May 06 15:39:02 2016
    13 // Update Count     : 33
     12// Last Modified On : Mon Apr 11 16:55:12 2016
     13// Update Count     : 36
    1414//
    1515
     
    2222#include "Parser/LinkageSpec.h"
    2323#include "Parser/ParseNode.h"
     24#include <string>
    2425
    2526class Declaration {
     
    6768        void set_mangleName( std::string newValue ) { mangleName = newValue; }
    6869
     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
    6975        virtual DeclarationWithType *clone() const = 0;
    7076        virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0;
     
    7581        // this represents the type with all types and typedefs expanded it is generated by SymTab::Validate::Pass2
    7682        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;
    7786};
    7887
     
    106115        typedef DeclarationWithType Parent;
    107116  public:
    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() );
     117        FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn );
    121118        FunctionDecl( const FunctionDecl &other );
    122119        virtual ~FunctionDecl();
     
    131128        std::list< std::string >& get_oldIdents() { return oldIdents; }
    132129        std::list< Declaration* >& get_oldDecls() { return oldDecls; }
    133         Attribute get_attribute() const { return attribute; }
    134         void set_attribute( Attribute newValue ) { attribute = newValue; }
    135130
    136131        virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); }
     
    144139        std::list< std::string > oldIdents;
    145140        std::list< Declaration* > oldDecls;
    146         Attribute attribute;
    147141};
    148142
Note: See TracChangeset for help on using the changeset viewer.