Mercurial > projects > ldc
annotate dmd/attrib.h @ 819:446263a8a30d
Fixed taking address of global static array element as constant expression.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 02 Dec 2008 01:07:22 +0100 |
parents | 340acf1535d0 |
children | dbe4af57b240 |
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 | |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
710
diff
changeset
|
53 virtual void toObjFile(int multiobj); // compile to .obj file |
19 | 54 int cvMember(unsigned char *p); |
1 | 55 }; |
56 | |
57 struct StorageClassDeclaration: AttribDeclaration | |
58 { | |
59 unsigned stc; | |
60 | |
61 StorageClassDeclaration(unsigned stc, Array *decl); | |
62 Dsymbol *syntaxCopy(Dsymbol *s); | |
63 void semantic(Scope *sc); | |
64 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
65 }; | |
66 | |
67 struct LinkDeclaration : AttribDeclaration | |
68 { | |
69 enum LINK linkage; | |
70 | |
71 LinkDeclaration(enum LINK p, Array *decl); | |
72 Dsymbol *syntaxCopy(Dsymbol *s); | |
73 void semantic(Scope *sc); | |
74 void semantic3(Scope *sc); | |
75 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
76 char *toChars(); | |
77 }; | |
78 | |
79 struct ProtDeclaration : AttribDeclaration | |
80 { | |
81 enum PROT protection; | |
82 | |
83 ProtDeclaration(enum PROT p, Array *decl); | |
84 Dsymbol *syntaxCopy(Dsymbol *s); | |
85 void semantic(Scope *sc); | |
86 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
87 }; | |
88 | |
89 struct AlignDeclaration : AttribDeclaration | |
90 { | |
91 unsigned salign; | |
92 | |
710
20a5180f2e80
Make align(n), n != 1 an error.
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
93 AlignDeclaration(Loc loc, unsigned sa, Array *decl); |
1 | 94 Dsymbol *syntaxCopy(Dsymbol *s); |
95 void semantic(Scope *sc); | |
96 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
97 }; | |
98 | |
99 struct AnonDeclaration : AttribDeclaration | |
100 { | |
101 int isunion; | |
102 Scope *scope; // !=NULL means context to use | |
103 int sem; // 1 if successful semantic() | |
104 | |
105 AnonDeclaration(Loc loc, int isunion, Array *decl); | |
106 Dsymbol *syntaxCopy(Dsymbol *s); | |
107 void semantic(Scope *sc); | |
108 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 109 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
|
110 |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
710
diff
changeset
|
111 // LDC |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
710
diff
changeset
|
112 void toObjFile(int multiobj); // compile to .obj file |
1 | 113 }; |
114 | |
115 struct PragmaDeclaration : AttribDeclaration | |
116 { | |
117 Expressions *args; // array of Expression's | |
118 | |
119 PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl); | |
120 Dsymbol *syntaxCopy(Dsymbol *s); | |
121 void semantic(Scope *sc); | |
122 int oneMember(Dsymbol **ps); | |
123 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
336 | 124 const char *kind(); |
125 void toObjFile(int multiobj); // compile to .obj file | |
1 | 126 }; |
127 | |
128 struct ConditionalDeclaration : AttribDeclaration | |
129 { | |
130 Condition *condition; | |
131 Array *elsedecl; // array of Dsymbol's for else block | |
132 | |
133 ConditionalDeclaration(Condition *condition, Array *decl, Array *elsedecl); | |
134 Dsymbol *syntaxCopy(Dsymbol *s); | |
135 int oneMember(Dsymbol **ps); | |
136 void emitComment(Scope *sc); | |
137 Array *include(Scope *sc, ScopeDsymbol *s); | |
138 void addComment(unsigned char *comment); | |
139 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
140 }; | |
141 | |
142 struct StaticIfDeclaration : ConditionalDeclaration | |
143 { | |
144 ScopeDsymbol *sd; | |
145 int addisdone; | |
146 | |
147 StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl); | |
148 Dsymbol *syntaxCopy(Dsymbol *s); | |
149 int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
150 void semantic(Scope *sc); | |
336 | 151 const char *kind(); |
1 | 152 }; |
153 | |
154 // Mixin declarations | |
155 | |
156 struct CompileDeclaration : AttribDeclaration | |
157 { | |
158 Expression *exp; | |
159 | |
160 ScopeDsymbol *sd; | |
336 | 161 int compiled; |
1 | 162 |
163 CompileDeclaration(Loc loc, Expression *exp); | |
164 Dsymbol *syntaxCopy(Dsymbol *s); | |
165 int addMember(Scope *sc, ScopeDsymbol *sd, int memnum); | |
336 | 166 void compileIt(Scope *sc); |
1 | 167 void semantic(Scope *sc); |
168 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
169 }; | |
170 | |
171 #endif /* DMD_ATTRIB_H */ |