Some clang-tidy -use-modernize-nullptr

Change-Id: I1bed5e85a5b7948d08502a72a10f80baa075c204
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
hjk
2019-07-31 17:21:41 +02:00
parent 630385751a
commit 2e14df7561
180 changed files with 1312 additions and 1312 deletions

View File

@@ -325,7 +325,7 @@ void StructTypeAST::Field::setInnerType(TypeAST *innerType)
return;
TypeAST **parent = &type;
TypeAST *inner = type;
while (inner != 0) {
while (inner != nullptr) {
ArrayTypeAST *array = inner->asArrayType();
if (!array)
break;
@@ -388,7 +388,7 @@ void VariableDeclarationAST::accept0(Visitor *visitor)
TypeAST *VariableDeclarationAST::declarationType(List<DeclarationAST *> *decls)
{
VariableDeclarationAST *var = decls->value->asVariableDeclaration();
return var ? var->type : 0;
return var ? var->type : nullptr;
}
void TypeDeclarationAST::accept0(Visitor *visitor)

View File

@@ -49,7 +49,7 @@ bool ASTDump::preVisit(AST *ast)
{
const char *id = typeid(*ast).name();
#ifdef Q_CC_GNU
char *cppId = abi::__cxa_demangle(id, 0, 0, 0);
char *cppId = abi::__cxa_demangle(id, nullptr, nullptr, nullptr);
id = cppId;
#endif
out << QByteArray(_depth, ' ') << id << endl;

View File

@@ -112,9 +112,9 @@ public:
// symbols
Namespace *newNamespace();
Struct *newStruct(Scope *scope = 0);
Block *newBlock(Scope *scope = 0);
Function *newFunction(Scope *scope = 0);
Struct *newStruct(Scope *scope = nullptr);
Block *newBlock(Scope *scope = nullptr);
Function *newFunction(Scope *scope = nullptr);
Argument *newArgument(Function *function, const QString &name, const Type *type);
Variable *newVariable(Scope *scope, const QString &name, const Type *type, int qualifiers = 0);

View File

@@ -60,9 +60,9 @@ void Lexer::yyinp()
int Lexer::yylex(Token *tk)
{
const char *pos = 0;
const char *pos = nullptr;
int line = 0;
_yyval.ptr = 0;
_yyval.ptr = nullptr;
const int kind = yylex_helper(&pos, &line);
tk->kind = kind;
tk->position = pos - _source;

View File

@@ -47,7 +47,7 @@ public:
};
Token()
: kind(0), position(0), length(0), line(0), ptr(0) {}
: kind(0), position(0), length(0), line(0), ptr(nullptr) {}
bool is(int k) const { return k == kind; }
bool isNot(int k) const { return k != kind; }

View File

@@ -30,11 +30,11 @@
using namespace GLSL;
MemoryPool::MemoryPool()
: _blocks(0),
: _blocks(nullptr),
_allocatedBlocks(0),
_blockCount(-1),
_ptr(0),
_end(0)
_ptr(nullptr),
_end(nullptr)
{ }
MemoryPool::~MemoryPool()
@@ -52,7 +52,7 @@ MemoryPool::~MemoryPool()
void MemoryPool::reset()
{
_blockCount = -1;
_ptr = _end = 0;
_ptr = _end = nullptr;
}
void *MemoryPool::allocate_helper(size_t size)
@@ -68,7 +68,7 @@ void *MemoryPool::allocate_helper(size_t size)
_blocks = (char **) realloc(_blocks, sizeof(char *) * _allocatedBlocks);
for (int index = _blockCount; index < _allocatedBlocks; ++index)
_blocks[index] = 0;
_blocks[index] = nullptr;
}
char *&block = _blocks[_blockCount];

View File

@@ -104,7 +104,7 @@ AST *Parser::parse(int startToken)
int action = 0;
yytoken = -1;
yyloc = -1;
void *yyval = 0; // value of the current token.
void *yyval = nullptr; // value of the current token.
_recovered = false;
_tos = -1;
@@ -204,7 +204,7 @@ AST *Parser::parse(int startToken)
else if (*tptr == T_NUMBER || *tptr == T_TYPE_NAME)
yyval = (void *) _engine->identifier(QLatin1String("$0"));
else
yyval = 0;
yyval = nullptr;
_symStack[_tos].ptr = yyval;
_locationStack[_tos] = yyloc;
@@ -224,7 +224,7 @@ AST *Parser::parse(int startToken)
} while (action);
return 0;
return nullptr;
}
#line 643 "./glsl.g"
@@ -347,14 +347,14 @@ case 17: {
case 18: {
sym(1).function.id = sym(1).function_identifier;
sym(1).function.arguments = 0;
sym(1).function.arguments = nullptr;
} break;
#line 788 "./glsl.g"
case 19: {
sym(1).function.id = sym(1).function_identifier;
sym(1).function.arguments = 0;
sym(1).function.arguments = nullptr;
} break;
#line 796 "./glsl.g"
@@ -815,7 +815,7 @@ case 87: {
case 88: {
TypeAST *type = makeAstNode<QualifiedTypeAST>
(sym(1).type_qualifier.qualifier, (TypeAST *)0,
(sym(1).type_qualifier.qualifier, (TypeAST *)nullptr,
sym(1).type_qualifier.layout_list);
ast(1) = makeAstNode<TypeDeclarationAST>(type);
} break;
@@ -878,7 +878,7 @@ case 97: {
ast(1) = makeAstNode<ParameterDeclarationAST>
(makeAstNode<QualifiedTypeAST>
(sym(1).qualifier, sym(3).param_declarator.type,
(List<LayoutQualifierAST *> *)0),
(List<LayoutQualifierAST *> *)nullptr),
ParameterDeclarationAST::Qualifier(sym(2).qualifier),
sym(3).param_declarator.name);
} break;
@@ -897,9 +897,9 @@ case 98: {
case 99: {
ast(1) = makeAstNode<ParameterDeclarationAST>
(makeAstNode<QualifiedTypeAST>
(sym(1).qualifier, type(3), (List<LayoutQualifierAST *> *)0),
(sym(1).qualifier, type(3), (List<LayoutQualifierAST *> *)nullptr),
ParameterDeclarationAST::Qualifier(sym(2).qualifier),
(const QString *)0);
(const QString *)nullptr);
} break;
#line 1421 "./glsl.g"
@@ -907,7 +907,7 @@ case 99: {
case 100: {
ast(1) = makeAstNode<ParameterDeclarationAST>
(type(2), ParameterDeclarationAST::Qualifier(sym(1).qualifier),
(const QString *)0);
(const QString *)nullptr);
} break;
#line 1430 "./glsl.g"
@@ -1065,7 +1065,7 @@ case 120: {
#line 1602 "./glsl.g"
case 121: {
ast(1) = makeAstNode<QualifiedTypeAST>(0, type(1), (List<LayoutQualifierAST *> *)0);
ast(1) = makeAstNode<QualifiedTypeAST>(0, type(1), (List<LayoutQualifierAST *> *)nullptr);
} break;
#line 1609 "./glsl.g"
@@ -1121,7 +1121,7 @@ case 129: {
#line 1667 "./glsl.g"
case 130: {
sym(1).layout = makeAstNode<LayoutQualifierAST>(string(1), (const QString *)0);
sym(1).layout = makeAstNode<LayoutQualifierAST>(string(1), (const QString *)nullptr);
} break;
#line 1674 "./glsl.g"
@@ -1140,7 +1140,7 @@ case 132: {
case 133: {
sym(1).type_qualifier.qualifier = sym(1).qualifier;
sym(1).type_qualifier.layout_list = 0;
sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1696 "./glsl.g"
@@ -1161,35 +1161,35 @@ case 135: {
case 136: {
sym(1).type_qualifier.qualifier = sym(1).qualifier | sym(2).qualifier;
sym(1).type_qualifier.layout_list = 0;
sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1720 "./glsl.g"
case 137: {
sym(1).type_qualifier.qualifier = sym(1).qualifier;
sym(1).type_qualifier.layout_list = 0;
sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1728 "./glsl.g"
case 138: {
sym(1).type_qualifier.qualifier = sym(1).qualifier | sym(2).qualifier;
sym(1).type_qualifier.layout_list = 0;
sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1736 "./glsl.g"
case 139: {
sym(1).type_qualifier.qualifier = sym(1).qualifier | sym(2).qualifier | sym(3).qualifier;
sym(1).type_qualifier.layout_list = 0;
sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1744 "./glsl.g"
case 140: {
sym(1).type_qualifier.qualifier = QualifiedTypeAST::Invariant;
sym(1).type_qualifier.layout_list = 0;
sym(1).type_qualifier.layout_list = nullptr;
} break;
#line 1752 "./glsl.g"
@@ -1905,14 +1905,14 @@ case 257: {
case 258: {
sym(1).field = makeAstNode<StructTypeAST::Field>
(string(1), makeAstNode<ArrayTypeAST>((TypeAST *)0));
(string(1), makeAstNode<ArrayTypeAST>((TypeAST *)nullptr));
} break;
#line 2586 "./glsl.g"
case 259: {
sym(1).field = makeAstNode<StructTypeAST::Field>
(string(1), makeAstNode<ArrayTypeAST>((TypeAST *)0, expression(3)));
(string(1), makeAstNode<ArrayTypeAST>((TypeAST *)nullptr, expression(3)));
} break;
#line 2594 "./glsl.g"
@@ -2070,7 +2070,7 @@ case 282: {
case 283: {
sym(1).ifstmt.thenClause = statement(1);
sym(1).ifstmt.elseClause = 0;
sym(1).ifstmt.elseClause = nullptr;
} break;
#line 2776 "./glsl.g"
@@ -2162,7 +2162,7 @@ case 297: {
case 298: {
sym(1).forstmt.condition = expression(1);
sym(1).forstmt.increment = 0;
sym(1).forstmt.increment = nullptr;
} break;
#line 2883 "./glsl.g"
@@ -2215,7 +2215,7 @@ case 306: {
sym(1).declaration_list = makeAstNode< List<DeclarationAST *> >
(sym(1).declaration);
} else {
sym(1).declaration_list = 0;
sym(1).declaration_list = nullptr;
}
} break;
@@ -2230,7 +2230,7 @@ case 307: {
sym(1).declaration_list = makeAstNode< List<DeclarationAST *> >
(sym(2).declaration);
} else {
sym(1).declaration_list = 0;
sym(1).declaration_list = nullptr;
}
}
} break;
@@ -2250,7 +2250,7 @@ case 309: {
#line 2976 "./glsl.g"
case 310: {
ast(1) = 0;
ast(1) = nullptr;
} break;
#line 2983 "./glsl.g"
@@ -2262,7 +2262,7 @@ case 311: {
#line 2990 "./glsl.g"
case 312: {
ast(1) = 0;
ast(1) = nullptr;
} break;
#line 2998 "./glsl.g"

View File

@@ -91,13 +91,13 @@ public:
TranslationUnitAST *parse() {
if (AST *u = parse(T_FEED_GLSL))
return u->asTranslationUnit();
return 0;
return nullptr;
}
ExpressionAST *parseExpression() {
if (AST *u = parse(T_FEED_EXPRESSION))
return u->asExpression();
return 0;
return nullptr;
}
AST *parse(int startToken);

View File

@@ -33,9 +33,9 @@
using namespace GLSL;
Semantic::Semantic()
: _engine(0)
, _scope(0)
, _type(0)
: _engine(nullptr)
, _scope(nullptr)
, _type(nullptr)
{
}
@@ -118,7 +118,7 @@ Semantic::ExprResult Semantic::functionIdentifier(FunctionIdentifierAST *ast)
if (ast) {
if (ast->name) {
if (Symbol *s = _scope->lookup(*ast->name)) {
if (s->asOverloadSet() != 0 || s->asFunction() != 0)
if (s->asOverloadSet() != nullptr || s->asFunction() != nullptr)
result.type = s->type();
else
_engine->error(ast->lineno, QString::fromLatin1("`%1' cannot be used as a function").arg(*ast->name));
@@ -308,33 +308,33 @@ bool Semantic::implicitCast(const Type *type, const Type *target) const
return false;
} else if (type->isEqualTo(target)) {
return true;
} else if (target->asUIntType() != 0) {
return type->asIntType() != 0;
} else if (target->asFloatType() != 0) {
return type->asIntType() != 0 ||
type->asUIntType() != 0;
} else if (target->asDoubleType() != 0) {
return type->asIntType() != 0 ||
type->asUIntType() != 0 ||
type->asFloatType() != 0;
} else if (target->asUIntType() != nullptr) {
return type->asIntType() != nullptr;
} else if (target->asFloatType() != nullptr) {
return type->asIntType() != nullptr ||
type->asUIntType() != nullptr;
} else if (target->asDoubleType() != nullptr) {
return type->asIntType() != nullptr ||
type->asUIntType() != nullptr ||
type->asFloatType() != nullptr;
} else if (const VectorType *targetVecTy = target->asVectorType()) {
if (const VectorType *vecTy = type->asVectorType()) {
if (targetVecTy->dimension() == vecTy->dimension()) {
const Type *targetElementType = targetVecTy->elementType();
const Type *elementType = vecTy->elementType();
if (targetElementType->asUIntType() != 0) {
if (targetElementType->asUIntType() != nullptr) {
// uvec* -> ivec*
return elementType->asIntType() != 0;
} else if (targetElementType->asFloatType() != 0) {
return elementType->asIntType() != nullptr;
} else if (targetElementType->asFloatType() != nullptr) {
// vec* -> ivec* | uvec*
return elementType->asIntType() != 0 ||
elementType->asUIntType() != 0;
} else if (targetElementType->asDoubleType() != 0) {
return elementType->asIntType() != nullptr ||
elementType->asUIntType() != nullptr;
} else if (targetElementType->asDoubleType() != nullptr) {
// dvec* -> ivec* | uvec* | fvec*
return elementType->asIntType() != 0 ||
elementType->asUIntType() != 0 ||
elementType->asFloatType() != 0;
return elementType->asIntType() != nullptr ||
elementType->asUIntType() != nullptr ||
elementType->asFloatType() != nullptr;
}
}
}
@@ -345,9 +345,9 @@ bool Semantic::implicitCast(const Type *type, const Type *target) const
const Type *targetElementType = targetMatTy->elementType();
const Type *elementType = matTy->elementType();
if (targetElementType->asDoubleType() != 0) {
if (targetElementType->asDoubleType() != nullptr) {
// dmat* -> mat*
return elementType->asFloatType() != 0;
return elementType->asFloatType() != nullptr;
}
}
}

View File

@@ -37,7 +37,7 @@ public:
~Semantic() override;
struct ExprResult {
ExprResult(const Type *type = 0, bool isConstant = false)
ExprResult(const Type *type = nullptr, bool isConstant = false)
: type(type), isConstant(isConstant) {}
~ExprResult() { }
@@ -45,7 +45,7 @@ public:
bool isValid() const {
if (! type)
return false;
else if (type->asUndefinedType() != 0)
else if (type->asUndefinedType() != nullptr)
return false;
return true;
}

View File

@@ -69,7 +69,7 @@ Symbol *Scope::lookup(const QString &name) const
else if (Scope *s = scope())
return s->lookup(name);
else
return 0;
return nullptr;
}
QList<Symbol *> Scope::members() const

View File

@@ -36,7 +36,7 @@ class Scope;
class GLSL_EXPORT Symbol
{
public:
Symbol(Scope *scope = 0);
Symbol(Scope *scope = nullptr);
virtual ~Symbol();
Scope *scope() const;
@@ -45,14 +45,14 @@ public:
QString name() const;
void setName(const QString &name);
virtual Scope *asScope() { return 0; }
virtual Struct *asStruct() { return 0; }
virtual Function *asFunction() { return 0; }
virtual Argument *asArgument() { return 0; }
virtual Block *asBlock() { return 0; }
virtual Variable *asVariable() { return 0; }
virtual OverloadSet *asOverloadSet() { return 0; }
virtual Namespace *asNamespace() { return 0; }
virtual Scope *asScope() { return nullptr; }
virtual Struct *asStruct() { return nullptr; }
virtual Function *asFunction() { return nullptr; }
virtual Argument *asArgument() { return nullptr; }
virtual Block *asBlock() { return nullptr; }
virtual Variable *asVariable() { return nullptr; }
virtual OverloadSet *asOverloadSet() { return nullptr; }
virtual Namespace *asNamespace() { return nullptr; }
virtual const Type *type() const = 0;
@@ -64,7 +64,7 @@ private:
class GLSL_EXPORT Scope: public Symbol
{
public:
Scope(Scope *sscope = 0);
Scope(Scope *sscope = nullptr);
Symbol *lookup(const QString &name) const;

View File

@@ -31,7 +31,7 @@ using namespace GLSL;
Argument::Argument(Function *scope)
: Symbol(scope)
, _type(0)
, _type(nullptr)
{
}
@@ -63,7 +63,7 @@ void Block::add(Symbol *symbol)
const Type *Block::type() const
{
// ### assert?
return 0;
return nullptr;
}
Symbol *Block::find(const QString &name) const
@@ -73,7 +73,7 @@ Symbol *Block::find(const QString &name) const
Variable::Variable(Scope *scope)
: Symbol(scope)
, _type(0)
, _type(nullptr)
, _qualifiers(0)
{
}
@@ -127,7 +127,7 @@ void Namespace::add(Symbol *symbol)
const Type *Namespace::type() const
{
return 0;
return nullptr;
}
Symbol *Namespace::find(const QString &name) const

View File

@@ -68,7 +68,7 @@ private:
class GLSL_EXPORT Block: public Scope
{
public:
Block(Scope *enclosingScope = 0);
Block(Scope *enclosingScope = nullptr);
QList<Symbol *> members() const override;
void add(Symbol *symbol) override;

View File

@@ -36,23 +36,23 @@ public:
virtual QString toString() const = 0;
virtual const UndefinedType *asUndefinedType() const { return 0; }
virtual const VoidType *asVoidType() const { return 0; }
virtual const BoolType *asBoolType() const { return 0; }
virtual const IntType *asIntType() const { return 0; }
virtual const UIntType *asUIntType() const { return 0; }
virtual const FloatType *asFloatType() const { return 0; }
virtual const DoubleType *asDoubleType() const { return 0; }
virtual const ScalarType *asScalarType() const { return 0; }
virtual const IndexType *asIndexType() const { return 0; }
virtual const VectorType *asVectorType() const { return 0; }
virtual const MatrixType *asMatrixType() const { return 0; }
virtual const ArrayType *asArrayType() const { return 0; }
virtual const SamplerType *asSamplerType() const { return 0; }
virtual const OverloadSet *asOverloadSetType() const { return 0; }
virtual const UndefinedType *asUndefinedType() const { return nullptr; }
virtual const VoidType *asVoidType() const { return nullptr; }
virtual const BoolType *asBoolType() const { return nullptr; }
virtual const IntType *asIntType() const { return nullptr; }
virtual const UIntType *asUIntType() const { return nullptr; }
virtual const FloatType *asFloatType() const { return nullptr; }
virtual const DoubleType *asDoubleType() const { return nullptr; }
virtual const ScalarType *asScalarType() const { return nullptr; }
virtual const IndexType *asIndexType() const { return nullptr; }
virtual const VectorType *asVectorType() const { return nullptr; }
virtual const MatrixType *asMatrixType() const { return nullptr; }
virtual const ArrayType *asArrayType() const { return nullptr; }
virtual const SamplerType *asSamplerType() const { return nullptr; }
virtual const OverloadSet *asOverloadSetType() const { return nullptr; }
virtual const Struct *asStructType() const { return 0; }
virtual const Function *asFunctionType() const { return 0; }
virtual const Struct *asStructType() const { return nullptr; }
virtual const Function *asFunctionType() const { return nullptr; }
virtual bool isEqualTo(const Type *other) const = 0;
virtual bool isLessThan(const Type *other) const = 0;

View File

@@ -32,7 +32,7 @@ using namespace GLSL;
bool UndefinedType::isEqualTo(const Type *other) const
{
if (other && other->asUndefinedType() != 0)
if (other && other->asUndefinedType() != nullptr)
return true;
return false;
}
@@ -40,14 +40,14 @@ bool UndefinedType::isEqualTo(const Type *other) const
bool UndefinedType::isLessThan(const Type *other) const
{
Q_UNUSED(other)
Q_ASSERT(other != 0);
Q_ASSERT(other->asUndefinedType() != 0);
Q_ASSERT(other != nullptr);
Q_ASSERT(other->asUndefinedType() != nullptr);
return false;
}
bool VoidType::isEqualTo(const Type *other) const
{
if (other && other->asVoidType() != 0)
if (other && other->asVoidType() != nullptr)
return true;
return false;
}
@@ -55,14 +55,14 @@ bool VoidType::isEqualTo(const Type *other) const
bool VoidType::isLessThan(const Type *other) const
{
Q_UNUSED(other)
Q_ASSERT(other != 0);
Q_ASSERT(other->asVoidType() != 0);
Q_ASSERT(other != nullptr);
Q_ASSERT(other->asVoidType() != nullptr);
return false;
}
bool BoolType::isEqualTo(const Type *other) const
{
if (other && other->asBoolType() != 0)
if (other && other->asBoolType() != nullptr)
return true;
return false;
}
@@ -70,14 +70,14 @@ bool BoolType::isEqualTo(const Type *other) const
bool BoolType::isLessThan(const Type *other) const
{
Q_UNUSED(other)
Q_ASSERT(other != 0);
Q_ASSERT(other->asBoolType() != 0);
Q_ASSERT(other != nullptr);
Q_ASSERT(other->asBoolType() != nullptr);
return false;
}
bool IntType::isEqualTo(const Type *other) const
{
if (other && other->asIntType() != 0)
if (other && other->asIntType() != nullptr)
return true;
return false;
}
@@ -85,14 +85,14 @@ bool IntType::isEqualTo(const Type *other) const
bool IntType::isLessThan(const Type *other) const
{
Q_UNUSED(other)
Q_ASSERT(other != 0);
Q_ASSERT(other->asIntType() != 0);
Q_ASSERT(other != nullptr);
Q_ASSERT(other->asIntType() != nullptr);
return false;
}
bool UIntType::isEqualTo(const Type *other) const
{
if (other && other->asUIntType() != 0)
if (other && other->asUIntType() != nullptr)
return true;
return false;
}
@@ -100,14 +100,14 @@ bool UIntType::isEqualTo(const Type *other) const
bool UIntType::isLessThan(const Type *other) const
{
Q_UNUSED(other)
Q_ASSERT(other != 0);
Q_ASSERT(other->asUIntType() != 0);
Q_ASSERT(other != nullptr);
Q_ASSERT(other->asUIntType() != nullptr);
return false;
}
bool FloatType::isEqualTo(const Type *other) const
{
if (other && other->asFloatType() != 0)
if (other && other->asFloatType() != nullptr)
return true;
return false;
}
@@ -115,14 +115,14 @@ bool FloatType::isEqualTo(const Type *other) const
bool FloatType::isLessThan(const Type *other) const
{
Q_UNUSED(other)
Q_ASSERT(other != 0);
Q_ASSERT(other->asFloatType() != 0);
Q_ASSERT(other != nullptr);
Q_ASSERT(other->asFloatType() != nullptr);
return false;
}
bool DoubleType::isEqualTo(const Type *other) const
{
if (other && other->asDoubleType() != 0)
if (other && other->asDoubleType() != nullptr)
return true;
return false;
}
@@ -130,21 +130,21 @@ bool DoubleType::isEqualTo(const Type *other) const
bool DoubleType::isLessThan(const Type *other) const
{
Q_UNUSED(other)
Q_ASSERT(other != 0);
Q_ASSERT(other->asDoubleType() != 0);
Q_ASSERT(other != nullptr);
Q_ASSERT(other->asDoubleType() != nullptr);
return false;
}
QString VectorType::toString() const
{
const char *prefix = "";
if (elementType()->asBoolType() != 0)
if (elementType()->asBoolType() != nullptr)
prefix = "b";
else if (elementType()->asIntType() != 0)
else if (elementType()->asIntType() != nullptr)
prefix = "i'";
else if (elementType()->asUIntType() != 0)
else if (elementType()->asUIntType() != nullptr)
prefix = "u";
else if (elementType()->asDoubleType() != 0)
else if (elementType()->asDoubleType() != nullptr)
prefix = "d";
return QString::fromLatin1("%1vec%2").arg(QLatin1String(prefix)).arg(_dimension);
}
@@ -249,9 +249,9 @@ bool VectorType::isEqualTo(const Type *other) const
bool VectorType::isLessThan(const Type *other) const
{
Q_ASSERT(other != 0);
Q_ASSERT(other != nullptr);
const VectorType *vec = other->asVectorType();
Q_ASSERT(vec != 0);
Q_ASSERT(vec != nullptr);
if (_dimension < vec->dimension())
return true;
else if (_dimension == vec->dimension() && elementType() < vec->elementType())
@@ -262,13 +262,13 @@ bool VectorType::isLessThan(const Type *other) const
QString MatrixType::toString() const
{
const char *prefix = "";
if (elementType()->asBoolType() != 0)
if (elementType()->asBoolType() != nullptr)
prefix = "b";
else if (elementType()->asIntType() != 0)
else if (elementType()->asIntType() != nullptr)
prefix = "i";
else if (elementType()->asUIntType() != 0)
else if (elementType()->asUIntType() != nullptr)
prefix = "u";
else if (elementType()->asDoubleType() != 0)
else if (elementType()->asDoubleType() != nullptr)
prefix = "d";
return QString::fromLatin1("%1mat%2x%3").arg(QLatin1String(prefix)).arg(_columns).arg(_rows);
}
@@ -291,9 +291,9 @@ bool MatrixType::isEqualTo(const Type *other) const
bool MatrixType::isLessThan(const Type *other) const
{
Q_ASSERT(other != 0);
Q_ASSERT(other != nullptr);
const MatrixType *mat = other->asMatrixType();
Q_ASSERT(mat != 0);
Q_ASSERT(mat != nullptr);
if (_columns < mat->columns()) {
return true;
} else if (_columns == mat->columns()) {
@@ -321,9 +321,9 @@ bool ArrayType::isEqualTo(const Type *other) const
bool ArrayType::isLessThan(const Type *other) const
{
Q_ASSERT(other != 0);
Q_ASSERT(other != nullptr);
const ArrayType *array = other->asArrayType();
Q_ASSERT(array != 0);
Q_ASSERT(array != nullptr);
return elementType() < array->elementType();
}
@@ -348,7 +348,7 @@ Symbol *Struct::find(const QString &name) const
if (s->name() == name)
return s;
}
return 0;
return nullptr;
}
bool Struct::isEqualTo(const Type *other) const
@@ -446,7 +446,7 @@ Symbol *Function::find(const QString &name) const
if (arg->name() == name)
return arg;
}
return 0;
return nullptr;
}
QString SamplerType::toString() const
@@ -465,9 +465,9 @@ bool SamplerType::isEqualTo(const Type *other) const
bool SamplerType::isLessThan(const Type *other) const
{
Q_ASSERT(other != 0);
Q_ASSERT(other != nullptr);
const SamplerType *samp = other->asSamplerType();
Q_ASSERT(samp != 0);
Q_ASSERT(samp != nullptr);
return _kind < samp->kind();
}
@@ -493,7 +493,7 @@ const Type *OverloadSet::type() const
Symbol *OverloadSet::find(const QString &) const
{
return 0;
return nullptr;
}
void OverloadSet::add(Symbol *symbol)

View File

@@ -186,7 +186,7 @@ public:
class GLSL_EXPORT Struct: public Type, public Scope
{
public:
Struct(Scope *scope = 0)
Struct(Scope *scope = nullptr)
: Scope(scope) {}
QList<Symbol *> members() const override;
@@ -210,7 +210,7 @@ private:
class GLSL_EXPORT Function: public Type, public Scope
{
public:
Function(Scope *scope = 0)
Function(Scope *scope = nullptr)
: Scope(scope) {}
const Type *returnType() const;
@@ -267,7 +267,7 @@ private:
class GLSL_EXPORT OverloadSet: public Type, public Scope
{
public:
OverloadSet(Scope *enclosingScope = 0);
OverloadSet(Scope *enclosingScope = nullptr);
QVector<Function *> functions() const;
void addFunction(Function *function);