Ignore:
Timestamp:
Oct 4, 2016, 11:25:00 AM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
40744af8, a7976d79
Parents:
6295081 (diff), 4b1fd2c (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r6295081 r19b5d6b  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 12 08:00:05 2016
    13 // Update Count     : 603
     12// Last Modified On : Sat Sep 24 11:12:04 2016
     13// Update Count     : 633
    1414//
    1515
     
    4141  public:
    4242        ParseNode() {};
    43         ParseNode( const std::string * name ) : name( * name ) { assert( false ); delete name; }
    44         ParseNode( const std::string &name ) : name( name ) { assert( false ); }
    45         virtual ~ParseNode() { delete next; };
     43        virtual ~ParseNode() { delete next; delete name; };
    4644        virtual ParseNode * clone() const = 0;
    4745
    4846        ParseNode * get_next() const { return next; }
    4947        ParseNode * set_next( ParseNode * newlink ) { next = newlink; return this; }
     48
    5049        ParseNode * get_last() {
    5150                ParseNode * current;
    52                 for ( current = this; current->get_next() != 0; current = current->get_next() );
     51                for ( current = this; current->get_next() != nullptr; current = current->get_next() );
    5352                return current;
    5453        }
    5554        ParseNode * set_last( ParseNode * newlast ) {
    56                 if ( newlast != 0 ) get_last()->set_next( newlast );
     55                if ( newlast != nullptr ) get_last()->set_next( newlast );
    5756                return this;
    5857        }
    59 
    60         const std::string &get_name() const { return name; }
    61         void set_name( const std::string &newValue ) { name = newValue; }
    6258
    6359        virtual void print( std::ostream &os, int indent = 0 ) const {}
    6460        virtual void printList( std::ostream &os, int indent = 0 ) const {}
    65   private:
     61
    6662        static int indent_by;
    6763
    6864        ParseNode * next = nullptr;
    69         std::string name;
     65        std::string * name = nullptr;
    7066}; // ParseNode
    7167
     
    7470class InitializerNode : public ParseNode {
    7571  public:
    76         InitializerNode( ExpressionNode *, bool aggrp = false,  ExpressionNode * des = 0 );
    77         InitializerNode( InitializerNode *, bool aggrp = false, ExpressionNode * des = 0 );
     72        InitializerNode( ExpressionNode *, bool aggrp = false,  ExpressionNode * des = nullptr );
     73        InitializerNode( InitializerNode *, bool aggrp = false, ExpressionNode * des = nullptr );
    7874        ~InitializerNode();
    7975        virtual InitializerNode * clone() const { assert( false ); return nullptr; }
     
    106102  public:
    107103        ExpressionNode( Expression * expr = nullptr ) : expr( expr ) {}
    108         ExpressionNode( Expression * expr, const std::string * name ) : ParseNode( name ), expr( expr ) {}
    109104        ExpressionNode( const ExpressionNode &other );
    110105        virtual ~ExpressionNode() {}
     
    183178Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node );
    184179Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node );
    185 Expression * build_tuple( ExpressionNode * expr_node = 0 );
     180Expression * build_tuple( ExpressionNode * expr_node = nullptr );
    186181Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node );
    187182Expression * build_range( ExpressionNode * low, ExpressionNode * high );
     
    219214        static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle = false );
    220215        static DeclarationNode * newQualifier( Qualifier );
    221         static DeclarationNode * newForall( DeclarationNode *);
     216        static DeclarationNode * newForall( DeclarationNode * );
    222217        static DeclarationNode * newStorageClass( StorageClass );
    223218        static DeclarationNode * newBasicType( BasicType );
     
    226221        static DeclarationNode * newLength( Length lnth );
    227222        static DeclarationNode * newBuiltinType( BuiltinType );
    228         static DeclarationNode * newFromTypedef( std::string *);
     223        static DeclarationNode * newFromTypedef( std::string * );
    229224        static DeclarationNode * newAggregate( Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body );
    230225        static DeclarationNode * newEnum( std::string * name, DeclarationNode * constants );
    231226        static DeclarationNode * newEnumConstant( std::string * name, ExpressionNode * constant );
    232         static DeclarationNode * newName( std::string *);
     227        static DeclarationNode * newName( std::string * );
    233228        static DeclarationNode * newFromTypeGen( std::string *, ExpressionNode * params );
    234         static DeclarationNode * newTypeParam( TypeClass, std::string *);
    235         static DeclarationNode * newTrait( std::string * name, DeclarationNode * params, DeclarationNode * asserts );
    236         static DeclarationNode * newTraitUse( std::string * name, ExpressionNode * params );
     229        static DeclarationNode * newTypeParam( TypeClass, std::string * );
     230        static DeclarationNode * newTrait( const std::string * name, DeclarationNode * params, DeclarationNode * asserts );
     231        static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params );
    237232        static DeclarationNode * newTypeDecl( std::string * name, DeclarationNode * typeParams );
    238233        static DeclarationNode * newPointer( DeclarationNode * qualifiers );
     
    249244        DeclarationNode * clone() const;
    250245
    251         DeclarationNode * addQualifiers( DeclarationNode *);
     246        DeclarationNode * addQualifiers( DeclarationNode * );
    252247        void checkQualifiers( const TypeData *, const TypeData * );
    253         void checkStorageClasses( DeclarationNode *q );
    254         DeclarationNode * copyStorageClasses( DeclarationNode *);
    255         DeclarationNode * addType( DeclarationNode *);
     248        void checkStorageClasses( DeclarationNode * );
     249        DeclarationNode * copyStorageClasses( DeclarationNode * );
     250        DeclarationNode * addType( DeclarationNode * );
    256251        DeclarationNode * addTypedef();
    257         DeclarationNode * addAssertions( DeclarationNode *);
    258         DeclarationNode * addName( std::string *);
     252        DeclarationNode * addAssertions( DeclarationNode * );
     253        DeclarationNode * addName( std::string * );
    259254        DeclarationNode * addBitfield( ExpressionNode * size );
    260255        DeclarationNode * addVarArgs();
     
    270265
    271266        DeclarationNode * cloneType( std::string * newName );
    272         DeclarationNode * cloneType( DeclarationNode * existing );
    273         DeclarationNode * cloneType( int ) { return cloneType( ( std::string *)0 ); }
    274         DeclarationNode * cloneBaseType( std::string * newName );
    275267        DeclarationNode * cloneBaseType( DeclarationNode * newdecl );
    276268
     
    286278
    287279        bool get_hasEllipsis() const;
    288         const std::string &get_name() const { return name; }
    289280        LinkageSpec::Spec get_linkage() const { return linkage; }
    290281        DeclarationNode * extractAggregate() const;
     
    295286        DeclarationNode * set_extension( bool exten ) { extension = exten; return this; }
    296287  public:
    297         // StorageClass buildStorageClass() const;
    298         // bool buildFuncSpecifier( StorageClass key ) const;
    299 
    300288        struct Variable_t {
     289                const std::string * name;
    301290                DeclarationNode::TypeClass tyClass;
    302                 std::string name;
    303291                DeclarationNode * assertions;
    304292        };
     
    306294
    307295        struct Attr_t {
    308                 std::string name;
     296                const std::string * name;
    309297                ExpressionNode * expr;
    310298                DeclarationNode * type;
     
    315303
    316304        TypeData * type;
    317         std::string name;
    318305        StorageClass storageClass;
    319306        bool isInline, isNoreturn;
     
    331318
    332319Type * buildType( TypeData * type );
    333 //Type::Qualifiers buildQualifiers( const TypeData::Qualifiers & qualifiers );
    334320
    335321static inline Type * maybeMoveBuildType( const DeclarationNode * orig ) {
     
    393379Statement * build_finally( StatementNode * stmt );
    394380Statement * build_compound( StatementNode * first );
    395 Statement * build_asmstmt( bool voltile, ConstantExpr * instruction, ExpressionNode * output = 0, ExpressionNode * input = 0, ExpressionNode * clobber = 0, LabelNode * gotolabels = 0 );
     381Statement * build_asmstmt( bool voltile, ConstantExpr * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
    396382
    397383//##############################################################################
Note: See TracChangeset for help on using the changeset viewer.