Ignore:
Timestamp:
Jun 16, 2017, 12:01:25 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
1a42132
Parents:
816d61c (diff), 974bcdd (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 plg2:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.proto.h

    r816d61c rf13ee31  
    11#pragma once
     2
     3typedef std::function<void( void * )> cleanup_func_t;
     4
     5class guard_value_impl {
     6public:
     7        guard_value_impl() = default;
     8
     9        ~guard_value_impl() {
     10                while( !cleanups.empty() ) {
     11                        auto& cleanup = cleanups.top();
     12                        cleanup.func( cleanup.val );
     13                        cleanups.pop();
     14                }
     15        }
     16
     17        void push( cleanup_func_t && func, void* val ) {
     18                cleanups.emplace( std::move(func), val );
     19        }
     20
     21private:
     22        struct cleanup_t {
     23                cleanup_func_t func;
     24                void * val;
     25
     26                cleanup_t( cleanup_func_t&& func, void * val ) : func(func), val(val) {}
     27        };
     28
     29        std::stack< cleanup_t > cleanups;
     30};
     31
     32typedef std::function< void( cleanup_func_t, void * ) > at_cleanup_t;
    233
    334//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    73104#define FIELD_PTR( type, name )                                                                                                        \
    74105template<typename pass_type>                                                                                                           \
    75 static inline auto name##_impl( pass_type& pass, __attribute__((unused)) int unused ) -> decltype( &pass.name ) { return &pass.name; }  \
     106static inline auto name##_impl( pass_type& pass, __attribute__((unused)) int unused ) -> decltype( &pass.name ) { return &pass.name; } \
    76107                                                                                                                                       \
    77108template<typename pass_type>                                                                                                           \
     
    82113FIELD_PTR( std::list< Statement* >, stmtsToAddAfter  )
    83114FIELD_PTR( bool, skip_children )
     115FIELD_PTR( at_cleanup_t, at_cleanup )
Note: See TracChangeset for help on using the changeset viewer.