Mercurial > projects > ldc
annotate dmd/attrib.h @ 1195:e961851fb8be
Merged DMD 1.042.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Fri, 03 Apr 2009 17:59:34 +0200 |
parents | dbe4af57b240 |
children | 79758fd2f48a |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2007 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 semantic(Scope *sc); | |
40 void semantic2(Scope *sc); | |
41 void semantic3(Scope *sc); | |
42 void inlineScan(); | |
43 void addComment(unsigned char *comment); | |
44 void emitComment(Scope *sc); | |
336 | 45 const char *kind(); |
1 | 46 int oneMember(Dsymbol **ps); |
47 int hasPointers(); | |
48 void checkCtorConstInit(); | |
49 void addLocalClass(ClassDeclarations *); | |
50 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
51 AttribDeclaration *isAttribDeclaration() { return this; } | |
52 | |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
53 #if IN_DMD |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
710
diff
changeset
|
54 virtual void toObjFile(int multiobj); // compile to .obj file |
19 | 55 int cvMember(unsigned char *p); |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
56 #endif |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
57 |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
58 #if IN_LLVM |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
59 virtual void codegen(Ir*); |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
60 #endif |
1 | 61 }; |
62 | |
63 struct StorageClassDeclaration: AttribDeclaration | |
64 { | |
65 unsigned stc; | |
66 | |
67 StorageClassDeclaration(unsigned stc, Array *decl); | |
68 Dsymbol *syntaxCopy(Dsymbol *s); | |
69 void semantic(Scope *sc); | |
70 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1195
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1147
diff
changeset
|
71 |
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1147
diff
changeset
|
72 static void stcToCBuffer(OutBuffer *buf, int stc); |
1 | 73 }; |
74 | |
75 struct LinkDeclaration : AttribDeclaration | |
76 { | |
77 enum LINK linkage; | |
78 | |
79 LinkDeclaration(enum LINK p, Array *decl); | |
80 Dsymbol *syntaxCopy(Dsymbol *s); | |
81 void semantic(Scope *sc); | |
82 void semantic3(Scope *sc); | |
83 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
84 char *toChars(); | |
85 }; | |
86 | |
87 struct ProtDeclaration : AttribDeclaration | |
88 { | |
89 enum PROT protection; | |
90 | |
91 ProtDeclaration(enum PROT p, Array *decl); | |
92 Dsymbol *syntaxCopy(Dsymbol *s); | |
93 void semantic(Scope *sc); | |
94 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
95 }; | |
96 | |
97 struct AlignDeclaration : AttribDeclaration | |
98 { | |
99 unsigned salign; | |
100 | |
710
20a5180f2e80
Make align(n), n != 1 an error.
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
101 AlignDeclaration(Loc loc, unsigned sa, Array *decl); |
1 | 102 Dsymbol *syntaxCopy(Dsymbol *s); |
103 void semantic(Scope *sc); | |
104 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
105 }; | |
106 | |
107 struct AnonDeclaration : AttribDeclaration | |
108 { | |
109 int isunion; | |
110 Scope *scope; // !=NULL means context to use | |
111 int sem; // 1 if successful semantic() | |
112 | |
113 AnonDeclaration(Loc loc, int isunion, Array *decl); | |
114 Dsymbol *syntaxCopy(Dsymbol *s); | |
115 void semantic(Scope *sc); | |
116 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 117 const char *kind(); |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
710
diff
changeset
|
118 |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
119 #if IN_LLVM |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
120 void codegen(Ir*); |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
121 #endif |
1 | 122 }; |
123 | |
124 struct PragmaDeclaration : AttribDeclaration | |
125 { | |
126 Expressions *args; // array of Expression's | |
127 | |
128 PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl); | |
129 Dsymbol *syntaxCopy(Dsymbol *s); | |
130 void semantic(Scope *sc); | |
131 int oneMember(Dsymbol **ps); | |
132 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 133 const char *kind(); |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
134 |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
135 #if IN_DMD |
336 | 136 void toObjFile(int multiobj); // compile to .obj file |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
137 #endif |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
138 |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
139 #if IN_LLVM |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
140 void codegen(Ir*); |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
141 #endif |
1 | 142 }; |
143 | |
144 struct ConditionalDeclaration : AttribDeclaration | |
145 { | |
146 Condition *condition; | |
147 Array *elsedecl; // array of Dsymbol's for else block | |
148 | |
149 ConditionalDeclaration(Condition *condition, Array *decl, Array *elsedecl); | |
150 Dsymbol *syntaxCopy(Dsymbol *s); | |
151 int oneMember(Dsymbol **ps); | |
152 void emitComment(Scope *sc); | |
153 Array *include(Scope *sc, ScopeDsymbol *s); | |
154 void addComment(unsigned char *comment); | |
155 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
156 }; | |
157 | |
158 struct StaticIfDeclaration : ConditionalDeclaration | |
159 { | |
160 ScopeDsymbol *sd; | |
161 int addisdone; | |
162 | |
163 StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl); | |
164 Dsymbol *syntaxCopy(Dsymbol *s); | |
165 int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
166 void semantic(Scope *sc); | |
336 | 167 const char *kind(); |
1 | 168 }; |
169 | |
170 // Mixin declarations | |
171 | |
172 struct CompileDeclaration : AttribDeclaration | |
173 { | |
174 Expression *exp; | |
175 | |
176 ScopeDsymbol *sd; | |
336 | 177 int compiled; |
1 | 178 |
179 CompileDeclaration(Loc loc, Expression *exp); | |
180 Dsymbol *syntaxCopy(Dsymbol *s); | |
181 int addMember(Scope *sc, ScopeDsymbol *sd, int memnum); | |
336 | 182 void compileIt(Scope *sc); |
1 | 183 void semantic(Scope *sc); |
184 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
185 }; | |
186 | |
187 #endif /* DMD_ATTRIB_H */ |