Changeset 54dd994 for src/AST


Ignore:
Timestamp:
Jun 24, 2019, 10:30:47 AM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
84917e2
Parents:
3c6e417 (diff), 9e0a360 (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/AST
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.hpp

    r3c6e417 r54dd994  
    248248        AddressExpr( const CodeLocation & loc, const Expr * a );
    249249
     250        /// Generate AddressExpr wrapping given expression at same location
     251        AddressExpr( const Expr * a ) : AddressExpr( a->location, a ) {}
     252
    250253        const Expr * accept( Visitor & v ) const override { return v.visit( this ); }
    251254private:
     
    281284        /// Cast-to-void
    282285        CastExpr( const CodeLocation & loc, const Expr * a, GeneratedFlag g = GeneratedCast );
     286
     287        /// Wrap a cast expression around an existing expression (always generated)
     288        CastExpr( const Expr * a, const Type * to ) : CastExpr( a->location, a, to, GeneratedCast ) {}
     289
     290        /// Wrap a cast-to-void expression around an existing expression (always generated)
     291        CastExpr( const Expr * a ) : CastExpr( a->location, a, GeneratedCast ) {}
    283292
    284293        const Expr * accept( Visitor & v ) const override { return v.visit( this ); }
  • src/AST/Init.hpp

    r3c6e417 r54dd994  
    5555        ConstructFlag maybeConstructed;
    5656
    57         Init( const CodeLocation& loc, ConstructFlag mc ) : ParseNode( loc ), maybeConstructed( mc ) {}
     57        Init( const CodeLocation & loc, ConstructFlag mc ) : ParseNode( loc ), maybeConstructed( mc ) {}
    5858
    59         const Init * accept( Visitor& v ) const override = 0;
     59        const Init * accept( Visitor & v ) const override = 0;
    6060private:
    6161        Init * clone() const override = 0;
     
    6969        ptr<Expr> value;
    7070
    71         SingleInit( const CodeLocation& loc, Expr* val, ConstructFlag mc = DoConstruct )
     71        SingleInit( const CodeLocation & loc, const Expr * val, ConstructFlag mc = DoConstruct )
    7272        : Init( loc, mc ), value( val ) {}
    7373
     
    8787        std::vector<ptr<Designation>> designations;
    8888
    89         ListInit( const CodeLocation& loc, std::vector<ptr<Init>>&& is,
    90                 std::vector<ptr<Designation>>&& ds = {}, ConstructFlag mc = DoConstruct );
     89        ListInit( const CodeLocation & loc, std::vector<ptr<Init>> && is,
     90                std::vector<ptr<Designation>> && ds = {}, ConstructFlag mc = DoConstruct );
    9191
    9292        using iterator = std::vector<ptr<Init>>::iterator;
     
    114114        ptr<Init> init;
    115115
    116         ConstructorInit( const CodeLocation& loc, Stmt* ctor, Stmt* dtor, Init* init )
     116        ConstructorInit(
     117                const CodeLocation & loc, const Stmt * ctor, const Stmt * dtor, const Init * init )
    117118        : Init( loc, DoConstruct ), ctor( ctor ), dtor( dtor ), init( init ) {}
    118119
  • src/AST/Node.hpp

    r3c6e417 r54dd994  
    1717
    1818#include <cassert>
     19#include <cstddef>     // for nullptr_t
    1920#include <iosfwd>
    2021#include <type_traits> // for remove_reference
     
    181182        }
    182183
     184        ptr_base & operator=( std::nullptr_t ) {
     185                if ( node ) _dec(node);
     186                node = nullptr;
     187                return *this;
     188        }
     189
    183190        ptr_base & operator=( const ptr_base & o ) {
    184191                assign(o.node);
  • src/AST/Stmt.hpp

    r3c6e417 r54dd994  
    6161        CompoundStmt( CompoundStmt&& o ) = default;
    6262
    63         void push_back( Stmt * s ) { kids.emplace_back( s ); }
    64         void push_front( Stmt * s ) { kids.emplace_front( s ); }
     63        void push_back( const Stmt * s ) { kids.emplace_back( s ); }
     64        void push_front( const Stmt * s ) { kids.emplace_front( s ); }
    6565
    6666        const CompoundStmt * accept( Visitor & v ) const override { return v.visit( this ); }
     
    143143
    144144        IfStmt( const CodeLocation & loc, const Expr * cond, const Stmt * thenPart,
    145                 Stmt * const elsePart, std::vector<ptr<Stmt>> && inits,
     145                const Stmt * elsePart = nullptr, std::vector<ptr<Stmt>> && inits = {},
    146146                std::vector<Label> && labels = {} )
    147147        : Stmt(loc, std::move(labels)), cond(cond), thenPart(thenPart), elsePart(elsePart),
Note: See TracChangeset for help on using the changeset viewer.