Mercurial > projects > ldc
comparison dmd/declaration.h @ 1367:8026319762be
Merged DMD 1.045 !!!
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Sat, 16 May 2009 22:21:31 +0200 |
parents | 78038e540342 |
children | d9c5f5a43403 |
comparison
equal
deleted
inserted
replaced
1366:81121ac19f61 | 1367:8026319762be |
---|---|
66 STCvariadic = 0x10000, // variadic function argument | 66 STCvariadic = 0x10000, // variadic function argument |
67 STCctorinit = 0x20000, // can only be set inside constructor | 67 STCctorinit = 0x20000, // can only be set inside constructor |
68 STCtemplateparameter = 0x40000, // template parameter | 68 STCtemplateparameter = 0x40000, // template parameter |
69 STCscope = 0x80000, // template parameter | 69 STCscope = 0x80000, // template parameter |
70 STCinvariant = 0x100000, | 70 STCinvariant = 0x100000, |
71 STCimmutable = 0x100000, | |
71 STCref = 0x200000, | 72 STCref = 0x200000, |
72 STCinit = 0x400000, // has explicit initializer | 73 STCinit = 0x400000, // has explicit initializer |
73 STCmanifest = 0x800000, // manifest constant | 74 STCmanifest = 0x800000, // manifest constant |
74 STCnodtor = 0x1000000, // don't run destructor | 75 STCnodtor = 0x1000000, // don't run destructor |
75 STCnothrow = 0x2000000, // never throws exceptions | 76 STCnothrow = 0x2000000, // never throws exceptions |
76 STCpure = 0x4000000, // pure function | 77 STCpure = 0x4000000, // pure function |
77 STCtls = 0x8000000, // thread local | 78 STCtls = 0x8000000, // thread local |
78 STCalias = 0x10000000, // alias parameter | 79 STCalias = 0x10000000, // alias parameter |
80 STCshared = 0x20000000, // accessible from multiple threads | |
81 STCgshared = 0x40000000, // accessible from multiple threads | |
82 // but not typed as "shared" | |
83 STC_TYPECTOR = (STCconst | STCimmutable | STCshared), | |
79 }; | 84 }; |
80 | 85 |
81 struct Match | 86 struct Match |
82 { | 87 { |
83 int count; // number of matches found | 88 int count; // number of matches found |
99 Type *type; | 104 Type *type; |
100 Type *originalType; // before semantic analysis | 105 Type *originalType; // before semantic analysis |
101 unsigned storage_class; | 106 unsigned storage_class; |
102 enum PROT protection; | 107 enum PROT protection; |
103 enum LINK linkage; | 108 enum LINK linkage; |
109 int inuse; // used to detect cycles | |
104 | 110 |
105 Declaration(Identifier *id); | 111 Declaration(Identifier *id); |
106 void semantic(Scope *sc); | 112 void semantic(Scope *sc); |
107 const char *kind(); | 113 const char *kind(); |
108 unsigned size(Loc loc); | 114 unsigned size(Loc loc); |
175 Initializer *init; | 181 Initializer *init; |
176 int sem; // 0: semantic() has not been run | 182 int sem; // 0: semantic() has not been run |
177 // 1: semantic() is in progress | 183 // 1: semantic() is in progress |
178 // 2: semantic() has been run | 184 // 2: semantic() has been run |
179 // 3: semantic2() has been run | 185 // 3: semantic2() has been run |
180 int inuse; // used to detect typedef cycles | |
181 | 186 |
182 TypedefDeclaration(Loc loc, Identifier *ident, Type *basetype, Initializer *init); | 187 TypedefDeclaration(Loc loc, Identifier *ident, Type *basetype, Initializer *init); |
183 Dsymbol *syntaxCopy(Dsymbol *); | 188 Dsymbol *syntaxCopy(Dsymbol *); |
184 void semantic(Scope *sc); | 189 void semantic(Scope *sc); |
185 void semantic2(Scope *sc); | 190 void semantic2(Scope *sc); |
247 { | 252 { |
248 Initializer *init; | 253 Initializer *init; |
249 unsigned offset; | 254 unsigned offset; |
250 int noauto; // no auto semantics | 255 int noauto; // no auto semantics |
251 int nestedref; // referenced by a lexically nested function | 256 int nestedref; // referenced by a lexically nested function |
252 int inuse; | |
253 int ctorinit; // it has been initialized in a ctor | 257 int ctorinit; // it has been initialized in a ctor |
254 int onstack; // 1: it has been allocated on the stack | 258 int onstack; // 1: it has been allocated on the stack |
255 // 2: on stack, run destructor anyway | 259 // 2: on stack, run destructor anyway |
256 int canassign; // it can be assigned to | 260 int canassign; // it can be assigned to |
257 Dsymbol *aliassym; // if redone as alias to another symbol | 261 Dsymbol *aliassym; // if redone as alias to another symbol |
258 Expression *value; // when interpreting, this is the value | 262 Expression *value; // when interpreting, this is the value |
259 // (NULL if value not determinable) | 263 // (NULL if value not determinable) |
264 Scope *scope; // !=NULL means context to use | |
260 | 265 |
261 VarDeclaration(Loc loc, Type *t, Identifier *id, Initializer *init); | 266 VarDeclaration(Loc loc, Type *t, Identifier *id, Initializer *init); |
262 Dsymbol *syntaxCopy(Dsymbol *); | 267 Dsymbol *syntaxCopy(Dsymbol *); |
263 void semantic(Scope *sc); | 268 void semantic(Scope *sc); |
264 void semantic2(Scope *sc); | 269 void semantic2(Scope *sc); |
559 | 564 |
560 #if IN_LLVM | 565 #if IN_LLVM |
561 void llvmDefine(); | 566 void llvmDefine(); |
562 #endif | 567 #endif |
563 }; | 568 }; |
569 | |
570 struct TypeInfoSharedDeclaration : TypeInfoDeclaration | |
571 { | |
572 TypeInfoSharedDeclaration(Type *tinfo); | |
573 | |
574 void toDt(dt_t **pdt); | |
575 }; | |
564 #endif | 576 #endif |
565 | 577 |
566 /**************************************************************/ | 578 /**************************************************************/ |
567 | 579 |
568 struct ThisDeclaration : VarDeclaration | 580 struct ThisDeclaration : VarDeclaration |
569 { | 581 { |
570 ThisDeclaration(Type *t); | 582 ThisDeclaration(Loc loc, Type *t); |
571 Dsymbol *syntaxCopy(Dsymbol *); | 583 Dsymbol *syntaxCopy(Dsymbol *); |
584 ThisDeclaration *isThisDeclaration() { return this; } | |
572 }; | 585 }; |
573 | 586 |
574 enum ILS | 587 enum ILS |
575 { | 588 { |
576 ILSuninitialized, // not computed yet | 589 ILSuninitialized, // not computed yet |
622 int naked; // !=0 if naked | 635 int naked; // !=0 if naked |
623 int inlineAsm; // !=0 if has inline assembler | 636 int inlineAsm; // !=0 if has inline assembler |
624 ILS inlineStatus; | 637 ILS inlineStatus; |
625 int inlineNest; // !=0 if nested inline | 638 int inlineNest; // !=0 if nested inline |
626 int cantInterpret; // !=0 if cannot interpret function | 639 int cantInterpret; // !=0 if cannot interpret function |
627 int semanticRun; // !=0 if semantic3() had been run | 640 int semanticRun; // 1 semantic() run |
641 // 2 semantic2() run | |
642 // 3 semantic3() started | |
643 // 4 semantic3() done | |
644 // 5 toObjFile() run | |
628 // this function's frame ptr | 645 // this function's frame ptr |
629 ForeachStatement *fes; // if foreach body, this is the foreach | 646 ForeachStatement *fes; // if foreach body, this is the foreach |
630 int introducing; // !=0 if 'introducing' function | 647 int introducing; // !=0 if 'introducing' function |
631 Type *tintro; // if !=NULL, then this is the type | 648 Type *tintro; // if !=NULL, then this is the type |
632 // of the 'introducing' function | 649 // of the 'introducing' function |