Changeset 65197c2 for src/SynTree


Ignore:
Timestamp:
Dec 5, 2017, 2:17:17 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
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, stuck-waitfor-destruct, with_gc
Children:
971d9f2, a85e44c, c13e8dc8
Parents:
12d2dc8 (diff), 866f560 (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/SynTree
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Mutator.cc

    r12d2dc8 r65197c2  
    203203}
    204204
     205Statement * Mutator::mutate( WithStmt * withStmt ) {
     206        mutateAll( withStmt->exprs, *this );
     207        withStmt->stmt = maybeMutate( withStmt->stmt, *this );
     208        return withStmt;
     209}
     210
    205211NullStmt * Mutator::mutate( NullStmt *nullStmt ) {
    206212        return nullStmt;
  • src/SynTree/Mutator.h

    r12d2dc8 r65197c2  
    5050        virtual Statement * mutate( FinallyStmt * catchStmt );
    5151        virtual Statement * mutate( WaitForStmt * waitforStmt );
     52        virtual Statement * mutate( WithStmt * withStmt );
    5253        virtual NullStmt * mutate( NullStmt * nullStmt );
    5354        virtual Statement * mutate( DeclStmt * declStmt );
  • src/SynTree/ReferenceToType.cc

    r12d2dc8 r65197c2  
    7070bool StructInstType::isComplete() const { return baseStruct ? baseStruct->has_body() : false; }
    7171
     72AggregateDecl * StructInstType::getAggr() { return baseStruct; }
     73
    7274void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
    7375        assert( baseStruct );
     
    101103
    102104bool UnionInstType::isComplete() const { return baseUnion ? baseUnion->has_body() : false; }
     105
     106AggregateDecl * UnionInstType::getAggr() { return baseUnion; }
    103107
    104108void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
  • src/SynTree/Statement.cc

    r12d2dc8 r65197c2  
    456456}
    457457
     458
     459WithStmt::WithStmt( const std::list< Expression * > & exprs, Statement * stmt ) : Statement(), exprs( exprs ), stmt( stmt ) {}
     460WithStmt::WithStmt( const WithStmt & other ) : Statement( other ), stmt( maybeClone( other.stmt ) ) {
     461        cloneAll( other.exprs, exprs );
     462}
     463WithStmt::~WithStmt() {
     464        deleteAll( exprs );
     465        delete stmt;
     466}
     467
     468void WithStmt::print( std::ostream & os, Indenter indent ) const {
     469        os << "With statement" << endl;
     470        os << indent << "... with statement:" << endl << indent+1;
     471        stmt->print( os, indent+1 );
     472}
     473
     474
    458475NullStmt::NullStmt( const std::list<Label> & labels ) : Statement( labels ) {
    459476}
  • src/SynTree/Statement.h

    r12d2dc8 r65197c2  
    431431};
    432432
     433class WithStmt : public Statement {
     434public:
     435        std::list< Expression * > exprs;
     436        Statement * stmt;
     437
     438        WithStmt( const std::list< Expression * > & exprs, Statement * stmt );
     439        WithStmt( const WithStmt & other );
     440        virtual ~WithStmt();
     441
     442        virtual WithStmt * clone() const override { return new WithStmt( *this ); }
     443        virtual void accept( Visitor & v ) override { v.visit( this ); }
     444        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     445        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     446};
     447
    433448
    434449// represents a declaration that occurs as part of a compound statement
  • src/SynTree/SynTree.h

    r12d2dc8 r65197c2  
    5555class FinallyStmt;
    5656class WaitForStmt;
     57class WithStmt;
    5758class NullStmt;
    5859class DeclStmt;
  • src/SynTree/Type.h

    r12d2dc8 r65197c2  
    178178        virtual bool isComplete() const { return true; }
    179179
     180        virtual AggregateDecl * getAggr() {     assertf( false, "Non-aggregate type: %s", toString( this ).c_str() ); }
     181
    180182        virtual Type *clone() const = 0;
    181183        virtual void accept( Visitor & v ) = 0;
     
    405407        virtual bool isComplete() const override;
    406408
     409        virtual AggregateDecl * getAggr() override;
     410
    407411        /// Looks up the members of this struct named "name" and places them into "foundDecls".
    408412        /// Clones declarations into "foundDecls", caller responsible for freeing
     
    436440
    437441        virtual bool isComplete() const override;
     442
     443        virtual AggregateDecl * getAggr() override;
    438444
    439445        /// looks up the members of this union named "name" and places them into "foundDecls"
  • src/SynTree/Visitor.cc

    r12d2dc8 r65197c2  
    174174}
    175175
    176 void Visitor::visit( __attribute__((unused)) NullStmt *nullStmt ) {
     176void Visitor::visit( WithStmt * withStmt ) {
     177        acceptAll( withStmt->exprs, *this );
     178        maybeAccept( withStmt->stmt, *this );
     179}
     180
     181void Visitor::visit( NullStmt * ) {
    177182}
    178183
  • src/SynTree/Visitor.h

    r12d2dc8 r65197c2  
    5252        virtual void visit( FinallyStmt * finallyStmt );
    5353        virtual void visit( WaitForStmt * waitforStmt );
     54        virtual void visit( WithStmt * withStmt );
    5455        virtual void visit( NullStmt * nullStmt );
    5556        virtual void visit( DeclStmt * declStmt );
Note: See TracChangeset for help on using the changeset viewer.