Ignore:
Timestamp:
May 16, 2019, 6:51:18 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
8ff178d, d66e7b7
Parents:
9b4f329 (diff), 6f8e87d (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/AST/Pass.impl.hpp

    r9b4f329 r246c245  
    1919#include <type_traits>
    2020#include <unordered_map>
     21
     22#include "AST/TypeSubstitution.hpp"
    2123
    2224#define VISIT_START( node ) \
     
    462464        VISIT({
    463465                guard_indexer guard { * this };
    464                 maybe_accept( node, &StructDecl::parameters );
    465                 maybe_accept( node, &StructDecl::members    );
     466                maybe_accept( node, &StructDecl::params );
     467                maybe_accept( node, &StructDecl::members );
    466468        })
    467469
     
    483485        VISIT({
    484486                guard_indexer guard { * this };
    485                 maybe_accept( node, &UnionDecl::parameters );
    486                 maybe_accept( node, &UnionDecl::members    );
     487                maybe_accept( node, &UnionDecl::params );
     488                maybe_accept( node, &UnionDecl::members );
    487489        })
    488490
     
    502504        VISIT(
    503505                // unlike structs, traits, and unions, enums inject their members into the global scope
    504                 maybe_accept( node, &EnumDecl::parameters );
    505                 maybe_accept( node, &EnumDecl::members    );
     506                maybe_accept( node, &EnumDecl::params );
     507                maybe_accept( node, &EnumDecl::members );
    506508        )
    507509
     
    517519        VISIT({
    518520                guard_indexer guard { *this };
    519                 maybe_accept( node, &TraitDecl::parameters );
    520                 maybe_accept( node, &TraitDecl::members    );
     521                maybe_accept( node, &TraitDecl::params );
     522                maybe_accept( node, &TraitDecl::members );
    521523        })
    522524
     
    534536        VISIT({
    535537                guard_indexer guard { *this };
    536                 maybe_accept( node, &TypeDecl::parameters );
    537                 maybe_accept( node, &TypeDecl::base       );
     538                maybe_accept( node, &TypeDecl::params );
     539                maybe_accept( node, &TypeDecl::base   );
    538540        })
    539541
     
    563565        VISIT({
    564566                guard_indexer guard { *this };
    565                 maybe_accept( node, &TypedefDecl::parameters );
    566                 maybe_accept( node, &TypedefDecl::base       );
     567                maybe_accept( node, &TypedefDecl::params );
     568                maybe_accept( node, &TypedefDecl::base   );
    567569        })
    568570
     
    688690                maybe_accept( node, &WhileStmt::body  );
    689691        })
     692
     693        VISIT_END( Stmt, node );
     694}
     695
     696//--------------------------------------------------------------------------
     697// ForStmt
     698template< typename pass_t >
     699const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ForStmt * node ) {
     700        VISIT_START( node );
     701
     702        VISIT({
     703                // for statements introduce a level of scope (for the initialization)
     704                guard_indexer guard { *this };
     705                maybe_accept( node, &ForStmt::inits );
     706                maybe_accept( node, &ForStmt::cond  );
     707                maybe_accept( node, &ForStmt::inc   );
     708                maybe_accept( node, &ForStmt::body  );
     709        })
     710
     711        VISIT_END( Stmt, node );
     712}
     713
     714//--------------------------------------------------------------------------
     715// SwitchStmt
     716template< typename pass_t >
     717const ast::Stmt * ast::Pass< pass_t >::visit( const ast::SwitchStmt * node ) {
     718        VISIT_START( node );
     719
     720        VISIT(
     721                maybe_accept( node, &SwitchStmt::cond  );
     722                maybe_accept( node, &SwitchStmt::stmts );
     723        )
     724
     725        VISIT_END( Stmt, node );
     726}
     727
     728//--------------------------------------------------------------------------
     729// CaseStmt
     730template< typename pass_t >
     731const ast::Stmt * ast::Pass< pass_t >::visit( const ast::CaseStmt * node ) {
     732        VISIT_START( node );
     733
     734        VISIT(
     735                maybe_accept( node, &CaseStmt::cond  );
     736                maybe_accept( node, &CaseStmt::stmts );
     737        )
     738
     739        VISIT_END( Stmt, node );
     740}
     741
     742//--------------------------------------------------------------------------
     743// BranchStmt
     744template< typename pass_t >
     745const ast::Stmt * ast::Pass< pass_t >::visit( const ast::BranchStmt * node ) {
     746        VISIT_START( node );
     747        VISIT_END( Stmt, node );
     748}
     749
     750//--------------------------------------------------------------------------
     751// ReturnStmt
     752template< typename pass_t >
     753const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ReturnStmt * node ) {
     754        VISIT_START( node );
     755
     756        VISIT(
     757                maybe_accept( node, &ReturnStmt::expr );
     758        )
     759
     760        VISIT_END( Stmt, node );
     761}
     762
     763//--------------------------------------------------------------------------
     764// ThrowStmt
     765template< typename pass_t >
     766const ast::Stmt * ast::Pass< pass_t >::visit( const ast::ThrowStmt * node ) {
     767        VISIT_START( node );
     768
     769        VISIT(
     770                maybe_accept( node, &ThrowStmt::expr   );
     771                maybe_accept( node, &ThrowStmt::target );
     772        )
     773
     774        VISIT_END( Stmt, node );
     775}
     776
     777//--------------------------------------------------------------------------
     778// TryStmt
     779template< typename pass_t >
     780const ast::Stmt * ast::Pass< pass_t >::visit( const ast::TryStmt * node ) {
     781        VISIT_START( node );
     782
     783        VISIT(
     784                maybe_accept( node, &TryStmt::body     );
     785                maybe_accept( node, &TryStmt::handlers );
     786                maybe_accept( node, &TryStmt::finally  );
     787        )
    690788
    691789        VISIT_END( Stmt, node );
Note: See TracChangeset for help on using the changeset viewer.