コード例 #1
0
static void typeSigAccessVar(   // ACCESS A DTOR, DEFAULT-CTOR, COPY-CTOR
    TYPE_SIG_ACCESS acc_var,    // - access type (variable)
    SYMBOL *a_sym,              // - addr[ symbol for item accessed ]
    ACCINFO *info )             // - access information
{
    SYMBOL sym;                 // - symbol for routine
    TYPE type;                  // - class type
    TOKEN_LOCN *err_locn;       // - error location
    boolean fill_out;           // - TRUE ==> fill out the entry

    sym = *a_sym;
    if( acc_var & info->acc ) {
        fill_out = info->acc & TSA_FILL_OUT;
        if( fill_out ) {
            SetCurrScope(info->class_scope);
        } else {
            SetCurrScope (info->access_scope);
        }
    } else {
        fill_out = TRUE;
        SetCurrScope(info->class_scope);
    }
    if( ( GetCurrScope() != info->class_scope ) || ( sym == NULL ) ) {
        type = info->type;
        err_locn = info->err_locn;
        switch( acc_var ) {
          case TSA_DTOR :
            sym = DtorFindLocn( type, err_locn );
            break;
          case TSA_DEFAULT_CTOR :
            sym = DefaultCtorFind( type, err_locn, fill_out );
            break;
          case TSA_COPY_CTOR :
            sym = CopyCtorFind( type, err_locn );
            break;
          default :
#ifndef NDEBUG
            CFatal( "typeSigAccessVar -- impossible type" );
#endif
            sym = NULL;
        }
        if( sym == NULL ) {
            if( ! fill_out ) {
                *info->err_occurred = TRUE;
            }
        } else {
            sym = ClassFunMakeAddressable( sym );
            sym->flag |= SF_ADDR_TAKEN;
            if( ! ( info->acc & TSA_NO_REF ) ) {
                if( acc_var & info->acc ) {
                    sym = SymMarkRefed( sym );
                }
            }
            *a_sym = sym;
            CDtorScheduleArgRemap( sym );
        }
    }
}
コード例 #2
0
SYMBOL CgBackOpDelete(          // GET ADDRESIBLE OPERATOR DELETE FOR A TYPE
    TYPE type )                 // - the type
{
    SEARCH_RESULT* result;      // - lookup result
    SYMBOL op_del;              // - operator delete

    result = ScopeFindNaked( TypeScope( type ), CppOperatorName( CO_DELETE ) );
    op_del = ClassFunMakeAddressable( result->sym_name->name_syms );
    ScopeFreeResult( result );
    return op_del;
}