home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples1.exe / smc / symbol.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  25.3 KB  |  742 lines

  1. /*****************************************************************************/
  2. #ifndef _SYMBOL_H_
  3. #define _SYMBOL_H_
  4. /*****************************************************************************/
  5. #ifndef _ALLOC_H_
  6. #include "alloc.h"
  7. #endif
  8. /*****************************************************************************/
  9. #ifndef _TYPE_H_
  10. #include "type.h"
  11. #endif
  12. /*****************************************************************************/
  13.  
  14. struct DefSrcDsc
  15. {
  16.     scanPosTP       dsdBegPos;              // source filepos
  17.     unsigned        dsdSrcLno;              // source line
  18. //  unsigned        dsdSrcCol   :8;         // source column
  19. };
  20.  
  21. const
  22. unsigned            dlSkipBits = 16;
  23. const
  24. unsigned            dlSkipBig = (1 << (dlSkipBits - 1));
  25.  
  26. DEFMGMT
  27. class DefListRec
  28. {
  29. public:
  30.  
  31.     DefList         dlNext;
  32.     SymDef          dlComp;                 // containing comp-unit
  33.     DefSrcDsc       dlDef;                  // where the symbol is defined
  34.     UseList         dlUses;                 // list of "using" clauses
  35.  
  36.     unsigned        dlDeclSkip  :dlSkipBits;// typespec -> declarator "distance"
  37. #ifdef  DEBUG
  38.     unsigned        dlExtended  :1;         // is there a name/sym extension?
  39. #endif
  40.     unsigned        dlDefAcc    :3;         // default access level
  41.     unsigned        dlHasBase   :1;         // class/interface: is there a base?
  42.     unsigned        dlHasDef    :1;         // class/var/func : is there a body/init?
  43.     unsigned        dlQualified :1;         // is the name a qualified one?
  44.     unsigned        dlEarlyDecl :1;         // needs to be declared "early" ?
  45.     unsigned        dlOldStyle  :1;         // old-style declaration?
  46.     unsigned        dlIsCtor    :1;         // constructor member?
  47.     unsigned        dlIsOvlop   :1;         // constructor member?
  48.     unsigned        dlPrefixMods:1;         // prefix modifiers present?
  49.     unsigned        dlAnonUnion :1;         // anonymous union member?
  50.     unsigned        dlInstance  :1;         // instance of a generic type?
  51. };
  52.  
  53. DEFMGMT
  54. class MemListRec : public DefListRec
  55. {
  56. public:
  57.  
  58.     SymDef          mlSym;                  // symbol (if known)
  59.  
  60.     union
  61.     {
  62.         Ident           mlName;             // name of symbol (simple)
  63.         QualName        mlQual;             // name of symbol (qualified)
  64.     };
  65. };
  66.  
  67. /*****************************************************************************/
  68.  
  69. DEFMGMT
  70. class   IniListRec
  71. {
  72. public:
  73.     IniList         ilNext;
  74.     ExtList         ilInit;
  75.     SymDef          ilCls;
  76. };
  77.  
  78. /*****************************************************************************/
  79.  
  80. DEFMGMT class UseListRec
  81. {
  82. public:
  83.  
  84.     UseList         ulNext;
  85.  
  86.     bool            ulAll       :1;         // are we using all symbols?
  87.     bool            ulBound     :1;         // chooses between the following 2
  88.     bool            ulAnchor    :1;         // placeholder for a list?
  89.  
  90.     union
  91.     {
  92.         QualName        ulName;             // qualified name being used
  93.         SymDef          ulSym;              // what symbol is being used
  94.     }
  95.         ul;
  96. };
  97.  
  98. /*****************************************************************************/
  99.  
  100. DEFMGMT class SymListRec
  101. {
  102. public:
  103.  
  104.     SymList         slNext;
  105.     SymDef          slSym;
  106. };
  107.  
  108. DEFMGMT class TypListRec
  109. {
  110. public:
  111.  
  112.     TypList         tlNext;
  113.     TypDef          tlType;
  114. };
  115.  
  116. /*****************************************************************************/
  117.  
  118. struct bitFieldDsc
  119. {
  120.     unsigned char   bfWidth;
  121.     unsigned char   bfOffset;
  122. };
  123.  
  124. /*****************************************************************************/
  125.  
  126. enum ovlOpFlavors
  127. {
  128.     OVOP_NONE,
  129.  
  130.     OVOP_ADD,                               // operator +
  131.     OVOP_SUB,                               // operator -
  132.     OVOP_MUL,                               // operator *
  133.     OVOP_DIV,                               // operator /
  134.     OVOP_MOD,                               // operator %
  135.  
  136.     OVOP_OR,                                // operator |
  137.     OVOP_XOR,                               // operator ^
  138.     OVOP_AND,                               // operator &
  139.  
  140.     OVOP_LSH,                               // operator <<
  141.     OVOP_RSH,                               // operator >>
  142.     OVOP_RSZ,                               // operator >>> [legacy mode only]
  143.  
  144.     OVOP_CNC,                               // operator %%
  145.  
  146.     OVOP_EQ,                                // operator ==
  147.     OVOP_NE,                                // operator !=
  148.  
  149.     OVOP_LT,                                // operator <
  150.     OVOP_LE,                                // operator <=
  151.     OVOP_GE,                                // operator >=
  152.     OVOP_GT,                                // operator >
  153.  
  154.     OVOP_LOG_AND,                           // operator &&
  155.     OVOP_LOG_OR,                            // operator ||
  156.  
  157.     OVOP_LOG_NOT,                           // operator !
  158.     OVOP_NOT,                               // operator ~
  159.  
  160.     OVOP_NOP,                               // operator + (unary)
  161.     OVOP_NEG,                               // operator - (unary)
  162.  
  163.     OVOP_INC,                               // operator ++
  164.     OVOP_DEC,                               // operator --
  165.  
  166.     OVOP_ASG,                               // operator =
  167.  
  168.     OVOP_ASG_ADD,                           // operator +=
  169.     OVOP_ASG_SUB,                           // operator -=
  170.     OVOP_ASG_MUL,                           // operator *=
  171.     OVOP_ASG_DIV,                           // operator /=
  172.     OVOP_ASG_MOD,                           // operator %=
  173.  
  174.     OVOP_ASG_AND,                           // operator &=
  175.     OVOP_ASG_XOR,                           // operator ^=
  176.     OVOP_ASG_OR,                            // operator |=
  177.  
  178.     OVOP_ASG_LSH,                           // operator <<=
  179.     OVOP_ASG_RSH,                           // operator >>=
  180.     OVOP_ASG_RSZ,                           // operator >>>= [legacy mode only]
  181.  
  182.     OVOP_ASG_CNC,                           // operator %%=
  183.  
  184.     OVOP_CTOR_INST,                         // instance constructor
  185.     OVOP_CTOR_STAT,                         // class    constructor
  186.  
  187.     OVOP_FINALIZER,                         // class    finalizer
  188.  
  189.     OVOP_CONV_IMP,                          // implicit conversion
  190.     OVOP_CONV_EXP,                          // explicit conversion
  191.  
  192.     OVOP_EQUALS,                            // quality comparison
  193.     OVOP_COMPARE,                           // full relational compare
  194.  
  195.     OVOP_PROP_GET,                          // property get
  196.     OVOP_PROP_SET,                          // property set
  197.  
  198.     OVOP_COUNT,
  199. };
  200.  
  201. /*****************************************************************************
  202.  *
  203.  *  Special methods such as constructors and overloaded operators are entered
  204.  *  in the symbol table under the following special names.
  205.  */
  206.  
  207. const   tokens      OPNM_CTOR_INST = tkLCurly;
  208. const   tokens      OPNM_CTOR_STAT = tkSTATIC;
  209.  
  210. const   tokens      OPNM_FINALIZER = tkRCurly;
  211.  
  212. const   tokens      OPNM_CONV_IMP  = tkIMPLICIT;
  213. const   tokens      OPNM_CONV_EXP  = tkEXPLICIT;
  214.  
  215. const   tokens      OPNM_EQUALS    = tkEQUALS;
  216. const   tokens      OPNM_COMPARE   = tkCOMPARE;
  217.  
  218. const   tokens      OPNM_PROP_GET  = tkOUT;
  219. const   tokens      OPNM_PROP_SET  = tkIN;
  220.  
  221. /*****************************************************************************
  222.  *
  223.  *  A descriptor for any symbol that is allowed to own other symbols (i.e. it
  224.  *  can be a scope) must have a first field of the following type. This way,
  225.  *  one can access these common scope-related members without having to always
  226.  *  switch on the particular symbol kind (i.e. the location of these members
  227.  *  is common for all symbols that contain them).
  228.  */
  229.  
  230. struct scopeFields
  231. {
  232.     SymDef          sdsChildList;           // head of list of owned symbols
  233.     SymDef          sdsChildLast;           // tail of list of owned symbols
  234. };
  235.  
  236. /*****************************************************************************
  237.  *
  238.  *  Information about one formal/actual generic class argument is stored in
  239.  *  the following descriptors.
  240.  */
  241.  
  242. DEFMGMT
  243. class   GenArgRec
  244. {
  245. public:
  246.     GenArgDsc       gaNext;
  247. #ifdef  DEBUG
  248.     unsigned char   gaBound     :1;         // is this an actual (bound) arg?
  249. #endif
  250. };
  251.  
  252. DEFMGMT
  253. class   GenArgRecF : public GenArgRec
  254. {
  255. public:
  256.     Ident           gaName;                 // name
  257.     SymDef          gaMsym;                 // member symbol created for the argument
  258.  
  259.     TypDef          gaBase;                 // bound: base class
  260.     TypList         gaIntf;                 // bound: nterface(s)
  261. };
  262.  
  263. DEFMGMT
  264. class   GenArgRecA : public GenArgRec
  265. {
  266. public:
  267.     TypDef          gaType;                 // actual type
  268. };
  269.  
  270. /*****************************************************************************/
  271.  
  272. DEFMGMT class SymDefRec
  273. {
  274. public:
  275.  
  276. #ifndef  FAST
  277.     Ident           sdName;                 // name of the symbol
  278.     TypDef          sdType;                 // type of the symbol
  279. #endif
  280.  
  281.     SymDef          sdParent;               // owning symbol
  282.  
  283. #ifndef FAST
  284.     symbolKinds     sdSymKind;
  285.     accessLevels    sdAccessLevel;
  286.     name_space      sdNameSpace;
  287.     compileStates   sdCompileState;
  288. #else
  289.     unsigned        sdSymKind           :8; // SYM_xxxx
  290.     unsigned        sdAccessLevel       :3; // ACL_xxxx
  291.     unsigned        sdNameSpace         :5; //  NS_xxxx (this is a mask)
  292.     unsigned        sdCompileState      :4; //  CS_xxxx
  293. #endif
  294.  
  295.     unsigned        sdIsDefined         :1; // has definition (e.g. fn body)
  296.     unsigned        sdIsImport          :1; // comes from another program?
  297.  
  298.     unsigned        sdIsMember          :1; // member of a class?
  299.     unsigned        sdIsImplicit        :1; // declared by compiler
  300.  
  301.     unsigned        sdIsVirtProp        :1; // properties: virtual ?
  302.     unsigned        sdIsDfltProp        :1; // properties: default ?
  303.  
  304.     unsigned        sdReferenced        :1; // methods  , variables
  305.     unsigned        sdRefDirect         :1; // methods  , variables
  306.     unsigned        sdIsDeprecated      :1; // methods  , variables, classes
  307.  
  308.     unsigned        sdIsAbstract        :1; // methods  , classes
  309.     unsigned        sdIsSealed          :1; // methods  , classes, fields, locals
  310.  
  311.     unsigned        sdIsStatic          :1; // variables, functions
  312.  
  313.     unsigned        sdIsManaged         :1; // classes  , namespaces
  314.     unsigned        sdMemListOrder      :1; // classes  , namespaces
  315.  
  316.     unsigned        sdIsTransient       :1; // properties, fields
  317.  
  318. #ifdef  FAST
  319.     Ident           sdName;                 // name of this symbol
  320.     TypDef          sdType;                 // the type of this symbol
  321. #endif
  322.  
  323.     symbolKinds     sdSymKindGet()
  324.     {
  325.         return  (symbolKinds)sdSymKind;
  326.     }
  327.  
  328.     stringBuff      sdSpelling()
  329.     {
  330.         return  hashTab::identSpelling(sdName);
  331.     }
  332.  
  333.     size_t          sdSpellLen()
  334.     {
  335.         return  hashTab::identSpellLen(sdName);
  336.     }
  337.  
  338.     bool            sdHasScope()
  339.     {
  340.         return  (bool)(sdSymKind >= SYM_FIRST_SCOPED);
  341.     }
  342.  
  343.     static
  344.     bool            sdHasScope(symbolKinds symkind)
  345.     {
  346.         return  (bool)(  symkind >= SYM_FIRST_SCOPED);
  347.     }
  348.  
  349. private:
  350.     TypDef          sdTypeMake();
  351. public:
  352.     TypDef          sdTypeGet();
  353.     SymTab          sdOwnerST();
  354.  
  355.     SymDef          sdNextDef;              // next definition in hash table
  356.     SymDef          sdNextInScope;          // next symbol in the same scope
  357.  
  358.     DefList         sdSrcDefList;           // list of source definitions
  359.  
  360.     UNION(sdSymKind)
  361.     {
  362.  
  363.     CASE(SYM_CLASS)     // class/interface symbol
  364.  
  365.         struct
  366.         {
  367.             /* This symbol owns scopes, the first field must be 'scopeFields' */
  368.  
  369.             scopeFields     sdScope;
  370.  
  371.             // Terrible hack to maintain metadata token ordering
  372.  
  373.             SymDef          sdNextTypeDef;
  374.  
  375.             /* Here are the fields specific to this symbol kind */
  376.  
  377.             vectorSym       sdcOvlOpers;    // overloaded operator table (or NULL)
  378.  
  379.             ExtList         sdcMemDefList;  // list of member defs - head
  380.             ExtList         sdcMemDefLast;  // list of member defs - tail
  381.  
  382.             mdTypeDef       sdcMDtypedef;   // definition metadata token (if known)
  383.             mdTypeRef       sdcMDtypeImp;   // import     metadata token (if known)
  384.             mdToken         sdcComTypeX;    // ComType    metadata token (if known)
  385.  
  386.             MetaDataImp     sdcMDimporter;  // imported from here
  387.  
  388.             SymDef          sdcDefProp;     // default property if present
  389.  
  390.             SymXinfo        sdcExtraInfo;   // linkage/security/etc. info
  391.  
  392.             SymDef          sdcVtableSym;   // vtable (unmanaged classes only)
  393.  
  394.             unsigned        sdcVirtCnt  :16;// number of vtable slots used
  395.             unsigned        sdcFlavor   :3; // union/struct/class/intf
  396.             unsigned        sdcDefAlign :3; // #pragma pack value in effect
  397.             unsigned        sdcOldStyle :1; // old-style syntax used for declaration
  398.             unsigned        sdcNestTypes:1; // class has nested types (classes,enums,...)
  399.             unsigned        sdcInstInit :1; // instance member initializers present?
  400.             unsigned        sdcStatInit :1; // static   member initializers present?
  401.             unsigned        sdcDeferInit:1; // deferred member initializers present?
  402.             unsigned        sdcMarshInfo:1; // any member marshalling info present?
  403.             unsigned        sdcAnonUnion:1; // is this an anonymous union?
  404.             unsigned        sdcTagdUnion:1; // is this a  tagged    union?
  405.             unsigned        sdc1stVptr  :1; // vtable ptr introduced?
  406.             unsigned        sdcHasVptr  :1; // vtable ptr present?
  407.  
  408.             // DWORD boundary (watch out for packing!)
  409.  
  410.             unsigned        sdcAssemIndx:16;// assembly index (0 = none)
  411.             unsigned        sdcAssemRefd:1; // assembly ref emitted yet?
  412.  
  413.             unsigned        sdcHasMeths :1; // methods present?
  414.             unsigned        sdcHasBodies:1; // bodies for methods defined?
  415.             unsigned        sdcHasLinks :1; // any methods have linkage specs?
  416.             unsigned        sdcAttribute:1; // this is an attribute class
  417.             unsigned        sdcAttrDupOK:1; // can be specified multiple times
  418.  
  419.             unsigned        sdcSrlzable :1; // class marked as "serializable" ?
  420.             unsigned        sdcUnsafe   :1; // class marked as "unsafe"       ?
  421.  
  422.             unsigned        sdcBuiltin  :1; // "Delegate"
  423.             unsigned        sdcMultiCast:1; // multicast delegate?
  424.  
  425. // temp hack ...
  426.             unsigned        sdcAsyncDlg :1; // asynchronous delegate?
  427.  
  428.             unsigned        sdcGeneric  :1; // generic class?
  429.             unsigned        sdcSpecific :1; // instance of a generic class?
  430.  
  431.             unsigned        sdcGenArg   :8; // generic class arg index or 0
  432.  
  433.             GenArgDsc       sdcArgLst;      // generic arguments (formal or actual)
  434.  
  435.             UNION(sdcGeneric)
  436.             {
  437.             CASE(true)
  438.                 SymList         sdcInstances;   // instances created so far
  439.  
  440.             CASE(false)
  441.                 SymDef          sdcGenClass;    // the "parent" generic type
  442.             };
  443.         }
  444.                 sdClass;
  445.  
  446.     CASE(SYM_NAMESPACE) // namespace
  447.  
  448.         struct
  449.         {
  450.             /* This symbol owns scopes, the first field must be 'scopeFields' */
  451.  
  452.             scopeFields     sdScope;
  453.  
  454.             /* Here are the fields specific to this symbol kind */
  455.  
  456.             SymTab          sdnSymtab;
  457.  
  458.             /* The list of global declarations */
  459.  
  460.             ExtList         sdnDeclList;
  461.         }
  462.                 sdNS;
  463.  
  464.     CASE(SYM_ENUM)      // enum type
  465.  
  466.         struct
  467.         {
  468.             /* This symbol owns scopes, the first field must be 'scopeFields' */
  469.  
  470.             scopeFields     sdScope;
  471.  
  472.             // Terrible hack to maintain metadata token ordering
  473.  
  474.             SymDef          sdNextTypeDef;
  475.  
  476.             /* Here are the fields specific to this symbol kind */
  477.  
  478.             MetaDataImp     sdeMDimporter;  // imported from here
  479.  
  480.             mdTypeDef       sdeMDtypedef;   // definition metadata token (if known)
  481.             mdToken         sdeComTypeX;    // ComType    metadata token (if known)
  482.  
  483.             SymXinfo        sdeExtraInfo;   // custom attributes etc.
  484.  
  485.             mdTypeRef       sdeMDtypeImp;   // import     metadata token (if known)
  486.  
  487.             unsigned        sdeAssemIndx:16;// assembly index (0 = none)
  488.             unsigned        sdeAssemRefd:1; // assembly ref emitted yet?
  489.  
  490.             // ......
  491.         }
  492.                 sdEnum;
  493.  
  494.     CASE(SYM_GENARG)    // generic argument
  495.  
  496.         struct
  497.         {
  498.             bool            sdgaValue;      // value (as opposed to type) argument?
  499.         }
  500.                 sdGenArg;
  501.  
  502.     CASE(SYM_SCOPE)     // scope
  503.  
  504.         struct
  505.         {
  506.             /* This symbol owns scopes, the first field must be 'scopeFields' */
  507.  
  508.             scopeFields     sdScope;
  509.  
  510.             /* Here are the fields specific to this symbol kind */
  511.  
  512.             int             sdSWscopeId;    // scope id for the scope
  513.  
  514.             ILblock         sdBegBlkAddr;
  515.             size_t          sdBegBlkOffs;
  516.             ILblock         sdEndBlkAddr;
  517.             size_t          sdEndBlkOffs;
  518.         }
  519.                 sdScope;
  520.  
  521.     CASE(SYM_COMPUNIT)  // compilation unit
  522.  
  523.         struct
  524.         {
  525.             /* Here are the fields specific to this symbol kind */
  526.  
  527.             stringBuff      sdcSrcFile;     // name of source file
  528.  
  529.             /* The source file token if debug info emitted */
  530.  
  531.             void    *       sdcDbgDocument;
  532.         }
  533.                 sdComp;
  534.  
  535.     CASE(SYM_FNC)       // function member
  536.  
  537.         struct
  538.         {
  539.             /* This symbol owns scopes, the first field must be 'scopeFields' */
  540.  
  541.             scopeFields     sdScope;
  542.  
  543.             /* Here are the fields specific to this symbol kind */
  544.  
  545.             SymDef          sdfNextOvl;     // next overloaded fn
  546.  
  547.             SymDef          sdfGenSym;      // generic method this is an instance of
  548.  
  549.             SymXinfo        sdfExtraInfo;   // linkage/security/etc. info
  550.  
  551.             unsigned        sdfVtblx    :16;// vtable index (0 = not virtual)
  552.             ovlOpFlavors    sdfOper     :8; // overloaded operator / ctor index
  553.             unsigned        sdfConvOper :1; // conversion operator?
  554.             unsigned        sdfCtor     :1; // constructor?
  555.             unsigned        sdfProperty :1; // is this a property?
  556.             unsigned        sdfNative   :1; // native import?
  557.             unsigned        sdfIsIntfImp:1; // implements an interface method?
  558.             unsigned        sdfDisabled :1; // conditionally disabled
  559.             unsigned        sdfRThasDef :1; // the runtime provides the body
  560.             unsigned        sdfInstance :1; // instance of a generic type
  561.  
  562.             unsigned        sdfImpIndex :6; // index of importer
  563.  
  564.             unsigned        sdfEntryPt  :1; // could be an entry point?
  565.             unsigned        sdfExclusive:1;
  566.             unsigned        sdfVirtual  :1;
  567.             unsigned        sdfOverride :1;
  568.             unsigned        sdfOverload :1;
  569.             unsigned        sdfUnsafe   :1;
  570.             unsigned        sdfBaseOvl  :1;
  571.             unsigned        sdfBaseHide :1; // potentially hides base methods
  572.             unsigned        sdfIntfImpl :1; // implements specific intf method
  573.  
  574.             SymDef          sdfIntfImpSym;  // interface method being implemented
  575.  
  576.             mdToken         sdfMDtoken;     // metadata token
  577.             mdMemberRef     sdfMDfnref;     // metadata token (methodref)   [temp HACK]
  578.         }
  579.                 sdFnc;
  580.  
  581.     CASE(SYM_VAR)       // variable (local or global) or data member
  582.  
  583.         struct
  584.         {
  585.             SymDef          sdvGenSym;      // generic member this is an instance of
  586.  
  587.             mdToken         sdvMDtoken;     // metadata token
  588.             mdMemberRef     sdvMDsdref;     // import token (statics/globals only)
  589.  
  590.             unsigned        sdvLocal    :1; // local (auto) (including arguments)
  591.             unsigned        sdvArgument :1; // local : is this an argument ?
  592.             unsigned        sdvBitfield :1; // member: is this a  bitfield ?
  593.             unsigned        sdvMgdByRef :1; // local :   managed  byref arg?
  594.             unsigned        sdvUmgByRef :1; // local : unmanaged  byref arg?
  595.             unsigned        sdvAllocated:1; // static: space been allocated?
  596.             unsigned        sdvCanInit  :1; // static member that s/b initialized
  597.             unsigned        sdvHadInit  :1; // have we found an initializer?
  598.             unsigned        sdvConst    :1; // compile time constant?
  599.             unsigned        sdvDeferCns :1; // const : hasn't been evaluated yet
  600.             unsigned        sdvInEval   :1; // const : it's being evaluated right now
  601.             unsigned        sdvMarshInfo:1; // marshalling info specified?
  602.             unsigned        sdvAnonUnion:1; // member of an anonymous union?
  603.             unsigned        sdvTagged   :1; // member of a  tagged    union?
  604.             unsigned        sdvCatchArg :1; // catch() argument?
  605.             unsigned        sdvChkInit  :1; // unitialized use possible?
  606.             unsigned        sdvIsVtable :1; // fake symbol for unmanaged vtable?
  607.             unsigned        sdvAddrTaken:1; // address has been taken?
  608.             unsigned        sdvInstance :1; // instance of a generic type
  609.  
  610.             /*
  611.                 For local variables 'sdvILindex' holds the IL slot number,
  612.                 which also serves as the index for initialization tracking.
  613.                 For managed static members the same field is used whenever
  614.                 initialization needs to be tracked.
  615.  
  616.                 For unmanaged members 'sdvOffset' holds the offset (either
  617.                 within the instance (for non-static members) or within the
  618.                 .data section (for static members).
  619.  
  620.                 For imported global variables 'sdvImpIndex' holds the index
  621.                 of the metadata importer where the variable came from.
  622.              */
  623.  
  624.             union
  625.             {
  626.                 unsigned        sdvILindex;
  627.                 unsigned        sdvOffset;
  628.                 unsigned        sdvImpIndex;
  629.             };
  630.  
  631.             UNION(sdvConst)
  632.             {
  633.             CASE(true)
  634.  
  635.                 ConstVal        sdvCnsVal;  // used for constants
  636.  
  637.             CASE(false)
  638.  
  639.                 UNION(sdvBitfield)
  640.                 {
  641.                 CASE(true)
  642.                     bitFieldDsc     sdvBfldInfo;// used for bitfields
  643.  
  644.                 CASE(false)
  645.                     SymXinfo        sdvFldInfo; // used for fields (marshalling, union tag, ...)
  646.                 };
  647.             };
  648.         }
  649.                 sdVar;
  650.  
  651.     CASE(SYM_PROP)      // property data member
  652.  
  653.         struct
  654.         {
  655.             SymDef          sdpGetMeth;     // the getter method (if present)
  656.             SymDef          sdpSetMeth;     // the setter method (if present)
  657.             SymDef          sdpNextOvl;     // next property with the same name
  658.             mdToken         sdpMDtoken;     // metadata token
  659.  
  660.             SymXinfo        sdpExtraInfo;   // custom attributes / etc.
  661.         }
  662.                 sdProp;
  663.  
  664.     CASE(SYM_LABEL)     // label
  665.  
  666.         struct
  667.         {
  668.             ILblock         sdlILlab;
  669. #ifdef  OLD_IL
  670.             mdToken         sdlMDtoken;
  671. #endif
  672.         }
  673.                 sdLabel;
  674.  
  675.     CASE(SYM_TYPEDEF)   // typedef
  676.  
  677.         struct
  678.         {
  679.             unsigned        sdtNothing;     // for now, no fields
  680.         }
  681.                 sdTypeDef;
  682.  
  683.     CASE(SYM_USING)     // symbol import
  684.  
  685.         struct
  686.         {
  687.             SymDef          sduSym;
  688.         }
  689.                 sdUsing;
  690.  
  691.     CASE(SYM_ENUMVAL)   // enumerator name
  692.  
  693.         struct
  694.         {
  695.             SymDef          sdeNext;        // next eval value in the type
  696.  
  697.             union
  698.             {
  699.                 __int32         sdevIval;   // for type <= uint
  700.                 __int64 *       sdevLval;   // for type >= long
  701.             }
  702.                     sdEV;
  703.  
  704.             SymXinfo        sdeExtraInfo;   // custom attributes / etc.
  705.         }
  706.                 sdEnumVal;
  707.  
  708.         /* The following is used only for sizing purposes */
  709.  
  710.     DEFCASE
  711.  
  712.         struct  {}     sdBase;
  713.     };
  714. };
  715.  
  716. /*****************************************************************************
  717.  *
  718.  *  IMPORTANT:  Please keep the contents of "symsizes.h" in synch with
  719.  *              the declarations above!
  720.  */
  721.  
  722. #include "symsizes.h"
  723.  
  724. /*****************************************************************************
  725.  *
  726.  *  Given a symbol that represents a type name, return its type (these are
  727.  *  created in a "lazy" as-needed fashion).
  728.  */
  729.  
  730. inline
  731. TypDef              SymDefRec::sdTypeGet()
  732. {
  733.     if  (!sdType)
  734.         sdTypeMake();
  735.  
  736.     return  sdType;
  737. }
  738.  
  739. /*****************************************************************************/
  740. #endif
  741. /*****************************************************************************/
  742.