(glslang) Simplifications - move nullptr to NULL

This commit is contained in:
libretroadmin 2024-05-23 07:25:27 +02:00
parent 0b29d52b67
commit 354c5afab4
40 changed files with 536 additions and 539 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -1506,7 +1506,7 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType)
if (numComponents == 1) if (numComponents == 1)
return scalar; return scalar;
Instruction* smear = nullptr; Instruction* smear = NULL;
if (generatingOpCodeForSpecConst) { if (generatingOpCodeForSpecConst) {
auto members = std::vector<spv::Id>(numComponents, scalar); auto members = std::vector<spv::Id>(numComponents, scalar);
// Sometime even in spec-constant-op mode, the temporary vector created by // 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 17: return "sRGBA";
case 18: return "sBGRA"; case 18: return "sBGRA";
default: default:
return "Bad"; return "Bad";
} }
} }
@ -739,7 +739,7 @@ const char* CapabilityString(int info)
case 22: return "Int16"; case 22: return "Int16";
case 23: return "TessellationPointSize"; case 23: return "TessellationPointSize";
case 24: return "GeometryPointSize"; case 24: return "GeometryPointSize";
case 25: return "ImageGatherExtended"; case 25: return "ImageGatherExtended";
case 26: return "Bad"; case 26: return "Bad";
case 27: return "StorageImageMultisample"; case 27: return "StorageImageMultisample";
case 28: return "UniformBufferArrayDynamicIndexing"; case 28: return "UniformBufferArrayDynamicIndexing";
@ -1371,37 +1371,37 @@ void Parameterize()
DecorationOperands[DecorationAlignment].push(OperandLiteralNumber, "'Alignment'"); DecorationOperands[DecorationAlignment].push(OperandLiteralNumber, "'Alignment'");
OperandClassParams[OperandSource].set(0, SourceString, 0); OperandClassParams[OperandSource].set(0, SourceString, 0);
OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, nullptr); OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, NULL);
OperandClassParams[OperandAddressing].set(0, AddressingString, nullptr); OperandClassParams[OperandAddressing].set(0, AddressingString, NULL);
OperandClassParams[OperandMemory].set(0, MemoryString, nullptr); OperandClassParams[OperandMemory].set(0, MemoryString, NULL);
OperandClassParams[OperandExecutionMode].set(ExecutionModeCeiling, ExecutionModeString, ExecutionModeParams); OperandClassParams[OperandExecutionMode].set(ExecutionModeCeiling, ExecutionModeString, ExecutionModeParams);
OperandClassParams[OperandExecutionMode].setOperands(ExecutionModeOperands); OperandClassParams[OperandExecutionMode].setOperands(ExecutionModeOperands);
OperandClassParams[OperandStorage].set(0, StorageClassString, nullptr); OperandClassParams[OperandStorage].set(0, StorageClassString, NULL);
OperandClassParams[OperandDimensionality].set(0, DimensionString, nullptr); OperandClassParams[OperandDimensionality].set(0, DimensionString, NULL);
OperandClassParams[OperandSamplerAddressingMode].set(0, SamplerAddressingModeString, nullptr); OperandClassParams[OperandSamplerAddressingMode].set(0, SamplerAddressingModeString, NULL);
OperandClassParams[OperandSamplerFilterMode].set(0, SamplerFilterModeString, nullptr); OperandClassParams[OperandSamplerFilterMode].set(0, SamplerFilterModeString, NULL);
OperandClassParams[OperandSamplerImageFormat].set(0, ImageFormatString, nullptr); OperandClassParams[OperandSamplerImageFormat].set(0, ImageFormatString, NULL);
OperandClassParams[OperandImageChannelOrder].set(0, ImageChannelOrderString, nullptr); OperandClassParams[OperandImageChannelOrder].set(0, ImageChannelOrderString, NULL);
OperandClassParams[OperandImageChannelDataType].set(0, ImageChannelDataTypeString, nullptr); OperandClassParams[OperandImageChannelDataType].set(0, ImageChannelDataTypeString, NULL);
OperandClassParams[OperandImageOperands].set(ImageOperandsCeiling, ImageOperandsString, ImageOperandsParams, true); OperandClassParams[OperandImageOperands].set(ImageOperandsCeiling, ImageOperandsString, ImageOperandsParams, true);
OperandClassParams[OperandFPFastMath].set(0, FPFastMathString, nullptr, true); OperandClassParams[OperandFPFastMath].set(0, FPFastMathString, NULL, true);
OperandClassParams[OperandFPRoundingMode].set(0, FPRoundingModeString, nullptr); OperandClassParams[OperandFPRoundingMode].set(0, FPRoundingModeString, NULL);
OperandClassParams[OperandLinkageType].set(0, LinkageTypeString, nullptr); OperandClassParams[OperandLinkageType].set(0, LinkageTypeString, NULL);
OperandClassParams[OperandFuncParamAttr].set(0, FuncParamAttrString, nullptr); OperandClassParams[OperandFuncParamAttr].set(0, FuncParamAttrString, NULL);
OperandClassParams[OperandAccessQualifier].set(0, AccessQualifierString, nullptr); OperandClassParams[OperandAccessQualifier].set(0, AccessQualifierString, NULL);
OperandClassParams[OperandDecoration].set(DecorationCeiling, DecorationString, DecorationParams); OperandClassParams[OperandDecoration].set(DecorationCeiling, DecorationString, DecorationParams);
OperandClassParams[OperandDecoration].setOperands(DecorationOperands); OperandClassParams[OperandDecoration].setOperands(DecorationOperands);
OperandClassParams[OperandBuiltIn].set(0, BuiltInString, nullptr); OperandClassParams[OperandBuiltIn].set(0, BuiltInString, NULL);
OperandClassParams[OperandSelect].set(SelectControlCeiling, SelectControlString, SelectionControlParams, true); OperandClassParams[OperandSelect].set(SelectControlCeiling, SelectControlString, SelectionControlParams, true);
OperandClassParams[OperandLoop].set(LoopControlCeiling, LoopControlString, LoopControlParams, true); OperandClassParams[OperandLoop].set(LoopControlCeiling, LoopControlString, LoopControlParams, true);
OperandClassParams[OperandFunction].set(FunctionControlCeiling, FunctionControlString, FunctionControlParams, true); OperandClassParams[OperandFunction].set(FunctionControlCeiling, FunctionControlString, FunctionControlParams, true);
OperandClassParams[OperandMemorySemantics].set(0, MemorySemanticsString, nullptr, true); OperandClassParams[OperandMemorySemantics].set(0, MemorySemanticsString, NULL, true);
OperandClassParams[OperandMemoryAccess].set(0, MemoryAccessString, nullptr, true); OperandClassParams[OperandMemoryAccess].set(0, MemoryAccessString, NULL, true);
OperandClassParams[OperandScope].set(0, ScopeString, nullptr); OperandClassParams[OperandScope].set(0, ScopeString, NULL);
OperandClassParams[OperandGroupOperation].set(0, GroupOperationString, nullptr); OperandClassParams[OperandGroupOperation].set(0, GroupOperationString, NULL);
OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, nullptr); OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, NULL);
OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, nullptr, true); OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, NULL, true);
OperandClassParams[OperandCapability].set(0, CapabilityString, nullptr); OperandClassParams[OperandCapability].set(0, CapabilityString, NULL);
OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, 0); OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, 0);
// set name of operator, an initial set of <id> style operands, and the description // 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, "'Base'");
InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Offset'"); InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Offset'");
InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Count'"); InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Count'");
InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Base'"); InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Base'");
InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Offset'"); InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Offset'");
InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Count'"); InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Count'");
InstructionDesc[OpBitReverse].operands.push(OperandId, "'Base'"); InstructionDesc[OpBitReverse].operands.push(OperandId, "'Base'");
InstructionDesc[OpBitCount].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* dec = "0123456789";
const char* lower = "abcdef"; const char* lower = "abcdef";
const char* upper = "ABCDEF"; const char* upper = "ABCDEF";
const char* p = nullptr; const char* p = NULL;
if ((p = strchr(dec, character))) if ((p = strchr(dec, character)))
return static_cast<uint8_t>(p - dec); return static_cast<uint8_t>(p - dec);
else if ((p = strchr(lower, character))) else if ((p = strchr(lower, character)))

View File

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

View File

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

View File

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

View File

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

View File

@ -56,12 +56,12 @@ extern bool SameSpecializationConstants(TIntermTyped*, TIntermTyped*);
// size and specialization constant nodes are the same. // size and specialization constant nodes are the same.
struct TArraySize { struct TArraySize {
unsigned int size; unsigned int size;
TIntermTyped* node; // nullptr means no specialization constant node TIntermTyped* node; // NULL means no specialization constant node
bool operator==(const TArraySize& rhs) const bool operator==(const TArraySize& rhs) const
{ {
if (size != rhs.size) if (size != rhs.size)
return false; return false;
if (node == nullptr || rhs.node == nullptr) if (node == NULL || rhs.node == NULL)
return node == rhs.node; return node == rhs.node;
return SameSpecializationConstants(node, rhs.node); return SameSpecializationConstants(node, rhs.node);
@ -82,14 +82,14 @@ struct TSmallArrayVector {
// //
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
TSmallArrayVector() : sizes(nullptr) { } TSmallArrayVector() : sizes(NULL) { }
virtual ~TSmallArrayVector() { dealloc(); } virtual ~TSmallArrayVector() { dealloc(); }
// For breaking into two non-shared copies, independently modifiable. // For breaking into two non-shared copies, independently modifiable.
TSmallArrayVector& operator=(const TSmallArrayVector& from) TSmallArrayVector& operator=(const TSmallArrayVector& from)
{ {
if (from.sizes == nullptr) if (from.sizes == NULL)
sizes = nullptr; sizes = NULL;
else { else {
alloc(); alloc();
*sizes = *from.sizes; *sizes = *from.sizes;
@ -100,7 +100,7 @@ struct TSmallArrayVector {
int size() const int size() const
{ {
if (sizes == nullptr) if (sizes == NULL)
return 0; return 0;
return (int)sizes->size(); return (int)sizes->size();
} }
@ -170,9 +170,9 @@ struct TSmallArrayVector {
bool operator==(const TSmallArrayVector& rhs) const bool operator==(const TSmallArrayVector& rhs) const
{ {
if (sizes == nullptr && rhs.sizes == nullptr) if (sizes == NULL && rhs.sizes == NULL)
return true; return true;
if (sizes == nullptr || rhs.sizes == nullptr) if (sizes == NULL || rhs.sizes == NULL)
return false; return false;
return *sizes == *rhs.sizes; return *sizes == *rhs.sizes;
} }
@ -183,13 +183,13 @@ protected:
void alloc() void alloc()
{ {
if (sizes == nullptr) if (sizes == NULL)
sizes = new TVector<TArraySize>; sizes = new TVector<TArraySize>;
} }
void dealloc() void dealloc()
{ {
delete sizes; delete sizes;
sizes = nullptr; sizes = NULL;
} }
TVector<TArraySize>* sizes; // will either hold such a pointer, or in the future, hold the two array sizes 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; return size;
} }
void addInnerSize() { addInnerSize((unsigned)UnsizedArraySize); } void addInnerSize() { addInnerSize((unsigned)UnsizedArraySize); }
void addInnerSize(int s) { addInnerSize((unsigned)s, nullptr); } void addInnerSize(int s) { addInnerSize((unsigned)s, NULL); }
void addInnerSize(int s, TIntermTyped* n) { sizes.push_back((unsigned)s, n); } void addInnerSize(int s, TIntermTyped* n) { sizes.push_back((unsigned)s, n); }
void addInnerSize(TArraySize pair) { sizes.push_back(pair.size, pair.node); } void addInnerSize(TArraySize pair) { sizes.push_back(pair.size, pair.node); }
void addInnerSizes(const TArraySizes& s) { sizes.push_back(s.sizes); } void addInnerSizes(const TArraySizes& s) { sizes.push_back(s.sizes); }
@ -268,7 +268,7 @@ struct TArraySizes {
bool isInnerSpecialization() const bool isInnerSpecialization() const
{ {
for (int d = 1; d < sizes.size(); ++d) { for (int d = 1; d < sizes.size(); ++d) {
if (sizes.getDimNode(d) != nullptr) if (sizes.getDimNode(d) != NULL)
return true; return true;
} }
@ -276,7 +276,7 @@ struct TArraySizes {
} }
bool isOuterSpecialization() bool isOuterSpecialization()
{ {
return sizes.getDimNode(0) != nullptr; return sizes.getDimNode(0) != NULL;
} }
bool hasUnsized() const { return getOuterSize() == UnsizedArraySize || isInnerUnsized(); } 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 // it is essential to use "symbol = sym" to assign to symbol
TIntermSymbol(int i, const TString& n, const TType& t) TIntermSymbol(int i, const TString& n, const TType& t)
: TIntermTyped(t), id(i), : TIntermTyped(t), id(i),
constSubtree(nullptr) constSubtree(NULL)
{ name = n; } { name = n; }
virtual int getId() const { return id; } virtual int getId() const { return id; }
virtual const TString& getName() const { return name; } virtual const TString& getName() const { return name; }
@ -1471,8 +1471,8 @@ typedef TVector<TStorageQualifier> TQualifierList;
// //
class TIntermAggregate : public TIntermOperator { class TIntermAggregate : public TIntermOperator {
public: public:
TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(nullptr) { } TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(NULL) { }
TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(nullptr) { } TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(NULL) { }
~TIntermAggregate() { delete pragmaTable; } ~TIntermAggregate() { delete pragmaTable; }
virtual TIntermAggregate* getAsAggregate() { return this; } virtual TIntermAggregate* getAsAggregate() { return this; }
virtual const TIntermAggregate* getAsAggregate() const { 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) TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
{ {
if (aggrNode == nullptr) if (aggrNode == NULL)
return aggrNode; return aggrNode;
if (! areAllChildConst(aggrNode)) if (! areAllChildConst(aggrNode))

View File

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

View File

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

View File

@ -139,12 +139,12 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
return true; return true;
} }
const char* symbol = nullptr; const char* symbol = NULL;
TIntermSymbol* symNode = node->getAsSymbolNode(); TIntermSymbol* symNode = node->getAsSymbolNode();
if (symNode != nullptr) if (symNode != NULL)
symbol = symNode->getName().c_str(); symbol = symNode->getName().c_str();
const char* message = nullptr; const char* message = NULL;
switch (node->getQualifier().storage) { switch (node->getQualifier().storage) {
case EvqConst: message = "can't modify a const"; break; case EvqConst: message = "can't modify a const"; break;
case EvqConstReadOnly: 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 == nullptr && binaryNode == nullptr && symNode == nullptr) { if (message == NULL && binaryNode == NULL && symNode == NULL) {
error(loc, " l-value required", op, "", ""); error(loc, " l-value required", op, "", "");
return true; return true;
@ -182,7 +182,7 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
// //
// Everything else is okay, no error. // Everything else is okay, no error.
// //
if (message == nullptr) if (message == NULL)
return false; return false;
// //
@ -276,15 +276,15 @@ void TParseContextBase::makeEditable(TSymbol*& symbol)
// Return a writable version of the variable 'name'. // Return a writable version of the variable 'name'.
// //
// Return nullptr if 'name' is not found. This should mean // Return NULL if 'name' is not found. This should mean
// something is seriously wrong (e.g., compiler asking self for // something is seriously wrong (e.g., compiler asking self for
// built-in that doesn't exist). // built-in that doesn't exist).
TVariable* TParseContextBase::getEditableVariable(const char* name) TVariable* TParseContextBase::getEditableVariable(const char* name)
{ {
bool builtIn; bool builtIn;
TSymbol* symbol = symbolTable.find(name, &builtIn); TSymbol* symbol = symbolTable.find(name, &builtIn);
if (symbol == nullptr) if (symbol == NULL)
return nullptr; return NULL;
if (builtIn) if (builtIn)
makeEditable(symbol); makeEditable(symbol);
@ -398,7 +398,7 @@ const TFunction* TParseContextBase::selectFunction(
// 2. none viable... // 2. none viable...
if (viableCandidates.size() == 0) if (viableCandidates.size() == 0)
return nullptr; return NULL;
// 3. only one viable... // 3. only one viable...
if (viableCandidates.size() == 1) 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) void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& memberType, const TString& memberName, TTypeList* typeList)
{ {
// Make the global block, if not yet made. // Make the global block, if not yet made.
if (globalUniformBlock == nullptr) { if (globalUniformBlock == NULL) {
TQualifier blockQualifier; TQualifier blockQualifier;
blockQualifier.clear(); blockQualifier.clear();
blockQualifier.storage = EvqUniform; 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, TParseContextBase(TSymbolTable& symbolTable, TIntermediate& interm, bool parsingBuiltins, int version,
EProfile profile, const SpvVersion& spvVersion, EShLanguage language, EProfile profile, const SpvVersion& spvVersion, EShLanguage language,
TInfoSink& infoSink, bool forwardCompatible, EShMessages messages, TInfoSink& infoSink, bool forwardCompatible, EShMessages messages,
const TString* entryPoint = nullptr) const TString* entryPoint = NULL)
: TParseVersions(interm, version, profile, spvVersion, language, infoSink, forwardCompatible, messages), : TParseVersions(interm, version, profile, spvVersion, language, infoSink, forwardCompatible, messages),
scopeMangler("::"), scopeMangler("::"),
symbolTable(symbolTable), symbolTable(symbolTable),
statementNestingLevel(0), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0), statementNestingLevel(0), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0),
postEntryPointReturn(false), postEntryPointReturn(false),
contextPragma(true, false), contextPragma(true, false),
parsingBuiltins(parsingBuiltins), scanContext(nullptr), ppContext(nullptr), parsingBuiltins(parsingBuiltins), scanContext(NULL), ppContext(NULL),
limits(resources.limits), limits(resources.limits),
globalUniformBlock(nullptr), globalUniformBlock(NULL),
globalUniformBinding(TQualifier::layoutBindingEnd), globalUniformBinding(TQualifier::layoutBindingEnd),
globalUniformSet(TQualifier::layoutSetEnd) globalUniformSet(TQualifier::layoutSetEnd)
{ {
if (entryPoint != nullptr) if (entryPoint != NULL)
sourceEntryPointName = *entryPoint; sourceEntryPointName = *entryPoint;
} }
virtual ~TParseContextBase() { } virtual ~TParseContextBase() { }
@ -149,14 +149,14 @@ public:
} }
// Manage the global uniform block (default uniforms in GLSL, $Global in HLSL) // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL)
virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr); virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = NULL);
// Potentially rename shader entry point function // Potentially rename shader entry point function
void renameShaderFunction(TString*& name) const void renameShaderFunction(TString*& name) const
{ {
// Replace the entry point name given in the shader with the real entry point name, // Replace the entry point name given in the shader with the real entry point name,
// if there is a substitution. // if there is a substitution.
if (name != nullptr && *name == sourceEntryPointName && intermediate.getEntryPointName().size() > 0) if (name != NULL && *name == sourceEntryPointName && intermediate.getEntryPointName().size() > 0)
name = NewPoolTString(intermediate.getEntryPointName().c_str()); name = NewPoolTString(intermediate.getEntryPointName().c_str());
} }
@ -272,7 +272,7 @@ class TParseContext : public TParseContextBase {
public: public:
TParseContext(TSymbolTable&, TIntermediate&, bool parsingBuiltins, int version, EProfile, const SpvVersion& spvVersion, EShLanguage, TInfoSink&, TParseContext(TSymbolTable&, TIntermediate&, bool parsingBuiltins, int version, EProfile, const SpvVersion& spvVersion, EShLanguage, TInfoSink&,
bool forwardCompatible = false, EShMessages messages = EShMsgDefault, bool forwardCompatible = false, EShMessages messages = EShMsgDefault,
const TString* entryPoint = nullptr); const TString* entryPoint = NULL);
virtual ~TParseContext(); virtual ~TParseContext();
bool obeyPrecisionQualifiers() const { return precisionManager.respectingPrecisionQualifiers(); }; bool obeyPrecisionQualifiers() const { return precisionManager.respectingPrecisionQualifiers(); };

View File

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

View File

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

View File

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

View File

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

View File

@ -151,7 +151,7 @@ public:
TVariable(const TString *name, const TType& t, bool uT = false ) TVariable(const TString *name, const TType& t, bool uT = false )
: TSymbol(name), : TSymbol(name),
userType(uT), userType(uT),
constSubtree(nullptr), constSubtree(NULL),
anonId(-1) { type.shallowCopy(t); } anonId(-1) { type.shallowCopy(t); }
virtual TVariable* clone() const; virtual TVariable* clone() const;
virtual ~TVariable() { } virtual ~TVariable() { }
@ -240,7 +240,7 @@ public:
parameters.push_back(p); parameters.push_back(p);
p.type->appendMangledName(mangledName); p.type->appendMangledName(mangledName);
if (p.defaultValue != nullptr) if (p.defaultValue != NULL)
defaultParamCount++; defaultParamCount++;
} }
@ -248,7 +248,7 @@ public:
// 'this' is reflected in the list of parameters, but not the mangled name. // 'this' is reflected in the list of parameters, but not the mangled name.
virtual void addThisParameter(TType& type, const char* name) virtual void addThisParameter(TType& type, const char* name)
{ {
TParameter p = { NewPoolTString(name), new TType, nullptr }; TParameter p = { NewPoolTString(name), new TType, NULL };
p.type->shallowCopy(type); p.type->shallowCopy(type);
parameters.insert(parameters.begin(), p); parameters.insert(parameters.begin(), p);
} }
@ -695,13 +695,13 @@ public:
++thisDepth; ++thisDepth;
symbol = table[level]->find(name); symbol = table[level]->find(name);
--level; --level;
} while (symbol == nullptr && level >= 0); } while (symbol == NULL && level >= 0);
level++; level++;
if (builtIn) if (builtIn)
*builtIn = isBuiltInLevel(level); *builtIn = isBuiltInLevel(level);
if (currentScope) if (currentScope)
*currentScope = isGlobalLevel(currentLevel()) || level == currentLevel(); // consider shared levels as "current scope" WRT user globals *currentScope = isGlobalLevel(currentLevel()) || level == currentLevel(); // consider shared levels as "current scope" WRT user globals
if (thisDepthP != nullptr) { if (thisDepthP != NULL) {
if (! table[level]->isThisLevel()) if (! table[level]->isThisLevel())
thisDepth = 0; thisDepth = 0;
*thisDepthP = thisDepth; *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. // Call for any operation needing full GLSL integer data-type support.
void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op) void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op)
{ {
profileRequires(loc, ENoProfile, 130, nullptr, op); profileRequires(loc, ENoProfile, 130, NULL, op);
profileRequires(loc, EEsProfile, 300, nullptr, op); profileRequires(loc, EEsProfile, 300, NULL, op);
} }
// Call for any operation needing GLSL double data-type support. // Call for any operation needing GLSL double data-type support.
void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op) void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op)
{ {
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 400, nullptr, op); profileRequires(loc, ECoreProfile, 400, NULL, op);
profileRequires(loc, ECompatibilityProfile, 400, nullptr, op); profileRequires(loc, ECompatibilityProfile, 400, NULL, op);
} }
// Call for any operation needing GLSL float16 data-type support. // 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 #endif
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types"); requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
} }
} }
@ -843,8 +843,8 @@ void TParseVersions::explicitFloat32Check(const TSourceLoc& loc, const char* op,
E_GL_KHX_shader_explicit_arithmetic_types_float32}; E_GL_KHX_shader_explicit_arithmetic_types_float32};
requireExtensions(loc, 2, extensions, "explicit types"); requireExtensions(loc, 2, extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
} }
} }
@ -856,8 +856,8 @@ void TParseVersions::explicitFloat64Check(const TSourceLoc& loc, const char* op,
E_GL_KHX_shader_explicit_arithmetic_types_float64}; E_GL_KHX_shader_explicit_arithmetic_types_float64};
requireExtensions(loc, 2, extensions, "explicit types"); requireExtensions(loc, 2, extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
} }
} }
@ -869,8 +869,8 @@ void TParseVersions::explicitInt8Check(const TSourceLoc& loc, const char* op, bo
E_GL_KHX_shader_explicit_arithmetic_types_int8}; E_GL_KHX_shader_explicit_arithmetic_types_int8};
requireExtensions(loc, 2, extensions, "explicit types"); requireExtensions(loc, 2, extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
} }
} }
@ -881,8 +881,8 @@ void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, b
if (! builtIn) { if (! builtIn) {
requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_half_float_fetch, op); requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_half_float_fetch, op);
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
} }
} }
#endif #endif
@ -901,8 +901,8 @@ void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, b
#endif #endif
requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types"); requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
} }
} }
@ -914,8 +914,8 @@ void TParseVersions::explicitInt32Check(const TSourceLoc& loc, const char* op, b
E_GL_KHX_shader_explicit_arithmetic_types_int32}; E_GL_KHX_shader_explicit_arithmetic_types_int32};
requireExtensions(loc, 2, extensions, "explicit types"); requireExtensions(loc, 2, extensions, "explicit types");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
} }
} }
@ -928,8 +928,8 @@ void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool buil
E_GL_KHX_shader_explicit_arithmetic_types_int64}; E_GL_KHX_shader_explicit_arithmetic_types_int64};
requireExtensions(loc, 3, extensions, "shader int64"); requireExtensions(loc, 3, extensions, "shader int64");
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, NULL, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, NULL, op);
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -273,7 +273,7 @@ public:
MacroSymbol* lookupMacroDef(int atom) MacroSymbol* lookupMacroDef(int atom)
{ {
auto existingMacroIt = macroDefs.find(atom); auto existingMacroIt = macroDefs.find(atom);
return (existingMacroIt == macroDefs.end()) ? nullptr : &(existingMacroIt->second); return (existingMacroIt == macroDefs.end()) ? NULL : &(existingMacroIt->second);
} }
void addMacroDef(int atom, MacroSymbol& macroDef) { macroDefs[atom] = macroDef; } void addMacroDef(int atom, MacroSymbol& macroDef) { macroDefs[atom] = macroDef; }
@ -527,7 +527,7 @@ protected:
epilogue_(epilogue), epilogue_(epilogue),
includedFile_(includedFile), includedFile_(includedFile),
scanner(3, strings, lengths, names, 0, 0, true), scanner(3, strings, lengths, names, 0, 0, true),
prevScanner(nullptr), prevScanner(NULL),
stringInput(pp, scanner) stringInput(pp, scanner)
{ {
strings[0] = prologue_.data(); 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') { } else if (ch == 'f' || ch == 'F') {
if (ifdepth == 0) if (ifdepth == 0)
_parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix"); _parseContext.profileRequires(ppToken->loc, EEsProfile, 300, NULL, "floating-point suffix");
if (ifdepth == 0 && !_parseContext.relaxedErrors()) if (ifdepth == 0 && !_parseContext.relaxedErrors())
_parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix"); _parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, NULL, "floating-point suffix");
if (ifdepth == 0 && !hasDecimalOrExponent) if (ifdepth == 0 && !hasDecimalOrExponent)
_parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); _parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
saveName(ch); saveName(ch);

View File

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

View File

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

View File

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

View File

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