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

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