comparison dmd2/dsymbol.h @ 1452:638d16625da2

LDC 2 compiles again.
author Robert Clipsham <robert@octarineparrot.com>
date Sat, 30 May 2009 17:23:32 +0100
parents 5fa3e0ea06e9
children 54b3c1394d62
comparison
equal deleted inserted replaced
1423:42bd767ec5a4 1452:638d16625da2
19 #include "stringtable.h" 19 #include "stringtable.h"
20 20
21 #include "mars.h" 21 #include "mars.h"
22 #include "arraytypes.h" 22 #include "arraytypes.h"
23 23
24 // llvm 24 #if IN_LLVM
25 #include "../ir/irsymbol.h" 25 #include "../ir/irdsymbol.h"
26 #endif
26 27
27 struct Identifier; 28 struct Identifier;
28 struct Scope; 29 struct Scope;
29 struct DsymbolTable; 30 struct DsymbolTable;
30 struct Declaration; 31 struct Declaration;
32 struct ThisDeclaration;
31 struct TupleDeclaration; 33 struct TupleDeclaration;
32 struct TypedefDeclaration; 34 struct TypedefDeclaration;
33 struct AliasDeclaration; 35 struct AliasDeclaration;
34 struct AggregateDeclaration; 36 struct AggregateDeclaration;
35 struct EnumDeclaration; 37 struct EnumDeclaration;
48 struct InvariantDeclaration; 50 struct InvariantDeclaration;
49 struct UnitTestDeclaration; 51 struct UnitTestDeclaration;
50 struct NewDeclaration; 52 struct NewDeclaration;
51 struct VarDeclaration; 53 struct VarDeclaration;
52 struct AttribDeclaration; 54 struct AttribDeclaration;
55 #if IN_DMD
53 struct Symbol; 56 struct Symbol;
57 #endif
54 struct Package; 58 struct Package;
55 struct Module; 59 struct Module;
56 struct Import; 60 struct Import;
57 struct Type; 61 struct Type;
58 struct TypeTuple; 62 struct TypeTuple;
68 struct StaticStructInitDeclaration; 72 struct StaticStructInitDeclaration;
69 struct Expression; 73 struct Expression;
70 struct DeleteDeclaration; 74 struct DeleteDeclaration;
71 struct HdrGenState; 75 struct HdrGenState;
72 struct OverloadSet; 76 struct OverloadSet;
77 #if IN_LLVM
73 struct TypeInfoDeclaration; 78 struct TypeInfoDeclaration;
74 struct ClassInfoDeclaration; 79 struct ClassInfoDeclaration;
80 #endif
81
82 #if IN_DMD
83 struct Symbol;
84 #endif
75 85
76 #if IN_GCC 86 #if IN_GCC
77 union tree_node; 87 union tree_node;
78 typedef union tree_node TYPE; 88 typedef union tree_node TYPE;
79 #else 89 #else
80 struct TYPE; 90 struct TYPE;
81 #endif 91 #endif
82 92
83 // llvm
84 #if IN_LLVM 93 #if IN_LLVM
94 class Ir;
95 class IrSymbol;
85 namespace llvm 96 namespace llvm
86 { 97 {
87 class Value; 98 class Value;
88 } 99 }
100 #endif
101 #if IN_DMD
102 // Back end
103 struct Classsym;
89 #endif 104 #endif
90 105
91 enum PROT 106 enum PROT
92 { 107 {
93 PROTundefined, 108 PROTundefined,
103 struct Dsymbol : Object 118 struct Dsymbol : Object
104 { 119 {
105 Identifier *ident; 120 Identifier *ident;
106 Identifier *c_ident; 121 Identifier *c_ident;
107 Dsymbol *parent; 122 Dsymbol *parent;
123 #if IN_DMD
108 Symbol *csym; // symbol for code generator 124 Symbol *csym; // symbol for code generator
109 Symbol *isym; // import version of csym 125 Symbol *isym; // import version of csym
126 #endif
110 unsigned char *comment; // documentation comment for this Dsymbol 127 unsigned char *comment; // documentation comment for this Dsymbol
111 Loc loc; // where defined 128 Loc loc; // where defined
112 129
113 Dsymbol(); 130 Dsymbol();
114 Dsymbol(Identifier *); 131 Dsymbol(Identifier *);
115 char *toChars(); 132 char *toChars();
116 char *toPrettyChars(); 133 char *toPrettyChars();
117 char *locToChars(); 134 char *locToChars();
118 int equals(Object *o); 135 int equals(Object *o);
119 int isAnonymous(); 136 int isAnonymous();
120 void error(Loc loc, const char *format, ...); 137 void error(Loc loc, const char *format, ...) IS_PRINTF(3);
121 void error(const char *format, ...); 138 void error(const char *format, ...) IS_PRINTF(2);
122 void checkDeprecated(Loc loc, Scope *sc); 139 void checkDeprecated(Loc loc, Scope *sc);
123 Module *getModule(); 140 Module *getModule(); // module where declared
124 Module *getCompilationModule(); // possibly different for templates 141 Module *getCompilationModule(); // possibly different for templates
125 Dsymbol *pastMixin(); 142 Dsymbol *pastMixin();
126 Dsymbol *toParent(); 143 Dsymbol *toParent();
127 Dsymbol *toParent2(); 144 Dsymbol *toParent2();
128 TemplateInstance *inTemplateInstance(); 145 TemplateInstance *inTemplateInstance();
171 188
172 virtual void addComment(unsigned char *comment); 189 virtual void addComment(unsigned char *comment);
173 virtual void emitComment(Scope *sc); 190 virtual void emitComment(Scope *sc);
174 void emitDitto(Scope *sc); 191 void emitDitto(Scope *sc);
175 192
193 #if IN_DMD
176 // Backend 194 // Backend
177 195
178 virtual Symbol *toSymbol(); // to backend symbol 196 virtual Symbol *toSymbol(); // to backend symbol
179 virtual void toObjFile(int multiobj); // compile to .obj file 197 virtual void toObjFile(int multiobj); // compile to .obj file
180 virtual int cvMember(unsigned char *p); // emit cv debug info for member 198 virtual int cvMember(unsigned char *p); // emit cv debug info for member
181 199
182 Symbol *toImport(); // to backend import symbol 200 Symbol *toImport(); // to backend import symbol
183 static Symbol *toImport(Symbol *s); // to backend import symbol 201 static Symbol *toImport(Symbol *s); // to backend import symbol
184 202
185 Symbol *toSymbolX(const char *prefix, int sclass, TYPE *t, const char *suffix); // helper 203 Symbol *toSymbolX(const char *prefix, int sclass, TYPE *t, const char *suffix); // helper
204 #endif
186 205
187 // Eliminate need for dynamic_cast 206 // Eliminate need for dynamic_cast
188 virtual Package *isPackage() { return NULL; } 207 virtual Package *isPackage() { return NULL; }
189 virtual Module *isModule() { return NULL; } 208 virtual Module *isModule() { return NULL; }
190 virtual EnumMember *isEnumMember() { return NULL; } 209 virtual EnumMember *isEnumMember() { return NULL; }
191 virtual TemplateDeclaration *isTemplateDeclaration() { return NULL; } 210 virtual TemplateDeclaration *isTemplateDeclaration() { return NULL; }
192 virtual TemplateInstance *isTemplateInstance() { return NULL; } 211 virtual TemplateInstance *isTemplateInstance() { return NULL; }
193 virtual TemplateMixin *isTemplateMixin() { return NULL; } 212 virtual TemplateMixin *isTemplateMixin() { return NULL; }
194 virtual Declaration *isDeclaration() { return NULL; } 213 virtual Declaration *isDeclaration() { return NULL; }
214 virtual ThisDeclaration *isThisDeclaration() { return NULL; }
195 virtual TupleDeclaration *isTupleDeclaration() { return NULL; } 215 virtual TupleDeclaration *isTupleDeclaration() { return NULL; }
196 virtual TypedefDeclaration *isTypedefDeclaration() { return NULL; } 216 virtual TypedefDeclaration *isTypedefDeclaration() { return NULL; }
197 virtual AliasDeclaration *isAliasDeclaration() { return NULL; } 217 virtual AliasDeclaration *isAliasDeclaration() { return NULL; }
198 virtual AggregateDeclaration *isAggregateDeclaration() { return NULL; } 218 virtual AggregateDeclaration *isAggregateDeclaration() { return NULL; }
199 virtual FuncDeclaration *isFuncDeclaration() { return NULL; } 219 virtual FuncDeclaration *isFuncDeclaration() { return NULL; }
224 virtual AttribDeclaration *isAttribDeclaration() { return NULL; } 244 virtual AttribDeclaration *isAttribDeclaration() { return NULL; }
225 virtual OverloadSet *isOverloadSet() { return NULL; } 245 virtual OverloadSet *isOverloadSet() { return NULL; }
226 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return NULL; } 246 virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return NULL; }
227 virtual ClassInfoDeclaration* isClassInfoDeclaration() { return NULL; } 247 virtual ClassInfoDeclaration* isClassInfoDeclaration() { return NULL; }
228 248
249 #if IN_LLVM
250 /// Codegen traversal
251 virtual void codegen(Ir* ir);
252
229 // llvm stuff 253 // llvm stuff
230 int llvmInternal; 254 int llvmInternal;
231 255
232 IrDsymbol ir; 256 IrDsymbol ir;
257 IrSymbol* irsym;
258 #endif
233 }; 259 };
234 260
235 // Dsymbol that generates a scope 261 // Dsymbol that generates a scope
236 262
237 struct ScopeDsymbol : Dsymbol 263 struct ScopeDsymbol : Dsymbol