Skip to content

Commit 354c5af

Browse files
committed
(glslang) Simplifications - move nullptr to NULL
1 parent 0b29d52 commit 354c5af

40 files changed

Lines changed: 536 additions & 539 deletions

deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool InitThread()
102102
return false;
103103
}
104104

105-
glslang::SetThreadPoolAllocator(nullptr);
105+
glslang::SetThreadPoolAllocator(NULL);
106106

107107
return true;
108108
}

deps/glslang/glslang/SPIRV/GlslangToSpv.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
10191019
spv::SpvBuildLogger* buildLogger, glslang::SpvOptions& options)
10201020
: TIntermTraverser(true, false, true),
10211021
options(options),
1022-
shaderEntry(nullptr), currentFunction(nullptr),
1022+
shaderEntry(NULL), currentFunction(NULL),
10231023
sequenceDepth(0), logger(buildLogger),
10241024
builder(spvVersion, (glslang::GetKhronosToolId() << 16) | GetSpirvGeneratorVersion(), logger),
10251025
inEntryPoint(false), entryPointTerminated(false), linkageOnly(false),
@@ -2122,8 +2122,8 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
21222122
// false otherwise.
21232123
const auto bothSidesPolicy = [&]() -> bool {
21242124
// do we have both sides?
2125-
if (node->getTrueBlock() == nullptr ||
2126-
node->getFalseBlock() == nullptr)
2125+
if (node->getTrueBlock() == NULL ||
2126+
node->getFalseBlock() == NULL)
21272127
return false;
21282128

21292129
// required? (unless we write additional code to look for side effects
@@ -2223,13 +2223,13 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
22232223
spv::Builder::If ifBuilder(condition, control, builder);
22242224

22252225
// emit the "then" statement
2226-
if (node->getTrueBlock() != nullptr) {
2226+
if (node->getTrueBlock() != NULL) {
22272227
node->getTrueBlock()->traverse(this);
22282228
if (result != spv::NoResult)
22292229
builder.createStore(accessChainLoad(node->getTrueBlock()->getAsTyped()->getType()), result);
22302230
}
22312231

2232-
if (node->getFalseBlock() != nullptr) {
2232+
if (node->getFalseBlock() != NULL) {
22332233
ifBuilder.makeBeginElse();
22342234
// emit the "else" statement
22352235
node->getFalseBlock()->traverse(this);
@@ -2288,7 +2288,7 @@ bool TGlslangToSpvTraverser::visitSwitch(glslang::TVisit /* visit */, glslang::T
22882288
// statements between the last case and the end of the switch statement
22892289
if ((caseValues.size() && (int)codeSegments.size() == valueIndexToSegment[caseValues.size() - 1]) ||
22902290
(int)codeSegments.size() == defaultSegment)
2291-
codeSegments.push_back(nullptr);
2291+
codeSegments.push_back(NULL);
22922292

22932293
// make the switch statement
22942294
std::vector<spv::Block*> segmentBlocks; // returned, as the blocks allocated in the call
@@ -2873,7 +2873,7 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
28732873
// nonuniform
28742874
builder.addMemberDecoration(spvType, member, TranslateNonUniformDecoration(glslangMember.getQualifier()));
28752875

2876-
if (glslangIntermediate->getHlslFunctionality1() && memberQualifier.semanticName != nullptr) {
2876+
if (glslangIntermediate->getHlslFunctionality1() && memberQualifier.semanticName != NULL) {
28772877
builder.addExtension("SPV_GOOGLE_hlsl_functionality1");
28782878
builder.addMemberDecoration(spvType, member, (spv::Decoration)spv::DecorationHlslSemanticGOOGLE,
28792879
memberQualifier.semanticName);
@@ -2920,7 +2920,7 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra
29202920
{
29212921
// First, see if this is sized with a node, meaning a specialization constant:
29222922
glslang::TIntermTyped* specNode = arraySizes.getDimNode(dim);
2923-
if (specNode != nullptr) {
2923+
if (specNode != NULL) {
29242924
builder.clearAccessChain();
29252925
specNode->traverse(this);
29262926
return accessChainLoad(specNode->getAsTyped()->getType());
@@ -6434,7 +6434,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
64346434
}
64356435
#endif
64366436

6437-
if (glslangIntermediate->getHlslFunctionality1() && symbol->getType().getQualifier().semanticName != nullptr) {
6437+
if (glslangIntermediate->getHlslFunctionality1() && symbol->getType().getQualifier().semanticName != NULL) {
64386438
builder.addExtension("SPV_GOOGLE_hlsl_functionality1");
64396439
builder.addDecoration(id, (spv::Decoration)spv::DecorationHlslSemanticGOOGLE,
64406440
symbol->getType().getQualifier().semanticName);
@@ -6631,15 +6631,15 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla
66316631
bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node)
66326632
{
66336633
// don't know what this is
6634-
if (node == nullptr)
6634+
if (node == NULL)
66356635
return false;
66366636

66376637
// a constant is safe
6638-
if (node->getAsConstantUnion() != nullptr)
6638+
if (node->getAsConstantUnion() != NULL)
66396639
return true;
66406640

66416641
// not a symbol means non-trivial
6642-
if (node->getAsSymbolNode() == nullptr)
6642+
if (node->getAsSymbolNode() == NULL)
66436643
return false;
66446644

66456645
// a symbol, depends on what's being read
@@ -6663,7 +6663,7 @@ bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node)
66636663
// Return true if trivial.
66646664
bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
66656665
{
6666-
if (node == nullptr)
6666+
if (node == NULL)
66676667
return false;
66686668

66696669
// count non scalars as trivial, as well as anything coming from HLSL
@@ -6679,7 +6679,7 @@ bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
66796679
// not a simple operation
66806680
const glslang::TIntermBinary* binaryNode = node->getAsBinaryNode();
66816681
const glslang::TIntermUnary* unaryNode = node->getAsUnaryNode();
6682-
if (binaryNode == nullptr && unaryNode == nullptr)
6682+
if (binaryNode == NULL && unaryNode == NULL)
66836683
return false;
66846684

66856685
// not on leaf nodes
@@ -6796,7 +6796,7 @@ void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsign
67966796
return;
67976797

67986798
glslang::SpvOptions defaultOptions;
6799-
if (options == nullptr)
6799+
if (options == NULL)
68006800
options = &defaultOptions;
68016801

68026802
glslang::GetThreadPoolAllocator().push();

deps/glslang/glslang/SPIRV/GlslangToSpv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ struct SpvOptions {
5555
};
5656

5757
void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
58-
SpvOptions* options = nullptr);
58+
SpvOptions* options = NULL);
5959
void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
60-
spv::SpvBuildLogger* logger, SpvOptions* options = nullptr);
60+
spv::SpvBuildLogger* logger, SpvOptions* options = NULL);
6161

6262
}

deps/glslang/glslang/SPIRV/InReadableOrder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class ReadableOrderTraverser {
7171
return;
7272
callback_(block);
7373
visited_.insert(block);
74-
Block* mergeBlock = nullptr;
75-
Block* continueBlock = nullptr;
74+
Block* mergeBlock = NULL;
75+
Block* continueBlock = NULL;
7676
auto mergeInst = block->getMergeInstruction();
7777
if (mergeInst) {
7878
Id mergeId = mergeInst->getIdOperand(0);

deps/glslang/glslang/SPIRV/SpvBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType)
15061506
if (numComponents == 1)
15071507
return scalar;
15081508

1509-
Instruction* smear = nullptr;
1509+
Instruction* smear = NULL;
15101510
if (generatingOpCodeForSpecConst) {
15111511
auto members = std::vector<spv::Id>(numComponents, scalar);
15121512
// Sometime even in spec-constant-op mode, the temporary vector created by

deps/glslang/glslang/SPIRV/doc.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ const char* ImageChannelOrderString(int format)
467467
case 17: return "sRGBA";
468468
case 18: return "sBGRA";
469469

470-
default:
470+
default:
471471
return "Bad";
472472
}
473473
}
@@ -739,7 +739,7 @@ const char* CapabilityString(int info)
739739
case 22: return "Int16";
740740
case 23: return "TessellationPointSize";
741741
case 24: return "GeometryPointSize";
742-
case 25: return "ImageGatherExtended";
742+
case 25: return "ImageGatherExtended";
743743
case 26: return "Bad";
744744
case 27: return "StorageImageMultisample";
745745
case 28: return "UniformBufferArrayDynamicIndexing";
@@ -1371,37 +1371,37 @@ void Parameterize()
13711371
DecorationOperands[DecorationAlignment].push(OperandLiteralNumber, "'Alignment'");
13721372

13731373
OperandClassParams[OperandSource].set(0, SourceString, 0);
1374-
OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, nullptr);
1375-
OperandClassParams[OperandAddressing].set(0, AddressingString, nullptr);
1376-
OperandClassParams[OperandMemory].set(0, MemoryString, nullptr);
1374+
OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, NULL);
1375+
OperandClassParams[OperandAddressing].set(0, AddressingString, NULL);
1376+
OperandClassParams[OperandMemory].set(0, MemoryString, NULL);
13771377
OperandClassParams[OperandExecutionMode].set(ExecutionModeCeiling, ExecutionModeString, ExecutionModeParams);
13781378
OperandClassParams[OperandExecutionMode].setOperands(ExecutionModeOperands);
1379-
OperandClassParams[OperandStorage].set(0, StorageClassString, nullptr);
1380-
OperandClassParams[OperandDimensionality].set(0, DimensionString, nullptr);
1381-
OperandClassParams[OperandSamplerAddressingMode].set(0, SamplerAddressingModeString, nullptr);
1382-
OperandClassParams[OperandSamplerFilterMode].set(0, SamplerFilterModeString, nullptr);
1383-
OperandClassParams[OperandSamplerImageFormat].set(0, ImageFormatString, nullptr);
1384-
OperandClassParams[OperandImageChannelOrder].set(0, ImageChannelOrderString, nullptr);
1385-
OperandClassParams[OperandImageChannelDataType].set(0, ImageChannelDataTypeString, nullptr);
1379+
OperandClassParams[OperandStorage].set(0, StorageClassString, NULL);
1380+
OperandClassParams[OperandDimensionality].set(0, DimensionString, NULL);
1381+
OperandClassParams[OperandSamplerAddressingMode].set(0, SamplerAddressingModeString, NULL);
1382+
OperandClassParams[OperandSamplerFilterMode].set(0, SamplerFilterModeString, NULL);
1383+
OperandClassParams[OperandSamplerImageFormat].set(0, ImageFormatString, NULL);
1384+
OperandClassParams[OperandImageChannelOrder].set(0, ImageChannelOrderString, NULL);
1385+
OperandClassParams[OperandImageChannelDataType].set(0, ImageChannelDataTypeString, NULL);
13861386
OperandClassParams[OperandImageOperands].set(ImageOperandsCeiling, ImageOperandsString, ImageOperandsParams, true);
1387-
OperandClassParams[OperandFPFastMath].set(0, FPFastMathString, nullptr, true);
1388-
OperandClassParams[OperandFPRoundingMode].set(0, FPRoundingModeString, nullptr);
1389-
OperandClassParams[OperandLinkageType].set(0, LinkageTypeString, nullptr);
1390-
OperandClassParams[OperandFuncParamAttr].set(0, FuncParamAttrString, nullptr);
1391-
OperandClassParams[OperandAccessQualifier].set(0, AccessQualifierString, nullptr);
1387+
OperandClassParams[OperandFPFastMath].set(0, FPFastMathString, NULL, true);
1388+
OperandClassParams[OperandFPRoundingMode].set(0, FPRoundingModeString, NULL);
1389+
OperandClassParams[OperandLinkageType].set(0, LinkageTypeString, NULL);
1390+
OperandClassParams[OperandFuncParamAttr].set(0, FuncParamAttrString, NULL);
1391+
OperandClassParams[OperandAccessQualifier].set(0, AccessQualifierString, NULL);
13921392
OperandClassParams[OperandDecoration].set(DecorationCeiling, DecorationString, DecorationParams);
13931393
OperandClassParams[OperandDecoration].setOperands(DecorationOperands);
1394-
OperandClassParams[OperandBuiltIn].set(0, BuiltInString, nullptr);
1394+
OperandClassParams[OperandBuiltIn].set(0, BuiltInString, NULL);
13951395
OperandClassParams[OperandSelect].set(SelectControlCeiling, SelectControlString, SelectionControlParams, true);
13961396
OperandClassParams[OperandLoop].set(LoopControlCeiling, LoopControlString, LoopControlParams, true);
13971397
OperandClassParams[OperandFunction].set(FunctionControlCeiling, FunctionControlString, FunctionControlParams, true);
1398-
OperandClassParams[OperandMemorySemantics].set(0, MemorySemanticsString, nullptr, true);
1399-
OperandClassParams[OperandMemoryAccess].set(0, MemoryAccessString, nullptr, true);
1400-
OperandClassParams[OperandScope].set(0, ScopeString, nullptr);
1401-
OperandClassParams[OperandGroupOperation].set(0, GroupOperationString, nullptr);
1402-
OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, nullptr);
1403-
OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, nullptr, true);
1404-
OperandClassParams[OperandCapability].set(0, CapabilityString, nullptr);
1398+
OperandClassParams[OperandMemorySemantics].set(0, MemorySemanticsString, NULL, true);
1399+
OperandClassParams[OperandMemoryAccess].set(0, MemoryAccessString, NULL, true);
1400+
OperandClassParams[OperandScope].set(0, ScopeString, NULL);
1401+
OperandClassParams[OperandGroupOperation].set(0, GroupOperationString, NULL);
1402+
OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, NULL);
1403+
OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, NULL, true);
1404+
OperandClassParams[OperandCapability].set(0, CapabilityString, NULL);
14051405
OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, 0);
14061406

14071407
// set name of operator, an initial set of <id> style operands, and the description
@@ -1943,11 +1943,11 @@ void Parameterize()
19431943
InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Base'");
19441944
InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Offset'");
19451945
InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Count'");
1946-
1946+
19471947
InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Base'");
19481948
InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Offset'");
19491949
InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Count'");
1950-
1950+
19511951
InstructionDesc[OpBitReverse].operands.push(OperandId, "'Base'");
19521952

19531953
InstructionDesc[OpBitCount].operands.push(OperandId, "'Base'");

deps/glslang/glslang/SPIRV/hex_float.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ inline uint8_t get_nibble_from_character(int character) {
643643
const char* dec = "0123456789";
644644
const char* lower = "abcdef";
645645
const char* upper = "ABCDEF";
646-
const char* p = nullptr;
646+
const char* p = NULL;
647647
if ((p = strchr(dec, character)))
648648
return static_cast<uint8_t>(p - dec);
649649
else if ((p = strchr(lower, character)))

deps/glslang/glslang/SPIRV/spvIR.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ const MemorySemanticsMask MemorySemanticsAllMemory =
8484

8585
class Instruction {
8686
public:
87-
Instruction(Id resultId, Id typeId, Op opCode) : resultId(resultId), typeId(typeId), opCode(opCode), block(nullptr) { }
88-
explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), block(nullptr) { }
87+
Instruction(Id resultId, Id typeId, Op opCode) : resultId(resultId), typeId(typeId), opCode(opCode), block(NULL) { }
88+
explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), block(NULL) { }
8989
virtual ~Instruction() {}
9090
void addIdOperand(Id id) { operands.push_back(id); }
9191
void addImmediateOperand(unsigned int immediate) { operands.push_back(immediate); }
@@ -182,16 +182,17 @@ class Block {
182182
bool isUnreachable() const { return unreachable; }
183183
// Returns the block's merge instruction, if one exists (otherwise null).
184184
const Instruction* getMergeInstruction() const {
185-
if (instructions.size() < 2) return nullptr;
185+
if (instructions.size() < 2) return NULL;
186186
const Instruction* nextToLast = (instructions.cend() - 2)->get();
187-
switch (nextToLast->getOpCode()) {
187+
switch (nextToLast->getOpCode())
188+
{
188189
case OpSelectionMerge:
189190
case OpLoopMerge:
190191
return nextToLast;
191192
default:
192-
return nullptr;
193+
break;
193194
}
194-
return nullptr;
195+
return NULL;
195196
}
196197

197198
bool isTerminated() const

deps/glslang/glslang/glslang/Include/Common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,12 @@ inline const TString String(const int i, const int /*base*/ = 10)
222222
#endif
223223

224224
struct TSourceLoc {
225-
void init() { name = nullptr; string = 0; line = 0; column = 0; }
225+
void init() { name = NULL; string = 0; line = 0; column = 0; }
226226
void init(int stringNum) { init(); string = stringNum; }
227227
// Returns the name if it exists. Otherwise, returns the string number.
228228
std::string getStringNameOrNum(bool quoteStringName = true) const
229229
{
230-
if (name != nullptr)
230+
if (name != NULL)
231231
return quoteStringName ? ("\"" + std::string(name) + "\"") : name;
232232
return std::to_string((long long)string);
233233
}

deps/glslang/glslang/glslang/Include/ConstantUnion.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -846,13 +846,13 @@ class TConstUnionArray {
846846
public:
847847
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
848848

849-
TConstUnionArray() : unionArray(nullptr) { }
849+
TConstUnionArray() : unionArray(NULL) { }
850850
virtual ~TConstUnionArray() { }
851851

852852
explicit TConstUnionArray(int size)
853853
{
854854
if (size == 0)
855-
unionArray = nullptr;
855+
unionArray = NULL;
856856
else
857857
unionArray = new TConstUnionVector(size);
858858
}
@@ -894,7 +894,7 @@ class TConstUnionArray {
894894
return sum;
895895
}
896896

897-
bool empty() const { return unionArray == nullptr; }
897+
bool empty() const { return unionArray == NULL; }
898898

899899
protected:
900900
typedef TVector<TConstUnion> TConstUnionVector;

0 commit comments

Comments
 (0)