Mercurial > projects > ldc
annotate dmd/enum.h @ 1404:11b122f92136
Now that templates instantiations are no longer emitted for all modules that
even blink at them they seem to break due to being linkonce (if compiled with
any optimization level > 0), so let's give them weak linkage instead.
The difference is that unreferenced linkonce symbols can be deleted, while
weak symbols need to be preserved.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Thu, 21 May 2009 15:23:28 +0200 |
parents | e961851fb8be |
children | def7a1d494fd |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
336 | 3 // Copyright (c) 1999-2008 by Digital Mars |
1 | 4 // All Rights Reserved |
5 // written by Walter Bright | |
6 // http://www.digitalmars.com | |
7 // License for redistribution is by either the Artistic License | |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
9 // See the included readme.txt for details. | |
10 | |
11 #ifndef DMD_ENUM_H | |
12 #define DMD_ENUM_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "root.h" | |
19 #include "dsymbol.h" | |
20 | |
21 struct Identifier; | |
22 struct Type; | |
23 struct Expression; | |
24 #ifdef _DH | |
25 struct HdrGenState; | |
26 #endif | |
27 | |
28 | |
29 struct EnumDeclaration : ScopeDsymbol | |
30 { | |
31 Type *type; // the TypeEnum | |
32 Type *memtype; // type of the members | |
336 | 33 |
34 #if DMDV1 | |
1195
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1147
diff
changeset
|
35 dinteger_t maxval; |
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1147
diff
changeset
|
36 dinteger_t minval; |
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1147
diff
changeset
|
37 dinteger_t defaultval; // default initializer |
336 | 38 #else |
39 Expression *maxval; | |
40 Expression *minval; | |
41 Expression *defaultval; // default initializer | |
42 | |
43 Scope *scope; // !=NULL means context to use | |
44 #endif | |
45 int isdeprecated; | |
1 | 46 |
47 EnumDeclaration(Loc loc, Identifier *id, Type *memtype); | |
48 Dsymbol *syntaxCopy(Dsymbol *s); | |
49 void semantic(Scope *sc); | |
50 int oneMember(Dsymbol **ps); | |
51 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
52 Type *getType(); | |
336 | 53 const char *kind(); |
54 #if DMDV2 | |
55 Dsymbol *search(Loc, Identifier *ident, int flags); | |
56 #endif | |
57 int isDeprecated(); // is Dsymbol deprecated? | |
1 | 58 |
59 void emitComment(Scope *sc); | |
60 void toDocBuffer(OutBuffer *buf); | |
61 | |
62 EnumDeclaration *isEnumDeclaration() { return this; } | |
63 | |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
64 #if IN_DMD |
336 | 65 void toObjFile(int multiobj); // compile to .obj file |
1 | 66 void toDebug(); |
67 int cvMember(unsigned char *p); | |
68 | |
69 Symbol *sinit; | |
70 Symbol *toInitializer(); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
336
diff
changeset
|
71 #endif |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
72 |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
73 #if IN_LLVM |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
74 void codegen(Ir*); |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
75 #endif |
1 | 76 }; |
77 | |
78 | |
79 struct EnumMember : Dsymbol | |
80 { | |
81 Expression *value; | |
82 | |
83 EnumMember(Loc loc, Identifier *id, Expression *value); | |
84 Dsymbol *syntaxCopy(Dsymbol *s); | |
85 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 86 const char *kind(); |
1 | 87 |
88 void emitComment(Scope *sc); | |
89 void toDocBuffer(OutBuffer *buf); | |
90 | |
91 EnumMember *isEnumMember() { return this; } | |
92 }; | |
93 | |
94 #endif /* DMD_ENUM_H */ |