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/IceCfg.h b/src/IceCfg.h
index c231860..e96804c 100644
--- a/src/IceCfg.h
+++ b/src/IceCfg.h
@@ -207,14 +207,14 @@
GlobalContext *Ctx;
uint32_t SequenceNumber; // output order for emission
VerboseMask VMask;
- IceString FunctionName;
- Type ReturnType;
- bool IsInternalLinkage;
- bool HasError;
- bool FocusedTiming;
- IceString ErrorMessage;
- CfgNode *Entry; // entry basic block
- NodeList Nodes; // linearized node list; Entry should be first
+ IceString FunctionName = "";
+ Type ReturnType = IceType_void;
+ bool IsInternalLinkage = false;
+ bool HasError = false;
+ bool FocusedTiming = false;
+ IceString ErrorMessage = "";
+ CfgNode *Entry = nullptr; // entry basic block
+ NodeList Nodes; // linearized node list; Entry should be first
std::vector<IceString> IdentifierNames;
InstNumberT NextInstNumber;
VarList Variables;
@@ -233,7 +233,7 @@
// CfgNodes maintains this, but before global operations like
// register allocation, resetCurrentNode() should be called to avoid
// spurious validation failures.
- const CfgNode *CurrentNode;
+ const CfgNode *CurrentNode = nullptr;
// Maintain a pointer in TLS to the current Cfg being translated.
// This is primarily for accessing its allocator statelessly, but