Non-functional: Change a bunch of 0 to nullptr.

This commit is contained in:
John Kessenich 2016-11-27 17:30:14 -07:00
parent 509c4216e6
commit 5307eb2d1b
2 changed files with 44 additions and 44 deletions

View File

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits. // For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run). // For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1662" #define GLSLANG_REVISION "Overload400-PrecQual.1663"
#define GLSLANG_DATE "27-Nov-2016" #define GLSLANG_DATE "27-Nov-2016"

View File

@ -114,7 +114,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
{ {
// No operations work on blocks // No operations work on blocks
if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock) if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock)
return 0; return nullptr;
// Try converting the children's base types to compatible types. // Try converting the children's base types to compatible types.
TIntermTyped* child = addConversion(op, left->getType(), right); TIntermTyped* child = addConversion(op, left->getType(), right);
@ -125,7 +125,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
if (child) if (child)
left = child; left = child;
else else
return 0; return nullptr;
} }
// Convert the children's type shape to be compatible. // Convert the children's type shape to be compatible.
@ -275,10 +275,10 @@ TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermT
TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSourceLoc loc) TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSourceLoc loc)
{ {
if (child == 0) if (child == 0)
return 0; return nullptr;
if (child->getType().getBasicType() == EbtBlock) if (child->getType().getBasicType() == EbtBlock)
return 0; return nullptr;
switch (op) { switch (op) {
case EOpLogicalNot: case EOpLogicalNot:
@ -287,7 +287,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
} }
if (child->getType().getBasicType() != EbtBool || child->getType().isMatrix() || child->getType().isArray() || child->getType().isVector()) { if (child->getType().getBasicType() != EbtBool || child->getType().isMatrix() || child->getType().isArray() || child->getType().isVector()) {
return 0; return nullptr;
} }
break; break;
@ -297,7 +297,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
case EOpPreDecrement: case EOpPreDecrement:
case EOpNegative: case EOpNegative:
if (child->getType().getBasicType() == EbtStruct || child->getType().isArray()) if (child->getType().getBasicType() == EbtStruct || child->getType().isArray())
return 0; return nullptr;
default: break; // some compilers want this default: break; // some compilers want this
} }
@ -325,8 +325,8 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
child->getMatrixRows(), child->getMatrixRows(),
child->isVector()), child->isVector()),
child); child);
if (child == 0) if (child == nullptr)
return 0; return nullptr;
} }
// //
@ -379,8 +379,8 @@ TIntermTyped* TIntermediate::addBuiltInFunctionCall(const TSourceLoc& loc, TOper
// including constness (which would differ from the prototype). // including constness (which would differ from the prototype).
// //
TIntermTyped* child = childNode->getAsTyped(); TIntermTyped* child = childNode->getAsTyped();
if (child == 0) if (child == nullptr)
return 0; return nullptr;
if (child->getAsConstantUnion()) { if (child->getAsConstantUnion()) {
TIntermTyped* folded = child->getAsConstantUnion()->fold(op, returnType); TIntermTyped* folded = child->getAsConstantUnion()->fold(op, returnType);
@ -416,7 +416,7 @@ TIntermTyped* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator o
// //
if (node) { if (node) {
aggNode = node->getAsAggregate(); aggNode = node->getAsAggregate();
if (aggNode == 0 || aggNode->getOp() != EOpNull) { if (aggNode == nullptr || aggNode->getOp() != EOpNull) {
// //
// Make an aggregate containing this node. // Make an aggregate containing this node.
// //
@ -451,7 +451,7 @@ TIntermTyped* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator o
// Generally, this is focused on basic type conversion, not shape conversion. // Generally, this is focused on basic type conversion, not shape conversion.
// See addShapeConversion(). // See addShapeConversion().
// //
// Return 0 if a conversion can't be done. // Return nullptr if a conversion can't be done.
// //
TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TIntermTyped* node) const TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TIntermTyped* node) const
{ {
@ -460,7 +460,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
// //
switch (node->getBasicType()) { switch (node->getBasicType()) {
case EbtVoid: case EbtVoid:
return 0; return nullptr;
case EbtAtomicUint: case EbtAtomicUint:
case EbtSampler: case EbtSampler:
// opaque types can be passed to functions // opaque types can be passed to functions
@ -478,7 +478,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
break; break;
// otherwise, opaque types can't even be operated on, let alone converted // otherwise, opaque types can't even be operated on, let alone converted
return 0; return nullptr;
default: default:
break; break;
} }
@ -489,11 +489,11 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
// If one's a structure, then no conversions. // If one's a structure, then no conversions.
if (type.isStruct() || node->isStruct()) if (type.isStruct() || node->isStruct())
return 0; return nullptr;
// If one's an array, then no conversions. // If one's an array, then no conversions.
if (type.isArray() || node->getType().isArray()) if (type.isArray() || node->getType().isArray())
return 0; return nullptr;
// Note: callers are responsible for other aspects of shape, // Note: callers are responsible for other aspects of shape,
// like vector and matrix sizes. // like vector and matrix sizes.
@ -584,7 +584,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
if (canImplicitlyPromote(node->getType().getBasicType(), type.getBasicType(), op)) if (canImplicitlyPromote(node->getType().getBasicType(), type.getBasicType(), op))
promoteTo = type.getBasicType(); promoteTo = type.getBasicType();
else else
return 0; return nullptr;
break; break;
@ -606,7 +606,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
return node; return node;
else else
return 0; return nullptr;
default: default:
// default is to require a match; all exceptions should have case statements above // default is to require a match; all exceptions should have case statements above
@ -614,7 +614,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
if (type.getBasicType() == node->getType().getBasicType()) if (type.getBasicType() == node->getType().getBasicType())
return node; return node;
else else
return 0; return nullptr;
} }
if (node->getAsConstantUnion()) if (node->getAsConstantUnion())
@ -623,7 +623,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
// //
// Add a new newNode for the conversion. // Add a new newNode for the conversion.
// //
TIntermUnary* newNode = 0; TIntermUnary* newNode = nullptr;
TOperator newOp = EOpNull; TOperator newOp = EOpNull;
@ -642,7 +642,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EbtInt64: newOp = EOpConvInt64ToDouble; break; case EbtInt64: newOp = EOpConvInt64ToDouble; break;
case EbtUint64: newOp = EOpConvUint64ToDouble; break; case EbtUint64: newOp = EOpConvUint64ToDouble; break;
default: default:
return 0; return nullptr;
} }
break; break;
case EbtFloat: case EbtFloat:
@ -657,7 +657,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EbtInt64: newOp = EOpConvInt64ToFloat; break; case EbtInt64: newOp = EOpConvInt64ToFloat; break;
case EbtUint64: newOp = EOpConvUint64ToFloat; break; case EbtUint64: newOp = EOpConvUint64ToFloat; break;
default: default:
return 0; return nullptr;
} }
break; break;
#ifdef AMD_EXTENSIONS #ifdef AMD_EXTENSIONS
@ -671,7 +671,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EbtInt64: newOp = EOpConvInt64ToFloat16; break; case EbtInt64: newOp = EOpConvInt64ToFloat16; break;
case EbtUint64: newOp = EOpConvUint64ToFloat16; break; case EbtUint64: newOp = EOpConvUint64ToFloat16; break;
default: default:
return 0; return nullptr;
} }
break; break;
#endif #endif
@ -687,7 +687,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EbtInt64: newOp = EOpConvInt64ToBool; break; case EbtInt64: newOp = EOpConvInt64ToBool; break;
case EbtUint64: newOp = EOpConvUint64ToBool; break; case EbtUint64: newOp = EOpConvUint64ToBool; break;
default: default:
return 0; return nullptr;
} }
break; break;
case EbtInt: case EbtInt:
@ -702,7 +702,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EbtInt64: newOp = EOpConvInt64ToInt; break; case EbtInt64: newOp = EOpConvInt64ToInt; break;
case EbtUint64: newOp = EOpConvUint64ToInt; break; case EbtUint64: newOp = EOpConvUint64ToInt; break;
default: default:
return 0; return nullptr;
} }
break; break;
case EbtUint: case EbtUint:
@ -717,7 +717,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EbtInt64: newOp = EOpConvInt64ToUint; break; case EbtInt64: newOp = EOpConvInt64ToUint; break;
case EbtUint64: newOp = EOpConvUint64ToUint; break; case EbtUint64: newOp = EOpConvUint64ToUint; break;
default: default:
return 0; return nullptr;
} }
break; break;
case EbtInt64: case EbtInt64:
@ -732,7 +732,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
#endif #endif
case EbtUint64: newOp = EOpConvUint64ToInt64; break; case EbtUint64: newOp = EOpConvUint64ToInt64; break;
default: default:
return 0; return nullptr;
} }
break; break;
case EbtUint64: case EbtUint64:
@ -747,11 +747,11 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
#endif #endif
case EbtInt64: newOp = EOpConvInt64ToUint64; break; case EbtInt64: newOp = EOpConvInt64ToUint64; break;
default: default:
return 0; return nullptr;
} }
break; break;
default: default:
return 0; return nullptr;
} }
TType newType(promoteTo, EvqTemporary, node->getVectorSize(), node->getMatrixCols(), node->getMatrixRows()); TType newType(promoteTo, EvqTemporary, node->getVectorSize(), node->getMatrixCols(), node->getMatrixRows());
@ -1123,15 +1123,15 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
// Safe way to combine two nodes into an aggregate. Works with null pointers, // Safe way to combine two nodes into an aggregate. Works with null pointers,
// a node that's not a aggregate yet, etc. // a node that's not a aggregate yet, etc.
// //
// Returns the resulting aggregate, unless 0 was passed in for // Returns the resulting aggregate, unless nullptr was passed in for
// both existing nodes. // both existing nodes.
// //
TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right) TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right)
{ {
if (left == 0 && right == 0) if (left == nullptr && right == nullptr)
return 0; return nullptr;
TIntermAggregate* aggNode = 0; TIntermAggregate* aggNode = nullptr;
if (left) if (left)
aggNode = left->getAsAggregate(); aggNode = left->getAsAggregate();
if (! aggNode || aggNode->getOp() != EOpNull) { if (! aggNode || aggNode->getOp() != EOpNull) {
@ -1158,12 +1158,12 @@ TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* r
// //
// Turn an existing node into an aggregate. // Turn an existing node into an aggregate.
// //
// Returns an aggregate, unless 0 was passed in for the existing node. // Returns an aggregate, unless nullptr was passed in for the existing node.
// //
TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node) TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node)
{ {
if (node == 0) if (node == nullptr)
return 0; return nullptr;
TIntermAggregate* aggNode = new TIntermAggregate; TIntermAggregate* aggNode = new TIntermAggregate;
aggNode->getSequence().push_back(node); aggNode->getSequence().push_back(node);
@ -1174,8 +1174,8 @@ TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node)
TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, const TSourceLoc& loc) TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, const TSourceLoc& loc)
{ {
if (node == 0) if (node == nullptr)
return 0; return nullptr;
TIntermAggregate* aggNode = new TIntermAggregate; TIntermAggregate* aggNode = new TIntermAggregate;
aggNode->getSequence().push_back(node); aggNode->getSequence().push_back(node);
@ -1237,7 +1237,7 @@ TIntermTyped* TIntermediate::addMethod(TIntermTyped* object, const TType& type,
// a true path, and a false path. The two paths are specified // a true path, and a false path. The two paths are specified
// as separate parameters. // as separate parameters.
// //
// Returns the selection node created, or 0 if one could not be. // Returns the selection node created, or nullptr if one could not be.
// //
TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc& loc) TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc& loc)
{ {
@ -1252,12 +1252,12 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
if (child) if (child)
trueBlock = child; trueBlock = child;
else else
return 0; return nullptr;
} }
// After conversion, types have to match. // After conversion, types have to match.
if (falseBlock->getType() != trueBlock->getType()) if (falseBlock->getType() != trueBlock->getType())
return 0; return nullptr;
// //
// See if all the operands are constant, then fold it otherwise not. // See if all the operands are constant, then fold it otherwise not.
@ -1431,7 +1431,7 @@ TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* init
// //
TIntermBranch* TIntermediate::addBranch(TOperator branchOp, const TSourceLoc& loc) TIntermBranch* TIntermediate::addBranch(TOperator branchOp, const TSourceLoc& loc)
{ {
return addBranch(branchOp, 0, loc); return addBranch(branchOp, nullptr, loc);
} }
TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, const TSourceLoc& loc) TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, const TSourceLoc& loc)
@ -1448,7 +1448,7 @@ TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expres
// //
bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/) bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
{ {
if (root == 0) if (root == nullptr)
return true; return true;
// Finish off the top-level sequence // Finish off the top-level sequence