Mercurial > projects > ldc
annotate dmd/attrib.h @ 1194:1853dcd9b944
Moved some DMDFE files into a seperate dmd/root subdir to closer match the DMD file structure since 1.041.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Fri, 03 Apr 2009 17:02:52 +0200 |
parents | dbe4af57b240 |
children | e961851fb8be |
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); | |
71 }; | |
72 | |
73 struct LinkDeclaration : AttribDeclaration | |
74 { | |
75 enum LINK linkage; | |
76 | |
77 LinkDeclaration(enum LINK p, Array *decl); | |
78 Dsymbol *syntaxCopy(Dsymbol *s); | |
79 void semantic(Scope *sc); | |
80 void semantic3(Scope *sc); | |
81 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
82 char *toChars(); | |
83 }; | |
84 | |
85 struct ProtDeclaration : AttribDeclaration | |
86 { | |
87 enum PROT protection; | |
88 | |
89 ProtDeclaration(enum PROT p, Array *decl); | |
90 Dsymbol *syntaxCopy(Dsymbol *s); | |
91 void semantic(Scope *sc); | |
92 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
93 }; | |
94 | |
95 struct AlignDeclaration : AttribDeclaration | |
96 { | |
97 unsigned salign; | |
98 | |
710
20a5180f2e80
Make align(n), n != 1 an error.
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
99 AlignDeclaration(Loc loc, unsigned sa, Array *decl); |
1 | 100 Dsymbol *syntaxCopy(Dsymbol *s); |
101 void semantic(Scope *sc); | |
102 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
103 }; | |
104 | |
105 struct AnonDeclaration : AttribDeclaration | |
106 { | |
107 int isunion; | |
108 Scope *scope; // !=NULL means context to use | |
109 int sem; // 1 if successful semantic() | |
110 | |
111 AnonDeclaration(Loc loc, int isunion, Array *decl); | |
112 Dsymbol *syntaxCopy(Dsymbol *s); | |
113 void semantic(Scope *sc); | |
114 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 115 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
|
116 |
1147
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
117 #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
|
118 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
|
119 #endif |
1 | 120 }; |
121 | |
122 struct PragmaDeclaration : AttribDeclaration | |
123 { | |
124 Expressions *args; // array of Expression's | |
125 | |
126 PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl); | |
127 Dsymbol *syntaxCopy(Dsymbol *s); | |
128 void semantic(Scope *sc); | |
129 int oneMember(Dsymbol **ps); | |
130 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 131 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
|
132 |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
133 #if IN_DMD |
336 | 134 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
|
135 #endif |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
136 |
dbe4af57b240
Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
797
diff
changeset
|
137 #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
|
138 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
|
139 #endif |
1 | 140 }; |
141 | |
142 struct ConditionalDeclaration : AttribDeclaration | |
143 { | |
144 Condition *condition; | |
145 Array *elsedecl; // array of Dsymbol's for else block | |
146 | |
147 ConditionalDeclaration(Condition *condition, Array *decl, Array *elsedecl); | |
148 Dsymbol *syntaxCopy(Dsymbol *s); | |
149 int oneMember(Dsymbol **ps); | |
150 void emitComment(Scope *sc); | |
151 Array *include(Scope *sc, ScopeDsymbol *s); | |
152 void addComment(unsigned char *comment); | |
153 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
154 }; | |
155 | |
156 struct StaticIfDeclaration : ConditionalDeclaration | |
157 { | |
158 ScopeDsymbol *sd; | |
159 int addisdone; | |
160 | |
161 StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl); | |
162 Dsymbol *syntaxCopy(Dsymbol *s); | |
163 int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
164 void semantic(Scope *sc); | |
336 | 165 const char *kind(); |
1 | 166 }; |
167 | |
168 // Mixin declarations | |
169 | |
170 struct CompileDeclaration : AttribDeclaration | |
171 { | |
172 Expression *exp; | |
173 | |
174 ScopeDsymbol *sd; | |
336 | 175 int compiled; |
1 | 176 |
177 CompileDeclaration(Loc loc, Expression *exp); | |
178 Dsymbol *syntaxCopy(Dsymbol *s); | |
179 int addMember(Scope *sc, ScopeDsymbol *sd, int memnum); | |
336 | 180 void compileIt(Scope *sc); |
1 | 181 void semantic(Scope *sc); |
182 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
183 }; | |
184 | |
185 #endif /* DMD_ATTRIB_H */ |