Mercurial > projects > ldc
annotate dmd/attrib.h @ 1644:9176437d98be
Add -linkonce-templates for emitting linkonce_odr syms instead of weak_odr.
author | Matti Niemenmaa <matti.niemenmaa+hg@iki.fi> |
---|---|
date | Tue, 09 Mar 2010 23:07:08 +0200 |
parents | a413ae7329bf |
children |
rev | line source |
---|---|
1587 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2009 by Digital Mars | |
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_ATTRIB_H | |
12 #define DMD_ATTRIB_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "dsymbol.h" | |
19 | |
20 struct Expression; | |
21 struct Statement; | |
22 struct LabelDsymbol; | |
23 struct Initializer; | |
24 struct Module; | |
25 struct Condition; | |
26 #ifdef _DH | |
27 struct HdrGenState; | |
28 #endif | |
29 | |
30 /**************************************************************/ | |
31 | |
32 struct AttribDeclaration : Dsymbol | |
33 { | |
34 Array *decl; // array of Dsymbol's | |
35 | |
36 AttribDeclaration(Array *decl); | |
37 virtual Array *include(Scope *sc, ScopeDsymbol *s); | |
38 int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
39 void setScopeNewSc(Scope *sc, | |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1587
diff
changeset
|
40 StorageClass newstc, enum LINK linkage, enum PROT protection, int explictProtection, |
1587 | 41 unsigned structalign); |
42 void semanticNewSc(Scope *sc, | |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1587
diff
changeset
|
43 StorageClass newstc, enum LINK linkage, enum PROT protection, int explictProtection, |
1587 | 44 unsigned structalign); |
45 void semantic(Scope *sc); | |
46 void semantic2(Scope *sc); | |
47 void semantic3(Scope *sc); | |
48 void inlineScan(); | |
49 void addComment(unsigned char *comment); | |
50 void emitComment(Scope *sc); | |
51 const char *kind(); | |
52 int oneMember(Dsymbol **ps); | |
53 int hasPointers(); | |
54 void checkCtorConstInit(); | |
55 void addLocalClass(ClassDeclarations *); | |
56 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
57 void toJsonBuffer(OutBuffer *buf); | |
58 AttribDeclaration *isAttribDeclaration() { return this; } | |
59 | |
60 #if IN_DMD | |
61 virtual void toObjFile(int multiobj); // compile to .obj file | |
62 int cvMember(unsigned char *p); | |
63 #endif | |
64 | |
65 #if IN_LLVM | |
66 virtual void codegen(Ir*); | |
67 #endif | |
68 }; | |
69 | |
70 struct StorageClassDeclaration: AttribDeclaration | |
71 { | |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1587
diff
changeset
|
72 StorageClass stc; |
1587 | 73 |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1587
diff
changeset
|
74 StorageClassDeclaration(StorageClass stc, Array *decl); |
1587 | 75 Dsymbol *syntaxCopy(Dsymbol *s); |
76 void setScope(Scope *sc); | |
77 void semantic(Scope *sc); | |
78 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
79 | |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1587
diff
changeset
|
80 static void stcToCBuffer(OutBuffer *buf, StorageClass stc); |
1587 | 81 }; |
82 | |
83 struct LinkDeclaration : AttribDeclaration | |
84 { | |
85 enum LINK linkage; | |
86 | |
87 LinkDeclaration(enum LINK p, Array *decl); | |
88 Dsymbol *syntaxCopy(Dsymbol *s); | |
89 void setScope(Scope *sc); | |
90 void semantic(Scope *sc); | |
91 void semantic3(Scope *sc); | |
92 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
93 char *toChars(); | |
94 }; | |
95 | |
96 struct ProtDeclaration : AttribDeclaration | |
97 { | |
98 enum PROT protection; | |
99 | |
100 ProtDeclaration(enum PROT p, Array *decl); | |
101 Dsymbol *syntaxCopy(Dsymbol *s); | |
102 void importAll(Scope *sc); | |
103 void setScope(Scope *sc); | |
104 void semantic(Scope *sc); | |
105 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
106 | |
107 static void protectionToCBuffer(OutBuffer *buf, enum PROT protection); | |
108 }; | |
109 | |
110 struct AlignDeclaration : AttribDeclaration | |
111 { | |
112 unsigned salign; | |
113 | |
114 AlignDeclaration(Loc loc, unsigned sa, Array *decl); | |
115 Dsymbol *syntaxCopy(Dsymbol *s); | |
116 void setScope(Scope *sc); | |
117 void semantic(Scope *sc); | |
118 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
119 }; | |
120 | |
121 struct AnonDeclaration : AttribDeclaration | |
122 { | |
123 int isunion; | |
124 int sem; // 1 if successful semantic() | |
125 | |
126 AnonDeclaration(Loc loc, int isunion, Array *decl); | |
127 Dsymbol *syntaxCopy(Dsymbol *s); | |
128 void semantic(Scope *sc); | |
129 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
130 const char *kind(); | |
131 }; | |
132 | |
133 struct PragmaDeclaration : AttribDeclaration | |
134 { | |
135 Expressions *args; // array of Expression's | |
136 | |
137 PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl); | |
138 Dsymbol *syntaxCopy(Dsymbol *s); | |
139 void semantic(Scope *sc); | |
140 void setScope(Scope *sc); | |
141 int oneMember(Dsymbol **ps); | |
142 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
143 const char *kind(); | |
144 | |
145 #if IN_DMD | |
146 void toObjFile(int multiobj); // compile to .obj file | |
147 #endif | |
148 | |
149 #if IN_LLVM | |
150 void codegen(Ir*); | |
151 #endif | |
152 }; | |
153 | |
154 struct ConditionalDeclaration : AttribDeclaration | |
155 { | |
156 Condition *condition; | |
157 Array *elsedecl; // array of Dsymbol's for else block | |
158 | |
159 ConditionalDeclaration(Condition *condition, Array *decl, Array *elsedecl); | |
160 Dsymbol *syntaxCopy(Dsymbol *s); | |
161 int oneMember(Dsymbol **ps); | |
162 void emitComment(Scope *sc); | |
163 Array *include(Scope *sc, ScopeDsymbol *s); | |
164 void addComment(unsigned char *comment); | |
165 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
166 void toJsonBuffer(OutBuffer *buf); | |
167 void importAll(Scope *sc); | |
168 void setScope(Scope *sc); | |
169 }; | |
170 | |
171 struct StaticIfDeclaration : ConditionalDeclaration | |
172 { | |
173 ScopeDsymbol *sd; | |
174 int addisdone; | |
175 | |
176 StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl); | |
177 Dsymbol *syntaxCopy(Dsymbol *s); | |
178 int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
179 void semantic(Scope *sc); | |
180 void importAll(Scope *sc); | |
181 void setScope(Scope *sc); | |
182 const char *kind(); | |
183 }; | |
184 | |
185 // Mixin declarations | |
186 | |
187 struct CompileDeclaration : AttribDeclaration | |
188 { | |
189 Expression *exp; | |
190 | |
191 ScopeDsymbol *sd; | |
192 int compiled; | |
193 | |
194 CompileDeclaration(Loc loc, Expression *exp); | |
195 Dsymbol *syntaxCopy(Dsymbol *s); | |
196 int addMember(Scope *sc, ScopeDsymbol *sd, int memnum); | |
197 void compileIt(Scope *sc); | |
198 void semantic(Scope *sc); | |
199 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
200 }; | |
201 | |
202 #endif /* DMD_ATTRIB_H */ |