Changeset 637568b for src/Common


Ignore:
Timestamp:
Jun 15, 2017, 3:33:32 PM (7 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, with_gc
Children:
7bd712d
Parents:
6e09f211
Message:

Added bases classes for pass visitor features

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.h

    r6e09f211 r637568b  
    253253}
    254254
     255class WithTypeSubstitution {
     256protected:
     257        WithTypeSubstitution() = default;
     258        ~WithTypeSubstitution() = default;
     259
     260        TypeSubstitution * env;
     261
     262        template<typename pass_type>
     263        friend class PassVisitor< pass_type>;
     264};
     265
     266class WithStmtsToAdd {
     267protected:
     268        WithStmtsToAdd() = default;
     269        ~WithStmtsToAdd() = default;
     270
     271        std::list< Statement* > stmtsToAddBefore;
     272        std::list< Statement* > stmtsToAddAfter;
     273
     274        template<typename pass_type>
     275        friend class PassVisitor< pass_type>;
     276};
     277
     278class WithShortCircuiting {
     279protected:
     280        WithShortCircuiting() = default;
     281        ~WithShortCircuiting() = default;
     282
     283        bool skip_children;
     284
     285        template<typename pass_type>
     286        friend class PassVisitor< pass_type>;
     287};
     288
     289class WithScopes {
     290protected:
     291        WithScopes() = default;
     292        ~WithScopes() = default;
     293
     294        at_cleanup_t at_cleanup;
     295
     296        void GuardValue( T& val ) {
     297                at_cleanup( [ val ]( void * newVal ) {
     298                        * static_cast< T * >( newVal ) = val;
     299                }, static_cast< void * >( & val ) );
     300        }
     301
     302        template<typename pass_type>
     303        friend class PassVisitor< pass_type>;
     304};
     305
     306
    255307#include "PassVisitor.impl.h"
Note: See TracChangeset for help on using the changeset viewer.