Changeset 02af79b0 for src/Common


Ignore:
Timestamp:
May 9, 2019, 4:47:53 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
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, stuck-waitfor-destruct
Children:
b038fe4
Parents:
ec28948 (diff), db27767 (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/Common
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Common/Assert.cc

    rec28948 r02af79b0  
    3939}
    4040
     41void abort(const char *fmt, ... ) noexcept __attribute__((noreturn, format(printf, 1, 2)));
     42void abort(const char *fmt, ... ) noexcept {
     43        va_list args;
     44        va_start( args, fmt );
     45        vfprintf( stderr, fmt, args );
     46        va_end( args );
     47        fprintf( stderr, "\n" );
     48        abort();
     49}
     50
    4151// Local Variables: //
    4252// tab-width: 4 //
  • src/Common/PassVisitor.h

    rec28948 r02af79b0  
    44
    55#include <stack>
     6#include <type_traits>
    67
    78#include "Common/Stats.h"
     
    301302
    302303
    303         TypeSubstitution **             get_env_ptr    () { return env_impl             ( pass, 0); }
     304        auto                                    get_env_ptr    () -> decltype(env_impl( pass, 0)) { return env_impl( pass, 0); }
    304305        std::list< Statement* > *       get_beforeStmts() { return stmtsToAddBefore_impl( pass, 0); }
    305306        std::list< Statement* > *       get_afterStmts () { return stmtsToAddAfter_impl ( pass, 0); }
     
    348349};
    349350
     351class WithConstTypeSubstitution {
     352protected:
     353        WithConstTypeSubstitution() = default;
     354        ~WithConstTypeSubstitution() = default;
     355
     356public:
     357        const TypeSubstitution * env = nullptr;
     358};
     359
    350360class WithStmtsToAdd {
    351361protected:
  • src/Common/PassVisitor.impl.h

    rec28948 r02af79b0  
    2020
    2121#define MUTATE_END( type, node )                \
    22         return call_postmutate< type * >( node ); \
     22        auto __return = call_postmutate< type * >( node ); \
     23        assert( __return ); \
     24        return __return;
    2325
    2426
     
    253255
    254256        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
    255         ValueGuardPtr< TypeSubstitution * >  oldEnv        ( get_env_ptr    () );
     257        ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
    256258        ValueGuardPtr< DeclList_t >          oldBeforeDecls( get_beforeDecls() );
    257259        ValueGuardPtr< DeclList_t >          oldAfterDecls ( get_afterDecls () );
     
    19951997
    19961998        // don't want statements from outer CompoundStmts to be added to this StmtExpr
    1997         ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
     1999        ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
    19982000        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
    19992001        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
     
    20122014
    20132015        // don't want statements from outer CompoundStmts to be added to this StmtExpr
    2014         ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
     2016        ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
    20152017        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
    20162018        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
  • src/Common/PassVisitor.proto.h

    rec28948 r02af79b0  
    165165static inline type * name##_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) long unused ) { return nullptr;}    \
    166166
    167 FIELD_PTR( TypeSubstitution *, env )
     167FIELD_PTR( const TypeSubstitution *, env )
    168168FIELD_PTR( std::list< Statement* >, stmtsToAddBefore )
    169169FIELD_PTR( std::list< Statement* >, stmtsToAddAfter  )
     
    174174FIELD_PTR( PassVisitor<pass_type> * const, visitor )
    175175
     176#undef FIELD_PTR
     177
    176178//---------------------------------------------------------
    177179// Indexer
Note: See TracChangeset for help on using the changeset viewer.