summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBSalita <BSalita@yahoo.com>2016-05-11 18:05:48 +0200
committerAlon Zakai <alonzakai@gmail.com>2016-05-11 09:05:48 -0700
commitfe952e30e5a796a0f5d14c66deb7e6dd237fc402 (patch)
treeea85bf45ca88fca846994f9786b1b89bb7bb0e33
parent0cd4f81442cdeac61ec611d94f381832bdbd361f (diff)
downloadbinaryen-fe952e30e5a796a0f5d14c66deb7e6dd237fc402.tar.gz
binaryen-fe952e30e5a796a0f5d14c66deb7e6dd237fc402.tar.bz2
binaryen-fe952e30e5a796a0f5d14c66deb7e6dd237fc402.zip
Change NULL to nullptr. Quiet Visual C++ 2015 optimizer errors by using "!!". (#465)
-rw-r--r--src/cfg/Relooper.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cfg/Relooper.cpp b/src/cfg/Relooper.cpp
index f791a3c13..14941833b 100644
--- a/src/cfg/Relooper.cpp
+++ b/src/cfg/Relooper.cpp
@@ -27,7 +27,7 @@
namespace CFG {
template <class T, class U> static bool contains(const T& container, const U& contained) {
- return container.count(contained);
+ return !!container.count(contained);
}
#ifdef RELOOPER_DEBUG
@@ -40,9 +40,9 @@ static void PrintDebug(const char *Format, ...);
// Branch
-Branch::Branch(wasm::Expression* ConditionInit, wasm::Expression* CodeInit) : Ancestor(NULL), Condition(ConditionInit), Code(CodeInit) {}
+Branch::Branch(wasm::Expression* ConditionInit, wasm::Expression* CodeInit) : Ancestor(nullptr), Condition(ConditionInit), Code(CodeInit) {}
-Branch::Branch(wasm::Index IndexInit, wasm::Expression* CodeInit) : Ancestor(NULL), Index(IndexInit), Code(CodeInit) {}
+Branch::Branch(wasm::Index IndexInit, wasm::Expression* CodeInit) : Ancestor(nullptr), Index(IndexInit), Code(CodeInit) {}
wasm::Expression* Branch::Render(RelooperBuilder& Builder, Block *Target, bool SetLabel) {
auto* Ret = Builder.makeBlock();
@@ -60,7 +60,7 @@ wasm::Expression* Branch::Render(RelooperBuilder& Builder, Block *Target, bool S
// Block
-Block::Block(wasm::Expression* CodeInit, wasm::Expression* SwitchConditionInit) : Parent(NULL), Id(-1), Code(CodeInit), SwitchCondition(SwitchConditionInit), IsCheckedMultipleEntry(false) {}
+Block::Block(wasm::Expression* CodeInit, wasm::Expression* SwitchConditionInit) : Parent(nullptr), Id(-1), Code(CodeInit), SwitchCondition(SwitchConditionInit), IsCheckedMultipleEntry(false) {}
Block::~Block() {
for (BlockBranchMap::iterator iter = ProcessedBranchesOut.begin(); iter != ProcessedBranchesOut.end(); iter++) {
@@ -88,7 +88,7 @@ wasm::Expression* Block::Render(RelooperBuilder& Builder, bool InLoop) {
if (!ProcessedBranchesOut.size()) return Ret;
bool SetLabel = true; // in some cases it is clear we can avoid setting label, see later
- bool ForceSetLabel = Shape::IsEmulated(Parent);
+ bool ForceSetLabel = Shape::IsEmulated(Parent) != nullptr;
// A setting of the label variable (label = x) is necessary if it can
// cause an impact. The main case is where we set label to x, then elsewhere
@@ -130,7 +130,7 @@ wasm::Expression* Block::Render(RelooperBuilder& Builder, bool InLoop) {
// Find the default target, the one without a condition
for (BlockBranchMap::iterator iter = ProcessedBranchesOut.begin(); iter != ProcessedBranchesOut.end(); iter++) {
if (!iter->second->Condition) {
- assert(!DefaultTarget && "block has branches without a default (NULL for the condition)"); // Must be exactly one default
+ assert(!DefaultTarget && "block has branches without a default (nullptr for the condition)"); // Must be exactly one default // nullptr
DefaultTarget = iter->first;
}
}