Refactoring: replace NULL by nullptr for pointers (2nd CL).
This CL mainly handles the pointer comparisons (== or !=).
BUG=angleproject:2001
Change-Id: I25ac3b61032e7ad91459a1c6541cadc87cf9b160
Reviewed-on: https://chromium-review.googlesource.com/483935
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ValidateLimitations.cpp b/src/compiler/translator/ValidateLimitations.cpp
index 2a29d14..9586e56 100644
--- a/src/compiler/translator/ValidateLimitations.cpp
+++ b/src/compiler/translator/ValidateLimitations.cpp
@@ -147,7 +147,7 @@
return false;
TIntermNode *body = node->getBody();
- if (body != NULL)
+ if (body != nullptr)
{
mLoopSymbolIds.push_back(GetLoopSymbolId(node));
body->traverse(this);
@@ -207,7 +207,7 @@
int ValidateLimitationsTraverser::validateForLoopInit(TIntermLoop *node)
{
TIntermNode *init = node->getInit();
- if (init == NULL)
+ if (init == nullptr)
{
error(node->getLine(), "Missing init declaration", "for");
return -1;
@@ -231,13 +231,13 @@
return -1;
}
TIntermBinary *declInit = (*declSeq)[0]->getAsBinaryNode();
- if ((declInit == NULL) || (declInit->getOp() != EOpInitialize))
+ if ((declInit == nullptr) || (declInit->getOp() != EOpInitialize))
{
error(decl->getLine(), "Invalid init declaration", "for");
return -1;
}
TIntermSymbol *symbol = declInit->getLeft()->getAsSymbolNode();
- if (symbol == NULL)
+ if (symbol == nullptr)
{
error(declInit->getLine(), "Invalid init declaration", "for");
return -1;
@@ -263,7 +263,7 @@
bool ValidateLimitationsTraverser::validateForLoopCond(TIntermLoop *node, int indexSymbolId)
{
TIntermNode *cond = node->getCondition();
- if (cond == NULL)
+ if (cond == nullptr)
{
error(node->getLine(), "Missing condition", "for");
return false;
@@ -273,14 +273,14 @@
// loop_index relational_operator constant_expression
//
TIntermBinary *binOp = cond->getAsBinaryNode();
- if (binOp == NULL)
+ if (binOp == nullptr)
{
error(node->getLine(), "Invalid condition", "for");
return false;
}
// Loop index should be to the left of relational operator.
TIntermSymbol *symbol = binOp->getLeft()->getAsSymbolNode();
- if (symbol == NULL)
+ if (symbol == nullptr)
{
error(binOp->getLine(), "Invalid condition", "for");
return false;
@@ -319,7 +319,7 @@
bool ValidateLimitationsTraverser::validateForLoopExpr(TIntermLoop *node, int indexSymbolId)
{
TIntermNode *expr = node->getExpression();
- if (expr == NULL)
+ if (expr == nullptr)
{
error(node->getLine(), "Missing expression", "for");
return false;
@@ -339,19 +339,19 @@
TOperator op = EOpNull;
TIntermSymbol *symbol = nullptr;
- if (unOp != NULL)
+ if (unOp != nullptr)
{
op = unOp->getOp();
symbol = unOp->getOperand()->getAsSymbolNode();
}
- else if (binOp != NULL)
+ else if (binOp != nullptr)
{
op = binOp->getOp();
symbol = binOp->getLeft()->getAsSymbolNode();
}
// The operand must be loop index.
- if (symbol == NULL)
+ if (symbol == nullptr)
{
error(expr->getLine(), "Invalid expression", "for");
return false;
@@ -369,11 +369,11 @@
case EOpPostDecrement:
case EOpPreIncrement:
case EOpPreDecrement:
- ASSERT((unOp != NULL) && (binOp == NULL));
+ ASSERT((unOp != nullptr) && (binOp == nullptr));
break;
case EOpAddAssign:
case EOpSubAssign:
- ASSERT((unOp == NULL) && (binOp != NULL));
+ ASSERT((unOp == nullptr) && (binOp != nullptr));
break;
default:
error(expr->getLine(), "Invalid operator", GetOperatorString(op));
@@ -381,7 +381,7 @@
}
// Loop index must be incremented/decremented with a constant.
- if (binOp != NULL)
+ if (binOp != nullptr)
{
if (!isConstExpr(binOp->getRight()))
{
@@ -402,7 +402,7 @@
bool ValidateLimitationsTraverser::isConstIndexExpr(TIntermNode *node)
{
- ASSERT(node != NULL);
+ ASSERT(node != nullptr);
ValidateConstIndexExpr validate(mLoopSymbolIds);
node->traverse(&validate);