symtype.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 1,407 行 · 第 1/5 页

H
1,407
字号
    TF1_VISITED         = 0x80000000,               // used temporarily in traversals
    TF1_STDOP           = 0x00000001,               // TYP_VOID for Std Ops
    TF1_STDOP_ARITH     = 0x00000002,               // TYP_VOID for arith Std Ops
    TF1_USED            = 0x00000001,               // TYP_GENERIC

    /* used (during parsing) to quietly change __huge to __far for the 386 */
#if _CPU == 8086
    TF1_SET_HUGE        = TF1_HUGE,
#else
    TF1_SET_HUGE        = TF1_FAR,
#endif
    /* used (during parsing) to quietly change __far16 to __far for the 8086 */
#if _CPU == 386
    TF1_SET_FAR16       = TF1_FAR16,
#else
    TF1_SET_FAR16       = TF1_FAR,
#endif

    /* multi-bit constants */
    TF1_MOD_IGNORE      = ( TF1_COMMON          // ignored during type comparison
                          | TF1_IN_MEM
                          ),
    TF1_FN_IGNORE       = ( TF1_INLINE          // ignored during type comparison
                          | TF1_VIRTUAL
                          | TF1_STACK_CHECK
                          | TF1_LOADDS
                          | TF1_INTRINSIC
                          | TF1_NAKED
                          | TF1_PURE
                          | TF1_EXPLICIT
                          ),
    TF1_FN_THUNK_KEEP   = ( TF1_PLUSPLUS        // fn-mods to keep when making
                          | TF1_LOADDS          // a thunk function for it
                          | TF1_SAVEREGS
                          | TF1_STACK_CHECK
                          ),
    TF1_MPTR_REMOVE     = ( TF1_MUTABLE         // flags to remove when creating
                          | TF1_DLLEXPORT
                          ),                    // the base type of a member ptr
    TF1_FN_MEMBER       = ( TF1_SAVEREGS        // allowable fn-modifiers for
                          | TF1_LOADDS          // member functions
                          ),
    TF1_FN_PERMANENT    = ( TF1_PLUSPLUS        // when combining two function
                          ),                    // types, these flags in the
                                                // original cannot change
    TF1_FN_CANT_ADD_LATER=( TF1_VIRTUAL         // flags that cannot be added
                          | TF1_PURE            // in subsequent declarations
                          | TF1_EXPLICIT
                          ),
    TF1_CV_MASK         = ( TF1_CONST
                          | TF1_VOLATILE
                          ),
    TF1_STAY_MEMORY     = ( TF1_VOLATILE        // object should not be in reg
                          | TF1_IN_MEM
                          ),
    TF1_MEM_MODEL       = ( TF1_NEAR
                          | TF1_FAR
                          | TF1_FAR16
                          | TF1_HUGE
                          | TF1_BASED
                          ),
    TF1_THIS_MASK       = ( TF1_CV_MASK         // relevant for "this" qualifier
                          | TF1_UNALIGNED
                          | TF1_MEM_MODEL
                          ),
    TF1_DISPLAY         = ( TF1_CV_MASK         // visible during type formatting
                          | TF1_MUTABLE
                          | TF1_UNALIGNED
                          | TF1_DLLIMPORT
                          | TF1_THREAD
                          | TF1_DLLEXPORT
                          | TF1_MEM_MODEL
                          ),
    TF1_OK_FOR_VAR      = ( TF1_DLLEXPORT ),    // mods that like to modify fns
                                                // but are OK for vars
    TF1_OK_FOR_AUTO     = ( TF1_CONST           // mods that can be used for
                          | TF1_VOLATILE        // auto vars
                          | TF1_IN_MEM ),
    TF1_MOD_MOVE        = ( TF1_DLLEXPORT       // mods that can move past fn
                          | TF1_MEM_MODEL       // and array declarators
                          ),
    TF1_MOD_MEMBER      = ( TF1_DLLEXPORT       // allowable modifiers for
                          | TF1_THREAD          // all members
                          | TF1_DLLIMPORT
                          ),
#if _CPU == 8086
    TF1_DEFAULT_FAR     = ( TF1_DLLEXPORT       // mods that cause default far
                          | TF1_DLLIMPORT       // to be used for the mem modifier
                          ),
#else
    TF1_DEFAULT_FAR     = TF1_FAR,
#endif
    TF1_MOD_OMIT_LATER  = ( TF1_DLLEXPORT       // modifiers that can be spec'd
                          | TF1_THREAD          // once but don't have to be
                          | TF1_DLLIMPORT       // repeated in redeclarations
                          ),
    TF1_MOD_ADD_LATER   = ( TF1_DLLEXPORT       // modifiers that can be added
                          ),                    // in subsequent declarations
                                                // (uses of this in decl.c must
                                                //  be fixed if TF1_MEM_MODEL
                                                //  is added to this mask)

    TF1_NULL            = 0x00000000
} type_flag;

/*
    These bits control access to the two fields in the 'dbg_info'
    structure, namely, 'dwh' and 'type'.
*/
typedef enum {                                  // for dbg field
    TF2_DWARF_DEF       = 0x01,                 // dwarf is defined
    TF2_DWARF_FWD       = 0x02,                 // dwarf is forward ref
    TF2_SYMDBG          = 0x04,                 // Watcom/CV4 info stored
    TF2_HASH            = 0x08,                 // used for type hash value
    TF2_DBG_IN_PCH      = 0x10,                 // type is in PCH (affects dbg info)
    TF2_PCH_DBG_EXTERN  = 0x20,                 // dwarf handle is in pch_handle

    TF2_DWARF           = ( TF2_DWARF_DEF       // contains dwarf handle
                          | TF2_DWARF_FWD ),
    TF2_NON_SYMDBG      = ( TF2_DWARF           // symdbg is not active
                          | TF2_HASH ),         // if these are on
    TF2_NULL            = 0x00
} type_dbgflag;

typedef PCH_struct {            /* used for keeping track of function arguments */
    unsigned    num_args;
    type_flag   qualifier;
    int         : 0;
    TYPE        *except_spec;   /* (NULL==...) array of types (NULL terminated) */
    TYPE        type_list[1];
} arg_list;

#define AUTO_ARG_MAX 16         // # arg.s in temporary structs

typedef struct                  // TEMP_ARG_LIST
{   arg_list base;              // - base
    TYPE array[ AUTO_ARG_MAX-1];// - default # (1 in arg_list)
} TEMP_ARG_LIST;

typedef PTREE TEMP_PT_LIST[ AUTO_ARG_MAX ]; // TEMP_PT_LIST

//
// list of comparisons to exclude in TypeCompareExclude
//
typedef enum {
    TC1_NOT_ENUM_CHAR   = 0x0001,       // don't exclude enum and char
    TC1_PTR_FUN         = 0x0002,       // ignore function vs. ptr to function
    TC1_FUN_LINKAGE     = 0x0004,       // ignore function linkage
    TC1_NOT_MEM_MODEL   = 0x0008,       // ignore default memory model
    TC1_NULL            = 0x0000
} type_exclude;

PCH_struct friend_list {
    FRIEND              *next;          // - next in ring
    SYMBOL              sym;            // - friendly symbol
};

struct reloc_list {
    RELOC_LIST *next;
    SYMBOL orig;
    SYMBOL dest;
};

typedef enum {
    IN_PRIVATE          = 0x0001,       // base access specifier
    IN_PROTECTED        = 0x0002,
    IN_PUBLIC           = 0x0004,       // used to catch duplicates
    IN_VIRTUAL          = 0x0008,       // direct virtual base
    IN_INDIRECT_VIRTUAL = 0x0010,       // indirect virtual base
    IN_USING_VF_INDICES = 0x0020,       // we are reusing this base's vfn indices
    IN_DIRECT           = 0x0040,       // base is a direct base
    IN_LATTICE          = 0x0080,       // lattice structure has been formed
    IN_CTOR_DISP        = 0x0100,       // base class has ctor-disp allocated
    IN_FREE             = 0x8000,       // used for precompiled headers
    IN_ACCESS_SPECIFIED = ( IN_PROTECTED
                          | IN_PUBLIC
                          | IN_PRIVATE ),
    IN_IS_VIRTUAL       = ( IN_VIRTUAL
                          | IN_INDIRECT_VIRTUAL ),
    IN_NULL             = 0x0000
} inherit_flag;

typedef enum                            // PC_CALLIMPL -- PC call implementations
{   CALL_IMPL_CPP                       // - normal C++, not ellipsis
,   CALL_IMPL_C                         // - normal C, not ellipsis
,   CALL_IMPL_REV_CPP                   // - reversed, C++
,   CALL_IMPL_REV_C                     // - reversed, C
,   CALL_IMPL_ELL_CPP                   // - ellipsis, C++
,   CALL_IMPL_ELL_C                     // - ellipsis, extern "C"
} PC_CALLIMPL;

typedef uint_32     dbg_handle;

typedef struct {
    dbg_handle      handle;             // debug info handle
    dbg_handle      pch_handle;         // debug info handle from PCH
} dbg_info;

PCH_struct base_class {
    BASE_CLASS          *next;
    TYPE                type;           // base class type
    target_offset_t     delta;          // offset within this class
    uint_16             vb_index;       // index into virtual base table
    inherit_flag        flag;           // inheritance flags
};

#define _IsIndirectVirtualBase( b ) \
        (((b)->flag & IN_INDIRECT_VIRTUAL) != 0 )
#define _IsDirectVirtualBase( b ) \
        (((b)->flag & IN_VIRTUAL) != 0 )
#define _IsDirectNonVirtualBase( b ) \
        (((b)->flag & IN_IS_VIRTUAL) == 0 )
#define _IsVirtualBase( b )     \
        (((b)->flag & IN_IS_VIRTUAL) != 0 )
#define _IsDirectBase( b )      \
        (((b)->flag & IN_DIRECT) != 0 )
#define _UsingVFIndices( b )      \
        (((b)->flag & IN_USING_VF_INDICES) != 0 )

typedef PCH_struct {
    BASE_CLASS      *bases;         // base classes
    FRIEND          *friends;       // ring of friends
    char            *name;          // name of class
    CDOPT_CACHE     *cdopt_cache;   // CDOPT info cache
    TYPE            class_mod;      // type representing class <mods> X mods
    CGREFNO         refno;          // code-generator ref #
    dbg_handle      dbg_no_vbases;  // for Watcom -d2 info
    target_offset_t size;           // size of class (including vbases)
    target_offset_t vsize;          // size of class (excluding vbases)
    target_offset_t vb_offset;      // offset of vbptr field
    target_offset_t vf_offset;      // offset of vfptr field
    uint_16         last_vfn;       // last virtual function index def'd
    uint_16         last_vbase;     // last virtual base index def'd
    uint_16         index;          // class unique ordering index
    uint_8          max_align;      // maximum alignment of fields

    int             : 0;

    unsigned        defined : 1;    // class is defined fully
    unsigned        opened : 1;     // class defn has been started
    unsigned        unnamed : 1;    // cannot have ctors, dtors, etc.
    unsigned        corrupted : 1;  // errors occurred during declaration!
    unsigned        abstract : 1;   // contains pure virtual functions
    unsigned        abstract_OK : 1;// abstract flag is set properly
    unsigned        anonymous : 1;  // class is an anonymous union/struct
    unsigned        has_def_opeq : 1; // has an explicit default operator=

    unsigned        has_ctor : 1;   // has an explicit constructor
    unsigned        has_dtor : 1;   // has an explicit dtor
    unsigned        has_pure : 1;   // has an explicit pure fn
    unsigned        has_vfptr : 1;  // has a vfptr field
    unsigned        has_vbptr : 1;  // has a vbptr field
    unsigned        has_data : 1;   // contains non-static data members
    unsigned        has_vfn : 1;    // contains virtual functions
    unsigned        has_vcdtor : 1; // contains an explicit ctor/dtor in
                                    // the presence of virtual functions

    unsigned        ctor_defined :1;// default ctor defined
    unsigned        copy_defined :1;// default copy ctor defined
    unsigned        dtor_defined :1;// default dtor defined
    unsigned        assign_defined:1;// default assignment defined
    unsigned        ctor_gen : 1;   // default ctor generated
    unsigned        copy_gen : 1;   // default copy ctor generated
    unsigned        dtor_gen : 1;   // default dtor generated
    unsigned        assign_gen : 1; // default assign generated

    unsigned        ctor_user_code : 1;   // ctor has user code
    unsigned        copy_user_code : 1;   // copy has user code
    unsigned        dtor_user_code : 1;   // dtor has user code
    unsigned        assign_user_code : 1; // assign has user code
    unsigned        ctor_user_code_checked : 1; // ctor_user_code was checked
    unsigned        copy_user_code_checked : 1; // copy_user_code was checked
    unsigned        dtor_user_code_checked : 1; // dtor_user_code was checked
    unsigned        assign_user_code_checked: 1;// assign_user_code was checked

    unsigned        needs_ctor : 1; // must be constructed
    unsigned        needs_dtor : 1; // must be destructed
    unsigned        needs_vdtor : 1;// must have a virtual destructor
    unsigned        needs_assign : 1;// must be assigned with op=
    unsigned        const_copy : 1; // copy ctor takes const C &
    unsigned        const_assign :1;// assignment takes const C &
    unsigned        const_ref : 1;  // contains a const or reference member

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?