Use nullptr where possible instead of NULL or 0

This commit is contained in:
Johannes Kauffmann 2022-11-22 19:09:31 +01:00 committed by Jeremy Hayes
parent 728c689574
commit a7603c132d
38 changed files with 248 additions and 248 deletions

View file

@ -84,7 +84,7 @@ typedef TVector<const char*> TExtensionList;
class TSymbol {
public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(0), writable(true) { }
explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(nullptr), writable(true) { }
virtual TSymbol* clone() const = 0;
virtual ~TSymbol() { } // rely on all symbol owned memory coming from the pool
@ -97,18 +97,18 @@ public:
changeName(NewPoolTString(newName.c_str()));
}
virtual const TString& getMangledName() const { return getName(); }
virtual TFunction* getAsFunction() { return 0; }
virtual const TFunction* getAsFunction() const { return 0; }
virtual TVariable* getAsVariable() { return 0; }
virtual const TVariable* getAsVariable() const { return 0; }
virtual const TAnonMember* getAsAnonMember() const { return 0; }
virtual TFunction* getAsFunction() { return nullptr; }
virtual const TFunction* getAsFunction() const { return nullptr; }
virtual TVariable* getAsVariable() { return nullptr; }
virtual const TVariable* getAsVariable() const { return nullptr; }
virtual const TAnonMember* getAsAnonMember() const { return nullptr; }
virtual const TType& getType() const = 0;
virtual TType& getWritableType() = 0;
virtual void setUniqueId(long long id) { uniqueId = id; }
virtual long long getUniqueId() const { return uniqueId; }
virtual void setExtensions(int numExts, const char* const exts[])
{
assert(extensions == 0);
assert(extensions == nullptr);
assert(numExts > 0);
extensions = NewPoolObject(extensions);
for (int e = 0; e < numExts; ++e)
@ -229,7 +229,7 @@ struct TParameter {
if (param.name)
name = NewPoolTString(param.name->c_str());
else
name = 0;
name = nullptr;
type = param.type->clone();
defaultValue = param.defaultValue;
return *this;
@ -243,7 +243,7 @@ struct TParameter {
class TFunction : public TSymbol {
public:
explicit TFunction(TOperator o) :
TSymbol(0),
TSymbol(nullptr),
op(o),
defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0) { }
TFunction(const TString *name, const TType& retType, TOperator tOp = EOpNull) :
@ -411,7 +411,7 @@ protected:
class TSymbolTableLevel {
public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
TSymbolTableLevel() : defaultPrecision(0), anonId(0), thisLevel(false) { }
TSymbolTableLevel() : defaultPrecision(nullptr), anonId(0), thisLevel(false) { }
~TSymbolTableLevel();
bool insert(const TString& name, TSymbol* symbol) {
@ -493,7 +493,7 @@ public:
{
tLevel::const_iterator it = level.find(name);
if (it == level.end())
return 0;
return nullptr;
else
return (*it).second;
}
@ -561,7 +561,7 @@ public:
{
// can call multiple times at one scope, will only latch on first call,
// as we're tracking the previous scope's values, not the current values
if (defaultPrecision != 0)
if (defaultPrecision != nullptr)
return;
defaultPrecision = new TPrecisionQualifier[EbtNumTypes];
@ -573,7 +573,7 @@ public:
{
// can be called for table level pops that didn't set the
// defaults
if (defaultPrecision == 0 || p == 0)
if (defaultPrecision == nullptr || p == nullptr)
return;
for (int t = 0; t < EbtNumTypes; ++t)
@ -622,7 +622,7 @@ public:
// don't deallocate levels passed in from elsewhere
while (table.size() > adoptedLevels)
pop(0);
pop(nullptr);
}
void adoptLevels(TSymbolTable& symTable)
@ -783,7 +783,7 @@ public:
// Normal find of a symbol, that can optionally say whether the symbol was found
// at a built-in level or the current top-scope level.
TSymbol* find(const TString& name, bool* builtIn = 0, bool* currentScope = 0, int* thisDepthP = 0)
TSymbol* find(const TString& name, bool* builtIn = nullptr, bool* currentScope = nullptr, int* thisDepthP = nullptr)
{
int level = currentLevel();
TSymbol* symbol;
@ -827,7 +827,7 @@ public:
++thisDepth;
symbol = table[level]->find(name);
--level;
} while (symbol == 0 && level >= 0);
} while (symbol == nullptr && level >= 0);
if (! table[level + 1]->isThisLevel())
thisDepth = 0;