Skip to content

Commit c001545

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 fb5ff4d commit c001545

47 files changed

Lines changed: 1110 additions & 1110 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: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ struct ASTBase
168168
}
169169

170170
extern (C++) __gshared const(StorageClass) STCStorageClass =
171-
(STCauto | STCscope | STCstatic | STCextern | STCconst | STCfinal | STCabstract | STCsynchronized | STCdeprecated | STCoverride | STClazy | STCalias | STCout | STCin | STCmanifest | STCimmutable | STCshared | STCwild | STCnothrow | STCnogc | STCpure | STCref | STCreturn | STCtls | STCgshared | STCproperty | STCsafe | STCtrusted | STCsystem | STCdisable);
171+
(STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.const_ | STC.final_ | STC.abstract_ | STC.synchronized_ | STC.deprecated_ | STC.override_ | STC.lazy_ | STC.alias_ | STC.out_ | STC.in_ | STC.manifest | STC.immutable_ | STC.shared_ | STC.wild | STC.nothrow_ | STC.nogc | STC.pure_ | STC.ref_ | STC.return_ | STC.tls | STC.gshared | STC.property | STC.safe | STC.trusted | STC.system | STC.disable);
172172

173173
enum ENUMTY : int
174174
{
@@ -540,7 +540,7 @@ struct ASTBase
540540
final extern (D) this(Identifier id)
541541
{
542542
super(id);
543-
storage_class = STCundefined;
543+
storage_class = STC.undefined_;
544544
protection = Prot(PROTundefined);
545545
linkage = LINKdefault;
546546
}
@@ -710,7 +710,7 @@ struct ASTBase
710710
uint sequenceNumber;
711711
__gshared uint nextSequenceNumber;
712712

713-
final extern (D) this(Loc loc, Type type, Identifier id, Initializer _init, StorageClass st = STCundefined)
713+
final extern (D) this(Loc loc, Type type, Identifier id, Initializer _init, StorageClass st = STC.undefined_)
714714
{
715715
super(id);
716716
this.type = type;
@@ -754,7 +754,7 @@ struct ASTBase
754754
{
755755
// Normalize storage_class, because function-type related attributes
756756
// are already set in the 'type' in parsing phase.
757-
this.storage_class &= ~(STC_TYPECTOR | STC_FUNCATTR);
757+
this.storage_class &= ~(STC.TYPECTOR | STC.FUNCATTR);
758758
}
759759
this.loc = loc;
760760
this.endloc = endloc;
@@ -836,7 +836,7 @@ struct ASTBase
836836

837837
extern (D) this(Loc loc, Loc endloc, Type type, TOK tok, ForeachStatement fes, Identifier id = null)
838838
{
839-
super(loc, endloc, null, STCundefined, type);
839+
super(loc, endloc, null, STC.undefined_, type);
840840
this.ident = id ? id : Id.empty;
841841
this.tok = tok;
842842
this.fes = fes;
@@ -883,7 +883,7 @@ struct ASTBase
883883
{
884884
extern (D) this(Loc loc, Loc endloc)
885885
{
886-
super(loc, endloc, Id.dtor, STCundefined, null);
886+
super(loc, endloc, Id.dtor, STC.undefined_, null);
887887
}
888888
extern (D) this(Loc loc, Loc endloc, StorageClass stc, Identifier id)
889889
{
@@ -935,7 +935,7 @@ struct ASTBase
935935

936936
extern (D) this(Loc loc, Loc endloc, StorageClass stc, Parameters* fparams, int varargs)
937937
{
938-
super(loc, endloc, Id.classNew, STCstatic | stc, null);
938+
super(loc, endloc, Id.classNew, STC.static_ | stc, null);
939939
this.parameters = fparams;
940940
this.varargs = varargs;
941941
}
@@ -952,7 +952,7 @@ struct ASTBase
952952

953953
extern (D) this(Loc loc, Loc endloc, StorageClass stc, Parameters* fparams)
954954
{
955-
super(loc, endloc, Id.classDelete, STCstatic | stc, null);
955+
super(loc, endloc, Id.classDelete, STC.static_ | stc, null);
956956
this.parameters = fparams;
957957
}
958958

@@ -966,11 +966,11 @@ struct ASTBase
966966
{
967967
final extern (D) this(Loc loc, Loc endloc, StorageClass stc)
968968
{
969-
super(loc, endloc, Identifier.generateId("_staticCtor"), STCstatic | stc, null);
969+
super(loc, endloc, Identifier.generateId("_staticCtor"), STC.static_ | stc, null);
970970
}
971971
final extern (D) this(Loc loc, Loc endloc, const(char)* name, StorageClass stc)
972972
{
973-
super(loc, endloc, Identifier.generateId(name), STCstatic | stc, null);
973+
super(loc, endloc, Identifier.generateId(name), STC.static_ | stc, null);
974974
}
975975

976976
override void accept(Visitor v)
@@ -983,11 +983,11 @@ struct ASTBase
983983
{
984984
final extern (D) this()(Loc loc, Loc endloc, StorageClass stc)
985985
{
986-
super(loc, endloc, Identifier.generateId("__staticDtor"), STCstatic | stc, null);
986+
super(loc, endloc, Identifier.generateId("__staticDtor"), STC.static_ | stc, null);
987987
}
988988
final extern (D) this(Loc loc, Loc endloc, const(char)* name, StorageClass stc)
989989
{
990-
super(loc, endloc, Identifier.generateId(name), STCstatic | stc, null);
990+
super(loc, endloc, Identifier.generateId(name), STC.static_ | stc, null);
991991
}
992992

993993
override void accept(Visitor v)
@@ -1425,7 +1425,7 @@ struct ASTBase
14251425

14261426
extern (D) this(Expression msg, Dsymbols* decl)
14271427
{
1428-
super(STCdeprecated, decl);
1428+
super(STC.deprecated_, decl);
14291429
this.msg = msg;
14301430
}
14311431

@@ -2966,13 +2966,13 @@ struct ASTBase
29662966
if (t.isImmutable())
29672967
{
29682968
}
2969-
else if (stc & STCimmutable)
2969+
else if (stc & STC.immutable_)
29702970
{
29712971
t = t.makeImmutable();
29722972
}
29732973
else
29742974
{
2975-
if ((stc & STCshared) && !t.isShared())
2975+
if ((stc & STC.shared_) && !t.isShared())
29762976
{
29772977
if (t.isWild())
29782978
{
@@ -2989,7 +2989,7 @@ struct ASTBase
29892989
t = t.makeShared();
29902990
}
29912991
}
2992-
if ((stc & STCconst) && !t.isConst())
2992+
if ((stc & STC.const_) && !t.isConst())
29932993
{
29942994
if (t.isShared())
29952995
{
@@ -3006,7 +3006,7 @@ struct ASTBase
30063006
t = t.makeConst();
30073007
}
30083008
}
3009-
if ((stc & STCwild) && !t.isWild())
3009+
if ((stc & STC.wild) && !t.isWild())
30103010
{
30113011
if (t.isShared())
30123012
{
@@ -3669,7 +3669,7 @@ struct ASTBase
36693669
Expression e = (*exps)[i];
36703670
if (e.type.ty == Ttuple)
36713671
e.error("cannot form tuple of tuples");
3672-
auto arg = new Parameter(STCundefined, e.type, null, null);
3672+
auto arg = new Parameter(STC.undefined_, e.type, null, null);
36733673
(*arguments)[i] = arg;
36743674
}
36753675
}
@@ -3886,28 +3886,28 @@ struct ASTBase
38863886
this.varargs = varargs;
38873887
this.linkage = linkage;
38883888

3889-
if (stc & STCpure)
3889+
if (stc & STC.pure_)
38903890
this.purity = PUREfwdref;
3891-
if (stc & STCnothrow)
3891+
if (stc & STC.nothrow_)
38923892
this.isnothrow = true;
3893-
if (stc & STCnogc)
3893+
if (stc & STC.nogc)
38943894
this.isnogc = true;
3895-
if (stc & STCproperty)
3895+
if (stc & STC.property)
38963896
this.isproperty = true;
38973897

3898-
if (stc & STCref)
3898+
if (stc & STC.ref_)
38993899
this.isref = true;
3900-
if (stc & STCreturn)
3900+
if (stc & STC.return_)
39013901
this.isreturn = true;
3902-
if (stc & STCscope)
3902+
if (stc & STC.scope_)
39033903
this.isscope = true;
39043904

39053905
this.trust = TRUSTdefault;
3906-
if (stc & STCsafe)
3906+
if (stc & STC.safe)
39073907
this.trust = TRUSTsafe;
3908-
if (stc & STCsystem)
3908+
if (stc & STC.system)
39093909
this.trust = TRUSTsystem;
3910-
if (stc & STCtrusted)
3910+
if (stc & STC.trusted)
39113911
this.trust = TRUSTtrusted;
39123912
}
39133913

@@ -6236,8 +6236,8 @@ struct ASTBase
62366236
extern (C++) static bool stcToBuffer(OutBuffer* buf, StorageClass stc)
62376237
{
62386238
bool result = false;
6239-
if ((stc & (STCreturn | STCscope)) == (STCreturn | STCscope))
6240-
stc &= ~STCscope;
6239+
if ((stc & (STC.return_ | STC.scope_)) == (STC.return_ | STC.scope_))
6240+
stc &= ~STC.scope_;
62416241
while (stc)
62426242
{
62436243
const(char)* p = stcToChars(stc);
@@ -6273,36 +6273,36 @@ struct ASTBase
62736273

62746274
static __gshared SCstring* table =
62756275
[
6276-
SCstring(STCauto, TOKauto),
6277-
SCstring(STCscope, TOKscope),
6278-
SCstring(STCstatic, TOKstatic),
6279-
SCstring(STCextern, TOKextern),
6280-
SCstring(STCconst, TOKconst),
6281-
SCstring(STCfinal, TOKfinal),
6282-
SCstring(STCabstract, TOKabstract),
6283-
SCstring(STCsynchronized, TOKsynchronized),
6284-
SCstring(STCdeprecated, TOKdeprecated),
6285-
SCstring(STCoverride, TOKoverride),
6286-
SCstring(STClazy, TOKlazy),
6287-
SCstring(STCalias, TOKalias),
6288-
SCstring(STCout, TOKout),
6289-
SCstring(STCin, TOKin),
6290-
SCstring(STCmanifest, TOKenum),
6291-
SCstring(STCimmutable, TOKimmutable),
6292-
SCstring(STCshared, TOKshared),
6293-
SCstring(STCnothrow, TOKnothrow),
6294-
SCstring(STCwild, TOKwild),
6295-
SCstring(STCpure, TOKpure),
6296-
SCstring(STCref, TOKref),
6297-
SCstring(STCtls),
6298-
SCstring(STCgshared, TOKgshared),
6299-
SCstring(STCnogc, TOKat, "@nogc"),
6300-
SCstring(STCproperty, TOKat, "@property"),
6301-
SCstring(STCsafe, TOKat, "@safe"),
6302-
SCstring(STCtrusted, TOKat, "@trusted"),
6303-
SCstring(STCsystem, TOKat, "@system"),
6304-
SCstring(STCdisable, TOKat, "@disable"),
6305-
SCstring(STCfuture, TOKat, "@__future"),
6276+
SCstring(STC.auto_, TOKauto),
6277+
SCstring(STC.scope_, TOKscope),
6278+
SCstring(STC.static_, TOKstatic),
6279+
SCstring(STC.extern_, TOKextern),
6280+
SCstring(STC.const_, TOKconst),
6281+
SCstring(STC.final_, TOKfinal),
6282+
SCstring(STC.abstract_, TOKabstract),
6283+
SCstring(STC.synchronized_, TOKsynchronized),
6284+
SCstring(STC.deprecated_, TOKdeprecated),
6285+
SCstring(STC.override_, TOKoverride),
6286+
SCstring(STC.lazy_, TOKlazy),
6287+
SCstring(STC.alias_, TOKalias),
6288+
SCstring(STC.out_, TOKout),
6289+
SCstring(STC.in_, TOKin),
6290+
SCstring(STC.manifest, TOKenum),
6291+
SCstring(STC.immutable_, TOKimmutable),
6292+
SCstring(STC.shared_, TOKshared),
6293+
SCstring(STC.nothrow_, TOKnothrow),
6294+
SCstring(STC.wild, TOKwild),
6295+
SCstring(STC.pure_, TOKpure),
6296+
SCstring(STC.ref_, TOKref),
6297+
SCstring(STC.tls),
6298+
SCstring(STC.gshared, TOKgshared),
6299+
SCstring(STC.nogc, TOKat, "@nogc"),
6300+
SCstring(STC.property, TOKat, "@property"),
6301+
SCstring(STC.safe, TOKat, "@safe"),
6302+
SCstring(STC.trusted, TOKat, "@trusted"),
6303+
SCstring(STC.system, TOKat, "@system"),
6304+
SCstring(STC.disable, TOKat, "@disable"),
6305+
SCstring(STC.future, TOKat, "@__future"),
63066306
SCstring(0, TOKreserved)
63076307
];
63086308
for (int i = 0; table[i].stc; i++)
@@ -6312,7 +6312,7 @@ struct ASTBase
63126312
if (stc & tbl)
63136313
{
63146314
stc &= ~tbl;
6315-
if (tbl == STCtls) // TOKtls was removed
6315+
if (tbl == STC.tls) // TOKtls was removed
63166316
return "__thread";
63176317
TOK tok = table[i].tok;
63186318
if (tok == TOKat)

0 commit comments

Comments
 (0)