2 * Defines enums common to dmd and dmd as parse library.
4 * Copyright: Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
6 * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/astenums.d, _astenums.d)
7 * Documentation: https://dlang.org/phobos/dmd_astenums.html
8 * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/astenums.d
15 none, /// size of aggregate is not yet able to compute
16 fwd, /// size of aggregate is ready to compute
17 inProcess, /// in the midst of computing the size
18 done, /// size of aggregate is set correctly
23 none, /// base classes not computed yet
24 start, /// in process of resolving base classes
25 done, /// all base classes are resolved
26 semanticdone, /// all base classes semantic done
31 const_ = 1, // type is const
32 immutable_ = 4, // type is immutable
33 shared_ = 2, // type is shared
34 wild = 8, // type is wild
35 wildconst = (MODFlags.wild | MODFlags.const_), // type is wild const
36 mutable = 0x10, // type is mutable (only used in wildcard matching)
41 enum STC : ulong // transfer changes to declaration.h
45 static_ = 1, /// `static`
46 extern_ = 2, /// `extern`
47 const_ = 4, /// `const`
48 final_ = 8, /// `final`
50 abstract_ = 0x10, /// `abstract`
51 parameter = 0x20, /// is function parameter
52 field = 0x40, /// is field of struct, union or class
53 override_ = 0x80, /// `override`
55 auto_ = 0x100, /// `auto`
56 synchronized_ = 0x200, /// `synchronized`
57 deprecated_ = 0x400, /// `deprecated`
58 in_ = 0x800, /// `in` parameter
60 out_ = 0x1000, /// `out` parameter
61 lazy_ = 0x2000, /// `lazy` parameter
62 foreach_ = 0x4000, /// variable for foreach loop
63 variadic = 0x8000, /// the `variadic` parameter in: T foo(T a, U b, V variadic...)
66 templateparameter = 0x2_0000, /// template parameter
67 ref_ = 0x4_0000, /// `ref`
68 scope_ = 0x8_0000, /// `scope`
70 maybescope = 0x10_0000, /// parameter might be `scope`
71 scopeinferred = 0x20_0000, /// `scope` has been inferred and should not be part of mangling, `scope_` must also be set
72 return_ = 0x40_0000, /// 'return ref' or 'return scope' for function parameters
73 returnScope = 0x80_0000, /// if `ref return scope` then resolve to `ref` and `return scope`
75 returninferred = 0x100_0000, /// `return` has been inferred and should not be part of mangling, `return_` must also be set
76 immutable_ = 0x200_0000, /// `immutable`
78 manifest = 0x800_0000, /// manifest constant
80 nodtor = 0x1000_0000, /// do not run destructor
81 nothrow_ = 0x2000_0000, /// `nothrow` meaning never throws exceptions
82 pure_ = 0x4000_0000, /// `pure` function
83 tls = 0x8000_0000, /// thread local
85 alias_ = 0x1_0000_0000, /// `alias` parameter
86 shared_ = 0x2_0000_0000, /// accessible from multiple threads
87 gshared = 0x4_0000_0000, /// accessible from multiple threads, but not typed as `shared`
88 wild = 0x8_0000_0000, /// for wild type constructor
90 property = 0x10_0000_0000, /// `@property`
91 safe = 0x20_0000_0000, /// `@safe`
92 trusted = 0x40_0000_0000, /// `@trusted`
93 system = 0x80_0000_0000, /// `@system`
95 ctfe = 0x100_0000_0000, /// can be used in CTFE, even if it is static
96 disable = 0x200_0000_0000, /// for functions that are not callable
97 result = 0x400_0000_0000, /// for result variables passed to out contracts
98 nodefaultctor = 0x800_0000_0000, /// must be set inside constructor
100 temp = 0x1000_0000_0000, /// temporary variable
101 rvalue = 0x2000_0000_0000, /// force rvalue for variables
102 nogc = 0x4000_0000_0000, /// `@nogc`
103 autoref = 0x8000_0000_0000, /// Mark for the already deduced `auto ref` parameter
105 inference = 0x1_0000_0000_0000, /// do attribute inference
106 exptemp = 0x2_0000_0000_0000, /// temporary variable that has lifetime restricted to an expression
107 future = 0x4_0000_0000_0000, /// introducing new base class function
108 local = 0x8_0000_0000_0000, /// do not forward (see dmd.dsymbol.ForwardingScopeDsymbol).
110 live = 0x10_0000_0000_0000, /// function `@live` attribute
111 register = 0x20_0000_0000_0000, /// `register` storage class (ImportC)
112 volatile_ = 0x40_0000_0000_0000, /// destined for volatile in the back end
114 safeGroup = STC.safe | STC.trusted | STC.system,
115 IOR = STC.in_ | STC.ref_ | STC.out_,
116 TYPECTOR = (STC.const_ | STC.immutable_ | STC.shared_ | STC.wild),
117 FUNCATTR = (STC.ref_ | STC.nothrow_ | STC.nogc | STC.pure_ | STC.property | STC.live |
120 /* These are visible to the user, i.e. are expressed by the user
122 visibleStorageClasses =
123 (STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.const_ | STC.final_ | STC.abstract_ | STC.synchronized_ |
124 STC.deprecated_ | STC.future | STC.override_ | STC.lazy_ | STC.alias_ | STC.out_ | STC.in_ | STC.manifest |
125 STC.immutable_ | STC.shared_ | STC.wild | STC.nothrow_ | STC.nogc | STC.pure_ | STC.ref_ | STC.return_ | STC.tls | STC.gshared |
126 STC.property | STC.safeGroup | STC.disable | STC.local | STC.live),
128 /* These storage classes "flow through" to the inner scope of a Dsymbol
130 flowThruAggregate = STC.safeGroup, /// for an AggregateDeclaration
131 flowThruFunction = ~(STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.abstract_ | STC.deprecated_ | STC.override_ |
132 STC.TYPECTOR | STC.final_ | STC.tls | STC.gshared | STC.ref_ | STC.return_ | STC.property |
133 STC.nothrow_ | STC.pure_ | STC.safe | STC.trusted | STC.system), /// for a FuncDeclaration
138 * Determine if it's the ambigous case of where `return` attaches to.
142 * true if (`ref` | `out`) and `scope` and `return`
144 @safe pure @nogc nothrow
145 bool isRefReturnScope(const ulong stc)
147 return (stc & (STC.scope_ | STC.return_)) == (STC.scope_ | STC.return_) &&
148 stc & (STC.ref_ | STC.out_);
151 /* This is different from the one in declaration.d, make that fix a separate PR */
153 extern (C++) __gshared const(StorageClass) STCStorageClass =
154 (STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.const_ | STC.final_ |
155 STC.abstract_ | STC.synchronized_ | STC.deprecated_ | STC.override_ | STC.lazy_ |
156 STC.alias_ | STC.out_ | STC.in_ | STC.manifest | STC.immutable_ | STC.shared_ |
157 STC.wild | STC.nothrow_ | STC.nogc | STC.pure_ | STC.ref_ | STC.return_ | STC.tls |
158 STC.gshared | STC.property | STC.live |
159 STC.safeGroup | STC.disable);
163 Tarray, // slice array, aka T[]
164 Tsarray, // static array, aka T[dimension]
165 Taarray, // associative array, aka T[type]
218 alias Tarray = TY.Tarray;
219 alias Tsarray = TY.Tsarray;
220 alias Taarray = TY.Taarray;
221 alias Tpointer = TY.Tpointer;
222 alias Treference = TY.Treference;
223 alias Tfunction = TY.Tfunction;
224 alias Tident = TY.Tident;
225 alias Tclass = TY.Tclass;
226 alias Tstruct = TY.Tstruct;
227 alias Tenum = TY.Tenum;
228 alias Tdelegate = TY.Tdelegate;
229 alias Tnone = TY.Tnone;
230 alias Tvoid = TY.Tvoid;
231 alias Tint8 = TY.Tint8;
232 alias Tuns8 = TY.Tuns8;
233 alias Tint16 = TY.Tint16;
234 alias Tuns16 = TY.Tuns16;
235 alias Tint32 = TY.Tint32;
236 alias Tuns32 = TY.Tuns32;
237 alias Tint64 = TY.Tint64;
238 alias Tuns64 = TY.Tuns64;
239 alias Tfloat32 = TY.Tfloat32;
240 alias Tfloat64 = TY.Tfloat64;
241 alias Tfloat80 = TY.Tfloat80;
242 alias Timaginary32 = TY.Timaginary32;
243 alias Timaginary64 = TY.Timaginary64;
244 alias Timaginary80 = TY.Timaginary80;
245 alias Tcomplex32 = TY.Tcomplex32;
246 alias Tcomplex64 = TY.Tcomplex64;
247 alias Tcomplex80 = TY.Tcomplex80;
248 alias Tbool = TY.Tbool;
249 alias Tchar = TY.Tchar;
250 alias Twchar = TY.Twchar;
251 alias Tdchar = TY.Tdchar;
252 alias Terror = TY.Terror;
253 alias Tinstance = TY.Tinstance;
254 alias Ttypeof = TY.Ttypeof;
255 alias Ttuple = TY.Ttuple;
256 alias Tslice = TY.Tslice;
257 alias Treturn = TY.Treturn;
258 alias Tnull = TY.Tnull;
259 alias Tvector = TY.Tvector;
260 alias Tint128 = TY.Tint128;
261 alias Tuns128 = TY.Tuns128;
262 alias Ttraits = TY.Ttraits;
263 alias Tmixin = TY.Tmixin;
264 alias Tnoreturn = TY.Tnoreturn;
265 alias Ttag = TY.Ttag;
266 alias TMAX = TY.TMAX;
280 unknown, /// not yet determined whether it's a package.d or not
281 module_, /// already determined that's an actual package.d
282 package_, /// already determined that's an actual package
285 enum ThreeState : ubyte
287 none, /// state is not yet computed
288 no, /// state is false
289 yes, /// state is true
295 system = 1, // @system (same as TRUST.default)
296 trusted = 2, // @trusted
302 impure = 0, // not pure at all
303 fwdref = 1, // it's pure, but not known which level yet
304 weak = 2, // no mutable globals are read or written
305 const_ = 3, // parameters are values or const
306 strong = 4, // parameters are values or immutable
309 // Whether alias this dependency is recursive or not
310 enum AliasThisRec : int
312 no = 0, // no alias this recursion
313 yes = 1, // alias this has recursive dependency
314 fwdref = 2, // not yet known
315 typeMask = 3, // mask to read no/yes/fwdref
316 tracing = 0x4, // mark in progress of implicitConvTo/deduceWild
317 tracingDT = 0x8, // mark in progress of deduceType
321 * Variadic argument lists
322 * https://dlang.org/spec/function.html#variadic
326 none = 0, /// fixed number of arguments
327 variadic = 1, /// (T t, ...) can be C-style (core.stdc.stdarg) or D-style (core.vararg)
328 typesafe = 2, /// (T t ...) typesafe https://dlang.org/spec/function.html#typesafe_variadic_functions
329 /// or https://dlang.org/spec/function.html#typesafe_variadic_functions
332 /*************************
333 * Identify Statement types with this enum rather than
342 Compound, CompoundDeclaration, CompoundAsm,
375 Asm, InlineAsm, GccAsm,
379 /**********************
380 * Discriminant for which kind of initializer
382 enum InitKind : ubyte