Skip to content

Commit

Permalink
Remove dead code that inits member variables to their default values
Browse files Browse the repository at this point in the history
  • Loading branch information
yebblies committed Sep 18, 2015
1 parent b904078 commit 71a25c9
Show file tree
Hide file tree
Showing 40 changed files with 2 additions and 370 deletions.
19 changes: 0 additions & 19 deletions src/aggregate.d
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,8 @@ public:
{
super(id);
this.loc = loc;
storage_class = 0;
protection = Prot(PROTpublic);
type = null;
structsize = 0; // size of struct
alignsize = 0; // size of struct for alignment purposes
sizeok = SIZEOKnone; // size not determined yet
deferred = null;
isdeprecated = false;
inv = null;
aggNew = null;
aggDelete = null;
stag = null;
sinit = null;
enclosing = null;
vthis = null;
ctor = null;
defaultCtor = null;
aliasthis = null;
noDefaultCtor = false;
dtor = null;
getRTInfo = null;
}

override final void setScope(Scope* sc)
Expand Down
5 changes: 0 additions & 5 deletions src/argtypes.d
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ extern (C++) TypeTuple toArgTypes(Type t)
public:
TypeTuple result;

extern (D) this()
{
result = null;
}

override void visit(Type)
{
// not valid for a parameter
Expand Down
1 change: 0 additions & 1 deletion src/arrayop.d
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ extern (C++) Expression buildArrayLoop(Expression e, Parameters* fparams)
extern (D) this(Parameters* fparams)
{
this.fparams = fparams;
this.result = null;
}

override void visit(Expression e)
Expand Down
7 changes: 0 additions & 7 deletions src/attrib.d
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ public:
super(decl);
this.loc = loc;
this.protection = p;
this.pkg_identifiers = null;
//printf("decl = %p\n", decl);
}

Expand Down Expand Up @@ -596,9 +595,7 @@ public:
{
super(decl);
this.loc = loc;
this.alignment = 0;
this.isunion = isunion;
this.sem = 0;
}

override Dsymbol syntaxCopy(Dsymbol s)
Expand Down Expand Up @@ -1111,8 +1108,6 @@ public:
{
super(condition, decl, elsedecl);
//printf("StaticIfDeclaration::StaticIfDeclaration()\n");
scopesym = null;
addisdone = 0;
}

override Dsymbol syntaxCopy(Dsymbol s)
Expand Down Expand Up @@ -1218,8 +1213,6 @@ public:
//printf("CompileDeclaration(loc = %d)\n", loc.linnum);
this.loc = loc;
this.exp = exp;
this.scopesym = null;
this.compiled = 0;
}

override Dsymbol syntaxCopy(Dsymbol s)
Expand Down
2 changes: 0 additions & 2 deletions src/cond.d
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public:
final extern (D) this(Loc loc)
{
this.loc = loc;
inc = 0;
}

abstract Condition syntaxCopy();
Expand Down Expand Up @@ -332,7 +331,6 @@ public:
{
super(loc);
this.exp = exp;
this.nest = 0;
}

override Condition syntaxCopy()
Expand Down
3 changes: 0 additions & 3 deletions src/cppmangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,6 @@ static if (TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TAR
public:
extern (D) this()
{
this.is_top_level = false;
this.components_on = true;
}

Expand Down Expand Up @@ -931,7 +930,6 @@ else static if (TARGET_WINDOS)

extern (D) this(VisualCPPMangler rvl)
{
this.flags = 0;
flags |= (rvl.flags & IS_DMC);
memcpy(&saved_idents, &rvl.saved_idents, (const(char)*).sizeof * VC_SAVED_IDENT_CNT);
memcpy(&saved_types, &rvl.saved_types, Type.sizeof * VC_SAVED_TYPE_CNT);
Expand All @@ -940,7 +938,6 @@ else static if (TARGET_WINDOS)
public:
extern (D) this(bool isdmc)
{
this.flags = 0;
if (isdmc)
{
flags |= IS_DMC;
Expand Down
3 changes: 0 additions & 3 deletions src/dcast.d
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ extern (C++) Expression implicitCastTo(Expression e, Scope* sc, Type t)
{
this.sc = sc;
this.t = t;
result = null;
}

override void visit(Expression e)
Expand Down Expand Up @@ -1324,7 +1323,6 @@ extern (C++) Expression castTo(Expression e, Scope* sc, Type t)
{
this.sc = sc;
this.t = t;
result = null;
}

override void visit(Expression e)
Expand Down Expand Up @@ -2268,7 +2266,6 @@ extern (C++) Expression inferType(Expression e, Type t, int flag = 0)
{
this.t = t;
this.flag = flag;
result = null;
}

override void visit(Expression e)
Expand Down
18 changes: 0 additions & 18 deletions src/dclass.d
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ struct BaseClass
//printf("BaseClass(this = %p, '%s')\n", this, type->toChars());
this.type = type;
this.protection = protection;
this.sym = null;
this.offset = 0;
this.baseInterfaces_dim = 0;
this.baseInterfaces = null;
}

/****************************************
Expand Down Expand Up @@ -203,17 +199,9 @@ public:
}
else
this.baseclasses = new BaseClasses();
baseClass = null;
interfaces_dim = 0;
interfaces = null;
vtblInterfaces = null;
//printf("ClassDeclaration(%s), dim = %d\n", id->toChars(), this->baseclasses->dim);
// For forward references
type = new TypeClass(this);
staticCtor = null;
staticDtor = null;
vtblsym = null;
vclassinfo = null;
if (id)
{
// Look for special class names
Expand Down Expand Up @@ -350,13 +338,7 @@ public:
errorException = this;
}
}
com = false;
cpp = false;
isscope = false;
isabstract = false;
inuse = 0;
baseok = BASEOKnone;
objc.objc = false;
}

override Dsymbol syntaxCopy(Dsymbol s)
Expand Down
27 changes: 0 additions & 27 deletions src/declaration.d
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,10 @@ public:
final extern (D) this(Identifier id)
{
super(id);
type = null;
originalType = null;
storage_class = STCundefined;
protection = Prot(PROTundefined);
linkage = LINKdefault;
inuse = 0;
sem = SemanticStart;
mangleOverride = null;
}

override void semantic(Scope* sc)
Expand Down Expand Up @@ -427,10 +423,7 @@ public:
{
super(id);
this.loc = loc;
this.type = null;
this.objects = objects;
this.isexp = false;
this.tupletype = null;
}

override Dsymbol syntaxCopy(Dsymbol s)
Expand Down Expand Up @@ -561,9 +554,6 @@ public:
//printf("type = '%s'\n", type->toChars());
this.loc = loc;
this.type = type;
this.aliassym = null;
this._import = null;
this.overnext = null;
assert(type);
}

Expand All @@ -573,10 +563,7 @@ public:
//printf("AliasDeclaration(id = '%s', s = %p)\n", id->toChars(), s);
assert(s != this);
this.loc = loc;
this.type = null;
this.aliassym = s;
this._import = null;
this.overnext = null;
assert(s);
}

Expand Down Expand Up @@ -917,7 +904,6 @@ public:
extern (D) this(Identifier ident, Dsymbol s, bool hasOverloads = true)
{
super(ident);
this.overnext = null;
this.aliassym = s;
this.hasOverloads = hasOverloads;
if (hasOverloads)
Expand Down Expand Up @@ -1076,20 +1062,7 @@ public:
this.type = type;
this._init = _init;
this.loc = loc;
offset = 0;
noscope = 0;
isargptr = false;
alignment = 0;
ctorinit = 0;
aliassym = null;
onstack = 0;
canassign = 0;
overlapped = false;
lastVar = null;
ctfeAdrOnStack = -1;
rundtor = null;
edtor = null;
range = null;
}

override Dsymbol syntaxCopy(Dsymbol s)
Expand Down
1 change: 0 additions & 1 deletion src/delegatize.d
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ extern (C++) bool lambdaCheckForNestedRef(Expression e, Scope* sc)
extern (D) this(Scope* sc)
{
this.sc = sc;
this.result = false;
}

override void visit(Expression)
Expand Down
10 changes: 0 additions & 10 deletions src/denum.d
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,7 @@ public:
this.loc = loc;
type = new TypeEnum(this);
this.memtype = memtype;
maxval = null;
minval = null;
defaultval = null;
sinit = null;
isdeprecated = false;
protection = Prot(PROTundefined);
parent = null;
added = false;
inuse = 0;
}

override Dsymbol syntaxCopy(Dsymbol s)
Expand Down Expand Up @@ -491,12 +483,10 @@ public:
extern (D) this(Loc loc, Identifier id, Expression value, Type type)
{
super(id);
this.ed = null;
this.value = value;
this.origValue = value;
this.type = type;
this.loc = loc;
this.vd = null;
}

override Dsymbol syntaxCopy(Dsymbol s)
Expand Down
2 changes: 0 additions & 2 deletions src/dimport.d
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ public:
this.aliasId = aliasId;
this.isstatic = isstatic;
this.protection = PROTprivate; // default to private
this.pkg = null;
this.mod = null;
// Set symbol name (bracketed)
if (aliasId)
{
Expand Down
2 changes: 0 additions & 2 deletions src/dinterpret.d
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ struct CompiledCtfeFunction
extern (D) this(FuncDeclaration f)
{
func = f;
numVars = 0;
}

extern (C++) void onDeclaration(VarDeclaration v)
Expand Down Expand Up @@ -1006,7 +1005,6 @@ public:
{
this.istate = istate;
this.goal = goal;
result = null;
}

// If e is TOKthrowexception or TOKcantexp,
Expand Down
2 changes: 0 additions & 2 deletions src/dmacro.d
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ private:

extern (D) this(const(char)* name, size_t namelen, const(char)* text, size_t textlen)
{
next = null;
this.name = name;
this.namelen = namelen;
this.text = text;
this.textlen = textlen;
inuse = 0;
}

extern (C++) Macro* search(const(char)* name, size_t namelen)
Expand Down
Loading

0 comments on commit 71a25c9

Please sign in to comment.