1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00

Revert "(glslang) Simplifications - move nullptr to NULL"

This reverts commit 354c5afab4.
This commit is contained in:
libretroadmin 2024-06-15 06:21:52 +02:00
parent e3e501a90c
commit 1a0320ceb4
40 changed files with 539 additions and 536 deletions

View File

@ -102,7 +102,7 @@ bool InitThread()
return false;
}
glslang::SetThreadPoolAllocator(NULL);
glslang::SetThreadPoolAllocator(nullptr);
return true;
}

View File

@ -1019,7 +1019,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
spv::SpvBuildLogger* buildLogger, glslang::SpvOptions& options)
: TIntermTraverser(true, false, true),
options(options),
shaderEntry(NULL), currentFunction(NULL),
shaderEntry(nullptr), currentFunction(nullptr),
sequenceDepth(0), logger(buildLogger),
builder(spvVersion, (glslang::GetKhronosToolId() << 16) | GetSpirvGeneratorVersion(), logger),
inEntryPoint(false), entryPointTerminated(false), linkageOnly(false),
@ -2122,8 +2122,8 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
// false otherwise.
const auto bothSidesPolicy = [&]() -> bool {
// do we have both sides?
if (node->getTrueBlock() == NULL ||
node->getFalseBlock() == NULL)
if (node->getTrueBlock() == nullptr ||
node->getFalseBlock() == nullptr)
return false;
// required? (unless we write additional code to look for side effects
@ -2223,13 +2223,13 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
spv::Builder::If ifBuilder(condition, control, builder);
// emit the "then" statement
if (node->getTrueBlock() != NULL) {
if (node->getTrueBlock() != nullptr) {
node->getTrueBlock()->traverse(this);
if (result != spv::NoResult)
builder.createStore(accessChainLoad(node->getTrueBlock()->getAsTyped()->getType()), result);
}
if (node->getFalseBlock() != NULL) {
if (node->getFalseBlock() != nullptr) {
ifBuilder.makeBeginElse();
// emit the "else" statement
node->getFalseBlock()->traverse(this);
@ -2288,7 +2288,7 @@ bool TGlslangToSpvTraverser::visitSwitch(glslang::TVisit /* visit */, glslang::T
// statements between the last case and the end of the switch statement
if ((caseValues.size() && (int)codeSegments.size() == valueIndexToSegment[caseValues.size() - 1]) ||
(int)codeSegments.size() == defaultSegment)
codeSegments.push_back(NULL);
codeSegments.push_back(nullptr);
// make the switch statement
std::vector<spv::Block*> segmentBlocks; // returned, as the blocks allocated in the call
@ -2873,7 +2873,7 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
// nonuniform
builder.addMemberDecoration(spvType, member, TranslateNonUniformDecoration(glslangMember.getQualifier()));
if (glslangIntermediate->getHlslFunctionality1() && memberQualifier.semanticName != NULL) {
if (glslangIntermediate->getHlslFunctionality1() && memberQualifier.semanticName != nullptr) {
builder.addExtension("SPV_GOOGLE_hlsl_functionality1");
builder.addMemberDecoration(spvType, member, (spv::Decoration)spv::DecorationHlslSemanticGOOGLE,
memberQualifier.semanticName);
@ -2920,7 +2920,7 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra
{
// First, see if this is sized with a node, meaning a specialization constant:
glslang::TIntermTyped* specNode = arraySizes.getDimNode(dim);
if (specNode != NULL) {
if (specNode != nullptr) {
builder.clearAccessChain();
specNode->traverse(this);
return accessChainLoad(specNode->getAsTyped()->getType());
@ -6434,7 +6434,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
}
#endif
if (glslangIntermediate->getHlslFunctionality1() && symbol->getType().getQualifier().semanticName != NULL) {
if (glslangIntermediate->getHlslFunctionality1() && symbol->getType().getQualifier().semanticName != nullptr) {
builder.addExtension("SPV_GOOGLE_hlsl_functionality1");
builder.addDecoration(id, (spv::Decoration)spv::DecorationHlslSemanticGOOGLE,
symbol->getType().getQualifier().semanticName);
@ -6631,15 +6631,15 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla
bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node)
{
// don't know what this is
if (node == NULL)
if (node == nullptr)
return false;
// a constant is safe
if (node->getAsConstantUnion() != NULL)
if (node->getAsConstantUnion() != nullptr)
return true;
// not a symbol means non-trivial
if (node->getAsSymbolNode() == NULL)
if (node->getAsSymbolNode() == nullptr)
return false;
// a symbol, depends on what's being read
@ -6663,7 +6663,7 @@ bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node)
// Return true if trivial.
bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
{
if (node == NULL)
if (node == nullptr)
return false;
// count non scalars as trivial, as well as anything coming from HLSL
@ -6679,7 +6679,7 @@ bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
// not a simple operation
const glslang::TIntermBinary* binaryNode = node->getAsBinaryNode();
const glslang::TIntermUnary* unaryNode = node->getAsUnaryNode();
if (binaryNode == NULL && unaryNode == NULL)
if (binaryNode == nullptr && unaryNode == nullptr)
return false;
// not on leaf nodes
@ -6796,7 +6796,7 @@ void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsign
return;
glslang::SpvOptions defaultOptions;
if (options == NULL)
if (options == nullptr)
options = &defaultOptions;
glslang::GetThreadPoolAllocator().push();

View File

@ -55,8 +55,8 @@ struct SpvOptions {
};
void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
SpvOptions* options = NULL);
SpvOptions* options = nullptr);
void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
spv::SpvBuildLogger* logger, SpvOptions* options = NULL);
spv::SpvBuildLogger* logger, SpvOptions* options = nullptr);
}

View File

@ -71,8 +71,8 @@ public:
return;
callback_(block);
visited_.insert(block);
Block* mergeBlock = NULL;
Block* continueBlock = NULL;
Block* mergeBlock = nullptr;
Block* continueBlock = nullptr;
auto mergeInst = block->getMergeInstruction();
if (mergeInst) {
Id mergeId = mergeInst->getIdOperand(0);

View File

@ -1506,7 +1506,7 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType)
if (numComponents == 1)
return scalar;
Instruction* smear = NULL;
Instruction* smear = nullptr;
if (generatingOpCodeForSpecConst) {
auto members = std::vector<spv::Id>(numComponents, scalar);
// Sometime even in spec-constant-op mode, the temporary vector created by

View File

@ -467,7 +467,7 @@ const char* ImageChannelOrderString(int format)
case 17: return "sRGBA";
case 18: return "sBGRA";
default:
default:
return "Bad";
}
}
@ -739,7 +739,7 @@ const char* CapabilityString(int info)
case 22: return "Int16";
case 23: return "TessellationPointSize";
case 24: return "GeometryPointSize";
case 25: return "ImageGatherExtended";
case 25: return "ImageGatherExtended";
case 26: return "Bad";
case 27: return "StorageImageMultisample";
case 28: return "UniformBufferArrayDynamicIndexing";
@ -1371,37 +1371,37 @@ void Parameterize()
DecorationOperands[DecorationAlignment].push(OperandLiteralNumber, "'Alignment'");
OperandClassParams[OperandSource].set(0, SourceString, 0);
OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, NULL);
OperandClassParams[OperandAddressing].set(0, AddressingString, NULL);
OperandClassParams[OperandMemory].set(0, MemoryString, NULL);
OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, nullptr);
OperandClassParams[OperandAddressing].set(0, AddressingString, nullptr);
OperandClassParams[OperandMemory].set(0, MemoryString, nullptr);
OperandClassParams[OperandExecutionMode].set(ExecutionModeCeiling, ExecutionModeString, ExecutionModeParams);
OperandClassParams[OperandExecutionMode].setOperands(ExecutionModeOperands);
OperandClassParams[OperandStorage].set(0, StorageClassString, NULL);
OperandClassParams[OperandDimensionality].set(0, DimensionString, NULL);
OperandClassParams[OperandSamplerAddressingMode].set(0, SamplerAddressingModeString, NULL);
OperandClassParams[OperandSamplerFilterMode].set(0, SamplerFilterModeString, NULL);
OperandClassParams[OperandSamplerImageFormat].set(0, ImageFormatString, NULL);
OperandClassParams[OperandImageChannelOrder].set(0, ImageChannelOrderString, NULL);
OperandClassParams[OperandImageChannelDataType].set(0, ImageChannelDataTypeString, NULL);
OperandClassParams[OperandStorage].set(0, StorageClassString, nullptr);
OperandClassParams[OperandDimensionality].set(0, DimensionString, nullptr);
OperandClassParams[OperandSamplerAddressingMode].set(0, SamplerAddressingModeString, nullptr);
OperandClassParams[OperandSamplerFilterMode].set(0, SamplerFilterModeString, nullptr);
OperandClassParams[OperandSamplerImageFormat].set(0, ImageFormatString, nullptr);
OperandClassParams[OperandImageChannelOrder].set(0, ImageChannelOrderString, nullptr);
OperandClassParams[OperandImageChannelDataType].set(0, ImageChannelDataTypeString, nullptr);
OperandClassParams[OperandImageOperands].set(ImageOperandsCeiling, ImageOperandsString, ImageOperandsParams, true);
OperandClassParams[OperandFPFastMath].set(0, FPFastMathString, NULL, true);
OperandClassParams[OperandFPRoundingMode].set(0, FPRoundingModeString, NULL);
OperandClassParams[OperandLinkageType].set(0, LinkageTypeString, NULL);
OperandClassParams[OperandFuncParamAttr].set(0, FuncParamAttrString, NULL);
OperandClassParams[OperandAccessQualifier].set(0, AccessQualifierString, NULL);
OperandClassParams[OperandFPFastMath].set(0, FPFastMathString, nullptr, true);
OperandClassParams[OperandFPRoundingMode].set(0, FPRoundingModeString, nullptr);
OperandClassParams[OperandLinkageType].set(0, LinkageTypeString, nullptr);
OperandClassParams[OperandFuncParamAttr].set(0, FuncParamAttrString, nullptr);
OperandClassParams[OperandAccessQualifier].set(0, AccessQualifierString, nullptr);
OperandClassParams[OperandDecoration].set(DecorationCeiling, DecorationString, DecorationParams);
OperandClassParams[OperandDecoration].setOperands(DecorationOperands);
OperandClassParams[OperandBuiltIn].set(0, BuiltInString, NULL);
OperandClassParams[OperandBuiltIn].set(0, BuiltInString, nullptr);
OperandClassParams[OperandSelect].set(SelectControlCeiling, SelectControlString, SelectionControlParams, true);
OperandClassParams[OperandLoop].set(LoopControlCeiling, LoopControlString, LoopControlParams, true);
OperandClassParams[OperandFunction].set(FunctionControlCeiling, FunctionControlString, FunctionControlParams, true);
OperandClassParams[OperandMemorySemantics].set(0, MemorySemanticsString, NULL, true);
OperandClassParams[OperandMemoryAccess].set(0, MemoryAccessString, NULL, true);
OperandClassParams[OperandScope].set(0, ScopeString, NULL);
OperandClassParams[OperandGroupOperation].set(0, GroupOperationString, NULL);
OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, NULL);
OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, NULL, true);
OperandClassParams[OperandCapability].set(0, CapabilityString, NULL);
OperandClassParams[OperandMemorySemantics].set(0, MemorySemanticsString, nullptr, true);
OperandClassParams[OperandMemoryAccess].set(0, MemoryAccessString, nullptr, true);
OperandClassParams[OperandScope].set(0, ScopeString, nullptr);
OperandClassParams[OperandGroupOperation].set(0, GroupOperationString, nullptr);
OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, nullptr);
OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, nullptr, true);
OperandClassParams[OperandCapability].set(0, CapabilityString, nullptr);
OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, 0);
// set name of operator, an initial set of <id> style operands, and the description
@ -1943,11 +1943,11 @@ void Parameterize()
InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Base'");
InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Offset'");
InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Count'");
InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Base'");
InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Offset'");
InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Count'");
InstructionDesc[OpBitReverse].operands.push(OperandId, "'Base'");
InstructionDesc[OpBitCount].operands.push(OperandId, "'Base'");

View File

@ -643,7 +643,7 @@ inline uint8_t get_nibble_from_character(int character) {
const char* dec = "0123456789";
const char* lower = "abcdef";
const char* upper = "ABCDEF";
const char* p = NULL;
const char* p = nullptr;
if ((p = strchr(dec, character)))
return static_cast<uint8_t>(p - dec);
else if ((p = strchr(lower, character)))

View File

@ -84,8 +84,8 @@ const MemorySemanticsMask MemorySemanticsAllMemory =
class Instruction {
public:
Instruction(Id resultId, Id typeId, Op opCode) : resultId(resultId), typeId(typeId), opCode(opCode), block(NULL) { }
explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), block(NULL) { }
Instruction(Id resultId, Id typeId, Op opCode) : resultId(resultId), typeId(typeId), opCode(opCode), block(nullptr) { }
explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), block(nullptr) { }
virtual ~Instruction() {}
void addIdOperand(Id id) { operands.push_back(id); }
void addImmediateOperand(unsigned int immediate) { operands.push_back(immediate); }
@ -182,17 +182,16 @@ public:
bool isUnreachable() const { return unreachable; }
// Returns the block's merge instruction, if one exists (otherwise null).
const Instruction* getMergeInstruction() const {
if (instructions.size() < 2) return NULL;
if (instructions.size() < 2) return nullptr;
const Instruction* nextToLast = (instructions.cend() - 2)->get();
switch (nextToLast->getOpCode())
{
switch (nextToLast->getOpCode()) {
case OpSelectionMerge:
case OpLoopMerge:
return nextToLast;
default:
break;
return nullptr;
}
return NULL;
return nullptr;
}
bool isTerminated() const

View File

@ -222,12 +222,12 @@ inline const TString String(const int i, const int /*base*/ = 10)
#endif
struct TSourceLoc {
void init() { name = NULL; string = 0; line = 0; column = 0; }
void init() { name = nullptr; string = 0; line = 0; column = 0; }
void init(int stringNum) { init(); string = stringNum; }
// Returns the name if it exists. Otherwise, returns the string number.
std::string getStringNameOrNum(bool quoteStringName = true) const
{
if (name != NULL)
if (name != nullptr)
return quoteStringName ? ("\"" + std::string(name) + "\"") : name;
return std::to_string((long long)string);
}

View File

@ -846,13 +846,13 @@ class TConstUnionArray {
public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
TConstUnionArray() : unionArray(NULL) { }
TConstUnionArray() : unionArray(nullptr) { }
virtual ~TConstUnionArray() { }
explicit TConstUnionArray(int size)
{
if (size == 0)
unionArray = NULL;
unionArray = nullptr;
else
unionArray = new TConstUnionVector(size);
}
@ -894,7 +894,7 @@ public:
return sum;
}
bool empty() const { return unionArray == NULL; }
bool empty() const { return unionArray == nullptr; }
protected:
typedef TVector<TConstUnion> TConstUnionVector;

View File

@ -431,7 +431,7 @@ public:
// drop qualifiers that don't belong in a temporary variable
void makeTemporary()
{
semanticName = NULL;
semanticName = nullptr;
storage = EvqTemporary;
builtIn = EbvNone;
clearInterstage();
@ -1119,8 +1119,8 @@ public:
vectorSize = 1;
matrixRows = 0;
matrixCols = 0;
arraySizes = NULL;
userDef = NULL;
arraySizes = nullptr;
userDef = nullptr;
loc = l;
}
@ -1155,7 +1155,7 @@ public:
bool isScalar() const
{
return matrixCols == 0 && vectorSize == 1 && arraySizes == NULL && userDef == NULL;
return matrixCols == 0 && vectorSize == 1 && arraySizes == nullptr && userDef == nullptr;
}
// "Image" is a superset of "Subpass"
@ -1174,7 +1174,7 @@ public:
explicit TType(TBasicType t = EbtVoid, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0,
bool isVector = false) :
basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1),
arraySizes(NULL), structure(NULL), fieldName(NULL), typeName(NULL)
arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr)
{
sampler.clear();
qualifier.clear();
@ -1184,7 +1184,7 @@ public:
TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0,
bool isVector = false) :
basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1),
arraySizes(NULL), structure(NULL), fieldName(NULL), typeName(NULL)
arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr)
{
sampler.clear();
qualifier.clear();
@ -1195,7 +1195,7 @@ public:
explicit TType(const TPublicType& p) :
basicType(p.basicType),
vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false),
arraySizes(p.arraySizes), structure(NULL), fieldName(NULL), typeName(NULL)
arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr)
{
if (basicType == EbtSampler)
sampler = p.sampler;
@ -1208,9 +1208,9 @@ public:
}
}
// for construction of sampler types
TType(const TSampler& sampler, TStorageQualifier q = EvqUniform, TArraySizes* as = NULL) :
TType(const TSampler& sampler, TStorageQualifier q = EvqUniform, TArraySizes* as = nullptr) :
basicType(EbtSampler), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false),
arraySizes(as), structure(NULL), fieldName(NULL), typeName(NULL),
arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr),
sampler(sampler)
{
qualifier.clear();
@ -1224,7 +1224,7 @@ public:
if (type.isArray()) {
shallowCopy(type);
if (type.getArraySizes()->getNumDims() == 1) {
arraySizes = NULL;
arraySizes = nullptr;
} else {
// want our own copy of the array, so we can edit it
arraySizes = new TArraySizes;
@ -1258,7 +1258,7 @@ public:
// for making structures, ...
TType(TTypeList* userDef, const TString& n) :
basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false),
arraySizes(NULL), structure(userDef), fieldName(NULL)
arraySizes(nullptr), structure(userDef), fieldName(nullptr)
{
sampler.clear();
qualifier.clear();
@ -1267,7 +1267,7 @@ public:
// For interface blocks
TType(TTypeList* userDef, const TString& n, const TQualifier& q) :
basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false),
qualifier(q), arraySizes(NULL), structure(userDef), fieldName(NULL)
qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr)
{
sampler.clear();
typeName = NewPoolTString(n.c_str());
@ -1346,7 +1346,7 @@ public:
virtual int getOuterArraySize() const { return arraySizes->getOuterSize(); }
virtual TIntermTyped* getOuterArrayNode() const { return arraySizes->getOuterNode(); }
virtual int getCumulativeArraySize() const { return arraySizes->getCumulativeSize(); }
virtual bool isArrayOfArrays() const { return arraySizes != NULL && arraySizes->getNumDims() > 1; }
virtual bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; }
virtual int getImplicitArraySize() const { return arraySizes->getImplicitSize(); }
virtual const TArraySizes* getArraySizes() const { return arraySizes; }
virtual TArraySizes* getArraySizes() { return arraySizes; }
@ -1355,13 +1355,13 @@ public:
virtual bool isScalarOrVec1() const { return isScalar() || vector1; }
virtual bool isVector() const { return vectorSize > 1 || vector1; }
virtual bool isMatrix() const { return matrixCols ? true : false; }
virtual bool isArray() const { return arraySizes != NULL; }
virtual bool isArray() const { return arraySizes != nullptr; }
virtual bool isSizedArray() const { return isArray() && arraySizes->isSized(); }
virtual bool isUnsizedArray() const { return isArray() && !arraySizes->isSized(); }
virtual bool isArrayVariablyIndexed() const { return arraySizes->isVariablyIndexed(); }
virtual void setArrayVariablyIndexed() { arraySizes->setVariablyIndexed(); }
virtual void updateImplicitArraySize(int size) { arraySizes->updateImplicitSize(size); }
virtual bool isStruct() const { return structure != NULL; }
virtual bool isStruct() const { return structure != nullptr; }
virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble || basicType == EbtFloat16; }
virtual bool isIntegerDomain() const
{
@ -1498,15 +1498,15 @@ public:
}
void clearArraySizes()
{
arraySizes = NULL;
arraySizes = nullptr;
}
// Add inner array sizes, to any existing sizes, via copy; the
// sizes passed in can still be reused for other purposes.
void copyArrayInnerSizes(const TArraySizes* s)
{
if (s != NULL) {
if (arraySizes == NULL)
if (s != nullptr) {
if (arraySizes == nullptr)
copyArraySizes(*s);
else
arraySizes->addInnerSizes(*s);
@ -1783,7 +1783,7 @@ public:
else
components = vectorSize;
if (arraySizes != NULL) {
if (arraySizes != nullptr) {
components *= arraySizes->getCumulativeSize();
}
@ -1807,12 +1807,12 @@ public:
//
bool sameStructType(const TType& right) const
{
// Most commonly, they are both NULL, or the same pointer to the same actual structure
// Most commonly, they are both nullptr, or the same pointer to the same actual structure
if (structure == right.structure)
return true;
// Both being NULL was caught above, now they both have to be structures of the same number of elements
if (structure == NULL || right.structure == NULL ||
// Both being nullptr was caught above, now they both have to be structures of the same number of elements
if (structure == nullptr || right.structure == nullptr ||
structure->size() != right.structure->size())
return false;
@ -1841,8 +1841,8 @@ public:
// See if two type's arrayness match
bool sameArrayness(const TType& right) const
{
return ((arraySizes == NULL && right.arraySizes == NULL) ||
(arraySizes != NULL && right.arraySizes != NULL && *arraySizes == *right.arraySizes));
return ((arraySizes == nullptr && right.arraySizes == nullptr) ||
(arraySizes != nullptr && right.arraySizes != nullptr && *arraySizes == *right.arraySizes));
}
// See if two type's arrayness match in everything except their outer dimension
@ -1927,8 +1927,8 @@ protected:
// from a scalar.
TQualifier qualifier;
TArraySizes* arraySizes; // NULL unless an array; can be shared across types
TTypeList* structure; // NULL unless this is a struct; can be shared across types
TArraySizes* arraySizes; // nullptr unless an array; can be shared across types
TTypeList* structure; // nullptr unless this is a struct; can be shared across types
TString *fieldName; // for structure field names
TString *typeName; // for structure type name
TSampler sampler;

View File

@ -56,12 +56,12 @@ extern bool SameSpecializationConstants(TIntermTyped*, TIntermTyped*);
// size and specialization constant nodes are the same.
struct TArraySize {
unsigned int size;
TIntermTyped* node; // NULL means no specialization constant node
TIntermTyped* node; // nullptr means no specialization constant node
bool operator==(const TArraySize& rhs) const
{
if (size != rhs.size)
return false;
if (node == NULL || rhs.node == NULL)
if (node == nullptr || rhs.node == nullptr)
return node == rhs.node;
return SameSpecializationConstants(node, rhs.node);
@ -82,14 +82,14 @@ struct TSmallArrayVector {
//
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
TSmallArrayVector() : sizes(NULL) { }
TSmallArrayVector() : sizes(nullptr) { }
virtual ~TSmallArrayVector() { dealloc(); }
// For breaking into two non-shared copies, independently modifiable.
TSmallArrayVector& operator=(const TSmallArrayVector& from)
{
if (from.sizes == NULL)
sizes = NULL;
if (from.sizes == nullptr)
sizes = nullptr;
else {
alloc();
*sizes = *from.sizes;
@ -100,7 +100,7 @@ struct TSmallArrayVector {
int size() const
{
if (sizes == NULL)
if (sizes == nullptr)
return 0;
return (int)sizes->size();
}
@ -170,9 +170,9 @@ struct TSmallArrayVector {
bool operator==(const TSmallArrayVector& rhs) const
{
if (sizes == NULL && rhs.sizes == NULL)
if (sizes == nullptr && rhs.sizes == nullptr)
return true;
if (sizes == NULL || rhs.sizes == NULL)
if (sizes == nullptr || rhs.sizes == nullptr)
return false;
return *sizes == *rhs.sizes;
}
@ -183,13 +183,13 @@ protected:
void alloc()
{
if (sizes == NULL)
if (sizes == nullptr)
sizes = new TVector<TArraySize>;
}
void dealloc()
{
delete sizes;
sizes = NULL;
sizes = nullptr;
}
TVector<TArraySize>* sizes; // will either hold such a pointer, or in the future, hold the two array sizes
@ -240,7 +240,7 @@ struct TArraySizes {
return size;
}
void addInnerSize() { addInnerSize((unsigned)UnsizedArraySize); }
void addInnerSize(int s) { addInnerSize((unsigned)s, NULL); }
void addInnerSize(int s) { addInnerSize((unsigned)s, nullptr); }
void addInnerSize(int s, TIntermTyped* n) { sizes.push_back((unsigned)s, n); }
void addInnerSize(TArraySize pair) { sizes.push_back(pair.size, pair.node); }
void addInnerSizes(const TArraySizes& s) { sizes.push_back(s.sizes); }
@ -268,7 +268,7 @@ struct TArraySizes {
bool isInnerSpecialization() const
{
for (int d = 1; d < sizes.size(); ++d) {
if (sizes.getDimNode(d) != NULL)
if (sizes.getDimNode(d) != nullptr)
return true;
}
@ -276,7 +276,7 @@ struct TArraySizes {
}
bool isOuterSpecialization()
{
return sizes.getDimNode(0) != NULL;
return sizes.getDimNode(0) != nullptr;
}
bool hasUnsized() const { return getOuterSize() == UnsizedArraySize || isInnerUnsized(); }

View File

@ -1158,7 +1158,7 @@ public:
// it is essential to use "symbol = sym" to assign to symbol
TIntermSymbol(int i, const TString& n, const TType& t)
: TIntermTyped(t), id(i),
constSubtree(NULL)
constSubtree(nullptr)
{ name = n; }
virtual int getId() const { return id; }
virtual const TString& getName() const { return name; }
@ -1471,8 +1471,8 @@ typedef TVector<TStorageQualifier> TQualifierList;
//
class TIntermAggregate : public TIntermOperator {
public:
TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(NULL) { }
TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(NULL) { }
TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(nullptr) { }
TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(nullptr) { }
~TIntermAggregate() { delete pragmaTable; }
virtual TIntermAggregate* getAsAggregate() { return this; }
virtual const TIntermAggregate* getAsAggregate() const { return this; }

View File

@ -701,7 +701,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
//
TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
{
if (aggrNode == NULL)
if (aggrNode == nullptr)
return aggrNode;
if (! areAllChildConst(aggrNode))

View File

@ -41,7 +41,7 @@ namespace glslang {
void TInfoSinkBase::append(const char* s)
{
if (outputStream & EString) {
if (s == NULL)
if (s == nullptr)
sink.append("(null)");
else {
checkMem(strlen(s));

View File

@ -103,7 +103,7 @@ TIntermSymbol* TIntermediate::addSymbol(const TType& type, const TSourceLoc& loc
{
TConstUnionArray unionArray; // just a null constant
return addSymbol(0, "", type, unionArray, NULL, loc);
return addSymbol(0, "", type, unionArray, nullptr, loc);
}
//
@ -111,26 +111,26 @@ TIntermSymbol* TIntermediate::addSymbol(const TType& type, const TSourceLoc& loc
//
// Returns the added node.
//
// Returns NULL if the working conversions and promotions could not be found.
// Returns nullptr if the working conversions and promotions could not be found.
//
TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc)
{
// No operations work on blocks
if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock)
return NULL;
return nullptr;
// Try converting the children's base types to compatible types.
auto children = addConversion(op, left, right);
left = std::get<0>(children);
right = std::get<1>(children);
if (left == NULL || right == NULL)
return NULL;
if (left == nullptr || right == nullptr)
return nullptr;
// Convert the children's type shape to be compatible.
addBiShapeConversion(op, left, right);
if (left == NULL || right == NULL)
return NULL;
if (left == nullptr || right == nullptr)
return nullptr;
//
// Need a new node holding things together. Make
@ -138,7 +138,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
//
TIntermBinary* node = addBinaryNode(op, left, right, loc);
if (! promote(node))
return NULL;
return nullptr;
node->updatePrecision();
@ -222,24 +222,24 @@ TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, TSo
//
// Returns the added node.
//
// Returns NULL if the 'right' type could not be converted to match the 'left' type,
// Returns nullptr if the 'right' type could not be converted to match the 'left' type,
// or the resulting operation cannot be properly promoted.
//
TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc)
{
// No block assignment
if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock)
return NULL;
return nullptr;
//
// Like adding binary math, except the conversion can only go
// from right to left.
//
// convert base types, NULL return means not possible
// convert base types, nullptr return means not possible
right = addConversion(op, left->getType(), right);
if (right == NULL)
return NULL;
if (right == nullptr)
return nullptr;
// convert shape
right = addUniShapeConversion(op, left->getType(), right);
@ -248,7 +248,7 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm
TIntermBinary* node = addBinaryNode(op, left, right, loc);
if (! promote(node))
return NULL;
return nullptr;
node->updatePrecision();
@ -276,10 +276,10 @@ TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermT
TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSourceLoc loc)
{
if (child == 0)
return NULL;
return nullptr;
if (child->getType().getBasicType() == EbtBlock)
return NULL;
return nullptr;
switch (op) {
case EOpLogicalNot:
@ -288,7 +288,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
}
if (child->getType().getBasicType() != EbtBool || child->getType().isMatrix() || child->getType().isArray() || child->getType().isVector()) {
return NULL;
return nullptr;
}
break;
@ -298,7 +298,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
case EOpPreDecrement:
case EOpNegative:
if (child->getType().getBasicType() == EbtStruct || child->getType().isArray())
return NULL;
return nullptr;
default: break; // some compilers want this
}
@ -328,8 +328,8 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
child->getMatrixRows(),
child->isVector()),
child);
if (child == NULL)
return NULL;
if (child == nullptr)
return nullptr;
}
//
@ -359,7 +359,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
TIntermUnary* node = addUnaryNode(op, child, loc);
if (! promote(node))
return NULL;
return nullptr;
node->updatePrecision();
@ -389,8 +389,8 @@ TIntermTyped* TIntermediate::addBuiltInFunctionCall(const TSourceLoc& loc, TOper
// including constness (which would differ from the prototype).
//
TIntermTyped* child = childNode->getAsTyped();
if (child == NULL)
return NULL;
if (child == nullptr)
return nullptr;
if (child->getAsConstantUnion()) {
TIntermTyped* folded = child->getAsConstantUnion()->fold(op, returnType);
@ -424,9 +424,9 @@ TIntermTyped* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator o
//
// Make sure we have an aggregate. If not turn it into one.
//
if (node != NULL) {
if (node != nullptr) {
aggNode = node->getAsAggregate();
if (aggNode == NULL || aggNode->getOp() != EOpNull) {
if (aggNode == nullptr || aggNode->getOp() != EOpNull) {
//
// Make an aggregate containing this node.
//
@ -471,7 +471,7 @@ bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const
// samplers can get assigned via a sampler constructor
// (well, not yet, but code in the rest of this function is ready for it)
if (node->getBasicType() == EbtSampler && op == EOpAssign &&
node->getAsOperator() != NULL && node->getAsOperator()->getOp() == EOpConstructTextureSampler)
node->getAsOperator() != nullptr && node->getAsOperator()->getOp() == EOpConstructTextureSampler)
break;
// otherwise, opaque types can't even be operated on, let alone converted
@ -491,7 +491,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
//
// Add a new newNode for the conversion.
//
TIntermUnary* newNode = NULL;
TIntermUnary* newNode = nullptr;
TOperator newOp = EOpNull;
@ -510,7 +510,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
default:
return NULL;
return nullptr;
}
break;
case EbtFloat:
@ -527,7 +527,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
default:
return NULL;
return nullptr;
}
break;
case EbtFloat16:
@ -544,7 +544,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtInt64: newOp = EOpConvInt64ToFloat16; break;
case EbtUint64: newOp = EOpConvUint64ToFloat16; break;
default:
return NULL;
return nullptr;
}
break;
case EbtBool:
@ -561,7 +561,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtInt64: newOp = EOpConvInt64ToBool; break;
case EbtUint64: newOp = EOpConvUint64ToBool; break;
default:
return NULL;
return nullptr;
}
break;
case EbtInt8:
@ -578,7 +578,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtDouble: newOp = EOpConvDoubleToInt8; break;
case EbtFloat16: newOp = EOpConvFloat16ToInt8; break;
default:
return NULL;
return nullptr;
}
break;
case EbtUint8:
@ -595,7 +595,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtDouble: newOp = EOpConvDoubleToUint8; break;
case EbtFloat16: newOp = EOpConvFloat16ToUint8; break;
default:
return NULL;
return nullptr;
}
break;
@ -613,7 +613,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtDouble: newOp = EOpConvDoubleToInt16; break;
case EbtFloat16: newOp = EOpConvFloat16ToInt16; break;
default:
return NULL;
return nullptr;
}
break;
case EbtUint16:
@ -630,7 +630,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtDouble: newOp = EOpConvDoubleToUint16; break;
case EbtFloat16: newOp = EOpConvFloat16ToUint16; break;
default:
return NULL;
return nullptr;
}
break;
@ -648,7 +648,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtInt64: newOp = EOpConvInt64ToInt; break;
case EbtUint64: newOp = EOpConvUint64ToInt; break;
default:
return NULL;
return nullptr;
}
break;
case EbtUint:
@ -665,7 +665,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtInt64: newOp = EOpConvInt64ToUint; break;
case EbtUint64: newOp = EOpConvUint64ToUint; break;
default:
return NULL;
return nullptr;
}
break;
case EbtInt64:
@ -682,7 +682,7 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtFloat16: newOp = EOpConvFloat16ToInt64; break;
case EbtUint64: newOp = EOpConvUint64ToInt64; break;
default:
return NULL;
return nullptr;
}
break;
case EbtUint64:
@ -699,11 +699,11 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
case EbtFloat16: newOp = EOpConvFloat16ToUint64; break;
case EbtInt64: newOp = EOpConvInt64ToUint64; break;
default:
return NULL;
return nullptr;
}
break;
default:
return NULL;
return nullptr;
}
TType newType(convertTo, EvqTemporary, node->getVectorSize(), node->getMatrixCols(), node->getMatrixRows());
@ -729,21 +729,21 @@ TIntermUnary* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
// See addShapeConversion() for shape conversions.
//
// Returns the converted pair of nodes.
// Returns <NULL, NULL> when there is no conversion.
// Returns <nullptr, nullptr> when there is no conversion.
std::tuple<TIntermTyped*, TIntermTyped*>
TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* node1) const
{
if (!isConversionAllowed(op, node0) || !isConversionAllowed(op, node1))
return std::make_tuple((glslang::TIntermTyped*)NULL, (glslang::TIntermTyped*)NULL);
return std::make_tuple(nullptr, nullptr);
if (node0->getType() != node1->getType()) {
// If differing structure, then no conversions.
if (node0->isStruct() || node1->isStruct())
return std::make_tuple((glslang::TIntermTyped*)NULL, (glslang::TIntermTyped*)NULL);
return std::make_tuple(nullptr, nullptr);
// If differing arrays, then no conversions.
if (node0->getType().isArray() || node1->getType().isArray())
return std::make_tuple((glslang::TIntermTyped*)NULL, (glslang::TIntermTyped*)NULL);
return std::make_tuple(nullptr, nullptr);
}
auto promoteTo = std::make_tuple(EbtNumTypes, EbtNumTypes);
@ -782,7 +782,7 @@ TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* no
promoteTo = getConversionDestinatonType(node0->getBasicType(), node1->getBasicType(), op);
if (std::get<0>(promoteTo) == EbtNumTypes || std::get<1>(promoteTo) == EbtNumTypes)
return std::make_tuple((glslang::TIntermTyped*)NULL, (glslang::TIntermTyped*)NULL);
return std::make_tuple(nullptr, nullptr);
break;
@ -812,7 +812,7 @@ TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* no
if (isTypeInt(node0->getBasicType()) && isTypeInt(node1->getBasicType()))
return std::make_tuple(node0, node1);
else
return std::make_tuple((glslang::TIntermTyped*)NULL, (glslang::TIntermTyped*)NULL);
return std::make_tuple(nullptr, nullptr);
}
break;
@ -820,7 +820,7 @@ TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* no
if (node0->getType() == node1->getType())
return std::make_tuple(node0, node1);
return std::make_tuple((glslang::TIntermTyped*)NULL, (glslang::TIntermTyped*)NULL);
return std::make_tuple(nullptr, nullptr);
}
TIntermTyped* newNode0;
@ -858,12 +858,12 @@ TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* no
// Generally, this is focused on basic type conversion, not shape conversion.
// See addShapeConversion() for shape conversions.
//
// Return NULL if a conversion can't be done.
// Return nullptr if a conversion can't be done.
//
TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TIntermTyped* node) const
{
if (!isConversionAllowed(op, node))
return NULL;
return nullptr;
// Otherwise, if types are identical, no problem
if (type == node->getType())
@ -871,11 +871,11 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
// If one's a structure, then no conversions.
if (type.isStruct() || node->isStruct())
return NULL;
return nullptr;
// If one's an array, then no conversions.
if (type.isArray() || node->getType().isArray())
return NULL;
return nullptr;
// Note: callers are responsible for other aspects of shape,
// like vector and matrix sizes.
@ -970,7 +970,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
if (canImplicitlyPromote(node->getBasicType(), type.getBasicType(), op))
promoteTo = type.getBasicType();
else
return NULL;
return nullptr;
break;
// For GLSL, there are no conversions needed; the shift amount just needs to be an
@ -985,7 +985,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
if (isTypeInt(type.getBasicType()) && isTypeInt(node->getBasicType()))
return node;
else
return NULL;
return nullptr;
}
break;
}
@ -996,7 +996,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
if (type.getBasicType() == node->getType().getBasicType())
return node;
else
return NULL;
return nullptr;
}
if (node->getAsConstantUnion())
@ -1191,7 +1191,7 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped*
const int matSize = type.getMatrixRows() * type.getMatrixCols();
TIntermAggregate* rhsAggregate = new TIntermAggregate();
const bool isSimple = (node->getAsSymbolNode() != NULL) || (node->getAsConstantUnion() != NULL);
const bool isSimple = (node->getAsSymbolNode() != nullptr) || (node->getAsConstantUnion() != nullptr);
for (int x=0; x<matSize; ++x)
rhsAggregate->getSequence().push_back(node);
@ -2052,24 +2052,24 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
// Safe way to combine two nodes into an aggregate. Works with null pointers,
// a node that's not a aggregate yet, etc.
//
// Returns the resulting aggregate, unless NULL was passed in for
// Returns the resulting aggregate, unless nullptr was passed in for
// both existing nodes.
//
TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right)
{
if (left == NULL && right == NULL)
return NULL;
if (left == nullptr && right == nullptr)
return nullptr;
TIntermAggregate* aggNode = NULL;
if (left != NULL)
TIntermAggregate* aggNode = nullptr;
if (left != nullptr)
aggNode = left->getAsAggregate();
if (aggNode == NULL || aggNode->getOp() != EOpNull) {
if (aggNode == nullptr || aggNode->getOp() != EOpNull) {
aggNode = new TIntermAggregate;
if (left != NULL)
if (left != nullptr)
aggNode->getSequence().push_back(left);
}
if (right != NULL)
if (right != nullptr)
aggNode->getSequence().push_back(right);
return aggNode;
@ -2087,12 +2087,12 @@ TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* r
//
// Turn an existing node into an aggregate.
//
// Returns an aggregate, unless NULL was passed in for the existing node.
// Returns an aggregate, unless nullptr was passed in for the existing node.
//
TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node)
{
if (node == NULL)
return NULL;
if (node == nullptr)
return nullptr;
TIntermAggregate* aggNode = new TIntermAggregate;
aggNode->getSequence().push_back(node);
@ -2103,8 +2103,8 @@ TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node)
TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, const TSourceLoc& loc)
{
if (node == NULL)
return NULL;
if (node == nullptr)
return nullptr;
TIntermAggregate* aggNode = new TIntermAggregate;
aggNode->getSequence().push_back(node);
@ -2180,7 +2180,7 @@ TIntermTyped* TIntermediate::addMethod(TIntermTyped* object, const TType& type,
// Specialization constant operations include
// - The ternary operator ( ? : )
//
// Returns the selection node created, or NULL if one could not be.
// Returns the selection node created, or nullptr if one could not be.
//
TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock,
const TSourceLoc& loc)
@ -2202,8 +2202,8 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
trueBlock = std::get<0>(children);
falseBlock = std::get<1>(children);
if (trueBlock == NULL || falseBlock == NULL)
return NULL;
if (trueBlock == nullptr || falseBlock == nullptr)
return nullptr;
// Handle a vector condition as a mix
if (!cond->getType().isScalarOrVec1()) {
@ -2215,7 +2215,7 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
// After conversion, types have to match.
if (falseBlock->getType() != trueBlock->getType())
return NULL;
return nullptr;
// make the mix operation
TIntermAggregate* mix = makeAggregate(loc);
@ -2235,7 +2235,7 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
// After conversion, types have to match.
if (falseBlock->getType() != trueBlock->getType())
return NULL;
return nullptr;
// Eliminate the selection when the condition is a scalar and all operands are constant.
if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) {
@ -2407,7 +2407,7 @@ TIntermTyped* TIntermediate::addSwizzle(TSwizzleSelectors<selectorType>& selecto
// expression (just "." and []).
//
// Return the base of the l-value (where following indexing quits working).
// Return NULL if a chain following dereferences cannot be followed.
// Return nullptr if a chain following dereferences cannot be followed.
//
// 'swizzleOkay' says whether or not it is okay to consider a swizzle
// a valid part of the dereference chain.
@ -2416,18 +2416,18 @@ const TIntermTyped* TIntermediate::findLValueBase(const TIntermTyped* node, bool
{
do {
const TIntermBinary* binary = node->getAsBinaryNode();
if (binary == NULL)
if (binary == nullptr)
return node;
TOperator op = binary->getOp();
if (op != EOpIndexDirect && op != EOpIndexIndirect && op != EOpIndexDirectStruct && op != EOpVectorSwizzle && op != EOpMatrixSwizzle)
return NULL;
return nullptr;
if (! swizzleOkay) {
if (op == EOpVectorSwizzle || op == EOpMatrixSwizzle)
return NULL;
return nullptr;
if ((op == EOpIndexDirect || op == EOpIndexIndirect) &&
(binary->getLeft()->getType().isVector() || binary->getLeft()->getType().isScalar()) &&
! binary->getLeft()->getType().isArray())
return NULL;
return nullptr;
}
node = node->getAsBinaryNode()->getLeft();
} while (true);
@ -2456,10 +2456,10 @@ TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* init
// make a sequence of the initializer and statement, but try to reuse the
// aggregate already created for whatever is in the initializer, if there is one
TIntermAggregate* loopSequence = (initializer == NULL ||
initializer->getAsAggregate() == NULL) ? makeAggregate(initializer, loc)
TIntermAggregate* loopSequence = (initializer == nullptr ||
initializer->getAsAggregate() == nullptr) ? makeAggregate(initializer, loc)
: initializer->getAsAggregate();
if (loopSequence != NULL && loopSequence->getOp() == EOpSequence)
if (loopSequence != nullptr && loopSequence->getOp() == EOpSequence)
loopSequence->setOp(EOpNull);
loopSequence = growAggregate(loopSequence, node);
loopSequence->setOperator(EOpSequence);
@ -2472,7 +2472,7 @@ TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* init
//
TIntermBranch* TIntermediate::addBranch(TOperator branchOp, const TSourceLoc& loc)
{
return addBranch(branchOp, NULL, loc);
return addBranch(branchOp, nullptr, loc);
}
TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, const TSourceLoc& loc)
@ -2489,7 +2489,7 @@ TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expres
//
bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
{
if (root == NULL)
if (root == nullptr)
return true;
// Finish off the top-level sequence
@ -2913,7 +2913,7 @@ bool TIntermOperator::isConstructor() const
//
bool TIntermediate::promote(TIntermOperator* node)
{
if (node == NULL)
if (node == nullptr)
return false;
if (node->getAsUnaryNode())
@ -2942,7 +2942,7 @@ bool TIntermediate::promoteUnary(TIntermUnary& node)
if (operand->getBasicType() != EbtBool) {
// Add constructor to boolean type. If that fails, we can't do it, so return false.
TIntermTyped* converted = addConversion(op, TType(EbtBool), operand);
if (converted == NULL)
if (converted == nullptr)
return false;
// Use the result of converting the node to a bool.
@ -3062,7 +3062,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
left = createConversion(EbtInt, left);
if (right->getBasicType() == EbtBool)
right = createConversion(EbtInt, right);
if (left == NULL || right == NULL)
if (left == nullptr || right == nullptr)
return false;
node.setLeft(left);
node.setRight(right);
@ -3420,7 +3420,7 @@ bool TIntermediate::promoteAggregate(TIntermAggregate& node)
// TODO: array and struct behavior
// Try converting all nodes to the given node's type
TIntermSequence convertedArgs(numArgs, NULL);
TIntermSequence convertedArgs(numArgs, nullptr);
// Try to convert all types to the nonConvArg type.
for (int nonConvArg = 0; nonConvArg < numArgs; ++nonConvArg) {
@ -3432,7 +3432,7 @@ bool TIntermediate::promoteAggregate(TIntermAggregate& node)
// If we successfully converted all the args, use the result.
if (std::all_of(convertedArgs.begin(), convertedArgs.end(),
[](const TIntermNode* node) { return node != NULL; })) {
[](const TIntermNode* node) { return node != nullptr; })) {
std::swap(args, convertedArgs);
return true;
@ -3807,7 +3807,7 @@ const char* TIntermediate::getResourceName(TResourceType res)
default:
break;
}
return NULL;
return nullptr;
}

View File

@ -139,12 +139,12 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
return true;
}
const char* symbol = NULL;
const char* symbol = nullptr;
TIntermSymbol* symNode = node->getAsSymbolNode();
if (symNode != NULL)
if (symNode != nullptr)
symbol = symNode->getName().c_str();
const char* message = NULL;
const char* message = nullptr;
switch (node->getQualifier().storage) {
case EvqConst: message = "can't modify a const"; break;
case EvqConstReadOnly: message = "can't modify a const"; break;
@ -173,7 +173,7 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
}
}
if (message == NULL && binaryNode == NULL && symNode == NULL) {
if (message == nullptr && binaryNode == nullptr && symNode == nullptr) {
error(loc, " l-value required", op, "", "");
return true;
@ -182,7 +182,7 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
//
// Everything else is okay, no error.
//
if (message == NULL)
if (message == nullptr)
return false;
//
@ -276,15 +276,15 @@ void TParseContextBase::makeEditable(TSymbol*& symbol)
// Return a writable version of the variable 'name'.
//
// Return NULL if 'name' is not found. This should mean
// Return nullptr if 'name' is not found. This should mean
// something is seriously wrong (e.g., compiler asking self for
// built-in that doesn't exist).
TVariable* TParseContextBase::getEditableVariable(const char* name)
{
bool builtIn;
TSymbol* symbol = symbolTable.find(name, &builtIn);
if (symbol == NULL)
return NULL;
if (symbol == nullptr)
return nullptr;
if (builtIn)
makeEditable(symbol);
@ -398,7 +398,7 @@ const TFunction* TParseContextBase::selectFunction(
// 2. none viable...
if (viableCandidates.size() == 0)
return NULL;
return nullptr;
// 3. only one viable...
if (viableCandidates.size() == 1)
@ -558,7 +558,7 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin
void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& memberType, const TString& memberName, TTypeList* typeList)
{
// Make the global block, if not yet made.
if (globalUniformBlock == NULL) {
if (globalUniformBlock == nullptr) {
TQualifier blockQualifier;
blockQualifier.clear();
blockQualifier.storage = EvqUniform;

File diff suppressed because it is too large Load Diff

View File

@ -77,20 +77,20 @@ public:
TParseContextBase(TSymbolTable& symbolTable, TIntermediate& interm, bool parsingBuiltins, int version,
EProfile profile, const SpvVersion& spvVersion, EShLanguage language,
TInfoSink& infoSink, bool forwardCompatible, EShMessages messages,
const TString* entryPoint = NULL)
const TString* entryPoint = nullptr)
: TParseVersions(interm, version, profile, spvVersion, language, infoSink, forwardCompatible, messages),
scopeMangler("::"),
symbolTable(symbolTable),
statementNestingLevel(0), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0),
postEntryPointReturn(false),
contextPragma(true, false),
parsingBuiltins(parsingBuiltins), scanContext(NULL), ppContext(NULL),
parsingBuiltins(parsingBuiltins), scanContext(nullptr), ppContext(nullptr),
limits(resources.limits),
globalUniformBlock(NULL),
globalUniformBlock(nullptr),
globalUniformBinding(TQualifier::layoutBindingEnd),
globalUniformSet(TQualifier::layoutSetEnd)
{
if (entryPoint != NULL)
if (entryPoint != nullptr)
sourceEntryPointName = *entryPoint;
}
virtual ~TParseContextBase() { }
@ -149,14 +149,14 @@ public:
}
// Manage the global uniform block (default uniforms in GLSL, $Global in HLSL)
virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = NULL);
virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr);
// Potentially rename shader entry point function
void renameShaderFunction(TString*& name) const
{
// Replace the entry point name given in the shader with the real entry point name,
// if there is a substitution.
if (name != NULL && *name == sourceEntryPointName && intermediate.getEntryPointName().size() > 0)
if (name != nullptr && *name == sourceEntryPointName && intermediate.getEntryPointName().size() > 0)
name = NewPoolTString(intermediate.getEntryPointName().c_str());
}
@ -272,7 +272,7 @@ class TParseContext : public TParseContextBase {
public:
TParseContext(TSymbolTable&, TIntermediate&, bool parsingBuiltins, int version, EProfile, const SpvVersion& spvVersion, EShLanguage, TInfoSink&,
bool forwardCompatible = false, EShMessages messages = EShMsgDefault,
const TString* entryPoint = NULL);
const TString* entryPoint = nullptr);
virtual ~TParseContext();
bool obeyPrecisionQualifiers() const { return precisionManager.respectingPrecisionQualifiers(); };

View File

@ -81,8 +81,8 @@ bool DeinitializePoolIndex()
TPoolAllocator::TPoolAllocator(int growthIncrement, int allocationAlignment) :
pageSize(growthIncrement),
alignment(allocationAlignment),
freeList(NULL),
inUseList(NULL),
freeList(nullptr),
inUseList(nullptr),
numCalls(0)
{
//

View File

@ -302,8 +302,8 @@ namespace {
// A single global usable by all threads, by all versions, by all languages.
// After a single process-level initialization, this is read only and thread safe
std::unordered_map<const char*, int, str_hash, str_eq>* KeywordMap = NULL;
std::unordered_set<const char*, str_hash, str_eq>* ReservedSet = NULL;
std::unordered_map<const char*, int, str_hash, str_eq>* KeywordMap = nullptr;
std::unordered_set<const char*, str_hash, str_eq>* ReservedSet = nullptr;
};
@ -311,7 +311,7 @@ namespace glslang {
void TScanContext::fillInKeywordMap()
{
if (KeywordMap != NULL) {
if (KeywordMap != nullptr) {
// this is really an error, as this should called only once per process
// but, the only risk is if two threads called simultaneously
return;
@ -715,9 +715,9 @@ void TScanContext::fillInKeywordMap()
void TScanContext::deleteKeywordMap()
{
delete KeywordMap;
KeywordMap = NULL;
KeywordMap = nullptr;
delete ReservedSet;
ReservedSet = NULL;
ReservedSet = nullptr;
}
// Called by yylex to get the next token.
@ -1519,7 +1519,7 @@ int TScanContext::identifierOrType()
return IDENTIFIER;
parserToken->sType.lex.symbol = _parseContext.symbolTable.find(*parserToken->sType.lex.string);
if ((afterType == false && afterStruct == false) && parserToken->sType.lex.symbol != NULL) {
if ((afterType == false && afterStruct == false) && parserToken->sType.lex.symbol != nullptr) {
if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) {
if (variable->isUserType()) {
afterType = true;

View File

@ -51,7 +51,7 @@ const int EndOfInput = -1;
//
class TInputScanner {
public:
TInputScanner(int n, const char* const s[], size_t L[], const char* const* names = NULL,
TInputScanner(int n, const char* const s[], size_t L[], const char* const* names = nullptr,
int b = 0, int f = 0, bool single = false) :
numSources(n),
// up to this point, common usage is "char*", but now we need positive 8-bit characters
@ -63,7 +63,7 @@ public:
for (int i = 0; i < numSources; ++i) {
loc[i].init(i - stringBias);
}
if (names != NULL) {
if (names != nullptr) {
for (int i = 0; i < numSources; ++i)
loc[i].name = names[i];
}
@ -186,8 +186,8 @@ public:
{
logicalSourceLoc.string = newString;
loc[getLastValidSourceIndex()].string = newString;
logicalSourceLoc.name = NULL;
loc[getLastValidSourceIndex()].name = NULL;
logicalSourceLoc.name = nullptr;
loc[getLastValidSourceIndex()].name = nullptr;
}
// for #include content indentation

View File

@ -77,7 +77,7 @@ TBuiltInParseables* CreateBuiltInParseables(TInfoSink& infoSink, EShSource sourc
default:
infoSink.info.message(EPrefixInternalError, "Unable to determine source language");
return NULL;
return nullptr;
}
}
@ -98,7 +98,7 @@ TParseContextBase* CreateParseContext(TSymbolTable& symbolTable, TIntermediate&
}
default:
infoSink.info.message(EPrefixInternalError, "Unable to determine source language");
return NULL;
return nullptr;
}
}
@ -195,12 +195,12 @@ enum EPrecisionClass {
TSymbolTable* CommonSymbolTable[VersionCount][SpvVersionCount][ProfileCount][SourceCount][EPcCount] = {};
TSymbolTable* SharedSymbolTables[VersionCount][SpvVersionCount][ProfileCount][SourceCount][EShLangCount] = {};
TPoolAllocator* PerProcessGPA = NULL;
TPoolAllocator* PerProcessGPA = nullptr;
//
// Parse and add to the given symbol table the content of the given shader string.
//
static bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language,
bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language,
EShSource source, TInfoSink& infoSink, TSymbolTable& symbolTable)
{
TIntermediate intermediate(language, version, profile);
@ -245,7 +245,7 @@ static bool InitializeSymbolTable(const TString& builtIns, int version, EProfile
return true;
}
static int CommonIndex(EProfile profile, EShLanguage language)
int CommonIndex(EProfile profile, EShLanguage language)
{
return (profile == EEsProfile && language == EShLangFragment) ? EPcFragment : EPcGeneral;
}
@ -253,7 +253,7 @@ static int CommonIndex(EProfile profile, EShLanguage language)
//
// To initialize per-stage shared tables, with the common table already complete.
//
static void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int version, EProfile profile, const SpvVersion& spvVersion,
void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int version, EProfile profile, const SpvVersion& spvVersion,
EShLanguage language, EShSource source, TInfoSink& infoSink, TSymbolTable** commonTable,
TSymbolTable** symbolTables)
{
@ -271,11 +271,11 @@ static void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, in
// Initialize the full set of shareable symbol tables;
// The common (cross-stage) and those shareable per-stage.
//
static bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, const SpvVersion& spvVersion, EShSource source)
bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, const SpvVersion& spvVersion, EShSource source)
{
std::unique_ptr<TBuiltInParseables> builtInParseables(CreateBuiltInParseables(infoSink, source));
if (builtInParseables == NULL)
if (builtInParseables == nullptr)
return false;
builtInParseables->initialize(version, profile, spvVersion);
@ -319,12 +319,12 @@ static bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTab
return true;
}
static bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& infoSink, TSymbolTable& symbolTable, int version,
bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& infoSink, TSymbolTable& symbolTable, int version,
EProfile profile, const SpvVersion& spvVersion, EShLanguage language, EShSource source)
{
std::unique_ptr<TBuiltInParseables> builtInParseables(CreateBuiltInParseables(infoSink, source));
if (builtInParseables == NULL)
if (builtInParseables == nullptr)
return false;
builtInParseables->initialize(*resources, version, profile, spvVersion, language);
@ -346,7 +346,7 @@ static bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSi
// This only gets done the first time any thread needs a particular symbol table
// (lazy evaluation).
//
static void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& spvVersion, EShSource source)
void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& spvVersion, EShSource source)
{
TInfoSink infoSink;
@ -414,7 +414,7 @@ static void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVers
}
// Return true if the shader was correctly specified for version/profile/stage.
static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNotFirst, int defaultVersion,
bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNotFirst, int defaultVersion,
EShSource source, int& version, EProfile& profile, const SpvVersion& spvVersion)
{
const int FirstProfileVersion = 150;
@ -588,7 +588,7 @@ static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool ve
// TEnvironment takes precedence, for what it sets, so sort all this out.
// Ideally, the internal code could be made to use TEnvironment, but for
// now, translate it to the historically used parameters.
static void TranslateEnvironment(const TEnvironment* environment, EShMessages& messages, EShSource& source,
void TranslateEnvironment(const TEnvironment* environment, EShMessages& messages, EShSource& source,
EShLanguage& stage, SpvVersion& spvVersion)
{
// Set up environmental defaults, first ignoring 'environment'.
@ -603,7 +603,7 @@ static void TranslateEnvironment(const TEnvironment* environment, EShMessages& m
// Now, override, based on any content set in 'environment'.
// 'environment' must be cleared to ESh*None settings when items
// are not being set.
if (environment != NULL) {
if (environment != nullptr) {
// input language
if (environment->input.languageFamily != EShSourceNone) {
stage = environment->input.stage;
@ -653,7 +653,7 @@ static void TranslateEnvironment(const TEnvironment* environment, EShMessages& m
// Most processes are recorded when set in the intermediate representation,
// These are the few that are not.
static void RecordProcesses(TIntermediate& intermediate, EShMessages messages, const std::string& sourceEntryPointName)
void RecordProcesses(TIntermediate& intermediate, EShMessages messages, const std::string& sourceEntryPointName)
{
if ((messages & EShMsgRelaxedErrors) != 0)
intermediate.addProcess("relaxed-errors");
@ -677,7 +677,7 @@ static void RecordProcesses(TIntermediate& intermediate, EShMessages messages, c
// Which returns false if a failure was detected and true otherwise.
//
template<typename ProcessingContext>
static bool ProcessDeferred(
bool ProcessDeferred(
TCompiler* compiler,
const char* const shaderStrings[],
const int numStrings,
@ -698,7 +698,7 @@ static bool ProcessDeferred(
bool requireNonempty,
TShader::Includer& includer,
const std::string sourceEntryPointName = "",
const TEnvironment* environment = NULL) // optional way of fully setting all versions, overriding the above
const TEnvironment* environment = nullptr) // optional way of fully setting all versions, overriding the above
{
// This must be undone (.pop()) by the caller, after it finishes consuming the created tree.
GetThreadPoolAllocator().push();
@ -723,17 +723,17 @@ static bool ProcessDeferred(
std::unique_ptr<const char*[]> names(new const char*[numTotal]);
for (int s = 0; s < numStrings; ++s) {
strings[s + numPre] = shaderStrings[s];
if (inputLengths == NULL || inputLengths[s] < 0)
if (inputLengths == nullptr || inputLengths[s] < 0)
lengths[s + numPre] = strlen(shaderStrings[s]);
else
lengths[s + numPre] = inputLengths[s];
}
if (stringNames != NULL) {
if (stringNames != nullptr) {
for (int s = 0; s < numStrings; ++s)
names[s + numPre] = stringNames[s];
} else {
for (int s = 0; s < numStrings; ++s)
names[s + numPre] = NULL;
names[s + numPre] = nullptr;
}
// Get all the stages, languages, clients, and other environment
@ -742,7 +742,7 @@ static bool ProcessDeferred(
SpvVersion spvVersion;
EShLanguage stage = compiler->getLanguage();
TranslateEnvironment(environment, messages, source, stage, spvVersion);
if (environment != NULL && environment->target.hlslFunctionality1)
if (environment != nullptr && environment->target.hlslFunctionality1)
intermediate.setHlslFunctionality1();
// First, without using the preprocessor or parser, find the #version, so we know what
@ -815,8 +815,9 @@ static bool ProcessDeferred(
// Add built-in symbols that are potentially context dependent;
// they get popped again further down.
if (! AddContextSpecificSymbols(resources, compiler->infoSink, *symbolTable, version, profile, spvVersion,
stage, source))
stage, source)) {
return false;
}
//
// Now we can process the full shader under proper symbols and rules.
@ -849,15 +850,15 @@ static bool ProcessDeferred(
_parseContext->getPreamble(preamble);
strings[0] = preamble.c_str();
lengths[0] = strlen(strings[0]);
names[0] = NULL;
names[0] = nullptr;
strings[1] = customPreamble;
lengths[1] = strlen(strings[1]);
names[1] = NULL;
names[1] = nullptr;
if (requireNonempty) {
const int postIndex = numStrings + numPre;
strings[postIndex] = "\n int;";
lengths[postIndex] = strlen(strings[numStrings + numPre]);
names[postIndex] = NULL;
names[postIndex] = nullptr;
}
TInputScanner fullInput(numStrings + numPre + numPost, strings.get(), lengths.get(), names.get(), numPre, numPost);
@ -973,12 +974,13 @@ struct DoPreprocessing {
outputBuffer += std::to_string(newLineNum);
if (hasSource) {
outputBuffer += ' ';
if (sourceName != NULL) {
if (sourceName != nullptr) {
outputBuffer += '\"';
outputBuffer += sourceName;
outputBuffer += '\"';
} else
} else {
outputBuffer += std::to_string(sourceNum);
}
}
if (_parseContext.lineDirectiveShouldSetNextLine()) {
// newLineNum is the new line number for the line following the #line
@ -1005,8 +1007,9 @@ struct DoPreprocessing {
int line, const glslang::TVector<glslang::TString>& ops) {
lineSync.syncToLine(line);
outputBuffer += "#pragma ";
for(size_t i = 0; i < ops.size(); ++i)
for(size_t i = 0; i < ops.size(); ++i) {
outputBuffer += ops[i].c_str();
}
});
_parseContext.setErrorCallback([&lineSync, &outputBuffer](
@ -1129,7 +1132,7 @@ bool PreprocessDeferred(
// return: the tree and other information is filled into the intermediate argument,
// and true is returned by the function for success.
//
static bool CompileDeferred(
bool CompileDeferred(
TCompiler* compiler,
const char* const shaderStrings[],
const int numStrings,
@ -1146,7 +1149,7 @@ static bool CompileDeferred(
TIntermediate& intermediate,// returned tree, etc.
TShader::Includer& includer,
const std::string sourceEntryPointName = "",
TEnvironment* environment = NULL)
TEnvironment* environment = nullptr)
{
DoFullParse parser;
return ProcessDeferred(compiler, shaderStrings, numStrings, inputLengths, stringNames,
@ -1172,7 +1175,7 @@ int ShInitialize()
++NumberOfClients;
glslang::ReleaseGlobalLock();
if (PerProcessGPA == NULL)
if (PerProcessGPA == nullptr)
PerProcessGPA = new TPoolAllocator();
glslang::TScanContext::fillInKeywordMap();
@ -1268,9 +1271,9 @@ int __fastcall ShFinalize()
}
}
if (PerProcessGPA != NULL) {
if (PerProcessGPA != nullptr) {
delete PerProcessGPA;
PerProcessGPA = NULL;
PerProcessGPA = nullptr;
}
glslang::TScanContext::deleteKeywordMap();
@ -1316,7 +1319,7 @@ int ShCompile(
TIntermediate intermediate(compiler->getLanguage());
TShader::ForbidIncluder includer;
bool success = CompileDeferred(compiler, shaderStrings, numStrings, inputLengths, NULL,
bool success = CompileDeferred(compiler, shaderStrings, numStrings, inputLengths, nullptr,
"", optLevel, resources, defaultVersion, ENoProfile, false,
forwardCompatible, messages, intermediate, includer);
@ -1568,7 +1571,7 @@ public:
};
TShader::TShader(EShLanguage s)
: stage(s), lengths(NULL), stringNames(NULL), preamble("")
: stage(s), lengths(nullptr), stringNames(nullptr), preamble("")
{
pool = new TPoolAllocator;
infoSink = new TInfoSink;
@ -1595,7 +1598,7 @@ void TShader::setStrings(const char* const* s, int n)
{
strings = s;
numStrings = n;
lengths = NULL;
lengths = nullptr;
}
void TShader::setStringsWithLengths(const char* const* s, const int* l, int n)
@ -1720,7 +1723,7 @@ const char* TShader::getInfoDebugLog()
return infoSink->debug.c_str();
}
TProgram::TProgram() : reflection(0), ioMapper(NULL), linked(false)
TProgram::TProgram() : reflection(0), ioMapper(nullptr), linked(false)
{
pool = new TPoolAllocator;
infoSink = new TInfoSink;
@ -1780,12 +1783,12 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
return true;
int numEsShaders = 0, numNonEsShaders = 0;
for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it)
{
if ((*it)->intermediate->getProfile() == EEsProfile)
for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it) {
if ((*it)->intermediate->getProfile() == EEsProfile) {
numEsShaders++;
else
} else {
numNonEsShaders++;
}
}
if (numEsShaders > 0 && numNonEsShaders > 0) {
@ -1811,8 +1814,9 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
// The new TIntermediate must use the same origin as the original TIntermediates.
// Otherwise linking will fail due to different coordinate systems.
if (firstIntermediate->getOriginUpperLeft())
if (firstIntermediate->getOriginUpperLeft()) {
intermediate[stage]->setOriginUpperLeft();
}
intermediate[stage]->setSpv(firstIntermediate->getSpv());
newedIntermediate[stage] = true;
@ -1835,12 +1839,12 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
return intermediate[stage]->getNumErrors() == 0;
}
const char* TProgram::getInfoLog(void)
const char* TProgram::getInfoLog()
{
return infoSink->info.c_str();
}
const char* TProgram::getInfoDebugLog(void)
const char* TProgram::getInfoDebugLog()
{
return infoSink->debug.c_str();
}
@ -1849,7 +1853,7 @@ const char* TProgram::getInfoDebugLog(void)
// Reflection implementation.
//
bool TProgram::buildReflection(void)
bool TProgram::buildReflection()
{
if (! linked || reflection)
return false;
@ -1887,7 +1891,9 @@ const TType* TProgram::getUniformTType(int index) const { return reflection
const TType* TProgram::getUniformBlockTType(int index) const { return reflection->getUniformBlock(index).getType(); }
unsigned TProgram::getLocalSize(int dim) const { return reflection->getLocalSize(dim); }
//
// I/O mapping implementation.
//
bool TProgram::mapIO(TIoMapResolver* resolver)
{
if (! linked || ioMapper)

View File

@ -294,7 +294,7 @@ TVariable::TVariable(const TVariable& copyOf) : TSymbol(copyOf)
}
// don't support specialization-constant subtrees in cloned tables
constSubtree = NULL;
constSubtree = nullptr;
}
TVariable* TVariable::clone() const

View File

@ -151,7 +151,7 @@ public:
TVariable(const TString *name, const TType& t, bool uT = false )
: TSymbol(name),
userType(uT),
constSubtree(NULL),
constSubtree(nullptr),
anonId(-1) { type.shallowCopy(t); }
virtual TVariable* clone() const;
virtual ~TVariable() { }
@ -240,7 +240,7 @@ public:
parameters.push_back(p);
p.type->appendMangledName(mangledName);
if (p.defaultValue != NULL)
if (p.defaultValue != nullptr)
defaultParamCount++;
}
@ -248,7 +248,7 @@ public:
// 'this' is reflected in the list of parameters, but not the mangled name.
virtual void addThisParameter(TType& type, const char* name)
{
TParameter p = { NewPoolTString(name), new TType, NULL };
TParameter p = { NewPoolTString(name), new TType, nullptr };
p.type->shallowCopy(type);
parameters.insert(parameters.begin(), p);
}
@ -695,13 +695,13 @@ public:
++thisDepth;
symbol = table[level]->find(name);
--level;
} while (symbol == NULL && level >= 0);
} while (symbol == nullptr && level >= 0);
level++;
if (builtIn)
*builtIn = isBuiltInLevel(level);
if (currentScope)
*currentScope = isGlobalLevel(currentLevel()) || level == currentLevel(); // consider shared levels as "current scope" WRT user globals
if (thisDepthP != NULL) {
if (thisDepthP != nullptr) {
if (! table[level]->isThisLevel())
thisDepth = 0;
*thisDepthP = thisDepth;

View File

@ -803,16 +803,16 @@ void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBe
// Call for any operation needing full GLSL integer data-type support.
void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op)
{
profileRequires(loc, ENoProfile, 130, NULL, op);
profileRequires(loc, EEsProfile, 300, NULL, op);
profileRequires(loc, ENoProfile, 130, nullptr, op);
profileRequires(loc, EEsProfile, 300, nullptr, op);
}
// Call for any operation needing GLSL double data-type support.
void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op)
{
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 400, NULL, op);
profileRequires(loc, ECompatibilityProfile, 400, NULL, op);
profileRequires(loc, ECoreProfile, 400, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 400, nullptr, op);
}
// Call for any operation needing GLSL float16 data-type support.
@ -830,8 +830,8 @@ void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool bu
#endif
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
}
}
@ -843,8 +843,8 @@ void TParseVersions::explicitFloat32Check(const TSourceLoc& loc, const char* op,
E_GL_KHX_shader_explicit_arithmetic_types_float32};
requireExtensions(loc, 2, extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
}
}
@ -856,8 +856,8 @@ void TParseVersions::explicitFloat64Check(const TSourceLoc& loc, const char* op,
E_GL_KHX_shader_explicit_arithmetic_types_float64};
requireExtensions(loc, 2, extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
}
}
@ -869,8 +869,8 @@ void TParseVersions::explicitInt8Check(const TSourceLoc& loc, const char* op, bo
E_GL_KHX_shader_explicit_arithmetic_types_int8};
requireExtensions(loc, 2, extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
}
}
@ -881,8 +881,8 @@ void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, b
if (! builtIn) {
requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_half_float_fetch, op);
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
}
}
#endif
@ -901,8 +901,8 @@ void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, b
#endif
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
}
}
@ -914,8 +914,8 @@ void TParseVersions::explicitInt32Check(const TSourceLoc& loc, const char* op, b
E_GL_KHX_shader_explicit_arithmetic_types_int32};
requireExtensions(loc, 2, extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
}
}
@ -928,8 +928,8 @@ void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool buil
E_GL_KHX_shader_explicit_arithmetic_types_int64};
requireExtensions(loc, 3, extensions, "shader int64");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
}
}

View File

@ -45,7 +45,7 @@ bool TAttributeArgs::getInt(int& value, int argNum) const
{
const TConstUnion* intConst = getConstUnion(EbtInt, argNum);
if (intConst == NULL)
if (intConst == nullptr)
return false;
value = intConst->getIConst();
@ -58,7 +58,7 @@ bool TAttributeArgs::getString(TString& value, int argNum, bool convertToLower)
{
const TConstUnion* stringConst = getConstUnion(EbtString, argNum);
if (stringConst == NULL)
if (stringConst == nullptr)
return false;
value = *stringConst->getSConst();
@ -73,21 +73,21 @@ bool TAttributeArgs::getString(TString& value, int argNum, bool convertToLower)
// How many arguments were supplied?
int TAttributeArgs::size() const
{
return args == NULL ? 0 : (int)args->getSequence().size();
return args == nullptr ? 0 : (int)args->getSequence().size();
}
// Helper to get attribute const union. Returns NULL on failure.
// Helper to get attribute const union. Returns nullptr on failure.
const TConstUnion* TAttributeArgs::getConstUnion(TBasicType basicType, int argNum) const
{
if (args == NULL)
return NULL;
if (args == nullptr)
return nullptr;
if (argNum >= (int)args->getSequence().size())
return NULL;
return nullptr;
const TConstUnion* constVal = &args->getSequence()[argNum]->getAsConstantUnion()->getConstArray()[0];
if (constVal == NULL || constVal->getType() != basicType)
return NULL;
if (constVal == nullptr || constVal->getType() != basicType)
return nullptr;
return constVal;
}
@ -113,9 +113,9 @@ TAttributeType TParseContext::attributeFromName(const TString& name) const
// Make an initial leaf for the grammar from a no-argument attribute
TAttributes* TParseContext::makeAttributes(const TString& identifier) const
{
TAttributes *attributes = NULL;
TAttributes *attributes = nullptr;
attributes = NewPoolObject(attributes);
TAttributeArgs args = { attributeFromName(identifier), NULL };
TAttributeArgs args = { attributeFromName(identifier), nullptr };
attributes->push_back(args);
return attributes;
}
@ -123,7 +123,7 @@ TAttributes* TParseContext::makeAttributes(const TString& identifier) const
// Make an initial leaf for the grammar from a one-argument attribute
TAttributes* TParseContext::makeAttributes(const TString& identifier, TIntermNode* node) const
{
TAttributes *attributes = NULL;
TAttributes *attributes = nullptr;
attributes = NewPoolObject(attributes);
// for now, node is always a simple single expression, but other code expects
@ -148,7 +148,7 @@ TAttributes* TParseContext::mergeAttributes(TAttributes* attr1, TAttributes* att
void TParseContext::handleSelectionAttributes(const TAttributes& attributes, TIntermNode* node)
{
TIntermSelection* selection = node->getAsSelectionNode();
if (selection == NULL)
if (selection == nullptr)
return;
for (auto it = attributes.begin(); it != attributes.end(); ++it) {
@ -177,7 +177,7 @@ void TParseContext::handleSelectionAttributes(const TAttributes& attributes, TIn
void TParseContext::handleSwitchAttributes(const TAttributes& attributes, TIntermNode* node)
{
TIntermSwitch* selection = node->getAsSwitchNode();
if (selection == NULL)
if (selection == nullptr)
return;
for (auto it = attributes.begin(); it != attributes.end(); ++it) {
@ -206,17 +206,17 @@ void TParseContext::handleSwitchAttributes(const TAttributes& attributes, TInter
void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermNode* node)
{
TIntermLoop* loop = node->getAsLoopNode();
if (loop == NULL) {
if (loop == nullptr) {
// the actual loop might be part of a sequence
TIntermAggregate* agg = node->getAsAggregate();
if (agg == NULL)
if (agg == nullptr)
return;
for (auto it = agg->getSequence().begin(); it != agg->getSequence().end(); ++it) {
loop = (*it)->getAsLoopNode();
if (loop != NULL)
if (loop != nullptr)
break;
}
if (loop == NULL)
if (loop == nullptr)
return;
}

View File

@ -1083,7 +1083,7 @@ fully_specified_type
}
if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier))
$2.arraySizes = NULL;
$2.arraySizes = nullptr;
parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers);
$2.shaderQualifiers.merge($1.shaderQualifiers);
@ -3546,7 +3546,7 @@ translation_unit
parseContext.intermediate.setTreeRoot($$);
}
| translation_unit external_declaration {
if ($2 != NULL) {
if ($2 != nullptr) {
$$ = parseContext.intermediate.growAggregate($1, $2);
parseContext.intermediate.setTreeRoot($$);
}
@ -3562,8 +3562,8 @@ external_declaration
}
| SEMICOLON {
parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
parseContext.profileRequires($1.loc, ~EEsProfile, 460, NULL, "extraneous semicolon");
$$ = NULL;
parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
$$ = nullptr;
}
;

View File

@ -92,7 +92,7 @@ using namespace glslang;
# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULL NULL
# define YY_NULL nullptr
# else
# define YY_NULL 0
# endif
@ -5304,7 +5304,7 @@ yyreduce:
}
if ((yyvsp[0].interm.type).arraySizes && parseContext.arrayQualifierError((yyvsp[0].interm.type).loc, (yyvsp[-1].interm.type).qualifier))
(yyvsp[0].interm.type).arraySizes = NULL;
(yyvsp[0].interm.type).arraySizes = nullptr;
parseContext.checkNoShaderLayouts((yyvsp[0].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers);
(yyvsp[0].interm.type).shaderQualifiers.merge((yyvsp[-1].interm.type).shaderQualifiers);
@ -9710,7 +9710,7 @@ yyreduce:
case 546:
#line 3548 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{
if ((yyvsp[0].interm.intermNode) != NULL) {
if ((yyvsp[0].interm.intermNode) != nullptr) {
(yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode));
parseContext.intermediate.setTreeRoot((yyval.interm.intermNode));
}
@ -9738,8 +9738,8 @@ yyreduce:
#line 3563 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{
parseContext.requireProfile((yyvsp[0].lex).loc, ~EEsProfile, "extraneous semicolon");
parseContext.profileRequires((yyvsp[0].lex).loc, ~EEsProfile, 460, NULL, "extraneous semicolon");
(yyval.interm.intermNode) = NULL;
parseContext.profileRequires((yyvsp[0].lex).loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
(yyval.interm.intermNode) = nullptr;
}
#line 9749 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */
break;

View File

@ -127,7 +127,7 @@ public:
virtual void visitSymbol(TIntermSymbol* base)
{
TVarLiveMap* target = NULL;
TVarLiveMap* target = nullptr;
if (base->getQualifier().storage == EvqVaryingIn)
target = &inputList;
else if (base->getQualifier().storage == EvqVaryingOut)
@ -359,7 +359,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
{ }
int getBaseBinding(TResourceType res, unsigned int set) const {
return selectBaseBinding(intermediate.getShiftBinding(res),
return selectBaseBinding(intermediate.getShiftBinding(res),
intermediate.getShiftBindingForSet(res, set));
}
@ -535,7 +535,7 @@ protected:
}
static bool isTextureType(const glslang::TType& type) {
return (type.getBasicType() == glslang::EbtSampler &&
return (type.getBasicType() == glslang::EbtSampler &&
(type.getSampler().isTexture() || type.getSampler().isSubpass()));
}
@ -634,7 +634,7 @@ t - for shader resource views (SRV)
BYTEADDRESSBUFFER
BUFFER
TBUFFER
s - for samplers
SAMPLER
SAMPLER1D
@ -738,21 +738,21 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi
intermediate.hasShiftBindingForSet(TResourceType(res));
}
if (!somethingToDo && resolver == NULL)
if (!somethingToDo && resolver == nullptr)
return true;
if (intermediate.getNumEntryPoints() != 1 || intermediate.isRecursive())
return false;
TIntermNode* root = intermediate.getTreeRoot();
if (root == NULL)
if (root == nullptr)
return false;
// if no resolver is provided, use the default resolver with the given shifts and auto map settings
TDefaultIoResolver defaultResolver(intermediate);
TDefaultHlslIoResolver defaultHlslResolver(intermediate);
if (resolver == NULL) {
if (resolver == nullptr) {
// TODO: use a passed in IO mapper for this
if (intermediate.usingHlslIoMapping())
resolver = &defaultHlslResolver;

View File

@ -133,7 +133,7 @@ void TParseContext::inductiveLoopBodyCheck(TIntermNode* body, int loopId, TSymbo
{
TInductiveTraverser it(loopId, symbolTable);
if (body == NULL)
if (body == nullptr)
return;
body->traverse(&it);

View File

@ -388,7 +388,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
//
void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
{
if (getTreeRoot() == NULL)
if (getTreeRoot() == nullptr)
return;
if (numEntryPoints < 1) {
@ -679,9 +679,9 @@ void TIntermediate::checkCallGraphBodies(TInfoSink& infoSink, bool keepUncalled)
if (! keepUncalled) {
for (int f = 0; f < (int)functionSequence.size(); ++f) {
if (! reachable[f])
functionSequence[f] = NULL;
functionSequence[f] = nullptr;
}
functionSequence.erase(std::remove(functionSequence.begin(), functionSequence.end(), NULL), functionSequence.end());
functionSequence.erase(std::remove(functionSequence.begin(), functionSequence.end(), nullptr), functionSequence.end());
}
}

View File

@ -267,7 +267,7 @@ public:
shiftBinding[res] = shift;
const char* name = getResourceName(res);
if (name != NULL)
if (name != nullptr)
processes.addIfNonZero(name, shift);
}
@ -281,7 +281,7 @@ public:
shiftBindingForSet[res][set] = shift;
const char* name = getResourceName(res);
if (name != NULL) {
if (name != nullptr) {
processes.addProcess(name);
processes.addArgument(shift);
processes.addArgument(set);
@ -618,7 +618,7 @@ public:
return semanticNameSet.insert(name).first->c_str();
}
void setSourceFile(const char* file) { if (file != NULL) sourceFile = file; }
void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; }
const std::string& getSourceFile() const { return sourceFile; }
void addSourceText(const char* text) { sourceText = sourceText + text; }
const std::string& getSourceText() const { return sourceText; }

View File

@ -86,8 +86,6 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cctype>
#include <climits>
#include <compat/strl.h>
#include "PpContext.h"
#include "PpTokens.h"
@ -161,7 +159,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
// check for duplicate definition
MacroSymbol* existing = lookupMacroDef(defAtom);
if (existing != NULL) {
if (existing != nullptr) {
if (! existing->undef) {
// Already defined -- need to make sure they are identical:
// "Two replacement lists are identical if and only if the preprocessing tokens in both have the same number,
@ -207,7 +205,7 @@ int TPpContext::CPPundef(TPpToken* ppToken)
_parseContext.reservedPpErrorCheck(ppToken->loc, ppToken->name, "#undef");
MacroSymbol* macro = lookupMacroDef(atomStrings.getAtom(ppToken->name));
if (macro != NULL)
if (macro != nullptr)
macro->undef = 1;
token = scanToken(ppToken);
if (token != '\n')
@ -424,7 +422,7 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo
}
MacroSymbol* macro = lookupMacroDef(atomStrings.getAtom(ppToken->name));
res = macro != NULL ? !macro->undef : 0;
res = macro != nullptr ? !macro->undef : 0;
token = scanToken(ppToken);
if (needclose) {
if (token != ')') {
@ -586,7 +584,7 @@ int TPpContext::CPPifdef(int defined, TPpToken* ppToken)
while (token != '\n' && token != EndOfInput)
token = scanToken(ppToken);
}
if (((macro != NULL && !macro->undef) ? 1 : 0) != defined)
if (((macro != nullptr && !macro->undef) ? 1 : 0) != defined)
token = CPPelse(1, ppToken);
}
@ -630,17 +628,17 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
// Find the inclusion, first look in "Local" ("") paths, if requested,
// otherwise, only search the "System" (<>) paths.
TShader::Includer::IncludeResult* res = NULL;
TShader::Includer::IncludeResult* res = nullptr;
if (startWithLocalSearch)
res = includer.includeLocal(filename.c_str(), currentSourceFile.c_str(), includeStack.size() + 1);
if (res == NULL || res->headerName.empty()) {
if (res == nullptr || res->headerName.empty()) {
includer.releaseInclude(res);
res = includer.includeSystem(filename.c_str(), currentSourceFile.c_str(), includeStack.size() + 1);
}
// Process the results
if (res != NULL && !res->headerName.empty()) {
if (res->headerData != NULL && res->headerLength > 0) {
if (res != nullptr && !res->headerName.empty()) {
if (res->headerData != nullptr && res->headerLength > 0) {
// path for processing one or more tokens from an included header, hand off 'res'
const bool forNextLine = _parseContext.lineDirectiveShouldSetNextLine();
std::ostringstream prologue;
@ -658,7 +656,7 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
} else {
// error path, clean up
std::string message =
res != NULL ? std::string(res->headerData, res->headerLength)
res != nullptr ? std::string(res->headerData, res->headerLength)
: std::string("Could not process include directive");
_parseContext.ppError(directiveLoc, message.c_str(), "#include", "for header name: %s", filename.c_str());
includer.releaseInclude(res);
@ -685,7 +683,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
int lineToken = 0;
bool hasFile = false;
int fileRes = 0; // Source file number after macro expansion.
const char* sourceName = NULL; // Optional source file name.
const char* sourceName = nullptr; // Optional source file name.
bool lineErr = false;
bool fileErr = false;
token = eval(token, MIN_PRECEDENCE, false, lineRes, lineErr, ppToken);
@ -822,7 +820,7 @@ int TPpContext::CPPversion(TPpToken* ppToken)
token = scanToken(ppToken);
if (token == '\n') {
_parseContext.notifyVersion(line, versionNumber, NULL);
_parseContext.notifyVersion(line, versionNumber, nullptr);
return token;
} else {
int profileAtom = atomStrings.getAtom(ppToken->name);
@ -1002,7 +1000,7 @@ int TPpContext::scanHeaderName(TPpToken* ppToken, char delimit)
// Macro-expand a macro argument 'arg' to create 'expandedArg'.
// Does not replace 'arg'.
// Returns NULL if no expanded argument is created.
// Returns nullptr if no expanded argument is created.
TPpContext::TokenStream* TPpContext::PrescanMacroArg(TokenStream& arg, TPpToken* ppToken, bool newLineOkay)
{
// expand the argument
@ -1022,7 +1020,7 @@ TPpContext::TokenStream* TPpContext::PrescanMacroArg(TokenStream& arg, TPpToken*
if (token == EndOfInput) {
// MacroExpand ate the marker, so had bad input, recover
delete expandedArg;
expandedArg = NULL;
expandedArg = nullptr;
} else {
// remove the marker
popInput();
@ -1086,7 +1084,7 @@ int TPpContext::tMacroInput::scan(TPpToken* ppToken)
break;
if (i >= 0) {
TokenStream* arg = expandedArgs[i];
if (arg == NULL || pasting)
if (arg == nullptr || pasting)
arg = args[i];
pp->pushTokenStreamInput(*arg, prepaste);
@ -1137,7 +1135,7 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
if (_parseContext.getCurrentLoc().name)
_parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based __FILE__");
ppToken->ival = _parseContext.getCurrentLoc().string;
strlcpy(ppToken->name, ppToken->loc.getStringNameOrNum().c_str(), sizeof(ppToken->name));
snprintf(ppToken->name, sizeof(ppToken->name), "%s", ppToken->loc.getStringNameOrNum().c_str());
UngetToken(PpAtomConstInt, ppToken);
return 1;
}
@ -1152,19 +1150,19 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
break;
}
MacroSymbol* macro = macroAtom == 0 ? NULL : lookupMacroDef(macroAtom);
MacroSymbol* macro = macroAtom == 0 ? nullptr : lookupMacroDef(macroAtom);
int depth = 0;
// no recursive expansions
if (macro != NULL && macro->busy)
if (macro != nullptr && macro->busy)
return 0;
// not expanding undefined macros
if ((macro == NULL || macro->undef) && ! expandUndef)
if ((macro == nullptr || macro->undef) && ! expandUndef)
return 0;
// 0 is the value of an undefined macro
if ((macro == NULL || macro->undef) && expandUndef) {
if ((macro == nullptr || macro->undef) && expandUndef) {
pushInput(new tZeroInput(this));
return -1;
}
@ -1189,7 +1187,7 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
in->args[i] = new TokenStream;
in->expandedArgs.resize(in->mac->args.size());
for (size_t i = 0; i < in->mac->args.size(); i++)
in->expandedArgs[i] = NULL;
in->expandedArgs[i] = nullptr;
size_t arg = 0;
bool tokenRecorded = false;
do {

View File

@ -273,7 +273,7 @@ public:
MacroSymbol* lookupMacroDef(int atom)
{
auto existingMacroIt = macroDefs.find(atom);
return (existingMacroIt == macroDefs.end()) ? NULL : &(existingMacroIt->second);
return (existingMacroIt == macroDefs.end()) ? nullptr : &(existingMacroIt->second);
}
void addMacroDef(int atom, MacroSymbol& macroDef) { macroDefs[atom] = macroDef; }
@ -527,7 +527,7 @@ protected:
epilogue_(epilogue),
includedFile_(includedFile),
scanner(3, strings, lengths, names, 0, 0, true),
prevScanner(NULL),
prevScanner(nullptr),
stringInput(pp, scanner)
{
strings[0] = prologue_.data();

View File

@ -288,9 +288,9 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
}
} else if (ch == 'f' || ch == 'F') {
if (ifdepth == 0)
_parseContext.profileRequires(ppToken->loc, EEsProfile, 300, NULL, "floating-point suffix");
_parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix");
if (ifdepth == 0 && !_parseContext.relaxedErrors())
_parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, NULL, "floating-point suffix");
_parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix");
if (ifdepth == 0 && !hasDecimalOrExponent)
_parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
saveName(ch);

View File

@ -274,7 +274,7 @@ TSymbolDefinitionCollectingTraverser::TSymbolDefinitionCollectingTraverser(
: TIntermTraverser(true, false, false), symbol_definition_mapping_(*symbol_definition_mapping),
precise_objects_(*precise_objects), precise_return_nodes_(*precise_return_nodes),
current_object_(), accesschain_mapping_(*accesschain_mapping),
current_function_definition_node_(NULL) {}
current_function_definition_node_(nullptr) {}
// Visits a symbol node, set the current_object_ to the
// current node symbol ID, and record a mapping from this node to the current
@ -462,7 +462,7 @@ class TNoContractionAssigneeCheckingTraverser : public glslang::TIntermTraverser
public:
TNoContractionAssigneeCheckingTraverser(const AccessChainMapping& accesschain_mapping)
: TIntermTraverser(true, false, false), accesschain_mapping_(accesschain_mapping),
precise_object_(NULL) {}
precise_object_(nullptr) {}
// Checks the preciseness of a given assignment node with a precise object
// represented as access chain. The precise object shares the same symbol
@ -654,7 +654,7 @@ protected:
// Gets the struct dereference index that leads to 'precise' object.
ObjectAccessChain precise_accesschain_index_str =
getFrontElement(remained_accesschain_);
unsigned precise_accesschain_index = (unsigned)strtoul(precise_accesschain_index_str.c_str(), NULL, 10);
unsigned precise_accesschain_index = (unsigned)strtoul(precise_accesschain_index_str.c_str(), nullptr, 10);
// Gets the node pointed by the access chain index extracted before.
glslang::TIntermTyped* potential_precise_node =
node->getSequence()[precise_accesschain_index]->getAsTyped();

View File

@ -372,7 +372,7 @@ public:
return base;
TIntermBinary* left = node->getLeft()->getAsBinaryNode();
if (! left)
return NULL;
return nullptr;
return findBase(left);
}
@ -781,7 +781,7 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate)
// Returns false if the input is too malformed to do this.
bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate)
{
if (intermediate.getTreeRoot() == NULL ||
if (intermediate.getTreeRoot() == nullptr ||
intermediate.getNumEntryPoints() != 1 ||
intermediate.isRecursive())
return false;

View File

@ -62,7 +62,7 @@ public:
const TType* const getType() const { return type; }
int getBinding() const
{
if (type == NULL || !type->getQualifier().hasBinding())
if (type == nullptr || !type->getQualifier().hasBinding())
return -1;
return type->getQualifier().layoutBinding;
}
@ -76,7 +76,7 @@ public:
int counterIndex;
protected:
TObjectReflection() : offset(-1), glDefineType(-1), size(-1), index(-1), type(NULL) { }
TObjectReflection() : offset(-1), glDefineType(-1), size(-1), index(-1), type(nullptr) { }
const TType* type;
};

View File

@ -474,7 +474,7 @@ public:
// and include depth.
// On success, returns an IncludeResult containing the resolved name
// and content of the include.
// On failure, returns a NULL, or an IncludeResult
// On failure, returns a nullptr, or an IncludeResult
// with an empty string for the headerName and error details in the
// header field.
// The Includer retains ownership of the contents
@ -489,14 +489,14 @@ public:
// For the "system" or <>-style includes; search the "system" paths.
virtual IncludeResult* includeSystem(const char* /*headerName*/,
const char* /*includerName*/,
size_t /*inclusionDepth*/) { return NULL; }
size_t /*inclusionDepth*/) { return nullptr; }
// For the "local"-only aspect of a "" include. Should not search in the
// "system" paths, because on returning a failure, the parser will
// call includeSystem() to look in the "system" locations.
virtual IncludeResult* includeLocal(const char* /*headerName*/,
const char* /*includerName*/,
size_t /*inclusionDepth*/) { return NULL; }
size_t /*inclusionDepth*/) { return nullptr; }
// Signals that the parser will no longer use the contents of the
// specified IncludeResult.