comparison dmd/attrib.h @ 1587:def7a1d494fd

Merge DMD 1.051
author Christian Kamm <kamm incasoftware de>
date Fri, 06 Nov 2009 23:58:01 +0100
parents 79758fd2f48a
children a413ae7329bf
comparison
equal deleted inserted replaced
1586:7f728c52e63c 1587:def7a1d494fd
1 1
2 // Compiler implementation of the D programming language 2 // Compiler implementation of the D programming language
3 // Copyright (c) 1999-2007 by Digital Mars 3 // Copyright (c) 1999-2009 by Digital Mars
4 // All Rights Reserved 4 // All Rights Reserved
5 // written by Walter Bright 5 // written by Walter Bright
6 // http://www.digitalmars.com 6 // http://www.digitalmars.com
7 // License for redistribution is by either the Artistic License 7 // License for redistribution is by either the Artistic License
8 // in artistic.txt, or the GNU General Public License in gnu.txt. 8 // in artistic.txt, or the GNU General Public License in gnu.txt.
34 Array *decl; // array of Dsymbol's 34 Array *decl; // array of Dsymbol's
35 35
36 AttribDeclaration(Array *decl); 36 AttribDeclaration(Array *decl);
37 virtual Array *include(Scope *sc, ScopeDsymbol *s); 37 virtual Array *include(Scope *sc, ScopeDsymbol *s);
38 int addMember(Scope *sc, ScopeDsymbol *s, int memnum); 38 int addMember(Scope *sc, ScopeDsymbol *s, int memnum);
39 void setScopeNewSc(Scope *sc,
40 unsigned newstc, enum LINK linkage, enum PROT protection, int explictProtection,
41 unsigned structalign);
42 void semanticNewSc(Scope *sc,
43 unsigned newstc, enum LINK linkage, enum PROT protection, int explictProtection,
44 unsigned structalign);
39 void semantic(Scope *sc); 45 void semantic(Scope *sc);
40 void semantic2(Scope *sc); 46 void semantic2(Scope *sc);
41 void semantic3(Scope *sc); 47 void semantic3(Scope *sc);
42 void inlineScan(); 48 void inlineScan();
43 void addComment(unsigned char *comment); 49 void addComment(unsigned char *comment);
46 int oneMember(Dsymbol **ps); 52 int oneMember(Dsymbol **ps);
47 int hasPointers(); 53 int hasPointers();
48 void checkCtorConstInit(); 54 void checkCtorConstInit();
49 void addLocalClass(ClassDeclarations *); 55 void addLocalClass(ClassDeclarations *);
50 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 56 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
57 void toJsonBuffer(OutBuffer *buf);
51 AttribDeclaration *isAttribDeclaration() { return this; } 58 AttribDeclaration *isAttribDeclaration() { return this; }
52 59
53 #if IN_DMD 60 #if IN_DMD
54 virtual void toObjFile(int multiobj); // compile to .obj file 61 virtual void toObjFile(int multiobj); // compile to .obj file
55 int cvMember(unsigned char *p); 62 int cvMember(unsigned char *p);
64 { 71 {
65 unsigned stc; 72 unsigned stc;
66 73
67 StorageClassDeclaration(unsigned stc, Array *decl); 74 StorageClassDeclaration(unsigned stc, Array *decl);
68 Dsymbol *syntaxCopy(Dsymbol *s); 75 Dsymbol *syntaxCopy(Dsymbol *s);
76 void setScope(Scope *sc);
69 void semantic(Scope *sc); 77 void semantic(Scope *sc);
70 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 78 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
71 79
72 static void stcToCBuffer(OutBuffer *buf, int stc); 80 static void stcToCBuffer(OutBuffer *buf, int stc);
73 }; 81 };
76 { 84 {
77 enum LINK linkage; 85 enum LINK linkage;
78 86
79 LinkDeclaration(enum LINK p, Array *decl); 87 LinkDeclaration(enum LINK p, Array *decl);
80 Dsymbol *syntaxCopy(Dsymbol *s); 88 Dsymbol *syntaxCopy(Dsymbol *s);
89 void setScope(Scope *sc);
81 void semantic(Scope *sc); 90 void semantic(Scope *sc);
82 void semantic3(Scope *sc); 91 void semantic3(Scope *sc);
83 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 92 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
84 char *toChars(); 93 char *toChars();
85 }; 94 };
88 { 97 {
89 enum PROT protection; 98 enum PROT protection;
90 99
91 ProtDeclaration(enum PROT p, Array *decl); 100 ProtDeclaration(enum PROT p, Array *decl);
92 Dsymbol *syntaxCopy(Dsymbol *s); 101 Dsymbol *syntaxCopy(Dsymbol *s);
93 void semantic(Scope *sc); 102 void importAll(Scope *sc);
94 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 103 void setScope(Scope *sc);
104 void semantic(Scope *sc);
105 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
106
107 static void protectionToCBuffer(OutBuffer *buf, enum PROT protection);
95 }; 108 };
96 109
97 struct AlignDeclaration : AttribDeclaration 110 struct AlignDeclaration : AttribDeclaration
98 { 111 {
99 unsigned salign; 112 unsigned salign;
100 113
101 AlignDeclaration(Loc loc, unsigned sa, Array *decl); 114 AlignDeclaration(Loc loc, unsigned sa, Array *decl);
102 Dsymbol *syntaxCopy(Dsymbol *s); 115 Dsymbol *syntaxCopy(Dsymbol *s);
116 void setScope(Scope *sc);
103 void semantic(Scope *sc); 117 void semantic(Scope *sc);
104 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 118 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
105 }; 119 };
106 120
107 struct AnonDeclaration : AttribDeclaration 121 struct AnonDeclaration : AttribDeclaration
108 { 122 {
109 int isunion; 123 int isunion;
110 Scope *scope; // !=NULL means context to use
111 int sem; // 1 if successful semantic() 124 int sem; // 1 if successful semantic()
112 125
113 AnonDeclaration(Loc loc, int isunion, Array *decl); 126 AnonDeclaration(Loc loc, int isunion, Array *decl);
114 Dsymbol *syntaxCopy(Dsymbol *s); 127 Dsymbol *syntaxCopy(Dsymbol *s);
115 void semantic(Scope *sc); 128 void semantic(Scope *sc);
122 Expressions *args; // array of Expression's 135 Expressions *args; // array of Expression's
123 136
124 PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl); 137 PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl);
125 Dsymbol *syntaxCopy(Dsymbol *s); 138 Dsymbol *syntaxCopy(Dsymbol *s);
126 void semantic(Scope *sc); 139 void semantic(Scope *sc);
140 void setScope(Scope *sc);
127 int oneMember(Dsymbol **ps); 141 int oneMember(Dsymbol **ps);
128 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 142 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
129 const char *kind(); 143 const char *kind();
130 144
131 #if IN_DMD 145 #if IN_DMD
147 int oneMember(Dsymbol **ps); 161 int oneMember(Dsymbol **ps);
148 void emitComment(Scope *sc); 162 void emitComment(Scope *sc);
149 Array *include(Scope *sc, ScopeDsymbol *s); 163 Array *include(Scope *sc, ScopeDsymbol *s);
150 void addComment(unsigned char *comment); 164 void addComment(unsigned char *comment);
151 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 165 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
166 void toJsonBuffer(OutBuffer *buf);
167 void importAll(Scope *sc);
168 void setScope(Scope *sc);
152 }; 169 };
153 170
154 struct StaticIfDeclaration : ConditionalDeclaration 171 struct StaticIfDeclaration : ConditionalDeclaration
155 { 172 {
156 ScopeDsymbol *sd; 173 ScopeDsymbol *sd;
158 175
159 StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl); 176 StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl);
160 Dsymbol *syntaxCopy(Dsymbol *s); 177 Dsymbol *syntaxCopy(Dsymbol *s);
161 int addMember(Scope *sc, ScopeDsymbol *s, int memnum); 178 int addMember(Scope *sc, ScopeDsymbol *s, int memnum);
162 void semantic(Scope *sc); 179 void semantic(Scope *sc);
180 void importAll(Scope *sc);
181 void setScope(Scope *sc);
163 const char *kind(); 182 const char *kind();
164 }; 183 };
165 184
166 // Mixin declarations 185 // Mixin declarations
167 186