Skip to content

Commit 9b86a89

Browse files
committed
Replace STCxxx with STC enum
``` replacements=( "STCautoref autoref" "STCinference inference" "STCinit init" "STCscopeinferred scopeinferred" "STCundefined undefined_" "STCstatic static_" "STCextern extern_" "STCconst const_" "STCfinal final_" "STCabstract abstract_" "STCparameter parameter" "STCfield field" "STCoverride override_" "STCauto auto_" "STCsynchronized synchronized_" "STCdeprecated deprecated_" "STCin in_" "STCout out_" "STClazy lazy_" "STCforeach foreach_" "STCvariadic variadic" "STCctorinit ctorinit" "STCtemplateparameter templateparameter" "STCscope scope_" "STCimmutable immutable_" "STCref ref_" "STCmanifest manifest" "STCnodtor nodtor" "STCnothrow nothrow_" "STCpure pure_" "STCtls tls" "STCalias alias_" "STCshared shared_" "STCgshared gshared" "STCwild wild" "STCproperty property" "STCsafe safe" "STCtrusted trusted" "STCsystem system" "STCctfe ctfe" "STCdisable disable" "STCresult result" "STCnodefaultctor nodefaultctor" "STCtemp temp" "STCrvalue rvalue" "STCnogc nogc" "STCvolatile volatile_" "STCreturn return_" "STCexptemp exptemp" "STCmaybescope maybescope" "STCfuture future" "STClocal local" "STC_TYPECTOR TYPECTOR" "STC_FUNCATTR FUNCATTR" ) for r in "${replacements[@]}" ; do w=($r) sed "s/${w[0]}/STC.${w[1]}/g" -i **/*.d done ```
1 parent 1bf4c69 commit 9b86a89

47 files changed

Lines changed: 1164 additions & 1164 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/dmd/aggregate.d

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
120120
Scope* newScope(Scope* sc)
121121
{
122122
auto sc2 = sc.push(this);
123-
sc2.stc &= STCsafe | STCtrusted | STCsystem;
123+
sc2.stc &= STC.safe | STC.trusted | STC.system;
124124
sc2.parent = this;
125125
if (isUnionDeclaration())
126126
sc2.inunion = 1;
@@ -166,7 +166,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
166166
auto v = s.isVarDeclaration();
167167
if (!v)
168168
return 0;
169-
if (v.storage_class & STCmanifest)
169+
if (v.storage_class & STC.manifest)
170170
return 0;
171171

172172
auto ad = cast(AggregateDeclaration)param;
@@ -180,14 +180,14 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
180180
if (v.aliassym)
181181
return 0; // If this variable was really a tuple, skip it.
182182

183-
if (v.storage_class & (STCstatic | STCextern | STCtls | STCgshared | STCmanifest | STCctfe | STCtemplateparameter))
183+
if (v.storage_class & (STC.static_ | STC.extern_ | STC.tls | STC.gshared | STC.manifest | STC.ctfe | STC.templateparameter))
184184
return 0;
185185
if (!v.isField() || v.semanticRun < PASSsemanticdone)
186186
return 1; // unresolvable forward reference
187187

188188
ad.fields.push(v);
189189

190-
if (v.storage_class & STCref)
190+
if (v.storage_class & STC.ref_)
191191
return 0;
192192
auto tv = v.type.baseElemOf();
193193
if (tv.ty != Tstruct)
@@ -472,7 +472,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
472472
}
473473
else
474474
{
475-
if ((vx.storage_class & STCnodefaultctor) && !ctorinit)
475+
if ((vx.storage_class & STC.nodefaultctor) && !ctorinit)
476476
{
477477
.error(loc, "field `%s.%s` must be initialized because it has no default constructor",
478478
type.toChars(), vx.toChars());
@@ -614,7 +614,7 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
614614
return;
615615
if (isUnionDeclaration() || isInterfaceDeclaration())
616616
return;
617-
if (storage_class & STCstatic)
617+
if (storage_class & STC.static_)
618618
return;
619619

620620
// If nested struct, add in hidden 'this' pointer to outer scope
@@ -656,13 +656,13 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
656656

657657
assert(!vthis);
658658
vthis = new ThisDeclaration(loc, t);
659-
//vthis.storage_class |= STCref;
659+
//vthis.storage_class |= STC.ref_;
660660

661661
// Emulate vthis.addMember()
662662
members.push(vthis);
663663

664664
// Emulate vthis.dsymbolSemantic()
665-
vthis.storage_class |= STCfield;
665+
vthis.storage_class |= STC.field;
666666
vthis.parent = this;
667667
vthis.protection = Prot(PROTpublic);
668668
vthis.alignment = t.alignment();

src/dmd/astbase.d

Lines changed: 115 additions & 115 deletions
Large diffs are not rendered by default.

src/dmd/attrib.d

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,16 @@ extern (C++) class StorageClassDeclaration : AttribDeclaration
296296
/* These sets of storage classes are mutually exclusive,
297297
* so choose the innermost or most recent one.
298298
*/
299-
if (stc & (STCauto | STCscope | STCstatic | STCextern | STCmanifest))
300-
scstc &= ~(STCauto | STCscope | STCstatic | STCextern | STCmanifest);
301-
if (stc & (STCauto | STCscope | STCstatic | STCtls | STCmanifest | STCgshared))
302-
scstc &= ~(STCauto | STCscope | STCstatic | STCtls | STCmanifest | STCgshared);
303-
if (stc & (STCconst | STCimmutable | STCmanifest))
304-
scstc &= ~(STCconst | STCimmutable | STCmanifest);
305-
if (stc & (STCgshared | STCshared | STCtls))
306-
scstc &= ~(STCgshared | STCshared | STCtls);
307-
if (stc & (STCsafe | STCtrusted | STCsystem))
308-
scstc &= ~(STCsafe | STCtrusted | STCsystem);
299+
if (stc & (STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.manifest))
300+
scstc &= ~(STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.manifest);
301+
if (stc & (STC.auto_ | STC.scope_ | STC.static_ | STC.tls | STC.manifest | STC.gshared))
302+
scstc &= ~(STC.auto_ | STC.scope_ | STC.static_ | STC.tls | STC.manifest | STC.gshared);
303+
if (stc & (STC.const_ | STC.immutable_ | STC.manifest))
304+
scstc &= ~(STC.const_ | STC.immutable_ | STC.manifest);
305+
if (stc & (STC.gshared | STC.shared_ | STC.tls))
306+
scstc &= ~(STC.gshared | STC.shared_ | STC.tls);
307+
if (stc & (STC.safe | STC.trusted | STC.system))
308+
scstc &= ~(STC.safe | STC.trusted | STC.system);
309309
scstc |= stc;
310310
//printf("scstc = x%llx\n", scstc);
311311
return createNewScope(sc, scstc, sc.linkage, sc.cppmangle,
@@ -349,13 +349,13 @@ extern (C++) class StorageClassDeclaration : AttribDeclaration
349349
{
350350
Dsymbol s = (*d)[i];
351351
//printf("\taddMember %s to %s\n", s.toChars(), sds.toChars());
352-
// STClocal needs to be attached before the member is added to the scope (because it influences the parent symbol)
352+
// STC.local needs to be attached before the member is added to the scope (because it influences the parent symbol)
353353
if (auto decl = s.isDeclaration())
354354
{
355-
decl.storage_class |= stc & STClocal;
355+
decl.storage_class |= stc & STC.local;
356356
if (auto sdecl = s.isStorageClassDeclaration()) // TODO: why is this not enough to deal with the nested case?
357357
{
358-
sdecl.stc |= stc & STClocal;
358+
sdecl.stc |= stc & STC.local;
359359
}
360360
}
361361
s.addMember(sc2, sds);
@@ -386,7 +386,7 @@ extern (C++) final class DeprecatedDeclaration : StorageClassDeclaration
386386

387387
extern (D) this(Expression msg, Dsymbols* decl)
388388
{
389-
super(STCdeprecated, decl);
389+
super(STC.deprecated_, decl);
390390
this.msg = msg;
391391
}
392392

@@ -397,7 +397,7 @@ extern (C++) final class DeprecatedDeclaration : StorageClassDeclaration
397397
}
398398

399399
/**
400-
* Provides a new scope with `STCdeprecated` and `Scope.depdecl` set
400+
* Provides a new scope with `STC.deprecated_` and `Scope.depdecl` set
401401
*
402402
* Calls `StorageClassDeclaration.newScope` (as it must be called or copied
403403
* in any function overriding `newScope`), then set the `Scope`'s depdecl.
@@ -1142,7 +1142,7 @@ extern (C++) final class StaticForeachDeclaration : AttribDeclaration
11421142
* another scope, like:
11431143
*
11441144
* static foreach (i; 0 .. 10) // loop variables for different indices do not conflict.
1145-
* { // this body is expanded into 10 ForwardingAttribDeclarations, where `i` has storage class STClocal
1145+
* { // this body is expanded into 10 ForwardingAttribDeclarations, where `i` has storage class STC.local
11461146
* mixin("enum x" ~ to!string(i) ~ " = i"); // ok, can access current loop variable
11471147
* }
11481148
*

src/dmd/blockexit.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,9 @@ int blockExit(Statement s, FuncDeclaration func, bool mustNotThrow)
510510
{
511511
// Assume the worst
512512
result = BE.fallthru | BE.return_ | BE.goto_ | BE.halt;
513-
if (!(s.stc & STCnothrow))
513+
if (!(s.stc & STC.nothrow_))
514514
{
515-
if (mustNotThrow && !(s.stc & STCnothrow))
515+
if (mustNotThrow && !(s.stc & STC.nothrow_))
516516
s.deprecation("asm statement is assumed to throw - mark it with `nothrow` if it does not");
517517
else
518518
result |= BE.throw_;

src/dmd/canthrow.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ private bool Dsymbol_canThrow(Dsymbol s, FuncDeclaration func, bool mustNotThrow
260260
s = s.toAlias();
261261
if (s != vd)
262262
return Dsymbol_canThrow(s, func, mustNotThrow);
263-
if (vd.storage_class & STCmanifest)
263+
if (vd.storage_class & STC.manifest)
264264
{
265265
}
266-
else if (vd.isStatic() || vd.storage_class & (STCextern | STCtls | STCgshared))
266+
else if (vd.isStatic() || vd.storage_class & (STC.extern_ | STC.tls | STC.gshared))
267267
{
268268
}
269269
else

0 commit comments

Comments
 (0)