{
// No operations work on blocks
if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock)
- return 0;
+ return nullptr;
// Try converting the children's base types to compatible types.
TIntermTyped* child = addConversion(op, left->getType(), right);
if (child)
left = child;
else
- return 0;
+ return nullptr;
}
// Convert the children's type shape to be compatible.
TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSourceLoc loc)
{
if (child == 0)
- return 0;
+ return nullptr;
if (child->getType().getBasicType() == EbtBlock)
- return 0;
+ return nullptr;
switch (op) {
case EOpLogicalNot:
}
if (child->getType().getBasicType() != EbtBool || child->getType().isMatrix() || child->getType().isArray() || child->getType().isVector()) {
- return 0;
+ return nullptr;
}
break;
case EOpPreDecrement:
case EOpNegative:
if (child->getType().getBasicType() == EbtStruct || child->getType().isArray())
- return 0;
+ return nullptr;
default: break; // some compilers want this
}
child->getMatrixRows(),
child->isVector()),
child);
- if (child == 0)
- return 0;
+ if (child == nullptr)
+ return nullptr;
}
//
// including constness (which would differ from the prototype).
//
TIntermTyped* child = childNode->getAsTyped();
- if (child == 0)
- return 0;
+ if (child == nullptr)
+ return nullptr;
if (child->getAsConstantUnion()) {
TIntermTyped* folded = child->getAsConstantUnion()->fold(op, returnType);
//
if (node) {
aggNode = node->getAsAggregate();
- if (aggNode == 0 || aggNode->getOp() != EOpNull) {
+ if (aggNode == nullptr || aggNode->getOp() != EOpNull) {
//
// Make an aggregate containing this node.
//
// Generally, this is focused on basic type conversion, not shape conversion.
// 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
{
//
switch (node->getBasicType()) {
case EbtVoid:
- return 0;
+ return nullptr;
case EbtAtomicUint:
case EbtSampler:
// opaque types can be passed to functions
break;
// otherwise, opaque types can't even be operated on, let alone converted
- return 0;
+ return nullptr;
default:
break;
}
// If one's a structure, then no conversions.
if (type.isStruct() || node->isStruct())
- return 0;
+ return nullptr;
// If one's an array, then no conversions.
if (type.isArray() || node->getType().isArray())
- return 0;
+ return nullptr;
// Note: callers are responsible for other aspects of shape,
// like vector and matrix sizes.
if (canImplicitlyPromote(node->getType().getBasicType(), type.getBasicType(), op))
promoteTo = type.getBasicType();
else
- return 0;
+ return nullptr;
break;
return node;
else
- return 0;
+ return nullptr;
default:
// default is to require a match; all exceptions should have case statements above
if (type.getBasicType() == node->getType().getBasicType())
return node;
else
- return 0;
+ return nullptr;
}
if (node->getAsConstantUnion())
//
// Add a new newNode for the conversion.
//
- TIntermUnary* newNode = 0;
+ TIntermUnary* newNode = nullptr;
TOperator newOp = EOpNull;
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
default:
- return 0;
+ return nullptr;
}
break;
case EbtFloat:
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
default:
- return 0;
+ return nullptr;
}
break;
#ifdef AMD_EXTENSIONS
case EbtInt64: newOp = EOpConvInt64ToFloat16; break;
case EbtUint64: newOp = EOpConvUint64ToFloat16; break;
default:
- return 0;
+ return nullptr;
}
break;
#endif
case EbtInt64: newOp = EOpConvInt64ToBool; break;
case EbtUint64: newOp = EOpConvUint64ToBool; break;
default:
- return 0;
+ return nullptr;
}
break;
case EbtInt:
case EbtInt64: newOp = EOpConvInt64ToInt; break;
case EbtUint64: newOp = EOpConvUint64ToInt; break;
default:
- return 0;
+ return nullptr;
}
break;
case EbtUint:
case EbtInt64: newOp = EOpConvInt64ToUint; break;
case EbtUint64: newOp = EOpConvUint64ToUint; break;
default:
- return 0;
+ return nullptr;
}
break;
case EbtInt64:
#endif
case EbtUint64: newOp = EOpConvUint64ToInt64; break;
default:
- return 0;
+ return nullptr;
}
break;
case EbtUint64:
#endif
case EbtInt64: newOp = EOpConvInt64ToUint64; break;
default:
- return 0;
+ return nullptr;
}
break;
default:
- return 0;
+ return nullptr;
}
TType newType(promoteTo, EvqTemporary, node->getVectorSize(), node->getMatrixCols(), node->getMatrixRows());
// Safe way to combine two nodes into an aggregate. Works with null pointers,
// a node that's not a aggregate yet, etc.
//
-// Returns the resulting aggregate, unless 0 was passed in for
+// Returns the resulting aggregate, unless nullptr was passed in for
// both existing nodes.
//
TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right)
{
- if (left == 0 && right == 0)
- return 0;
+ if (left == nullptr && right == nullptr)
+ return nullptr;
- TIntermAggregate* aggNode = 0;
+ TIntermAggregate* aggNode = nullptr;
if (left)
aggNode = left->getAsAggregate();
if (! aggNode || aggNode->getOp() != EOpNull) {
//
// 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)
{
- if (node == 0)
- return 0;
+ if (node == nullptr)
+ return nullptr;
TIntermAggregate* aggNode = new TIntermAggregate;
aggNode->getSequence().push_back(node);
TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, const TSourceLoc& loc)
{
- if (node == 0)
- return 0;
+ if (node == nullptr)
+ return nullptr;
TIntermAggregate* aggNode = new TIntermAggregate;
aggNode->getSequence().push_back(node);
// a true path, and a false path. The two paths are specified
// 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)
{
if (child)
trueBlock = child;
else
- return 0;
+ return nullptr;
}
// After conversion, types have to match.
if (falseBlock->getType() != trueBlock->getType())
- return 0;
+ return nullptr;
//
// See if all the operands are constant, then fold it otherwise not.
//
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)
//
bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
{
- if (root == 0)
+ if (root == nullptr)
return true;
// Finish off the top-level sequence