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
|
336
|
53 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
|
|
93 AlignDeclaration(unsigned sa, Array *decl);
|
|
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();
|
1
|
110 };
|
|
111
|
|
112 struct PragmaDeclaration : AttribDeclaration
|
|
113 {
|
|
114 Expressions *args; // array of Expression's
|
|
115
|
|
116 PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl);
|
|
117 Dsymbol *syntaxCopy(Dsymbol *s);
|
|
118 void semantic(Scope *sc);
|
|
119 int oneMember(Dsymbol **ps);
|
|
120 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
336
|
121 const char *kind();
|
|
122 void toObjFile(int multiobj); // compile to .obj file
|
1
|
123 };
|
|
124
|
|
125 struct ConditionalDeclaration : AttribDeclaration
|
|
126 {
|
|
127 Condition *condition;
|
|
128 Array *elsedecl; // array of Dsymbol's for else block
|
|
129
|
|
130 ConditionalDeclaration(Condition *condition, Array *decl, Array *elsedecl);
|
|
131 Dsymbol *syntaxCopy(Dsymbol *s);
|
|
132 int oneMember(Dsymbol **ps);
|
|
133 void emitComment(Scope *sc);
|
|
134 Array *include(Scope *sc, ScopeDsymbol *s);
|
|
135 void addComment(unsigned char *comment);
|
|
136 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
137 };
|
|
138
|
|
139 struct StaticIfDeclaration : ConditionalDeclaration
|
|
140 {
|
|
141 ScopeDsymbol *sd;
|
|
142 int addisdone;
|
|
143
|
|
144 StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl);
|
|
145 Dsymbol *syntaxCopy(Dsymbol *s);
|
|
146 int addMember(Scope *sc, ScopeDsymbol *s, int memnum);
|
|
147 void semantic(Scope *sc);
|
336
|
148 const char *kind();
|
1
|
149 };
|
|
150
|
|
151 // Mixin declarations
|
|
152
|
|
153 struct CompileDeclaration : AttribDeclaration
|
|
154 {
|
|
155 Expression *exp;
|
|
156
|
|
157 ScopeDsymbol *sd;
|
336
|
158 int compiled;
|
1
|
159
|
|
160 CompileDeclaration(Loc loc, Expression *exp);
|
|
161 Dsymbol *syntaxCopy(Dsymbol *s);
|
|
162 int addMember(Scope *sc, ScopeDsymbol *sd, int memnum);
|
336
|
163 void compileIt(Scope *sc);
|
1
|
164 void semantic(Scope *sc);
|
|
165 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
|
166 };
|
|
167
|
|
168 #endif /* DMD_ATTRIB_H */
|