Mercurial > projects > ldc
comparison dmd/dsymbol.h @ 1146:1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
* Added #if IN_DMD versioning around DMD backend specific code in the D1 frontend, D2 is currently broken.
* All part of a greater cleanup scheme.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Thu, 26 Mar 2009 20:45:53 +0100 |
parents | 1714836f2c0b |
children | dbe4af57b240 |
comparison
equal
deleted
inserted
replaced
1145:40caa8207b3e | 1146:1860414bf3b7 |
---|---|
20 | 20 |
21 #include "mars.h" | 21 #include "mars.h" |
22 #include "arraytypes.h" | 22 #include "arraytypes.h" |
23 | 23 |
24 // llvm | 24 // llvm |
25 #include "../ir/irsymbol.h" | 25 #include "../ir/irdsymbol.h" |
26 | 26 |
27 struct Identifier; | 27 struct Identifier; |
28 struct Scope; | 28 struct Scope; |
29 struct DsymbolTable; | 29 struct DsymbolTable; |
30 struct Declaration; | 30 struct Declaration; |
47 struct InvariantDeclaration; | 47 struct InvariantDeclaration; |
48 struct UnitTestDeclaration; | 48 struct UnitTestDeclaration; |
49 struct NewDeclaration; | 49 struct NewDeclaration; |
50 struct VarDeclaration; | 50 struct VarDeclaration; |
51 struct AttribDeclaration; | 51 struct AttribDeclaration; |
52 struct Symbol; | |
53 struct Package; | 52 struct Package; |
54 struct Module; | 53 struct Module; |
55 struct Import; | 54 struct Import; |
56 struct Type; | 55 struct Type; |
57 struct TypeTuple; | 56 struct TypeTuple; |
70 struct DeleteDeclaration; | 69 struct DeleteDeclaration; |
71 struct HdrGenState; | 70 struct HdrGenState; |
72 struct TypeInfoDeclaration; | 71 struct TypeInfoDeclaration; |
73 struct ClassInfoDeclaration; | 72 struct ClassInfoDeclaration; |
74 | 73 |
74 #if IN_DMD | |
75 struct Symbol; | |
76 #endif | |
77 | |
75 #if IN_GCC | 78 #if IN_GCC |
76 union tree_node; | 79 union tree_node; |
77 typedef union tree_node TYPE; | 80 typedef union tree_node TYPE; |
78 #else | 81 #else |
79 struct TYPE; | 82 struct TYPE; |
102 struct Dsymbol : Object | 105 struct Dsymbol : Object |
103 { | 106 { |
104 Identifier *ident; | 107 Identifier *ident; |
105 Identifier *c_ident; | 108 Identifier *c_ident; |
106 Dsymbol *parent; | 109 Dsymbol *parent; |
110 #if IN_DMD | |
107 Symbol *csym; // symbol for code generator | 111 Symbol *csym; // symbol for code generator |
108 Symbol *isym; // import version of csym | 112 Symbol *isym; // import version of csym |
113 #endif | |
109 unsigned char *comment; // documentation comment for this Dsymbol | 114 unsigned char *comment; // documentation comment for this Dsymbol |
110 Loc loc; // where defined | 115 Loc loc; // where defined |
111 | 116 |
112 Dsymbol(); | 117 Dsymbol(); |
113 Dsymbol(Identifier *); | 118 Dsymbol(Identifier *); |
169 | 174 |
170 virtual void addComment(unsigned char *comment); | 175 virtual void addComment(unsigned char *comment); |
171 virtual void emitComment(Scope *sc); | 176 virtual void emitComment(Scope *sc); |
172 void emitDitto(Scope *sc); | 177 void emitDitto(Scope *sc); |
173 | 178 |
179 #if IN_DMD | |
174 // Backend | 180 // Backend |
175 | 181 |
176 virtual Symbol *toSymbol(); // to backend symbol | 182 virtual Symbol *toSymbol(); // to backend symbol |
183 #endif | |
177 virtual void toObjFile(int multiobj); // compile to .obj file | 184 virtual void toObjFile(int multiobj); // compile to .obj file |
185 #if IN_DMD | |
178 virtual int cvMember(unsigned char *p); // emit cv debug info for member | 186 virtual int cvMember(unsigned char *p); // emit cv debug info for member |
179 | 187 |
180 Symbol *toImport(); // to backend import symbol | 188 Symbol *toImport(); // to backend import symbol |
181 static Symbol *toImport(Symbol *s); // to backend import symbol | 189 static Symbol *toImport(Symbol *s); // to backend import symbol |
182 | 190 |
183 Symbol *toSymbolX(const char *prefix, int sclass, TYPE *t, const char *suffix); // helper | 191 Symbol *toSymbolX(const char *prefix, int sclass, TYPE *t, const char *suffix); // helper |
192 #endif | |
184 | 193 |
185 // Eliminate need for dynamic_cast | 194 // Eliminate need for dynamic_cast |
186 virtual Package *isPackage() { return NULL; } | 195 virtual Package *isPackage() { return NULL; } |
187 virtual Module *isModule() { return NULL; } | 196 virtual Module *isModule() { return NULL; } |
188 virtual EnumMember *isEnumMember() { return NULL; } | 197 virtual EnumMember *isEnumMember() { return NULL; } |
220 virtual StaticStructInitDeclaration *isStaticStructInitDeclaration() { return NULL; } | 229 virtual StaticStructInitDeclaration *isStaticStructInitDeclaration() { return NULL; } |
221 virtual AttribDeclaration *isAttribDeclaration() { return NULL; } | 230 virtual AttribDeclaration *isAttribDeclaration() { return NULL; } |
222 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return NULL; } | 231 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return NULL; } |
223 virtual ClassInfoDeclaration* isClassInfoDeclaration() { return NULL; } | 232 virtual ClassInfoDeclaration* isClassInfoDeclaration() { return NULL; } |
224 | 233 |
234 #if IN_LLVM | |
225 // llvm stuff | 235 // llvm stuff |
226 int llvmInternal; | 236 int llvmInternal; |
227 | 237 |
228 IrDsymbol ir; | 238 IrDsymbol ir; |
239 #endif | |
229 }; | 240 }; |
230 | 241 |
231 // Dsymbol that generates a scope | 242 // Dsymbol that generates a scope |
232 | 243 |
233 struct ScopeDsymbol : Dsymbol | 244 struct ScopeDsymbol : Dsymbol |