Exemple #1
0
void CgFrontScopeCall(          // GENERATE IC_SCOPE_CALL, IF REQ'D
    SYMBOL fun,                 // - function called
    SYMBOL dtor,                // - dtor, when function is ctor
    DTOR_KIND kind )            // - kind of dtoring
{
    boolean keep_scope;         // - TRUE ==> keep the current scope

    keep_scope = FALSE;
    if( dtor != NULL ) {
        switch( kind ) {
          case DTORING_SCOPE :
            CgFrontCodePtr( IC_SCOPE_CALL_BDTOR, dtor );
            keep_scope = TRUE;
            break;
          case DTORING_TEMP :
            CgFrontCodePtr( IC_SCOPE_CALL_TDTOR, dtor );
            break;
          case DTORING_COMPONENT :
            CgFrontCodePtr( IC_SCOPE_CALL_CDTOR, dtor );
            keep_scope = TRUE;
            break;
          DbgDefault( "CgFrontScopeCall -- bad DTOR_KIND" );
        }
    }
    if( fun != NULL && ( fun->flag & SF_NO_LONGJUMP ) ) {
        fun = NULL;
    }
    if( fun != NULL || dtor != NULL ) {
        CgFrontCodePtr( IC_SCOPE_CALL_FUN, fun );
    }
    if( keep_scope ) {
        ScopeKeep( GetCurrScope() );
    }
}
Exemple #2
0
void ModuleInitInit(            // START MODULE-INITIALIZATION FUNCTION
    void )
{
    SYMBOL module_init;         // - SYMBOL for mod-init. function
    SCOPE curr_scope;           // - current scope
    TYPE fn_type;               // - type for init function

    curr_scope = moduleInitSave();
    fn_type = TypeVoidFunOfVoid();
    module_init = SymCreateFileScope( fn_type
                                    , SC_STATIC
                                    , 0
                                    , CppSpecialName( SPECIAL_INIT_FUNCTION ) );
    module_init_func = module_init;
    SetCurrScope(GetFileScope());
    ScopeBeginFunction( module_init );
    FunctionBodyStartup( module_init, &module_fd, FUNC_NULL );
    module_fd.retn_opt = false;
    module_init_scope = GetCurrScope();
    ScopeKeep( module_init_scope );
    moduleInitRestore( curr_scope );
}