}
// Recovery, if it wasn't found or was not a variable.
- if (! variable) {
+ if (variable == nullptr) {
error(loc, "unknown variable", string->c_str(), "");
variable = new TVariable(string, TType(EbtVoid));
}
TIntermTyped* HlslParseContext::handleBinaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right)
{
TIntermTyped* result = intermediate.addBinaryMath(op, left, right, loc);
- if (! result)
+ if (result == nullptr)
binaryOpError(loc, str, left->getCompleteString(), right->getCompleteString());
return result;
TSymbol* symbol = symbolTable.find(function.getMangledName());
TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr;
- if (! prevDec)
+ if (prevDec == nullptr)
error(loc, "can't find function", function.getName().c_str(), "");
// Note: 'prevDec' could be 'function' if this is the first time we've seen function
// as it would have just been put in the symbol table. Otherwise, we're looking up
//
void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermTyped*& node, TIntermNode* arguments)
{
- if (!node || !node->getAsOperator())
+ if (node == nullptr || !node->getAsOperator())
return;
const auto clampReturn = [&loc, &node, this](TIntermTyped* result, const TSampler& sampler) -> TIntermTyped* {
//
void HlslParseContext::decomposeGeometryMethods(const TSourceLoc& loc, TIntermTyped*& node, TIntermNode* arguments)
{
- if (!node || !node->getAsOperator())
+ if (node == nullptr || !node->getAsOperator())
return;
const TOperator op = node->getAsOperator()->getOp();
}
if (arg > 0) {
- if (! aggArgs[arg]->getAsConstantUnion())
+ if (aggArgs[arg]->getAsConstantUnion() == nullptr)
error(loc, "argument must be compile-time constant", "texel offset", "");
else {
const TType& type = aggArgs[arg]->getAsTyped()->getType();
//
void HlslParseContext::declareArray(const TSourceLoc& loc, const TString& identifier, const TType& type, TSymbol*& symbol, bool track)
{
- if (! symbol) {
+ if (symbol == nullptr) {
bool currentScope;
symbol = symbolTable.find(identifier, nullptr, ¤tScope);
// Process a redeclaration.
//
- if (! symbol) {
+ if (symbol == nullptr) {
error(loc, "array variable name expected", identifier.c_str(), "");
return;
}
// If the block was not found, this must be a version/profile/stage
// that doesn't have it, or the instance name is wrong.
const char* errorName = instanceName ? instanceName->c_str() : newTypeList.front().type->getFieldName().c_str();
- if (! block) {
+ if (block == nullptr) {
error(loc, "no declaration found for redeclaration", errorName, "");
return;
}
declareArray(loc, identifier, type, symbol, !flattenVar);
} else {
// non-array case
- if (! symbol)
+ if (symbol == nullptr)
symbol = declareNonArray(loc, identifier, type, !flattenVar);
else if (type != symbol->getType())
error(loc, "cannot change the type of", "redeclaration", symbol->getName().c_str());
if (flattenVar)
flatten(loc, *symbol->getAsVariable());
- if (! symbol)
+ if (symbol == nullptr)
return nullptr;
// Deal with initializer
error(loc, "flattened array with initializer list unsupported", identifier.c_str(), "");
TVariable* variable = symbol->getAsVariable();
- if (! variable) {
+ if (variable == nullptr) {
error(loc, "initializer requires a variable, not a member", identifier.c_str(), "");
return nullptr;
}
skeletalType.getQualifier().makeTemporary();
if (initializer->getAsAggregate() && initializer->getAsAggregate()->getOp() == EOpNull)
initializer = convertInitializerList(loc, skeletalType, initializer, nullptr);
- if (! initializer) {
+ if (initializer == nullptr) {
// error recovery; don't leave const without constant values
if (qualifier == EvqConst)
variable->getWritableType().getQualifier().storage = EvqTemporary;
specializationCheck(loc, initializer->getType(), "initializer");
TIntermSymbol* intermSymbol = intermediate.addSymbol(*variable, loc);
TIntermNode* initNode = handleAssign(loc, EOpAssign, intermSymbol, initializer);
- if (! initNode)
+ if (initNode == nullptr)
assignError(loc, "=", intermSymbol->getCompleteString(), initializer->getCompleteString());
return initNode;
// see if we have bottomed out in the tree within the initializer-list part
TIntermAggregate* initList = initializer->getAsAggregate();
- if (! initList || initList->getOp() != EOpNull) {
+ if (initList == nullptr || initList->getOp() != EOpNull) {
// We don't have a list, but if it's a scalar and the 'type' is a
// composite, we need to lengthen below to make it useful.
// Otherwise, this is an already formed object to initialize with.
{
// Handle cases that map more 1:1 between constructor arguments and constructed.
TIntermTyped* converted = intermediate.addConversion(EOpConstructStruct, type, node->getAsTyped());
- if (! converted || converted->getType() != type) {
+ if (converted == nullptr || converted->getType() != type) {
error(loc, "", "constructor", "cannot convert parameter %d from '%s' to '%s'", paramCount,
node->getAsTyped()->getType().getCompleteString().c_str(), type.getCompleteString().c_str());
// Add the variable, as anonymous or named instanceName.
// Make an anonymous variable if no name was provided.
- if (! instanceName)
+ if (instanceName == nullptr)
instanceName = NewPoolTString("");
TVariable& variable = *new TVariable(instanceName, blockType);
void HlslParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qualifier, const TString& identifier)
{
TSymbol* symbol = symbolTable.find(identifier);
- if (! symbol) {
+ if (symbol == nullptr) {
error(loc, "identifier not previously declared", identifier.c_str(), "");
return;
}