Refactoring: replace NULL by nullptr for pointers (3rd CL).
This CL mainly handles passing/returning NULL to/from a function.
BUG=angleproject:2001
Change-Id: I34802f792e710e3d7ff697cbe4701dc1bf5ab009
Reviewed-on: https://chromium-review.googlesource.com/485060
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index e1edaaa..51398f5 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -144,7 +144,7 @@
}
~TScopedPoolAllocator()
{
- SetGlobalPoolAllocator(NULL);
+ SetGlobalPoolAllocator(nullptr);
mAllocator->pop();
}
@@ -199,7 +199,7 @@
TShHandleBase::~TShHandleBase()
{
- SetGlobalPoolAllocator(NULL);
+ SetGlobalPoolAllocator(nullptr);
allocator.popAll();
}
@@ -216,7 +216,7 @@
clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC),
builtInFunctionEmulator(),
mDiagnostics(infoSink.info),
- mSourcePath(NULL),
+ mSourcePath(nullptr),
mComputeShaderLocalSizeDeclared(false),
mTemporaryIndex(0)
{
@@ -479,7 +479,7 @@
if (success)
return root;
- return NULL;
+ return nullptr;
}
bool TCompiler::compile(const char *const shaderStrings[],
diff --git a/src/compiler/translator/ExtensionBehavior.h b/src/compiler/translator/ExtensionBehavior.h
index fac82a1..179dca3 100644
--- a/src/compiler/translator/ExtensionBehavior.h
+++ b/src/compiler/translator/ExtensionBehavior.h
@@ -25,7 +25,7 @@
case EBhDisable:
return "disable";
default:
- return NULL;
+ return nullptr;
}
}
diff --git a/src/compiler/translator/OutputGLSL.cpp b/src/compiler/translator/OutputGLSL.cpp
index a7270f3..5a7de93 100644
--- a/src/compiler/translator/OutputGLSL.cpp
+++ b/src/compiler/translator/OutputGLSL.cpp
@@ -80,8 +80,8 @@
"texture2DProjGradARB",
"textureCubeGradEXT",
"textureCubeGradARB",
- NULL,
- NULL};
+ nullptr,
+ nullptr};
static const char *legacyToCoreRename[] = {
"texture2D", "texture", "texture2DProj", "textureProj", "texture2DLod", "textureLod",
"texture2DProjLod", "textureProjLod", "texture2DRect", "texture", "textureCube", "texture",
@@ -89,7 +89,8 @@
// Extensions
"texture2DLodEXT", "textureLod", "texture2DProjLodEXT", "textureProjLod",
"textureCubeLodEXT", "textureLod", "texture2DGradEXT", "textureGrad",
- "texture2DProjGradEXT", "textureProjGrad", "textureCubeGradEXT", "textureGrad", NULL, NULL};
+ "texture2DProjGradEXT", "textureProjGrad", "textureCubeGradEXT", "textureGrad", nullptr,
+ nullptr};
const char **mapping =
(sh::IsGLSL130OrNewer(getShaderOutput())) ? legacyToCoreRename : simpleRename;
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index 4d8e03e..aa7d8d5 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -546,7 +546,7 @@
break;
case EOpIndexDirect:
- writeTriplet(visit, NULL, "[", "]");
+ writeTriplet(visit, nullptr, "[", "]");
break;
case EOpIndexIndirect:
if (node->getAddIndexClamp())
@@ -582,7 +582,7 @@
}
else
{
- writeTriplet(visit, NULL, "[", "]");
+ writeTriplet(visit, nullptr, "[", "]");
}
break;
case EOpIndexDirectStruct:
@@ -799,7 +799,7 @@
UNREACHABLE();
}
- writeTriplet(visit, preString.c_str(), NULL, postString.c_str());
+ writeTriplet(visit, preString.c_str(), nullptr, postString.c_str());
return true;
}
@@ -1119,16 +1119,16 @@
switch (node->getFlowOp())
{
case EOpKill:
- writeTriplet(visit, "discard", NULL, NULL);
+ writeTriplet(visit, "discard", nullptr, nullptr);
break;
case EOpBreak:
- writeTriplet(visit, "break", NULL, NULL);
+ writeTriplet(visit, "break", nullptr, nullptr);
break;
case EOpContinue:
- writeTriplet(visit, "continue", NULL, NULL);
+ writeTriplet(visit, "continue", nullptr, nullptr);
break;
case EOpReturn:
- writeTriplet(visit, "return ", NULL, NULL);
+ writeTriplet(visit, "return ", nullptr, nullptr);
break;
default:
UNREACHABLE();
diff --git a/src/compiler/translator/RewriteElseBlocks.cpp b/src/compiler/translator/RewriteElseBlocks.cpp
index 15aed4c..ab14fcc 100644
--- a/src/compiler/translator/RewriteElseBlocks.cpp
+++ b/src/compiler/translator/RewriteElseBlocks.cpp
@@ -34,7 +34,7 @@
TIntermNode *rewriteIfElse(TIntermIfElse *ifElse);
};
-ElseBlockRewriter::ElseBlockRewriter() : TIntermTraverser(true, false, true), mFunctionType(NULL)
+ElseBlockRewriter::ElseBlockRewriter() : TIntermTraverser(true, false, true), mFunctionType(nullptr)
{
}
diff --git a/src/compiler/translator/ShaderLang.cpp b/src/compiler/translator/ShaderLang.cpp
index 9ac335a..831f369 100644
--- a/src/compiler/translator/ShaderLang.cpp
+++ b/src/compiler/translator/ShaderLang.cpp
@@ -71,14 +71,14 @@
{
if (!handle)
{
- return NULL;
+ return nullptr;
}
TShHandleBase *base = static_cast<TShHandleBase *>(handle);
TCompiler *compiler = base->getAsCompiler();
if (!compiler)
{
- return NULL;
+ return nullptr;
}
return GetVariableList<VarT>(compiler);
@@ -87,7 +87,7 @@
TCompiler *GetCompilerFromHandle(ShHandle handle)
{
if (!handle)
- return NULL;
+ return nullptr;
TShHandleBase *base = static_cast<TShHandleBase *>(handle);
return base->getAsCompiler();
}
@@ -96,7 +96,7 @@
TranslatorHLSL *GetTranslatorHLSLFromHandle(ShHandle handle)
{
if (!handle)
- return NULL;
+ return nullptr;
TShHandleBase *base = static_cast<TShHandleBase *>(handle);
return base->getAsTranslatorHLSL();
}
diff --git a/src/compiler/translator/StructureHLSL.cpp b/src/compiler/translator/StructureHLSL.cpp
index fd140ae..57c7c75 100644
--- a/src/compiler/translator/StructureHLSL.cpp
+++ b/src/compiler/translator/StructureHLSL.cpp
@@ -163,13 +163,13 @@
}
else
{
- return define(structure, useHLSLRowMajorPacking, useStd140Packing, NULL);
+ return define(structure, useHLSLRowMajorPacking, useStd140Packing, nullptr);
}
}
TString StructureHLSL::defineNameless(const TStructure &structure)
{
- return define(structure, false, false, NULL);
+ return define(structure, false, false, nullptr);
}
TString StructureHLSL::define(const TStructure &structure,
diff --git a/src/compiler/translator/ValidateLimitations.cpp b/src/compiler/translator/ValidateLimitations.cpp
index 9586e56..a59b1bb 100644
--- a/src/compiler/translator/ValidateLimitations.cpp
+++ b/src/compiler/translator/ValidateLimitations.cpp
@@ -335,7 +335,7 @@
// The last two forms are not specified in the spec, but I am assuming
// its an oversight.
TIntermUnary *unOp = expr->getAsUnaryNode();
- TIntermBinary *binOp = unOp ? NULL : expr->getAsBinaryNode();
+ TIntermBinary *binOp = unOp ? nullptr : expr->getAsBinaryNode();
TOperator op = EOpNull;
TIntermSymbol *symbol = nullptr;
diff --git a/src/compiler/translator/VariableInfo.cpp b/src/compiler/translator/VariableInfo.cpp
index bc84aea..7673edc 100644
--- a/src/compiler/translator/VariableInfo.cpp
+++ b/src/compiler/translator/VariableInfo.cpp
@@ -60,7 +60,7 @@
return &((*infoList)[ii]);
}
- return NULL;
+ return nullptr;
}
}