Changeset cb25fc9 for src/AST/Pass.hpp


Ignore:
Timestamp:
Oct 27, 2020, 3:26:27 PM (13 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
5d2db68
Parents:
342be43
Message:

Added to new ast mixin for checker whether it is inFunction or not

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.hpp

    r342be43 rcb25fc9  
    8888                if(visitor) {
    8989                        *const_cast<type **>( visitor ) = this;
     90                }
     91
     92                // After the pass is constructed, check if it wants to track the inFunction field
     93                const bool * const * infunc_ptr = __pass::infunc_ptr(core, 0);
     94                if(infunc_ptr) {
     95                        *const_cast<const bool **>( infunc_ptr ) = &this->inFunction;
    9096                }
    9197        }
     
    380386};
    381387
     388/// Used to track whether or not we are in a function.
     389class WithIsInFuncion {
     390        const bool * const __in_funct_ptr = nullptr;
     391
     392        template<typename core_t>
     393        friend class Pass;
     394public:
     395        bool isInFunction() {
     396                assert( __in_funct_ptr );
     397                return *__in_funct_ptr;
     398        }
     399};
     400
    382401/// Use when the templated visitor should update the symbol table
    383402struct WithSymbolTable {
Note: See TracChangeset for help on using the changeset viewer.