comparison dmd/backend/struct_t.d @ 0:10317f0c89a5

Initial commit
author korDen
date Sat, 24 Oct 2009 08:42:06 +0400
parents
children e28b18c23469
comparison
equal deleted inserted replaced
-1:000000000000 0:10317f0c89a5
1 module dmd.backend.struct_t;
2
3 import dmd.backend.targ_types;
4 import dmd.backend.LIST;
5 import dmd.backend.Symbol;
6
7 /***********************************
8 * Special information for structs.
9 */
10
11 struct struct_t
12 {
13 targ_size_t Sstructsize; // size of struct
14 symlist_t Sfldlst; // all members of struct (list freeable)
15 Symbol* Sroot; // root of binary tree Symbol table
16 uint Salignsize; // size of struct for alignment purposes
17 ubyte Sstructalign; // struct member alignment in effect
18 uint Sflags;
19 /+
20 #define STRanonymous 0x01 // set for unions with no tag names
21 #define STRglobal 0x02 // defined at file scope
22 #define STRnotagname 0x04 // struct/class with no tag name
23 #define STRoutdef 0x08 // we've output the debug definition
24 #define STRbitfields 0x10 // set if struct contains bit fields
25 #define STRpredef 0x1000 // a predefined struct
26 #define STRunion 0x4000 // actually, it's a union
27
28 #define STRabstract 0x20 // abstract class
29 #define STRbitcopy 0x40 // set if operator=() is merely a bit copy
30 #define STRanyctor 0x80 // set if any constructors were defined
31 // by the user
32 #define STRnoctor 0x100 // no constructors allowed
33 #define STRgen 0x200 // if struct is an instantiation of a
34 // template class, and was generated by
35 // that template
36 #define STRvtblext 0x400 // generate vtbl[] only when first member function
37 // definition is encountered (see Fvtblgen)
38 #define STRexport 0x800 // all member functions are to be _export
39 #define STRclass 0x8000 // it's a class, not a struct
40 #if TX86
41 #define STRimport 0x40000 // imported class
42 #define STRstaticmems 0x80000 // class has static members
43 #endif
44 #define STR0size 0x100000 // zero sized struct
45 #define STRinstantiating 0x200000 // if currently being instantiated
46 #define STRexplicit 0x400000 // if explicit template instantiation
47 #define STRgenctor0 0x800000 // need to gen X::X()
48 tym_t ptrtype; // type of pointer to refer to classes by
49 unsigned short access; // current access privilege, here so
50 // enum declarations can get at it
51 targ_size_t Snonvirtsize; // size of struct excluding virtual classes
52 list_t Svirtual; // freeable list of mptrs
53 // that go into vtbl[]
54 #if TX86
55 list_t *Spvirtder; // pointer into Svirtual that points to start
56 // of virtual functions for this (derived) class
57 symlist_t Sopoverload; // overloaded operator funcs (list freeable)
58 #endif
59 symlist_t Scastoverload; // overloaded cast funcs (list freeable)
60 symlist_t Sclassfriends; // list of classes of which this is a friend
61 // (list is freeable)
62 symlist_t Sfriendclass; // classes which are a friend to this class
63 // (list is freeable)
64 symlist_t Sfriendfuncs; // functions which are a friend to this class
65 // (list is freeable)
66 symlist_t Sinlinefuncs; // list of tokenized functions
67 baseclass_t *Sbase; // list of direct base classes
68 baseclass_t *Svirtbase; // list of all virtual base classes
69 baseclass_t *Smptrbase; // list of all base classes that have
70 // their own vtbl[]
71 baseclass_t *Sprimary; // if not NULL, then points to primary
72 // base class
73 Funcsym *Svecctor; // constructor for use by vec_new()
74 Funcsym *Sctor; // constructor function
75
76 Funcsym *Sdtor; // basic destructor
77 #if VBTABLES
78 Funcsym *Sprimdtor; // primary destructor
79 Funcsym *Spriminv; // primary invariant
80 Funcsym *Sscaldeldtor; // scalar deleting destructor
81 #endif
82
83 Funcsym *Sinvariant; // basic invariant function
84
85 Symbol *Svptr; // Symbol of vptr
86 Symbol *Svtbl; // Symbol of vtbl[]
87 #if VBTABLES
88 Symbol *Svbptr; // Symbol of pointer to vbtbl[]
89 Symbol *Svbptr_parent; // base class for which Svbptr is a member.
90 // NULL if Svbptr is a member of this class
91 targ_size_t Svbptr_off; // offset of Svbptr member
92 Symbol *Svbtbl; // virtual base offset table
93 baseclass_t *Svbptrbase; // list of all base classes in canonical
94 // order that have their own vbtbl[]
95 #endif
96 Funcsym *Sopeq; // X& X::operator =(X&)
97 Funcsym *Sopeq2; // Sopeq, but no copy of virtual bases
98 Funcsym *Scpct; // copy constructor
99 Funcsym *Sveccpct; // vector copy constructor
100 Symbol *Salias; // pointer to identifier S to use if
101 // struct was defined as:
102 // typedef struct { ... } S;
103
104 Symbol *Stempsym; // if this struct is an instantiation
105 // of a template class, this is the
106 // template class Symbol
107
108 /* For:
109 * template<class T> struct A { };
110 * template<class T> struct A<T *> { };
111 *
112 * A<int> a; // primary
113 * Gives:
114 * Sarglist = <int>
115 * Spr_arglist = NULL;
116 *
117 * A<int*> a; // specialization
118 * Gives:
119 * Sarglist = <int>
120 * Spr_arglist = <int*>;
121 */
122
123 param_t *Sarglist; // if this struct is an instantiation
124 // of a template class, this is the
125 // actual arg list used
126 param_t *Spr_arglist; // if this struct is an instantiation
127 // of a specialized template class, this is the
128 // actual primary arg list used.
129 // It is NULL for the
130 // primary template class (since it would be
131 // identical to Sarglist).
132 TARGET_structSTRUCT
133 +/
134 }