Subzero: Use C++11 member initializers where practical.
Also change the pattern "foo() {}" into "foo() = default;" for ctors and dtors.
Generally avoids initializing unique_ptr<> members to nullptr in a .h file, because that requires knowing the definition of the underlying class which may not be available to all includers.
BUG= none
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/1197223002
diff --git a/src/IceInst.h b/src/IceInst.h
index 99a8653..84bd83d 100644
--- a/src/IceInst.h
+++ b/src/IceInst.h
@@ -161,7 +161,7 @@
void dumpDest(const Cfg *Func) const;
virtual bool isRedundantAssign() const { return false; }
- virtual ~Inst() {}
+ virtual ~Inst() = default;
protected:
Inst(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest);
@@ -183,23 +183,23 @@
// Number is the instruction number for describing live ranges.
InstNumberT Number;
// Deleted means irrevocably deleted.
- bool Deleted;
+ bool Deleted = false;
// Dead means one of two things depending on context: (1) pending
// deletion after liveness analysis converges, or (2) marked for
// deletion during lowering due to a folded bool operation.
- bool Dead;
+ bool Dead = false;
// HasSideEffects means the instruction is something like a function
// call or a volatile load that can't be removed even if its Dest
// variable is not live.
- bool HasSideEffects;
+ bool HasSideEffects = false;
// IsDestNonKillable means that liveness analysis shouldn't consider
// this instruction to kill the Dest variable. This is used when
// lowering produces two assignments to the same variable.
- bool IsDestNonKillable;
+ bool IsDestNonKillable = false;
Variable *Dest;
const SizeT MaxSrcs; // only used for assert
- SizeT NumSrcs;
+ SizeT NumSrcs = 0;
Operand **Srcs;
// LiveRangesEnded marks which Variables' live ranges end in this