Allow returning something of type void in a function that returns void
[delight/core.git] / dmd2 / attrib.h
blobd23f748cb34e32c576f33bea9207aee336c4b858
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.
11 #ifndef DMD_ATTRIB_H
12 #define DMD_ATTRIB_H
14 #ifdef __DMC__
15 #pragma once
16 #endif /* __DMC__ */
18 #include "dsymbol.h"
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
30 /**************************************************************/
32 struct AttribDeclaration : Dsymbol
34 Array *decl; // array of Dsymbol's
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);
45 char *kind();
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; }
53 void toObjFile(int multiobj); // compile to .obj file
54 int cvMember(unsigned char *p);
57 struct StorageClassDeclaration: AttribDeclaration
59 unsigned stc;
61 StorageClassDeclaration(unsigned stc, Array *decl);
62 Dsymbol *syntaxCopy(Dsymbol *s);
63 void semantic(Scope *sc);
64 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
67 struct LinkDeclaration : AttribDeclaration
69 enum LINK linkage;
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();
79 struct ProtDeclaration : AttribDeclaration
81 enum PROT protection;
83 ProtDeclaration(enum PROT p, Array *decl);
84 Dsymbol *syntaxCopy(Dsymbol *s);
85 void semantic(Scope *sc);
86 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
89 struct AlignDeclaration : AttribDeclaration
91 unsigned salign;
93 AlignDeclaration(unsigned sa, Array *decl);
94 Dsymbol *syntaxCopy(Dsymbol *s);
95 void semantic(Scope *sc);
96 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
99 struct AnonDeclaration : AttribDeclaration
101 int isunion;
102 Scope *scope; // !=NULL means context to use
103 int sem; // 1 if successful semantic()
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);
109 char *kind();
112 struct PragmaDeclaration : AttribDeclaration
114 Expressions *args; // array of Expression's
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);
121 char *kind();
122 void toObjFile(int multiobj); // compile to .obj file
125 struct ConditionalDeclaration : AttribDeclaration
127 Condition *condition;
128 Array *elsedecl; // array of Dsymbol's for else block
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);
139 struct StaticIfDeclaration : ConditionalDeclaration
141 ScopeDsymbol *sd;
142 int addisdone;
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);
148 char *kind();
151 // Mixin declarations
153 struct CompileDeclaration : AttribDeclaration
155 Expression *exp;
157 ScopeDsymbol *sd;
159 CompileDeclaration(Loc loc, Expression *exp);
160 Dsymbol *syntaxCopy(Dsymbol *s);
161 int addMember(Scope *sc, ScopeDsymbol *sd, int memnum);
162 void semantic(Scope *sc);
163 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
166 #endif /* DMD_ATTRIB_H */