From a7603c132d0dd1476eb8e13e50d042820f2154a7 Mon Sep 17 00:00:00 2001 From: Johannes Kauffmann <19662702+JohannesKauffmann@users.noreply.github.com> Date: Tue, 22 Nov 2022 19:09:31 +0100 Subject: [PATCH] Use nullptr where possible instead of NULL or 0 --- OGLCompilersDLL/InitializeDll.cpp | 6 +- SPIRV/GlslangToSpv.cpp | 2 +- SPIRV/SpvBuilder.cpp | 10 +- SPIRV/SpvBuilder.h | 2 +- SPIRV/doc.cpp | 4 +- SPIRV/doc.h | 4 +- StandAlone/StandAlone.cpp | 14 +- StandAlone/spirv-remap.cpp | 4 +- gen_extension_headers.py | 2 +- glslang/GenericCodeGen/Link.cpp | 2 +- glslang/HLSL/hlslGrammar.cpp | 2 +- glslang/HLSL/hlslParseHelper.cpp | 10 +- glslang/HLSL/hlslParseHelper.h | 8 +- glslang/Include/PoolAlloc.h | 6 +- glslang/Include/ShHandle.h | 16 +- glslang/Include/intermediate.h | 54 ++--- glslang/MachineIndependent/Constant.cpp | 10 +- glslang/MachineIndependent/Intermediate.cpp | 2 +- glslang/MachineIndependent/ParseHelper.cpp | 12 +- glslang/MachineIndependent/ParseHelper.h | 4 +- glslang/MachineIndependent/PoolAlloc.cpp | 10 +- glslang/MachineIndependent/ShaderLang.cpp | 60 +++--- glslang/MachineIndependent/SymbolTable.cpp | 2 +- glslang/MachineIndependent/SymbolTable.h | 32 +-- glslang/MachineIndependent/Versions.cpp | 8 +- glslang/MachineIndependent/glslang_tab.cpp | 184 +++++++++--------- glslang/MachineIndependent/intermOut.cpp | 2 +- glslang/MachineIndependent/linkValidate.cpp | 2 +- .../MachineIndependent/localintermediate.h | 2 +- glslang/MachineIndependent/parseConst.cpp | 2 +- glslang/MachineIndependent/parseVersions.h | 2 +- .../preprocessor/PpContext.cpp | 2 +- .../preprocessor/PpTokens.cpp | 2 +- .../propagateNoContraction.cpp | 2 +- glslang/MachineIndependent/reflection.cpp | 2 +- glslang/OSDependent/Unix/ossource.cpp | 2 +- glslang/OSDependent/Windows/ossource.cpp | 4 +- glslang/OSDependent/osinclude.h | 2 +- 38 files changed, 248 insertions(+), 248 deletions(-) diff --git a/OGLCompilersDLL/InitializeDll.cpp b/OGLCompilersDLL/InitializeDll.cpp index abea9108b..9d81f5787 100644 --- a/OGLCompilersDLL/InitializeDll.cpp +++ b/OGLCompilersDLL/InitializeDll.cpp @@ -102,7 +102,7 @@ bool InitThread() return false; } - if (OS_GetTLSValue(ThreadInitializeIndex) != 0) + if (OS_GetTLSValue(ThreadInitializeIndex) != nullptr) return true; if (! OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) { @@ -130,8 +130,8 @@ bool DetachThread() // // Function is re-entrant and this thread may not have been initialized. // - if (OS_GetTLSValue(ThreadInitializeIndex) != 0) { - if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)0)) { + if (OS_GetTLSValue(ThreadInitializeIndex) != nullptr) { + if (!OS_SetTLSValue(ThreadInitializeIndex, nullptr)) { assert(0 && "DetachThread(): Unable to clear init flag."); success = false; } diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 842221cba..11fc70c25 100644 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -9615,7 +9615,7 @@ void GlslangToSpv(const TIntermediate& intermediate, std::vector& { TIntermNode* root = intermediate.getTreeRoot(); - if (root == 0) + if (root == nullptr) return; SpvOptions defaultOptions; diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 7c5ea874b..7b2d70367 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -71,9 +71,9 @@ Builder::Builder(unsigned int spvVersion, unsigned int magicNumber, SpvBuildLogg addressModel(AddressingModelLogical), memoryModel(MemoryModelGLSL450), builderNumber(magicNumber), - buildPoint(0), + buildPoint(nullptr), uniqueId(0), - entryPointFunction(0), + entryPointFunction(nullptr), generatingOpCodeForSpecConst(false), logger(buildLogger) { @@ -1675,7 +1675,7 @@ Id Builder::importNonSemanticShaderDebugInfoInstructions() Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector& comps) { - Instruction* constant = 0; + Instruction* constant = nullptr; bool found = false; for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) { constant = groupedConstants[typeClass][i]; @@ -1702,7 +1702,7 @@ Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector Id Builder::findStructConstant(Id typeId, const std::vector& comps) { - Instruction* constant = 0; + Instruction* constant = nullptr; bool found = false; for (int i = 0; i < (int)groupedStructConstants[typeId].size(); ++i) { constant = groupedStructConstants[typeId][i]; @@ -3332,7 +3332,7 @@ Builder::If::If(Id cond, unsigned int ctrl, Builder& gb) : builder(gb), condition(cond), control(ctrl), - elseBlock(0) + elseBlock(nullptr) { function = &builder.getBuildPoint()->getParent(); diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index f7fdc6ad8..b75eab891 100644 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -414,7 +414,7 @@ public: // The returned pointer is only valid for the lifetime of this builder. Function* makeFunctionEntry(Decoration precision, Id returnType, const char* name, const std::vector& paramTypes, const std::vector& paramNames, - const std::vector>& precisions, Block **entry = 0); + const std::vector>& precisions, Block **entry = nullptr); // Create a return. An 'implicit' return is one not appearing in the source // code. In the case of an implicit return, no post-return block is inserted. diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp index b7fe3e742..b6cc42db8 100644 --- a/SPIRV/doc.cpp +++ b/SPIRV/doc.cpp @@ -1607,7 +1607,7 @@ void Parameterize() DecorationOperands[DecorationInputAttachmentIndex].push(OperandLiteralNumber, "'Attachment Index'"); DecorationOperands[DecorationAlignment].push(OperandLiteralNumber, "'Alignment'"); - OperandClassParams[OperandSource].set(0, SourceString, 0); + OperandClassParams[OperandSource].set(0, SourceString, nullptr); OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, nullptr); OperandClassParams[OperandAddressing].set(0, AddressingString, nullptr); OperandClassParams[OperandMemory].set(0, MemoryString, nullptr); @@ -1639,7 +1639,7 @@ void Parameterize() OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, nullptr); OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, nullptr, true); OperandClassParams[OperandCapability].set(0, CapabilityString, nullptr); - OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, 0); + OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, nullptr); // set name of operator, an initial set of style operands, and the description diff --git a/SPIRV/doc.h b/SPIRV/doc.h index 2a0b28c6b..7e1559950 100644 --- a/SPIRV/doc.h +++ b/SPIRV/doc.h @@ -190,7 +190,7 @@ protected: // Parameterize an enumerant class EnumParameters { public: - EnumParameters() : desc(0) { } + EnumParameters() : desc(nullptr) { } const char* desc; }; @@ -198,7 +198,7 @@ public: class EnumDefinition : public EnumParameters { public: EnumDefinition() : - ceiling(0), bitmask(false), getName(0), enumParams(0), operandParams(0) { } + ceiling(0), bitmask(false), getName(nullptr), enumParams(nullptr), operandParams(nullptr) { } void set(int ceil, const char* (*name)(int), EnumParameters* ep, bool mask = false) { ceiling = ceil; diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 53a6b9c2f..e02628562 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -504,7 +504,7 @@ void ProcessGlobalBlockSettings(int& argc, char**& argv, std::string* name, unsi if (set) { errno = 0; - int setVal = ::strtol(argv[curArg], NULL, 10); + int setVal = ::strtol(argv[curArg], nullptr, 10); if (errno || setVal < 0) { printf("%s: invalid set\n", argv[curArg]); usage(); @@ -516,7 +516,7 @@ void ProcessGlobalBlockSettings(int& argc, char**& argv, std::string* name, unsi if (binding) { errno = 0; - int bindingVal = ::strtol(argv[curArg], NULL, 10); + int bindingVal = ::strtol(argv[curArg], nullptr, 10); if (errno || bindingVal < 0) { printf("%s: invalid binding\n", argv[curArg]); usage(); @@ -594,12 +594,12 @@ void ProcessArguments(std::vector>& workItem const auto getUniformOverride = [getStringOperand]() { const char *arg = getStringOperand("-u:"); const char *split = strchr(arg, ':'); - if (split == NULL) { + if (split == nullptr) { printf("%s: missing location\n", arg); exit(EFailUsage); } errno = 0; - int location = ::strtol(split + 1, NULL, 10); + int location = ::strtol(split + 1, nullptr, 10); if (errno) { printf("%s: invalid location\n", arg); exit(EFailUsage); @@ -626,7 +626,7 @@ void ProcessArguments(std::vector>& workItem } else if (lowerword == "uniform-base") { if (argc <= 1) Error("no provided", lowerword.c_str()); - uniformBase = ::strtol(argv[1], NULL, 10); + uniformBase = ::strtol(argv[1], nullptr, 10); bumpArg(); break; } else if (lowerword == "client") { @@ -1161,7 +1161,7 @@ void CompileShaders(glslang::TWorklist& worklist) } else { while (worklist.remove(workItem)) { ShHandle compiler = ShConstructCompiler(FindLanguage(workItem->name), Options); - if (compiler == 0) + if (compiler == nullptr) return; CompileFile(workItem->name.c_str(), compiler); @@ -1297,7 +1297,7 @@ void CompileAndLinkShaderUnits(std::vector compUnits) sources.push_back(compUnit.fileNameList[i]); } glslang::TShader* shader = new glslang::TShader(compUnit.stage); - shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count); + shader->setStringsWithLengthsAndNames(compUnit.text, nullptr, compUnit.fileNameList, compUnit.count); if (entryPointName) shader->setEntryPoint(entryPointName); if (sourceEntryPointName) { diff --git a/StandAlone/spirv-remap.cpp b/StandAlone/spirv-remap.cpp index 15c3ac513..301bb0cb5 100644 --- a/StandAlone/spirv-remap.cpp +++ b/StandAlone/spirv-remap.cpp @@ -157,7 +157,7 @@ namespace { } // Print helpful usage message to stdout, and exit - void usage(const char* const name, const char* const msg = 0) + void usage(const char* const name, const char* const msg = nullptr) { if (msg) std::cout << msg << std::endl << std::endl; @@ -245,7 +245,7 @@ namespace { verbosity = 1; if (a < argc) { - char* end_ptr = 0; + char* end_ptr = nullptr; int verb = ::strtol(argv[a], &end_ptr, 10); // If we have not read to the end of the string or // the string contained no elements, then we do not want to diff --git a/gen_extension_headers.py b/gen_extension_headers.py index 2838c9622..0638720a0 100755 --- a/gen_extension_headers.py +++ b/gen_extension_headers.py @@ -57,7 +57,7 @@ def generate_main(glsl_files, output_header_file): contents += '\tfor (int i = 0; i < n; i++) {\n' for symbol_name in symbol_name_list: - contents += '\t\tif (strstr(shaders[i], "%s") != NULL) {\n' % (symbol_name) + contents += '\t\tif (strstr(shaders[i], "%s") != nullptr) {\n' % (symbol_name) contents += '\t\t shaderString.append(%s_GLSL);\n' % (symbol_name) contents += '\t\t}\n' diff --git a/glslang/GenericCodeGen/Link.cpp b/glslang/GenericCodeGen/Link.cpp index c38db0f69..5e28405f0 100644 --- a/glslang/GenericCodeGen/Link.cpp +++ b/glslang/GenericCodeGen/Link.cpp @@ -82,7 +82,7 @@ void DeleteUniformMap(TUniformMap* map) TShHandleBase* ConstructBindings() { - return 0; + return nullptr; } void DeleteBindingList(TShHandleBase* bindingList) diff --git a/glslang/HLSL/hlslGrammar.cpp b/glslang/HLSL/hlslGrammar.cpp index a01f24035..19a792b98 100644 --- a/glslang/HLSL/hlslGrammar.cpp +++ b/glslang/HLSL/hlslGrammar.cpp @@ -3794,7 +3794,7 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttri parseContext.unnestLooping(); --parseContext.controlFlowNestingLevel; - loopNode = intermediate.addLoop(statement, condition, 0, false, loc); + loopNode = intermediate.addLoop(statement, condition, nullptr, false, loc); statement = loopNode; break; diff --git a/glslang/HLSL/hlslParseHelper.cpp b/glslang/HLSL/hlslParseHelper.cpp index 62e46a093..6e0d314ae 100644 --- a/glslang/HLSL/hlslParseHelper.cpp +++ b/glslang/HLSL/hlslParseHelper.cpp @@ -1596,7 +1596,7 @@ void HlslParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunction // bool builtIn; TSymbol* symbol = symbolTable.find(function.getMangledName(), &builtIn); - const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0; + const TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr; if (prototype) { // All built-in functions are defined, even though they don't have a body. @@ -2472,7 +2472,7 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT void HlslParseContext::handleFunctionArgument(TFunction* function, TIntermTyped*& arguments, TIntermTyped* newArg) { - TParameter param = { 0, new TType, nullptr }; + TParameter param = { nullptr, new TType, nullptr }; param.type->shallowCopy(newArg->getType()); function->addParameter(param); @@ -7790,18 +7790,18 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction // Handle aggregates: put all args into the new function call for (int arg = 0; arg < int(args->getAsAggregate()->getSequence().size()); ++arg) { // TODO: But for constness, we could avoid the new & shallowCopy, and use the pointer directly. - TParameter param = { 0, new TType, nullptr }; + TParameter param = { nullptr, new TType, nullptr }; param.type->shallowCopy(args->getAsAggregate()->getSequence()[arg]->getAsTyped()->getType()); convertedCall.addParameter(param); } } else if (args->getAsUnaryNode()) { // Handle unaries: put all args into the new function call - TParameter param = { 0, new TType, nullptr }; + TParameter param = { nullptr, new TType, nullptr }; param.type->shallowCopy(args->getAsUnaryNode()->getOperand()->getAsTyped()->getType()); convertedCall.addParameter(param); } else if (args->getAsTyped()) { // Handle bare e.g, floats, not in an aggregate. - TParameter param = { 0, new TType, nullptr }; + TParameter param = { nullptr, new TType, nullptr }; param.type->shallowCopy(args->getAsTyped()->getType()); convertedCall.addParameter(param); } else { diff --git a/glslang/HLSL/hlslParseHelper.h b/glslang/HLSL/hlslParseHelper.h index 96d85f434..97c52d453 100644 --- a/glslang/HLSL/hlslParseHelper.h +++ b/glslang/HLSL/hlslParseHelper.h @@ -147,14 +147,14 @@ public: void declareTypedef(const TSourceLoc&, const TString& identifier, const TType&); void declareStruct(const TSourceLoc&, TString& structName, TType&); TSymbol* lookupUserType(const TString&, TType&); - TIntermNode* declareVariable(const TSourceLoc&, const TString& identifier, TType&, TIntermTyped* initializer = 0); + TIntermNode* declareVariable(const TSourceLoc&, const TString& identifier, TType&, TIntermTyped* initializer = nullptr); void lengthenList(const TSourceLoc&, TIntermSequence& list, int size, TIntermTyped* scalarInit); TIntermTyped* handleConstructor(const TSourceLoc&, TIntermTyped*, const TType&); TIntermTyped* addConstructor(const TSourceLoc&, TIntermTyped*, const TType&); TIntermTyped* convertArray(TIntermTyped*, const TType&); TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset); - void declareBlock(const TSourceLoc&, TType&, const TString* instanceName = 0); + void declareBlock(const TSourceLoc&, TType&, const TString* instanceName = nullptr); void declareStructBufferCounter(const TSourceLoc& loc, const TType& bufferType, const TString& name); void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation); void fixXfbOffsets(TQualifier&, TTypeList&); @@ -171,10 +171,10 @@ public: void unnestAnnotations() { --annotationNestingLevel; } int getAnnotationNestingLevel() { return annotationNestingLevel; } void pushScope() { symbolTable.push(); } - void popScope() { symbolTable.pop(0); } + void popScope() { symbolTable.pop(nullptr); } void pushThisScope(const TType&, const TVector&); - void popThisScope() { symbolTable.pop(0); } + void popThisScope() { symbolTable.pop(nullptr); } void pushImplicitThis(TVariable* thisParameter) { implicitThisStack.push_back(thisParameter); } void popImplicitThis() { implicitThisStack.pop_back(); } diff --git a/glslang/Include/PoolAlloc.h b/glslang/Include/PoolAlloc.h index 15adbaf0e..3e67d6edf 100644 --- a/glslang/Include/PoolAlloc.h +++ b/glslang/Include/PoolAlloc.h @@ -74,7 +74,7 @@ namespace glslang { class TAllocation { public: - TAllocation(size_t size, unsigned char* mem, TAllocation* prev = 0) : + TAllocation(size_t size, unsigned char* mem, TAllocation* prev = nullptr) : size(size), mem(mem), prevAlloc(prev) { // Allocations are bracketed: // [allocationHeader][initialGuardBlock][userData][finalGuardBlock] @@ -171,7 +171,7 @@ public: void popAll(); // - // Call allocate() to actually acquire memory. Returns 0 if no memory + // Call allocate() to actually acquire memory. Returns nullptr if no memory // available, otherwise a properly aligned pointer to 'numBytes' of memory. // void* allocate(size_t numBytes); @@ -189,7 +189,7 @@ protected: struct tHeader { tHeader(tHeader* nextPage, size_t pageCount) : #ifdef GUARD_BLOCKS - lastAllocation(0), + lastAllocation(nullptr), #endif nextPage(nextPage), pageCount(pageCount) { } diff --git a/glslang/Include/ShHandle.h b/glslang/Include/ShHandle.h index df07bd8ed..dee47c0df 100644 --- a/glslang/Include/ShHandle.h +++ b/glslang/Include/ShHandle.h @@ -58,9 +58,9 @@ class TShHandleBase { public: TShHandleBase() { pool = new glslang::TPoolAllocator; } virtual ~TShHandleBase() { delete pool; } - virtual TCompiler* getAsCompiler() { return 0; } - virtual TLinker* getAsLinker() { return 0; } - virtual TUniformMap* getAsUniformMap() { return 0; } + virtual TCompiler* getAsCompiler() { return nullptr; } + virtual TLinker* getAsLinker() { return nullptr; } + virtual TUniformMap* getAsUniformMap() { return nullptr; } virtual glslang::TPoolAllocator* getPool() const { return pool; } private: glslang::TPoolAllocator* pool; @@ -123,11 +123,11 @@ public: infoSink(iSink), executable(e), haveReturnableObjectCode(false), - appAttributeBindings(0), - fixedAttributeBindings(0), - excludedAttributes(0), + appAttributeBindings(nullptr), + fixedAttributeBindings(nullptr), + excludedAttributes(nullptr), excludedCount(0), - uniformBindings(0) { } + uniformBindings(nullptr) { } virtual TLinker* getAsLinker() { return this; } virtual ~TLinker() { } virtual bool link(TCompilerList&, TUniformMap*) = 0; @@ -137,7 +137,7 @@ public: virtual void getAttributeBindings(ShBindingTable const **t) const = 0; virtual void setExcludedAttributes(const int* attributes, int count) { excludedAttributes = attributes; excludedCount = count; } virtual ShBindingTable* getUniformBindings() const { return uniformBindings; } - virtual const void* getObjectCode() const { return 0; } // a real compiler would be returning object code here + virtual const void* getObjectCode() const { return nullptr; } // a real compiler would be returning object code here virtual TInfoSink& getInfoSink() { return infoSink; } TInfoSink& infoSink; protected: diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index a0240028d..2b81a22fe 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -1086,31 +1086,31 @@ public: virtual const glslang::TSourceLoc& getLoc() const { return loc; } virtual void setLoc(const glslang::TSourceLoc& l) { loc = l; } virtual void traverse(glslang::TIntermTraverser*) = 0; - virtual glslang::TIntermTyped* getAsTyped() { return 0; } - virtual glslang::TIntermOperator* getAsOperator() { return 0; } - virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return 0; } - virtual glslang::TIntermAggregate* getAsAggregate() { return 0; } - virtual glslang::TIntermUnary* getAsUnaryNode() { return 0; } - virtual glslang::TIntermBinary* getAsBinaryNode() { return 0; } - virtual glslang::TIntermSelection* getAsSelectionNode() { return 0; } - virtual glslang::TIntermSwitch* getAsSwitchNode() { return 0; } - virtual glslang::TIntermMethod* getAsMethodNode() { return 0; } - virtual glslang::TIntermSymbol* getAsSymbolNode() { return 0; } - virtual glslang::TIntermBranch* getAsBranchNode() { return 0; } - virtual glslang::TIntermLoop* getAsLoopNode() { return 0; } + virtual glslang::TIntermTyped* getAsTyped() { return nullptr; } + virtual glslang::TIntermOperator* getAsOperator() { return nullptr; } + virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return nullptr; } + virtual glslang::TIntermAggregate* getAsAggregate() { return nullptr; } + virtual glslang::TIntermUnary* getAsUnaryNode() { return nullptr; } + virtual glslang::TIntermBinary* getAsBinaryNode() { return nullptr; } + virtual glslang::TIntermSelection* getAsSelectionNode() { return nullptr; } + virtual glslang::TIntermSwitch* getAsSwitchNode() { return nullptr; } + virtual glslang::TIntermMethod* getAsMethodNode() { return nullptr; } + virtual glslang::TIntermSymbol* getAsSymbolNode() { return nullptr; } + virtual glslang::TIntermBranch* getAsBranchNode() { return nullptr; } + virtual glslang::TIntermLoop* getAsLoopNode() { return nullptr; } - virtual const glslang::TIntermTyped* getAsTyped() const { return 0; } - virtual const glslang::TIntermOperator* getAsOperator() const { return 0; } - virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return 0; } - virtual const glslang::TIntermAggregate* getAsAggregate() const { return 0; } - virtual const glslang::TIntermUnary* getAsUnaryNode() const { return 0; } - virtual const glslang::TIntermBinary* getAsBinaryNode() const { return 0; } - virtual const glslang::TIntermSelection* getAsSelectionNode() const { return 0; } - virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return 0; } - virtual const glslang::TIntermMethod* getAsMethodNode() const { return 0; } - virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return 0; } - virtual const glslang::TIntermBranch* getAsBranchNode() const { return 0; } - virtual const glslang::TIntermLoop* getAsLoopNode() const { return 0; } + virtual const glslang::TIntermTyped* getAsTyped() const { return nullptr; } + virtual const glslang::TIntermOperator* getAsOperator() const { return nullptr; } + virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return nullptr; } + virtual const glslang::TIntermAggregate* getAsAggregate() const { return nullptr; } + virtual const glslang::TIntermUnary* getAsUnaryNode() const { return nullptr; } + virtual const glslang::TIntermBinary* getAsBinaryNode() const { return nullptr; } + virtual const glslang::TIntermSelection* getAsSelectionNode() const { return nullptr; } + virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return nullptr; } + virtual const glslang::TIntermMethod* getAsMethodNode() const { return nullptr; } + virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return nullptr; } + virtual const glslang::TIntermBranch* getAsBranchNode() const { return nullptr; } + virtual const glslang::TIntermLoop* getAsLoopNode() const { return nullptr; } virtual ~TIntermNode() { } protected: @@ -1616,8 +1616,8 @@ protected: // class TIntermUnary : public TIntermOperator { public: - TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {} - TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {} + TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(nullptr) {} + TIntermUnary(TOperator o) : TIntermOperator(o), operand(nullptr) {} virtual void traverse(TIntermTraverser*); virtual void setOperand(TIntermTyped* o) { operand = o; } virtual TIntermTyped* getOperand() { return operand; } @@ -1819,7 +1819,7 @@ public: TIntermNode *getParentNode() { - return path.size() == 0 ? NULL : path.back(); + return path.size() == 0 ? nullptr : path.back(); } const bool preVisit; diff --git a/glslang/MachineIndependent/Constant.cpp b/glslang/MachineIndependent/Constant.cpp index 5fc61dbb7..40f53bbcc 100644 --- a/glslang/MachineIndependent/Constant.cpp +++ b/glslang/MachineIndependent/Constant.cpp @@ -226,7 +226,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right newConstArray[i].setU64Const(leftUnionArray[i].getU64Const() / rightUnionArray[i].getU64Const()); break; default: - return 0; + return nullptr; #endif } } @@ -354,7 +354,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right break; default: - return 0; + return nullptr; } TIntermConstantUnion *newNode = new TIntermConstantUnion(newConstArray, returnType); @@ -1345,7 +1345,7 @@ TIntermTyped* TIntermediate::foldDereference(TIntermTyped* node, int index, cons { TType dereferencedType(node->getType(), index); dereferencedType.getQualifier().storage = EvqConst; - TIntermTyped* result = 0; + TIntermTyped* result = nullptr; int size = dereferencedType.computeNumComponents(); // arrays, vectors, matrices, all use simple multiplicative math @@ -1365,7 +1365,7 @@ TIntermTyped* TIntermediate::foldDereference(TIntermTyped* node, int index, cons result = addConstantUnion(TConstUnionArray(node->getAsConstantUnion()->getConstArray(), start, size), node->getType(), loc); - if (result == 0) + if (result == nullptr) result = node; else result->setType(dereferencedType); @@ -1387,7 +1387,7 @@ TIntermTyped* TIntermediate::foldSwizzle(TIntermTyped* node, TSwizzleSelectorsgetType(), loc); - if (result == 0) + if (result == nullptr) result = node; else result->setType(TType(node->getBasicType(), EvqConst, selectors.size())); diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 6a43ef3e8..5adf19d65 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -352,7 +352,7 @@ TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermT TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, const TSourceLoc& loc) { - if (child == 0) + if (child == nullptr) return nullptr; if (child->getType().getBasicType() == EbtBlock) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 41afbc052..ff76cada0 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -1165,7 +1165,7 @@ TFunction* TParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunct if (symbol && builtIn && function.getBuiltInOp() == EOpSpirvInst) symbol = nullptr; #endif - const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0; + const TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr; if (prevDec) { if (prevDec->isPrototyped() && prototype) profileRequires(loc, EEsProfile, 300, nullptr, "multiple prototypes for same function"); @@ -3140,7 +3140,7 @@ void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* iden ppWarn(loc, "\"defined\" is (un)defined:", op, identifier); else ppError(loc, "\"defined\" can't be (un)defined:", op, identifier); - else if (strstr(identifier, "__") != 0 && !extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) { + else if (strstr(identifier, "__") != nullptr && !extensionTurnedOn(E_GL_EXT_spirv_intrinsics)) { // The extension GL_EXT_spirv_intrinsics allows us to declare macros prefixed with "__". if (isEsProfile() && version >= 300 && (strcmp(identifier, "__LINE__") == 0 || @@ -5206,7 +5206,7 @@ void TParseContext::inductiveLoopCheck(const TSourceLoc& loc, TIntermNode* init, bool badInit = false; if (! init || ! init->getAsAggregate() || init->getAsAggregate()->getSequence().size() != 1) badInit = true; - TIntermBinary* binaryInit = 0; + TIntermBinary* binaryInit = nullptr; if (! badInit) { // get the declaration assignment binaryInit = init->getAsAggregate()->getSequence()[0]->getAsBinaryNode(); @@ -6015,7 +6015,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi if (language == EShLangMesh || language == EShLangTask) { requireExtensions(loc, Num_AEP_mesh_shader, AEP_mesh_shader, "gl_WorkGroupSize"); } else { - profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize"); + profileRequires(loc, EEsProfile, 310, nullptr, "gl_WorkGroupSize"); profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize"); } #endif @@ -7082,7 +7082,7 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T realFunc.addParameter(TParameter().copyParam((*function)[i])); } - TParameter tmpP = { 0, &uintType }; + TParameter tmpP = { nullptr, &uintType }; realFunc.addParameter(TParameter().copyParam(tmpP)); arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(1, loc, true)); @@ -7099,7 +7099,7 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T realFunc.addParameter(TParameter().copyParam((*function)[i])); } - TParameter tmpP = { 0, &uintType }; + TParameter tmpP = { nullptr, &uintType }; realFunc.addParameter(TParameter().copyParam(tmpP)); arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(-1, loc, true)); diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index 885fd9081..64dc00538 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -438,12 +438,12 @@ public: const TFunction* findFunction400(const TSourceLoc& loc, const TFunction& call, bool& builtIn); const TFunction* findFunctionExplicitTypes(const TSourceLoc& loc, const TFunction& call, bool& builtIn); void declareTypeDefaults(const TSourceLoc&, const TPublicType&); - TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, const TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0); + TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, const TPublicType&, TArraySizes* typeArray = nullptr, TIntermTyped* initializer = nullptr); TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&); TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset); void inheritMemoryQualifiers(const TQualifier& from, TQualifier& to); - void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0); + void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = nullptr, TArraySizes* arraySizes = nullptr); void blockStorageRemap(const TSourceLoc&, const TString*, TQualifier&); void blockStageIoCheck(const TSourceLoc&, const TQualifier&); void blockQualifierCheck(const TSourceLoc&, const TQualifier&, bool instanceName); diff --git a/glslang/MachineIndependent/PoolAlloc.cpp b/glslang/MachineIndependent/PoolAlloc.cpp index 84c40f4e7..c3a3928ce 100644 --- a/glslang/MachineIndependent/PoolAlloc.cpp +++ b/glslang/MachineIndependent/PoolAlloc.cpp @@ -267,8 +267,8 @@ void* TPoolAllocator::allocate(size_t numBytes) // size_t numBytesToAlloc = allocationSize + headerSkip; tHeader* memory = reinterpret_cast(::new char[numBytesToAlloc]); - if (memory == 0) - return 0; + if (memory == nullptr) + return nullptr; // Use placement-new to initialize header new(memory) tHeader(inUseList, (numBytesToAlloc + pageSize - 1) / pageSize); @@ -289,8 +289,8 @@ void* TPoolAllocator::allocate(size_t numBytes) freeList = freeList->nextPage; } else { memory = reinterpret_cast(::new char[pageSize]); - if (memory == 0) - return 0; + if (memory == nullptr) + return nullptr; } // Use placement-new to initialize header @@ -308,7 +308,7 @@ void* TPoolAllocator::allocate(size_t numBytes) // void TAllocation::checkAllocList() const { - for (const TAllocation* alloc = this; alloc != 0; alloc = alloc->prevAlloc) + for (const TAllocation* alloc = this; alloc != nullptr; alloc = alloc->prevAlloc) alloc->check(); } diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index ced00863e..ed40c3669 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -1357,7 +1357,7 @@ int ShInitialize() ShHandle ShConstructCompiler(const EShLanguage language, int debugOptions) { if (!InitThread()) - return 0; + return nullptr; TShHandleBase* base = static_cast(ConstructCompiler(language, debugOptions)); @@ -1367,7 +1367,7 @@ ShHandle ShConstructCompiler(const EShLanguage language, int debugOptions) ShHandle ShConstructLinker(const EShExecutable executable, int debugOptions) { if (!InitThread()) - return 0; + return nullptr; TShHandleBase* base = static_cast(ConstructLinker(executable, debugOptions)); @@ -1377,7 +1377,7 @@ ShHandle ShConstructLinker(const EShExecutable executable, int debugOptions) ShHandle ShConstructUniformMap() { if (!InitThread()) - return 0; + return nullptr; TShHandleBase* base = static_cast(ConstructUniformMap()); @@ -1386,7 +1386,7 @@ ShHandle ShConstructUniformMap() void ShDestruct(ShHandle handle) { - if (handle == 0) + if (handle == nullptr) return; TShHandleBase* base = static_cast(handle); @@ -1419,7 +1419,7 @@ int ShFinalize() for (int source = 0; source < SourceCount; ++source) { for (int stage = 0; stage < EShLangCount; ++stage) { delete SharedSymbolTables[version][spvVersion][p][source][stage]; - SharedSymbolTables[version][spvVersion][p][source][stage] = 0; + SharedSymbolTables[version][spvVersion][p][source][stage] = nullptr; } } } @@ -1432,7 +1432,7 @@ int ShFinalize() for (int source = 0; source < SourceCount; ++source) { for (int pc = 0; pc < EPcCount; ++pc) { delete CommonSymbolTable[version][spvVersion][p][source][pc]; - CommonSymbolTable[version][spvVersion][p][source][pc] = 0; + CommonSymbolTable[version][spvVersion][p][source][pc] = nullptr; } } } @@ -1475,12 +1475,12 @@ int ShCompile( ) { // Map the generic handle to the C++ object - if (handle == 0) + if (handle == nullptr) return 0; TShHandleBase* base = reinterpret_cast(handle); TCompiler* compiler = base->getAsCompiler(); - if (compiler == 0) + if (compiler == nullptr) return 0; SetThreadPoolAllocator(compiler->getPool()); @@ -1520,13 +1520,13 @@ int ShLinkExt( const ShHandle compHandles[], const int numHandles) { - if (linkHandle == 0 || numHandles == 0) + if (linkHandle == nullptr || numHandles == 0) return 0; THandleList cObjects; for (int i = 0; i < numHandles; ++i) { - if (compHandles[i] == 0) + if (compHandles[i] == nullptr) return 0; TShHandleBase* base = reinterpret_cast(compHandles[i]); if (base->getAsLinker()) { @@ -1535,7 +1535,7 @@ int ShLinkExt( if (base->getAsCompiler()) cObjects.push_back(base->getAsCompiler()); - if (cObjects[i] == 0) + if (cObjects[i] == nullptr) return 0; } @@ -1544,7 +1544,7 @@ int ShLinkExt( SetThreadPoolAllocator(linker->getPool()); - if (linker == 0) + if (linker == nullptr) return 0; linker->infoSink.info.erase(); @@ -1569,7 +1569,7 @@ int ShLinkExt( // void ShSetEncryptionMethod(ShHandle handle) { - if (handle == 0) + if (handle == nullptr) return; } @@ -1578,8 +1578,8 @@ void ShSetEncryptionMethod(ShHandle handle) // const char* ShGetInfoLog(const ShHandle handle) { - if (handle == 0) - return 0; + if (handle == nullptr) + return nullptr; TShHandleBase* base = static_cast(handle); TInfoSink* infoSink; @@ -1589,7 +1589,7 @@ const char* ShGetInfoLog(const ShHandle handle) else if (base->getAsLinker()) infoSink = &(base->getAsLinker()->getInfoSink()); else - return 0; + return nullptr; infoSink->info << infoSink->debug.c_str(); return infoSink->info.c_str(); @@ -1601,14 +1601,14 @@ const char* ShGetInfoLog(const ShHandle handle) // const void* ShGetExecutable(const ShHandle handle) { - if (handle == 0) - return 0; + if (handle == nullptr) + return nullptr; TShHandleBase* base = reinterpret_cast(handle); TLinker* linker = static_cast(base->getAsLinker()); - if (linker == 0) - return 0; + if (linker == nullptr) + return nullptr; return linker->getObjectCode(); } @@ -1623,13 +1623,13 @@ const void* ShGetExecutable(const ShHandle handle) // int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* table) { - if (handle == 0) + if (handle == nullptr) return 0; TShHandleBase* base = reinterpret_cast(handle); TLinker* linker = static_cast(base->getAsLinker()); - if (linker == 0) + if (linker == nullptr) return 0; linker->setAppAttributeBindings(table); @@ -1642,13 +1642,13 @@ int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* t // int ShSetFixedAttributeBindings(const ShHandle handle, const ShBindingTable* table) { - if (handle == 0) + if (handle == nullptr) return 0; TShHandleBase* base = reinterpret_cast(handle); TLinker* linker = static_cast(base->getAsLinker()); - if (linker == 0) + if (linker == nullptr) return 0; linker->setFixedAttributeBindings(table); @@ -1660,12 +1660,12 @@ int ShSetFixedAttributeBindings(const ShHandle handle, const ShBindingTable* tab // int ShExcludeAttributes(const ShHandle handle, int *attributes, int count) { - if (handle == 0) + if (handle == nullptr) return 0; TShHandleBase* base = reinterpret_cast(handle); TLinker* linker = static_cast(base->getAsLinker()); - if (linker == 0) + if (linker == nullptr) return 0; linker->setExcludedAttributes(attributes, count); @@ -1681,12 +1681,12 @@ int ShExcludeAttributes(const ShHandle handle, int *attributes, int count) // int ShGetUniformLocation(const ShHandle handle, const char* name) { - if (handle == 0) + if (handle == nullptr) return -1; TShHandleBase* base = reinterpret_cast(handle); TUniformMap* uniformMap= base->getAsUniformMap(); - if (uniformMap == 0) + if (uniformMap == nullptr) return -1; return uniformMap->getLocation(name); @@ -1954,14 +1954,14 @@ const char* TShader::getInfoDebugLog() TProgram::TProgram() : #if !defined(GLSLANG_WEB) - reflection(0), + reflection(nullptr), #endif linked(false) { pool = new TPoolAllocator; infoSink = new TInfoSink; for (int s = 0; s < EShLangCount; ++s) { - intermediate[s] = 0; + intermediate[s] = nullptr; newedIntermediate[s] = false; } } diff --git a/glslang/MachineIndependent/SymbolTable.cpp b/glslang/MachineIndependent/SymbolTable.cpp index b140686d6..57b868a20 100644 --- a/glslang/MachineIndependent/SymbolTable.cpp +++ b/glslang/MachineIndependent/SymbolTable.cpp @@ -416,7 +416,7 @@ TAnonMember* TAnonMember::clone() const // copy of the original container. assert(0); - return 0; + return nullptr; } TSymbolTableLevel* TSymbolTableLevel::clone() const diff --git a/glslang/MachineIndependent/SymbolTable.h b/glslang/MachineIndependent/SymbolTable.h index 0d45e484c..bf427c5e4 100644 --- a/glslang/MachineIndependent/SymbolTable.h +++ b/glslang/MachineIndependent/SymbolTable.h @@ -84,7 +84,7 @@ typedef TVector TExtensionList; class TSymbol { public: POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(0), writable(true) { } + explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(nullptr), writable(true) { } virtual TSymbol* clone() const = 0; virtual ~TSymbol() { } // rely on all symbol owned memory coming from the pool @@ -97,18 +97,18 @@ public: changeName(NewPoolTString(newName.c_str())); } virtual const TString& getMangledName() const { return getName(); } - virtual TFunction* getAsFunction() { return 0; } - virtual const TFunction* getAsFunction() const { return 0; } - virtual TVariable* getAsVariable() { return 0; } - virtual const TVariable* getAsVariable() const { return 0; } - virtual const TAnonMember* getAsAnonMember() const { return 0; } + virtual TFunction* getAsFunction() { return nullptr; } + virtual const TFunction* getAsFunction() const { return nullptr; } + virtual TVariable* getAsVariable() { return nullptr; } + virtual const TVariable* getAsVariable() const { return nullptr; } + virtual const TAnonMember* getAsAnonMember() const { return nullptr; } virtual const TType& getType() const = 0; virtual TType& getWritableType() = 0; virtual void setUniqueId(long long id) { uniqueId = id; } virtual long long getUniqueId() const { return uniqueId; } virtual void setExtensions(int numExts, const char* const exts[]) { - assert(extensions == 0); + assert(extensions == nullptr); assert(numExts > 0); extensions = NewPoolObject(extensions); for (int e = 0; e < numExts; ++e) @@ -229,7 +229,7 @@ struct TParameter { if (param.name) name = NewPoolTString(param.name->c_str()); else - name = 0; + name = nullptr; type = param.type->clone(); defaultValue = param.defaultValue; return *this; @@ -243,7 +243,7 @@ struct TParameter { class TFunction : public TSymbol { public: explicit TFunction(TOperator o) : - TSymbol(0), + TSymbol(nullptr), op(o), defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0) { } TFunction(const TString *name, const TType& retType, TOperator tOp = EOpNull) : @@ -411,7 +411,7 @@ protected: class TSymbolTableLevel { public: POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - TSymbolTableLevel() : defaultPrecision(0), anonId(0), thisLevel(false) { } + TSymbolTableLevel() : defaultPrecision(nullptr), anonId(0), thisLevel(false) { } ~TSymbolTableLevel(); bool insert(const TString& name, TSymbol* symbol) { @@ -493,7 +493,7 @@ public: { tLevel::const_iterator it = level.find(name); if (it == level.end()) - return 0; + return nullptr; else return (*it).second; } @@ -561,7 +561,7 @@ public: { // can call multiple times at one scope, will only latch on first call, // as we're tracking the previous scope's values, not the current values - if (defaultPrecision != 0) + if (defaultPrecision != nullptr) return; defaultPrecision = new TPrecisionQualifier[EbtNumTypes]; @@ -573,7 +573,7 @@ public: { // can be called for table level pops that didn't set the // defaults - if (defaultPrecision == 0 || p == 0) + if (defaultPrecision == nullptr || p == nullptr) return; for (int t = 0; t < EbtNumTypes; ++t) @@ -622,7 +622,7 @@ public: // don't deallocate levels passed in from elsewhere while (table.size() > adoptedLevels) - pop(0); + pop(nullptr); } void adoptLevels(TSymbolTable& symTable) @@ -783,7 +783,7 @@ public: // Normal find of a symbol, that can optionally say whether the symbol was found // at a built-in level or the current top-scope level. - TSymbol* find(const TString& name, bool* builtIn = 0, bool* currentScope = 0, int* thisDepthP = 0) + TSymbol* find(const TString& name, bool* builtIn = nullptr, bool* currentScope = nullptr, int* thisDepthP = nullptr) { int level = currentLevel(); TSymbol* symbol; @@ -827,7 +827,7 @@ public: ++thisDepth; symbol = table[level]->find(name); --level; - } while (symbol == 0 && level >= 0); + } while (symbol == nullptr && level >= 0); if (! table[level + 1]->isThisLevel()) thisDepth = 0; diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index a5fd10753..154180258 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -1066,8 +1066,8 @@ void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * con if (strcmp(extension, "GL_NV_mesh_shader") == 0) { requireStage(loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask | EShLangFragmentMask), "#extension GL_NV_mesh_shader"); - profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_NV_mesh_shader"); - profileRequires(loc, EEsProfile, 320, 0, "#extension GL_NV_mesh_shader"); + profileRequires(loc, ECoreProfile, 450, nullptr, "#extension GL_NV_mesh_shader"); + profileRequires(loc, EEsProfile, 320, nullptr, "#extension GL_NV_mesh_shader"); if (extensionTurnedOn(E_GL_EXT_mesh_shader)) { error(loc, "GL_EXT_mesh_shader is already turned on, and not allowed with", "#extension", extension); } @@ -1075,8 +1075,8 @@ void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * con else if (strcmp(extension, "GL_EXT_mesh_shader") == 0) { requireStage(loc, (EShLanguageMask)(EShLangTaskMask | EShLangMeshMask | EShLangFragmentMask), "#extension GL_EXT_mesh_shader"); - profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_EXT_mesh_shader"); - profileRequires(loc, EEsProfile, 320, 0, "#extension GL_EXT_mesh_shader"); + profileRequires(loc, ECoreProfile, 450, nullptr, "#extension GL_EXT_mesh_shader"); + profileRequires(loc, EEsProfile, 320, nullptr, "#extension GL_EXT_mesh_shader"); if (extensionTurnedOn(E_GL_NV_mesh_shader)) { error(loc, "GL_NV_mesh_shader is already turned on, and not allowed with", "#extension", extension); } diff --git a/glslang/MachineIndependent/glslang_tab.cpp b/glslang/MachineIndependent/glslang_tab.cpp index 7ca3e711b..7a5ac521c 100644 --- a/glslang/MachineIndependent/glslang_tab.cpp +++ b/glslang/MachineIndependent/glslang_tab.cpp @@ -5446,7 +5446,7 @@ yyreduce: case 31: /* function_call_header_with_parameters: function_call_header assignment_expression */ #line 526 "MachineIndependent/glslang.y" { - TParameter param = { 0, new TType }; + TParameter param = { nullptr, new TType }; param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); (yyvsp[-1].interm).function->addParameter(param); (yyval.interm).function = (yyvsp[-1].interm).function; @@ -5458,7 +5458,7 @@ yyreduce: case 32: /* function_call_header_with_parameters: function_call_header_with_parameters COMMA assignment_expression */ #line 533 "MachineIndependent/glslang.y" { - TParameter param = { 0, new TType }; + TParameter param = { nullptr, new TType }; param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); (yyvsp[-2].interm).function->addParameter(param); (yyval.interm).function = (yyvsp[-2].interm).function; @@ -5479,7 +5479,7 @@ yyreduce: #line 551 "MachineIndependent/glslang.y" { // Constructor - (yyval.interm).intermNode = 0; + (yyval.interm).intermNode = nullptr; (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } #line 5486 "MachineIndependent/glslang_tab.cpp" @@ -5491,8 +5491,8 @@ yyreduce: // // Should be a method or subroutine call, but we haven't recognized the arguments yet. // - (yyval.interm).function = 0; - (yyval.interm).intermNode = 0; + (yyval.interm).function = nullptr; + (yyval.interm).intermNode = nullptr; TIntermMethod* method = (yyvsp[0].interm.intermTypedNode)->getAsMethodNode(); if (method) { @@ -5508,7 +5508,7 @@ yyreduce: parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "function call, method, or subroutine call expected", "", ""); } - if ((yyval.interm).function == 0) { + if ((yyval.interm).function == nullptr) { // error recover TString* empty = NewPoolTString(""); (yyval.interm).function = new TFunction(empty, TType(EbtVoid), EOpNull); @@ -5521,7 +5521,7 @@ yyreduce: #line 584 "MachineIndependent/glslang.y" { // Constructor - (yyval.interm).intermNode = 0; + (yyval.interm).intermNode = nullptr; (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } #line 5528 "MachineIndependent/glslang_tab.cpp" @@ -5612,7 +5612,7 @@ yyreduce: #line 637 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "*", EOpMul, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } #line 5619 "MachineIndependent/glslang_tab.cpp" @@ -5622,7 +5622,7 @@ yyreduce: #line 642 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "/", EOpDiv, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } #line 5629 "MachineIndependent/glslang_tab.cpp" @@ -5633,7 +5633,7 @@ yyreduce: { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "%"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "%", EOpMod, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } #line 5640 "MachineIndependent/glslang_tab.cpp" @@ -5649,7 +5649,7 @@ yyreduce: #line 657 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "+", EOpAdd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } #line 5656 "MachineIndependent/glslang_tab.cpp" @@ -5659,7 +5659,7 @@ yyreduce: #line 662 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "-", EOpSub, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } #line 5666 "MachineIndependent/glslang_tab.cpp" @@ -5676,7 +5676,7 @@ yyreduce: { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift left"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<<", EOpLeftShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } #line 5683 "MachineIndependent/glslang_tab.cpp" @@ -5687,7 +5687,7 @@ yyreduce: { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift right"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">>", EOpRightShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } #line 5694 "MachineIndependent/glslang_tab.cpp" @@ -5703,7 +5703,7 @@ yyreduce: #line 687 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<", EOpLessThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } #line 5710 "MachineIndependent/glslang_tab.cpp" @@ -5713,7 +5713,7 @@ yyreduce: #line 692 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">", EOpGreaterThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } #line 5720 "MachineIndependent/glslang_tab.cpp" @@ -5723,7 +5723,7 @@ yyreduce: #line 697 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<=", EOpLessThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } #line 5730 "MachineIndependent/glslang_tab.cpp" @@ -5733,7 +5733,7 @@ yyreduce: #line 702 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">=", EOpGreaterThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } #line 5740 "MachineIndependent/glslang_tab.cpp" @@ -5753,7 +5753,7 @@ yyreduce: parseContext.specializationCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "=="); parseContext.referenceCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "=="); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "==", EOpEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } #line 5760 "MachineIndependent/glslang_tab.cpp" @@ -5767,7 +5767,7 @@ yyreduce: parseContext.specializationCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "!="); parseContext.referenceCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "!="); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "!=", EOpNotEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } #line 5774 "MachineIndependent/glslang_tab.cpp" @@ -5784,7 +5784,7 @@ yyreduce: { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise and"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&", EOpAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } #line 5791 "MachineIndependent/glslang_tab.cpp" @@ -5801,7 +5801,7 @@ yyreduce: { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise exclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^", EOpExclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } #line 5808 "MachineIndependent/glslang_tab.cpp" @@ -5818,7 +5818,7 @@ yyreduce: { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise inclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "|", EOpInclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } #line 5825 "MachineIndependent/glslang_tab.cpp" @@ -5834,7 +5834,7 @@ yyreduce: #line 763 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&&", EOpLogicalAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } #line 5841 "MachineIndependent/glslang_tab.cpp" @@ -5850,7 +5850,7 @@ yyreduce: #line 772 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^^", EOpLogicalXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } #line 5857 "MachineIndependent/glslang_tab.cpp" @@ -5866,7 +5866,7 @@ yyreduce: #line 781 "MachineIndependent/glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "||", EOpLogicalOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) + if ((yyval.interm.intermTypedNode) == nullptr) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } #line 5873 "MachineIndependent/glslang_tab.cpp" @@ -5895,7 +5895,7 @@ yyreduce: parseContext.rValueErrorCheck((yyvsp[-1].lex).loc, ":", (yyvsp[-2].interm.intermTypedNode)); parseContext.rValueErrorCheck((yyvsp[-1].lex).loc, ":", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.intermediate.addSelection((yyvsp[-5].interm.intermTypedNode), (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-4].lex).loc); - if ((yyval.interm.intermTypedNode) == 0) { + if ((yyval.interm.intermTypedNode) == nullptr) { parseContext.binaryOpError((yyvsp[-4].lex).loc, ":", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), (yyvsp[0].interm.intermTypedNode)->getCompleteString(parseContext.intermediate.getEnhancedMsgs())); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } @@ -5919,7 +5919,7 @@ yyreduce: parseContext.lValueErrorCheck((yyvsp[-1].interm).loc, "assign", (yyvsp[-2].interm.intermTypedNode)); parseContext.rValueErrorCheck((yyvsp[-1].interm).loc, "assign", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.addAssign((yyvsp[-1].interm).loc, (yyvsp[-1].interm).op, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - if ((yyval.interm.intermTypedNode) == 0) { + if ((yyval.interm.intermTypedNode) == nullptr) { parseContext.assignError((yyvsp[-1].interm).loc, "assign", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), (yyvsp[0].interm.intermTypedNode)->getCompleteString(parseContext.intermediate.getEnhancedMsgs())); (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } @@ -6040,7 +6040,7 @@ yyreduce: { parseContext.samplerConstructorLocationCheck((yyvsp[-1].lex).loc, ",", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.intermediate.addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); - if ((yyval.interm.intermTypedNode) == 0) { + if ((yyval.interm.intermTypedNode) == nullptr) { parseContext.binaryOpError((yyvsp[-1].lex).loc, ",", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(parseContext.intermediate.getEnhancedMsgs()), (yyvsp[0].interm.intermTypedNode)->getCompleteString(parseContext.intermediate.getEnhancedMsgs())); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } @@ -6061,7 +6061,7 @@ yyreduce: #line 894 "MachineIndependent/glslang.y" { parseContext.handleFunctionDeclarator((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).function, true /* prototype */); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature } #line 6068 "MachineIndependent/glslang_tab.cpp" @@ -6073,7 +6073,7 @@ yyreduce: parseContext.requireExtensions((yyvsp[-1].interm).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier"); (yyvsp[-1].interm).function->setSpirvInstruction(*(yyvsp[-2].interm.spirvInst)); // Attach SPIR-V intruction qualifier parseContext.handleFunctionDeclarator((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).function, true /* prototype */); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature } #line 6080 "MachineIndependent/glslang_tab.cpp" @@ -6084,7 +6084,7 @@ yyreduce: { parseContext.globalCheck((yyvsp[0].lex).loc, "SPIR-V execution mode qualifier"); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier"); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 6090 "MachineIndependent/glslang_tab.cpp" break; @@ -6102,11 +6102,11 @@ yyreduce: case 98: /* declaration: PRECISION precision_qualifier type_specifier SEMICOLON */ #line 918 "MachineIndependent/glslang.y" { - parseContext.profileRequires((yyvsp[-3].lex).loc, ENoProfile, 130, 0, "precision statement"); + parseContext.profileRequires((yyvsp[-3].lex).loc, ENoProfile, 130, nullptr, "precision statement"); // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]); parseContext.setDefaultPrecision((yyvsp[-3].lex).loc, (yyvsp[-1].interm.type), (yyvsp[-2].interm.type).qualifier.precision); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 6112 "MachineIndependent/glslang_tab.cpp" break; @@ -6115,7 +6115,7 @@ yyreduce: #line 925 "MachineIndependent/glslang.y" { parseContext.declareBlock((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).typeList); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 6121 "MachineIndependent/glslang_tab.cpp" break; @@ -6124,7 +6124,7 @@ yyreduce: #line 929 "MachineIndependent/glslang.y" { parseContext.declareBlock((yyvsp[-2].interm).loc, *(yyvsp[-2].interm).typeList, (yyvsp[-1].lex).string); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 6130 "MachineIndependent/glslang_tab.cpp" break; @@ -6133,7 +6133,7 @@ yyreduce: #line 933 "MachineIndependent/glslang.y" { parseContext.declareBlock((yyvsp[-3].interm).loc, *(yyvsp[-3].interm).typeList, (yyvsp[-2].lex).string, (yyvsp[-1].interm).arraySizes); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 6139 "MachineIndependent/glslang_tab.cpp" break; @@ -6143,7 +6143,7 @@ yyreduce: { parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); parseContext.updateStandaloneQualifierDefaults((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type)); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 6149 "MachineIndependent/glslang_tab.cpp" break; @@ -6153,7 +6153,7 @@ yyreduce: { parseContext.checkNoShaderLayouts((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).shaderQualifiers); parseContext.addQualifierToExisting((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, *(yyvsp[-1].lex).string); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 6159 "MachineIndependent/glslang_tab.cpp" break; @@ -6164,7 +6164,7 @@ yyreduce: parseContext.checkNoShaderLayouts((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).shaderQualifiers); (yyvsp[-1].interm.identifierList)->push_back((yyvsp[-2].lex).string); parseContext.addQualifierToExisting((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier, *(yyvsp[-1].interm.identifierList)); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 6170 "MachineIndependent/glslang_tab.cpp" break; @@ -6330,7 +6330,7 @@ yyreduce: { if ((yyvsp[-1].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-1].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[-1].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + parseContext.profileRequires((yyvsp[-1].interm.type).loc, EEsProfile, 300, nullptr, "arrayed type"); parseContext.arraySizeRequiredCheck((yyvsp[-1].interm.type).loc, *(yyvsp[-1].interm.type).arraySizes); } if ((yyvsp[-1].interm.type).basicType == EbtVoid) { @@ -6350,7 +6350,7 @@ yyreduce: { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, nullptr, "arrayed type"); parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); } TType* type = new TType((yyvsp[-2].interm.type)); @@ -6427,7 +6427,7 @@ yyreduce: case 124: /* parameter_type_specifier: type_specifier */ #line 1146 "MachineIndependent/glslang.y" { - TParameter param = { 0, new TType((yyvsp[0].interm.type)) }; + TParameter param = { nullptr, new TType((yyvsp[0].interm.type)) }; (yyval.interm).param = param; if ((yyvsp[0].interm.type).arraySizes) parseContext.arraySizeRequiredCheck((yyvsp[0].interm.type).loc, *(yyvsp[0].interm.type).arraySizes); @@ -6475,7 +6475,7 @@ yyreduce: #line 1171 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-4].interm).type; - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, 0, (yyvsp[0].interm.intermTypedNode)); + TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, nullptr, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-4].interm).intermNode, initNode, (yyvsp[-1].lex).loc); } #line 6482 "MachineIndependent/glslang_tab.cpp" @@ -6485,7 +6485,7 @@ yyreduce: #line 1179 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[0].interm.type); - (yyval.interm).intermNode = 0; + (yyval.interm).intermNode = nullptr; parseContext.declareTypeDefaults((yyval.interm).loc, (yyval.interm).type); @@ -6497,7 +6497,7 @@ yyreduce: #line 1186 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-1].interm.type); - (yyval.interm).intermNode = 0; + (yyval.interm).intermNode = nullptr; parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-1].interm.type)); } #line 6504 "MachineIndependent/glslang_tab.cpp" @@ -6507,7 +6507,7 @@ yyreduce: #line 1191 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-2].interm.type); - (yyval.interm).intermNode = 0; + (yyval.interm).intermNode = nullptr; parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-2].interm.type), (yyvsp[0].interm).arraySizes); } #line 6514 "MachineIndependent/glslang_tab.cpp" @@ -6518,7 +6518,7 @@ yyreduce: { (yyval.interm).type = (yyvsp[-4].interm.type); TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-4].interm.type), (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate(nullptr, initNode, (yyvsp[-1].lex).loc); } #line 6524 "MachineIndependent/glslang_tab.cpp" break; @@ -6527,8 +6527,8 @@ yyreduce: #line 1201 "MachineIndependent/glslang.y" { (yyval.interm).type = (yyvsp[-3].interm.type); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); + TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), nullptr, (yyvsp[0].interm.intermTypedNode)); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate(nullptr, initNode, (yyvsp[-1].lex).loc); } #line 6534 "MachineIndependent/glslang_tab.cpp" break; @@ -6541,7 +6541,7 @@ yyreduce: parseContext.globalQualifierTypeCheck((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier, (yyval.interm.type)); if ((yyvsp[0].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[0].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[0].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + parseContext.profileRequires((yyvsp[0].interm.type).loc, EEsProfile, 300, nullptr, "arrayed type"); } parseContext.precisionQualifierCheck((yyval.interm.type).loc, (yyval.interm.type).basicType, (yyval.interm.type).qualifier); } @@ -6556,7 +6556,7 @@ yyreduce: if ((yyvsp[0].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[0].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[0].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + parseContext.profileRequires((yyvsp[0].interm.type).loc, EEsProfile, 300, nullptr, "arrayed type"); } if ((yyvsp[0].interm.type).arraySizes && parseContext.arrayQualifierError((yyvsp[0].interm.type).loc, (yyvsp[-1].interm.type).qualifier)) @@ -6581,7 +6581,7 @@ yyreduce: #line 1247 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "invariant"); - parseContext.profileRequires((yyval.interm.type).loc, ENoProfile, 120, 0, "invariant"); + parseContext.profileRequires((yyval.interm.type).loc, ENoProfile, 120, nullptr, "invariant"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.invariant = true; } @@ -6592,8 +6592,8 @@ yyreduce: #line 1256 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "smooth"); - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "smooth"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "smooth"); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, nullptr, "smooth"); + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, nullptr, "smooth"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.smooth = true; } @@ -6604,8 +6604,8 @@ yyreduce: #line 1263 "MachineIndependent/glslang.y" { parseContext.globalCheck((yyvsp[0].lex).loc, "flat"); - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "flat"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "flat"); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, nullptr, "flat"); + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, nullptr, "flat"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.flat = true; } @@ -6617,7 +6617,7 @@ yyreduce: { parseContext.globalCheck((yyvsp[0].lex).loc, "noperspective"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "noperspective"); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, nullptr, "noperspective"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.nopersp = true; } @@ -6945,8 +6945,8 @@ yyreduce: case 172: /* storage_qualifier: CENTROID */ #line 1466 "MachineIndependent/glslang.y" { - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 120, 0, "centroid"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "centroid"); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 120, nullptr, "centroid"); + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, nullptr, "centroid"); parseContext.globalCheck((yyvsp[0].lex).loc, "centroid"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.centroid = true; @@ -6969,7 +6969,7 @@ yyreduce: { parseContext.globalCheck((yyvsp[0].lex).loc, "shared"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 310, 0, "shared"); + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 310, nullptr, "shared"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshMask | EShLangTaskMask), "shared"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqShared; @@ -7415,7 +7415,7 @@ yyreduce: case 214: /* type_parameter_specifier_opt: %empty */ #line 1745 "MachineIndependent/glslang.y" { - (yyval.interm.typeParameters) = 0; + (yyval.interm.typeParameters) = nullptr; } #line 7421 "MachineIndependent/glslang_tab.cpp" break; @@ -10779,7 +10779,7 @@ yyreduce: case 533: /* precision_qualifier: HIGH_PRECISION */ #line 3534 "MachineIndependent/glslang.y" { - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "highp precision qualifier"); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, nullptr, "highp precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqHigh); } @@ -10789,7 +10789,7 @@ yyreduce: case 534: /* precision_qualifier: MEDIUM_PRECISION */ #line 3539 "MachineIndependent/glslang.y" { - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "mediump precision qualifier"); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, nullptr, "mediump precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqMedium); } @@ -10799,7 +10799,7 @@ yyreduce: case 535: /* precision_qualifier: LOW_PRECISION */ #line 3544 "MachineIndependent/glslang.y" { - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "lowp precision qualifier"); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, nullptr, "lowp precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqLow); } @@ -10874,7 +10874,7 @@ yyreduce: { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, nullptr, "arrayed type"); if (parseContext.isEsProfile()) parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); } @@ -10901,7 +10901,7 @@ yyreduce: { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, nullptr, "arrayed type"); if (parseContext.isEsProfile()) parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); } @@ -11009,7 +11009,7 @@ yyreduce: case 552: /* initializer_list: initializer */ #line 3691 "MachineIndependent/glslang.y" { - (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); + (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(nullptr, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); } #line 11015 "MachineIndependent/glslang_tab.cpp" break; @@ -11100,7 +11100,7 @@ yyreduce: case 566: /* compound_statement: LEFT_BRACE RIGHT_BRACE */ #line 3735 "MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = 0; } + { (yyval.interm.intermNode) = nullptr; } #line 11105 "MachineIndependent/glslang_tab.cpp" break; @@ -11185,7 +11185,7 @@ yyreduce: case 576: /* compound_statement_no_new_scope: LEFT_BRACE RIGHT_BRACE */ #line 3778 "MachineIndependent/glslang.y" { - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 11191 "MachineIndependent/glslang_tab.cpp" break; @@ -11206,8 +11206,8 @@ yyreduce: (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || (yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { - parseContext.wrapupSwitchSubsequence(0, (yyvsp[0].interm.intermNode)); - (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case + parseContext.wrapupSwitchSubsequence(nullptr, (yyvsp[0].interm.intermNode)); + (yyval.interm.intermNode) = nullptr; // start a fresh subsequence for what's after this case } } #line 11214 "MachineIndependent/glslang_tab.cpp" @@ -11218,8 +11218,8 @@ yyreduce: { if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || (yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { - parseContext.wrapupSwitchSubsequence((yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : 0, (yyvsp[0].interm.intermNode)); - (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case + parseContext.wrapupSwitchSubsequence((yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : nullptr, (yyvsp[0].interm.intermNode)); + (yyval.interm.intermNode) = nullptr; // start a fresh subsequence for what's after this case } else (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); } @@ -11228,7 +11228,7 @@ yyreduce: case 580: /* expression_statement: SEMICOLON */ #line 3808 "MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = 0; } + { (yyval.interm.intermNode) = nullptr; } #line 11233 "MachineIndependent/glslang_tab.cpp" break; @@ -11278,7 +11278,7 @@ yyreduce: #line 3836 "MachineIndependent/glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode); - (yyval.interm.nodePair).node2 = 0; + (yyval.interm.nodePair).node2 = nullptr; } #line 11284 "MachineIndependent/glslang_tab.cpp" break; @@ -11298,11 +11298,11 @@ yyreduce: parseContext.boolCheck((yyvsp[-2].lex).loc, (yyvsp[-3].interm.type)); TType type((yyvsp[-3].interm.type)); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); + TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), nullptr, (yyvsp[0].interm.intermTypedNode)); if (initNode) (yyval.interm.intermTypedNode) = initNode->getAsTyped(); else - (yyval.interm.intermTypedNode) = 0; + (yyval.interm.intermTypedNode) = nullptr; } #line 11308 "MachineIndependent/glslang_tab.cpp" break; @@ -11341,7 +11341,7 @@ yyreduce: case 592: /* switch_statement_nonattributed: SWITCH LEFT_PAREN expression RIGHT_PAREN $@9 LEFT_BRACE switch_statement_list RIGHT_BRACE */ #line 3881 "MachineIndependent/glslang.y" { - (yyval.interm.intermNode) = parseContext.addSwitch((yyvsp[-7].lex).loc, (yyvsp[-5].interm.intermTypedNode), (yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : 0); + (yyval.interm.intermNode) = parseContext.addSwitch((yyvsp[-7].lex).loc, (yyvsp[-5].interm.intermTypedNode), (yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : nullptr); delete parseContext.switchSequenceStack.back(); parseContext.switchSequenceStack.pop_back(); parseContext.switchLevel.pop_back(); @@ -11355,7 +11355,7 @@ yyreduce: case 593: /* switch_statement_list: %empty */ #line 3893 "MachineIndependent/glslang.y" { - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 11361 "MachineIndependent/glslang_tab.cpp" break; @@ -11371,7 +11371,7 @@ yyreduce: case 595: /* case_label: CASE expression COLON */ #line 3902 "MachineIndependent/glslang.y" { - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; if (parseContext.switchLevel.size() == 0) parseContext.error((yyvsp[-2].lex).loc, "cannot appear outside switch statement", "case", ""); else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) @@ -11388,7 +11388,7 @@ yyreduce: case 596: /* case_label: DEFAULT COLON */ #line 3914 "MachineIndependent/glslang.y" { - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; if (parseContext.switchLevel.size() == 0) parseContext.error((yyvsp[-1].lex).loc, "cannot appear outside switch statement", "default", ""); else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) @@ -11434,7 +11434,7 @@ yyreduce: #line 3946 "MachineIndependent/glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, true, (yyvsp[-5].lex).loc); + (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), nullptr, true, (yyvsp[-5].lex).loc); --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; @@ -11461,7 +11461,7 @@ yyreduce: parseContext.boolCheck((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode)); - (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[-5].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, false, (yyvsp[-4].lex).loc); + (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[-5].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), nullptr, false, (yyvsp[-4].lex).loc); parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; @@ -11525,7 +11525,7 @@ yyreduce: case 608: /* conditionopt: %empty */ #line 4004 "MachineIndependent/glslang.y" { - (yyval.interm.intermTypedNode) = 0; + (yyval.interm.intermTypedNode) = nullptr; } #line 11531 "MachineIndependent/glslang_tab.cpp" break; @@ -11534,7 +11534,7 @@ yyreduce: #line 4010 "MachineIndependent/glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode); - (yyval.interm.nodePair).node2 = 0; + (yyval.interm.nodePair).node2 = nullptr; } #line 11540 "MachineIndependent/glslang_tab.cpp" break; @@ -11826,7 +11826,7 @@ yyreduce: #line 4190 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-1].lex).i); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 11832 "MachineIndependent/glslang_tab.cpp" break; @@ -11836,7 +11836,7 @@ yyreduce: { parseContext.intermediate.insertSpirvRequirement((yyvsp[-3].interm.spirvReq)); parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-1].lex).i); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 11842 "MachineIndependent/glslang_tab.cpp" break; @@ -11845,7 +11845,7 @@ yyreduce: #line 4199 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 11851 "MachineIndependent/glslang_tab.cpp" break; @@ -11855,7 +11855,7 @@ yyreduce: { parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); parseContext.intermediate.insertSpirvExecutionMode((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 11861 "MachineIndependent/glslang_tab.cpp" break; @@ -11864,7 +11864,7 @@ yyreduce: #line 4208 "MachineIndependent/glslang.y" { parseContext.intermediate.insertSpirvExecutionModeId((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 11870 "MachineIndependent/glslang_tab.cpp" break; @@ -11874,7 +11874,7 @@ yyreduce: { parseContext.intermediate.insertSpirvRequirement((yyvsp[-5].interm.spirvReq)); parseContext.intermediate.insertSpirvExecutionModeId((yyvsp[-3].lex).i, (yyvsp[-1].interm.intermNode)->getAsAggregate()); - (yyval.interm.intermNode) = 0; + (yyval.interm.intermNode) = nullptr; } #line 11880 "MachineIndependent/glslang_tab.cpp" break; diff --git a/glslang/MachineIndependent/intermOut.cpp b/glslang/MachineIndependent/intermOut.cpp index a79a6928b..f797ada9f 100644 --- a/glslang/MachineIndependent/intermOut.cpp +++ b/glslang/MachineIndependent/intermOut.cpp @@ -1552,7 +1552,7 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree) break; } - if (treeRoot == 0 || ! tree) + if (treeRoot == nullptr || ! tree) return; TOutputTraverser it(infoSink); diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index fab65a76e..ff9761492 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -1383,7 +1383,7 @@ void TIntermediate::checkCallGraphCycles(TInfoSink& infoSink) TCall* newRoot; do { // See if we have unvisited parts of the graph. - newRoot = 0; + newRoot = nullptr; for (TGraph::iterator call = callGraph.begin(); call != callGraph.end(); ++call) { if (! call->visited) { newRoot = &(*call); diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 1bb4e9770..b9ad7db3b 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -284,7 +284,7 @@ public: explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : language(l), profile(p), version(v), - treeRoot(0), + treeRoot(nullptr), resources(TBuiltInResource{}), numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false), invertY(false), diff --git a/glslang/MachineIndependent/parseConst.cpp b/glslang/MachineIndependent/parseConst.cpp index 6c182991f..835097234 100644 --- a/glslang/MachineIndependent/parseConst.cpp +++ b/glslang/MachineIndependent/parseConst.cpp @@ -198,7 +198,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node) bool TIntermediate::parseConstTree(TIntermNode* root, TConstUnionArray unionArray, TOperator constructorType, const TType& t, bool singleConstantParam) { - if (root == 0) + if (root == nullptr) return false; TConstTraverser it(unionArray, singleConstantParam, constructorType, t); diff --git a/glslang/MachineIndependent/parseVersions.h b/glslang/MachineIndependent/parseVersions.h index 3c52ff1aa..cdf4524c0 100644 --- a/glslang/MachineIndependent/parseVersions.h +++ b/glslang/MachineIndependent/parseVersions.h @@ -65,7 +65,7 @@ public: infoSink(infoSink), version(version), language(language), spvVersion(spvVersion), - intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { } + intermediate(interm), messages(messages), numErrors(0), currentScanner(nullptr) { } virtual ~TParseVersions() { } void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc); void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc); diff --git a/glslang/MachineIndependent/preprocessor/PpContext.cpp b/glslang/MachineIndependent/preprocessor/PpContext.cpp index 1363ce2be..70f511978 100644 --- a/glslang/MachineIndependent/preprocessor/PpContext.cpp +++ b/glslang/MachineIndependent/preprocessor/PpContext.cpp @@ -85,7 +85,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace glslang { TPpContext::TPpContext(TParseContextBase& pc, const std::string& rootFileName, TShader::Includer& inclr) : - preamble(0), strings(0), previous_token('\n'), parseContext(pc), includer(inclr), inComment(false), + preamble(nullptr), strings(nullptr), previous_token('\n'), parseContext(pc), includer(inclr), inComment(false), rootFileName(rootFileName), currentSourceFile(rootFileName), disableEscapeSequences(false) diff --git a/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/glslang/MachineIndependent/preprocessor/PpTokens.cpp index 7ed58703f..e17eeafda 100644 --- a/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ b/glslang/MachineIndependent/preprocessor/PpTokens.cpp @@ -121,7 +121,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken if (atom == '#') { if (peekToken('#')) { parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)"); - parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)"); + parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, nullptr, "token pasting (##)"); currentPos++; atom = PpAtomPaste; } diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index 9def592ba..a1aa5ea6b 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -423,7 +423,7 @@ getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& in ReturnBranchNodeSet()); TIntermNode* root = intermediate.getTreeRoot(); - if (root == 0) + if (root == nullptr) return result_tuple; NodeMapping& symbol_definition_mapping = std::get<0>(result_tuple); diff --git a/glslang/MachineIndependent/reflection.cpp b/glslang/MachineIndependent/reflection.cpp index 3061ff79e..144f85bdb 100644 --- a/glslang/MachineIndependent/reflection.cpp +++ b/glslang/MachineIndependent/reflection.cpp @@ -682,7 +682,7 @@ public: } // For a binary operation indexing into an aggregate, chase down the base of the aggregate. - // Return 0 if the topology does not fit this situation. + // Return nullptr if the topology does not fit this situation. TIntermSymbol* findBase(const TIntermBinary* node) { TIntermSymbol *base = node->getLeft()->getAsSymbolNode(); diff --git a/glslang/OSDependent/Unix/ossource.cpp b/glslang/OSDependent/Unix/ossource.cpp index b98df9348..9a31a9aad 100644 --- a/glslang/OSDependent/Unix/ossource.cpp +++ b/glslang/OSDependent/Unix/ossource.cpp @@ -76,7 +76,7 @@ OS_TLSIndex OS_AllocTLSIndex() // // Create global pool key. // - if ((pthread_key_create(&pPoolIndex, NULL)) != 0) { + if ((pthread_key_create(&pPoolIndex, nullptr)) != 0) { assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage"); return OS_INVALID_TLS_INDEX; } diff --git a/glslang/OSDependent/Windows/ossource.cpp b/glslang/OSDependent/Windows/ossource.cpp index 870840c56..fa372a2cc 100644 --- a/glslang/OSDependent/Windows/ossource.cpp +++ b/glslang/OSDependent/Windows/ossource.cpp @@ -113,7 +113,7 @@ HANDLE GlobalLock; void InitGlobalLock() { - GlobalLock = CreateMutex(0, false, 0); + GlobalLock = CreateMutex(nullptr, false, nullptr); } void GetGlobalLock() @@ -128,7 +128,7 @@ void ReleaseGlobalLock() unsigned int __stdcall EnterGenericThread (void* entry) { - return ((TThreadEntrypoint)entry)(0); + return ((TThreadEntrypoint)entry)(nullptr); } //#define DUMP_COUNTERS diff --git a/glslang/OSDependent/osinclude.h b/glslang/OSDependent/osinclude.h index fcfeff2cc..7eaa11340 100644 --- a/glslang/OSDependent/osinclude.h +++ b/glslang/OSDependent/osinclude.h @@ -41,7 +41,7 @@ namespace glslang { // Thread Local Storage Operations // typedef void* OS_TLSIndex; -#define OS_INVALID_TLS_INDEX ((void*)0) +#define OS_INVALID_TLS_INDEX nullptr OS_TLSIndex OS_AllocTLSIndex(); bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);