Ignore:
Timestamp:
Jun 26, 2015, 4:00:26 PM (10 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, string, with_gc
Children:
0df292b, e0ff3e6
Parents:
eb50842 (diff), 1869adf (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 pointer to pointer to qualified fix into master

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    reb50842 r937e51d  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May 16 13:30:24 2015
    13 // Update Count     : 3
     12// Last Modified On : Wed Jun 24 14:09:51 2015
     13// Update Count     : 81
    1414//
    1515
     
    2222
    2323#include "utility.h"
    24 #include "SynTree/Declaration.h"
     24#include "Parser/LinkageSpec.h"
     25#include "SynTree/Type.h"
     26//#include "SynTree/Declaration.h"
    2527#include "UniqueName.h"
    2628
     
    3638class ParseNode {
    3739  public:
    38         ParseNode( void );
    39         ParseNode ( std::string );
    40         virtual ~ParseNode( void );
    41 
    42         ParseNode *set_name ( std::string ) ;
    43         ParseNode *set_name ( std::string * ) ;
    44 
    45         std::string get_name( void );
    46 
    47         ParseNode *get_link( void ) const;
    48         ParseNode *get_last( void );
     40        ParseNode();
     41        ParseNode( const std::string * );
     42        virtual ~ParseNode();
     43
     44        ParseNode *get_link() const;
     45        ParseNode *get_last();
    4946        ParseNode *set_link( ParseNode * );
    5047        void set_next( ParseNode *newlink ) { next = newlink; }
     
    5249        virtual ParseNode *clone() const { return 0; };
    5350
    54         const std::string get_name( void ) const;
     51        const std::string &get_name() const { return *name; }
    5552        virtual void print( std::ostream &, int indent = 0 ) const;
    5653        virtual void printList( std::ostream &, int indent = 0 ) const;
     
    5855        ParseNode &operator,( ParseNode &);
    5956  protected:
    60         std::string name;
     57        const std::string *name;
    6158        ParseNode *next;
    6259        static int indent_by;
     
    6865  public:
    6966        ExpressionNode();
    70         ExpressionNode( std::string * );
     67        ExpressionNode( const std::string * );
    7168        ExpressionNode( const ExpressionNode &other );
    7269        virtual ~ExpressionNode() {} // cannot delete asArgName because it might be referenced elsewhere
     
    7774
    7875        ExpressionNode *get_argName() const { return argName; }
    79         ExpressionNode *set_asArgName( std::string *aName );
     76        ExpressionNode *set_asArgName( const std::string *aName );
    8077        ExpressionNode *set_asArgName( ExpressionNode *aDesignator );
    8178
     
    105102class ConstantNode : public ExpressionNode {
    106103  public:
    107         enum Type {
    108                 Integer, Float, Character, String /* , Range, EnumConstant  */
    109         };
    110 
    111         ConstantNode( void );
    112         ConstantNode( std::string * );
     104        enum Type { Integer, Float, Character, String };
     105
    113106        ConstantNode( Type, std::string * );
    114         ConstantNode( const ConstantNode &other );
    115107
    116108        virtual ConstantNode *clone() const { return new ConstantNode( *this ); }
    117 
    118         Type get_type( void ) const ;
     109        Type get_type( void ) const { return type; }
    119110        virtual void print( std::ostream &, int indent = 0) const;
    120111        virtual void printOneLine( std::ostream &, int indent = 0) const;
    121112
    122         std::string get_value() const { return value; }
    123         ConstantNode *append( std::string *newValue );
     113        const std::string &get_value() const { return value; }
     114        ConstantNode *appendstr( const std::string *newValue );
    124115
    125116        Expression *build() const;
    126117  private:
    127         void classify( std::string &);
    128118        Type type;
    129         std::string value;
    130         bool sign;
    131         short base;
    132         int longs, size;
     119        BasicType::Kind btype;
     120        std::string &value;
    133121};
    134122
     
    136124  public:
    137125        VarRefNode();
    138         VarRefNode( std::string *, bool isLabel = false );
     126        VarRefNode( const std::string *, bool isLabel = false );
    139127        VarRefNode( const VarRefNode &other );
    140128
     
    143131        virtual VarRefNode *clone() const { return new VarRefNode( *this ); }
    144132
    145         virtual void print( std::ostream &, int indent = 0) const;
    146         virtual void printOneLine( std::ostream &, int indent = 0) const;
     133        virtual void print( std::ostream &, int indent = 0 ) const;
     134        virtual void printOneLine( std::ostream &, int indent = 0 ) const;
    147135  private:
    148136        bool isLabel;
     
    183171        virtual OperatorNode *clone() const { return new OperatorNode( *this ); }
    184172
    185         Type get_type( void ) const;
    186         std::string get_typename( void ) const;
     173        Type get_type() const;
     174        const char *get_typename() const;
    187175
    188176        virtual void print( std::ostream &, int indent = 0) const;
     
    198186class CompositeExprNode : public ExpressionNode {
    199187  public:
    200         CompositeExprNode( void );
    201         CompositeExprNode( std::string * );
     188        CompositeExprNode();
     189        CompositeExprNode( const std::string * );
    202190        CompositeExprNode( ExpressionNode *f, ExpressionNode *args = 0 );
    203191        CompositeExprNode( ExpressionNode *f, ExpressionNode *arg1, ExpressionNode *arg2 );
     
    278266  public:
    279267        enum Qualifier { Const, Restrict, Volatile, Lvalue, Atomic, Attribute };
    280         enum StorageClass { Extern, Static, Auto, Register, Inline, Fortran };
     268        enum StorageClass { Extern, Static, Auto, Register, Inline, Fortran, Noreturn, Threadlocal, NoStorageClass, };
    281269        enum BasicType { Char, Int, Float, Double, Void, Bool, Complex, Imaginary };
    282         enum Modifier { Signed, Unsigned, Short, Long };
    283         enum TyCon { Struct, Union, Context };
     270        enum Modifier  { Signed, Unsigned, Short, Long };
     271        enum Aggregate { Struct, Union, Context };
    284272        enum TypeClass { Type, Dtype, Ftype };
    285273
     274        static const char *storageName[]; 
    286275        static const char *qualifierName[];
    287276        static const char *basicTypeName[];
    288277        static const char *modifierName[];
    289         static const char *tyConName[];
     278        static const char *aggregateName[];
    290279        static const char *typeClassName[];
    291280
     
    298287        static DeclarationNode *newForall( DeclarationNode *);
    299288        static DeclarationNode *newFromTypedef( std::string *);
    300         static DeclarationNode *newAggregate( TyCon kind, std::string *name, DeclarationNode *formals, ExpressionNode *actuals, DeclarationNode *fields );
     289        static DeclarationNode *newAggregate( Aggregate kind, std::string *name, DeclarationNode *formals, ExpressionNode *actuals, DeclarationNode *fields );
    301290        static DeclarationNode *newEnum( std::string *name, DeclarationNode *constants );
    302291        static DeclarationNode *newEnumConstant( std::string *name, ExpressionNode *constant );
    303292        static DeclarationNode *newName( std::string *);
    304         static DeclarationNode *newFromTypeGen( std::string*, ExpressionNode *params );
     293        static DeclarationNode *newFromTypeGen( std::string *, ExpressionNode *params );
    305294        static DeclarationNode *newTypeParam( TypeClass, std::string *);
    306295        static DeclarationNode *newContext( std::string *name, DeclarationNode *params, DeclarationNode *asserts );
     
    313302        static DeclarationNode *newTuple( DeclarationNode *members );
    314303        static DeclarationNode *newTypeof( ExpressionNode *expr );
    315         static DeclarationNode *newAttr( std::string*, ExpressionNode *expr );
    316         static DeclarationNode *newAttr( std::string*, DeclarationNode *type );
     304        static DeclarationNode *newAttr( std::string *, ExpressionNode *expr );
     305        static DeclarationNode *newAttr( std::string *, DeclarationNode *type );
    317306
    318307        DeclarationNode *addQualifiers( DeclarationNode *);
     
    340329        DeclarationNode *cloneBaseType( DeclarationNode *newdecl );
    341330
    342         DeclarationNode *appendList( DeclarationNode  *);
     331        DeclarationNode *appendList( DeclarationNode * );
    343332
    344333        DeclarationNode *clone() const;
     
    350339
    351340        bool get_hasEllipsis() const;
    352         std::string get_name() const { return name; }
     341        const std::string &get_name() const { return name; }
    353342        LinkageSpec::Type get_linkage() const { return linkage; }
    354343        DeclarationNode *extractAggregate() const;
     
    357346        ~DeclarationNode();
    358347  private:
    359         Declaration::StorageClass buildStorageClass() const;
    360         bool buildInline() const;
     348        StorageClass buildStorageClass() const;
     349        bool buildFuncSpecifier( StorageClass key ) const;
    361350
    362351        TypeData *type;
     
    380369        };
    381370
    382         StatementNode( void );
    383         StatementNode( std::string );
     371        StatementNode();
     372        StatementNode( const std::string * );
    384373        StatementNode( Type, ExpressionNode *e = 0, StatementNode *s = 0 );
    385374        StatementNode( Type, std::string *target );
     
    387376
    388377
    389         ~StatementNode( void );
    390 
    391         static StatementNode  *newCatchStmt( DeclarationNode *d = 0, StatementNode *s = 0, bool catchRestP = false );
     378        ~StatementNode();
     379
     380        static StatementNode *newCatchStmt( DeclarationNode *d = 0, StatementNode *s = 0, bool catchRestP = false );
    392381
    393382        void set_control( ExpressionNode * );
     
    396385        ExpressionNode *get_control() const ;
    397386        StatementNode *get_block() const;
    398         StatementNode::Type get_type( void ) const;
    399 
    400         StatementNode *add_label( std::string * );
     387        StatementNode::Type get_type() const;
     388
     389        StatementNode *add_label( const std::string * );
    401390        std::list<std::string> *get_labels() const;
    402391
     
    429418class CompoundStmtNode : public StatementNode {
    430419  public:
    431         CompoundStmtNode( void );
    432         CompoundStmtNode( std::string * );
     420        CompoundStmtNode();
     421        CompoundStmtNode( const std::string * );
    433422        CompoundStmtNode( StatementNode * );
    434423        ~CompoundStmtNode();
     
    499488
    500489// in DeclarationNode.cc
    501 void buildList( const DeclarationNode *firstNode, std::list< Declaration *> &outputList );
     490void buildList( const DeclarationNode *firstNode, std::list< Declaration * > &outputList );
    502491void buildList( const DeclarationNode *firstNode, std::list< DeclarationWithType *> &outputList );
    503 void buildTypeList( const DeclarationNode *firstNode, std::list< Type *> &outputList );
     492void buildTypeList( const DeclarationNode *firstNode, std::list< Type * > &outputList );
    504493
    505494// in ExpressionNode.cc
Note: See TracChangeset for help on using the changeset viewer.