root/branches/tango/rebuild/attrib.h

Revision 589, 4.3 kB (checked in by Gregor, 2 years ago)

MERGE: trunk r588

Line 
1 // Compiler implementation of the D programming language
2 // Copyright (c) 1999-2007 by Digital Mars
3 // All Rights Reserved
4 // written by Walter Bright
5 // http://www.digitalmars.com
6 // License for redistribution is by either the Artistic License
7 // in artistic.txt, or the GNU General Public License in gnu.txt.
8 // See the included readme.txt for details.
9
10 #ifndef DMD_ATTRIB_H
11 #define DMD_ATTRIB_H
12
13 #ifdef __DMC__
14 #pragma once
15 #endif /* __DMC__ */
16
17 #include "dsymbol.h"
18
19 struct Expression;
20 struct Statement;
21 struct LabelDsymbol;
22 struct Initializer;
23 struct Module;
24 struct Condition;
25 #ifdef _DH
26 struct HdrGenState;
27 #endif
28
29 /**************************************************************/
30
31 struct AttribDeclaration : Dsymbol
32 {
33     Array *decl;    // array of Dsymbol's
34
35     AttribDeclaration(Array *decl);
36     virtual Array *include(Scope *sc, ScopeDsymbol *s);
37     int addMember(Scope *sc, ScopeDsymbol *s, int memnum);
38     void semantic(Scope *sc);
39     void semantic2(Scope *sc);
40     void semantic3(Scope *sc);
41     void inlineScan();
42     void addComment(unsigned char *comment);
43     void emitComment(Scope *sc);
44     char *kind();
45     int oneMember(Dsymbol **ps);
46     int hasPointers();
47     void checkCtorConstInit();
48     void addLocalClass(ClassDeclarations *);
49     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
50     AttribDeclaration *isAttribDeclaration() { return this; }
51    
52     virtual void parsepragmas(Module *);
53 };
54
55 struct StorageClassDeclaration: AttribDeclaration
56 {
57     unsigned stc;
58
59     StorageClassDeclaration(unsigned stc, Array *decl);
60     Dsymbol *syntaxCopy(Dsymbol *s);
61     void semantic(Scope *sc);
62     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
63 };
64
65 struct LinkDeclaration : AttribDeclaration
66 {
67     enum LINK linkage;
68
69     LinkDeclaration(enum LINK p, Array *decl);
70     Dsymbol *syntaxCopy(Dsymbol *s);
71     void semantic(Scope *sc);
72     void semantic3(Scope *sc);
73     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
74     char *toChars();
75 };
76
77 struct ProtDeclaration : AttribDeclaration
78 {
79     enum PROT protection;
80
81     ProtDeclaration(enum PROT p, Array *decl);
82     Dsymbol *syntaxCopy(Dsymbol *s);
83     void semantic(Scope *sc);
84     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
85 };
86
87 struct AlignDeclaration : AttribDeclaration
88 {
89     unsigned salign;
90
91     AlignDeclaration(unsigned sa, Array *decl);
92     Dsymbol *syntaxCopy(Dsymbol *s);
93     void semantic(Scope *sc);
94     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
95 };
96
97 struct AnonDeclaration : AttribDeclaration
98 {
99     int isunion;
100     Scope *scope;       // !=NULL means context to use
101     int sem;            // 1 if successful semantic()
102
103     AnonDeclaration(Loc loc, int isunion, Array *decl);
104     Dsymbol *syntaxCopy(Dsymbol *s);
105     void semantic(Scope *sc);
106     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
107     char *kind();
108 };
109
110 struct PragmaDeclaration : AttribDeclaration
111 {
112     Expressions *args;      // array of Expression's
113
114     PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl);
115     Dsymbol *syntaxCopy(Dsymbol *s);
116     void semantic(Scope *sc);
117     int oneMember(Dsymbol **ps);
118     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
119     char *kind();
120    
121     virtual void parsepragmas(Module *);
122 };
123
124 struct ConditionalDeclaration : AttribDeclaration
125 {
126     Condition *condition;
127     Array *elsedecl;    // array of Dsymbol's for else block
128
129     ConditionalDeclaration(Condition *condition, Array *decl, Array *elsedecl);
130     Dsymbol *syntaxCopy(Dsymbol *s);
131     int oneMember(Dsymbol **ps);
132     void emitComment(Scope *sc);
133     Array *include(Scope *sc, ScopeDsymbol *s);
134     void addComment(unsigned char *comment);
135     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
136    
137     virtual void parsepragmas(Module *);
138 };
139
140 struct StaticIfDeclaration : ConditionalDeclaration
141 {
142     ScopeDsymbol *sd;
143     int addisdone;
144
145     StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl);
146     Dsymbol *syntaxCopy(Dsymbol *s);
147     int addMember(Scope *sc, ScopeDsymbol *s, int memnum);
148     void semantic(Scope *sc);
149     char *kind();
150 };
151
152 // Mixin declarations
153
154 struct CompileDeclaration : AttribDeclaration
155 {
156     Expression *exp;
157
158     ScopeDsymbol *sd;
159
160     CompileDeclaration(Loc loc, Expression *exp);
161     Dsymbol *syntaxCopy(Dsymbol *s);
162     int addMember(Scope *sc, ScopeDsymbol *sd, int memnum);
163     void semantic(Scope *sc);
164     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
165 };
166
167 #endif /* DMD_ATTRIB_H */
Note: See TracBrowser for help on using the browser.