forked from qt-creator/qt-creator
Some clang-tidy -use-modernize-nullptr
Change-Id: I1bed5e85a5b7948d08502a72a10f80baa075c204 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -35,7 +35,7 @@ template<typename T>
|
||||
class AlreadyConsideredClassContainer
|
||||
{
|
||||
public:
|
||||
AlreadyConsideredClassContainer() : _class(0) {}
|
||||
AlreadyConsideredClassContainer() : _class(nullptr) {}
|
||||
void insert(const T *item)
|
||||
{
|
||||
if (_container.isEmpty())
|
||||
|
||||
@@ -67,13 +67,13 @@ class LastVisibleSymbolAt: protected SymbolVisitor
|
||||
|
||||
public:
|
||||
LastVisibleSymbolAt(Symbol *root)
|
||||
: root(root), line(0), column(0), symbol(0) {}
|
||||
: root(root), line(0), column(0), symbol(nullptr) {}
|
||||
|
||||
Symbol *operator()(int line, int column)
|
||||
{
|
||||
this->line = line;
|
||||
this->column = column;
|
||||
this->symbol = 0;
|
||||
this->symbol = nullptr;
|
||||
accept(root);
|
||||
if (! symbol)
|
||||
symbol = root;
|
||||
@@ -104,7 +104,7 @@ class FindScopeAt: protected SymbolVisitor
|
||||
public:
|
||||
/** line and column should be 1-based */
|
||||
FindScopeAt(TranslationUnit *unit, int line, int column)
|
||||
: _unit(unit), _line(line), _column(column), _scope(0) {}
|
||||
: _unit(unit), _line(line), _column(column), _scope(nullptr) {}
|
||||
|
||||
Scope *operator()(Symbol *symbol)
|
||||
{
|
||||
@@ -265,7 +265,7 @@ private:
|
||||
|
||||
Document::Document(const QString &fileName)
|
||||
: _fileName(QDir::cleanPath(fileName)),
|
||||
_globalNamespace(0),
|
||||
_globalNamespace(nullptr),
|
||||
_revision(0),
|
||||
_editorRevision(0),
|
||||
_checkMode(0)
|
||||
@@ -284,12 +284,12 @@ Document::Document(const QString &fileName)
|
||||
Document::~Document()
|
||||
{
|
||||
delete _translationUnit;
|
||||
_translationUnit = 0;
|
||||
_translationUnit = nullptr;
|
||||
if (_control) {
|
||||
delete _control->diagnosticClient();
|
||||
delete _control;
|
||||
}
|
||||
_control = 0;
|
||||
_control = nullptr;
|
||||
}
|
||||
|
||||
Control *Document::control() const
|
||||
@@ -308,7 +308,7 @@ Control *Document::swapControl(Control *newControl)
|
||||
_translationUnit = newTranslationUnit;
|
||||
} else {
|
||||
delete _translationUnit;
|
||||
_translationUnit = 0;
|
||||
_translationUnit = nullptr;
|
||||
}
|
||||
|
||||
Control *oldControl = _control;
|
||||
@@ -557,7 +557,7 @@ const Macro *Document::findMacroDefinitionAt(int line) const
|
||||
if (macro.line() == line)
|
||||
return ¯o;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Document::MacroUse *Document::findMacroUseAt(int utf16charsOffset) const
|
||||
@@ -568,7 +568,7 @@ const Document::MacroUse *Document::findMacroUseAt(int utf16charsOffset) const
|
||||
return &use;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Document::UndefinedMacroUse *Document::findUndefinedMacroUseAt(int utf16charsOffset) const
|
||||
@@ -579,7 +579,7 @@ const Document::UndefinedMacroUse *Document::findUndefinedMacroUseAt(int utf16ch
|
||||
+ QString::fromUtf8(use.name(), use.name().size()).length()))
|
||||
return &use;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Document::Ptr Document::create(const QString &fileName)
|
||||
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
|
||||
void visit(Function *type) override
|
||||
{
|
||||
Function *funTy = control()->newFunction(0, 0);
|
||||
Function *funTy = control()->newFunction(0, nullptr);
|
||||
funTy->copy(type);
|
||||
funTy->setConst(type->isConst());
|
||||
funTy->setVolatile(type->isVolatile());
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
for (unsigned i = 0, argc = type->argumentCount(); i < argc; ++i) {
|
||||
Symbol *arg = type->argumentAt(i);
|
||||
|
||||
Argument *newArg = control()->newArgument(0, 0);
|
||||
Argument *newArg = control()->newArgument(0, nullptr);
|
||||
newArg->copy(arg);
|
||||
newArg->setName(rewrite->rewriteName(arg->name()));
|
||||
newArg->setType(rewrite->rewriteType(arg->type()));
|
||||
@@ -225,7 +225,7 @@ public:
|
||||
const Identifier *identifier(const Identifier *other) const
|
||||
{
|
||||
if (! other)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return control()->identifier(other->chars(), other->size());
|
||||
}
|
||||
@@ -236,7 +236,7 @@ public:
|
||||
const Name *operator()(const Name *name)
|
||||
{
|
||||
if (! name)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
accept(name);
|
||||
return (!temps.isEmpty()) ? temps.takeLast() : name;
|
||||
@@ -296,7 +296,7 @@ public: // attributes
|
||||
};
|
||||
|
||||
SubstitutionEnvironment::SubstitutionEnvironment()
|
||||
: _scope(0)
|
||||
: _scope(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ FullySpecifiedType UseMinimalNames::apply(const Name *name, Rewrite *rewrite) co
|
||||
|
||||
|
||||
UseQualifiedNames::UseQualifiedNames()
|
||||
: UseMinimalNames(0)
|
||||
: UseMinimalNames(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ private:
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void visit(const QualifiedNameId *name) override
|
||||
@@ -362,7 +362,7 @@ FullySpecifiedType ApplySubstitution::apply(const FullySpecifiedType &type)
|
||||
|
||||
int ApplySubstitution::findSubstitution(const Identifier *id) const
|
||||
{
|
||||
Q_ASSERT(id != 0);
|
||||
Q_ASSERT(id != nullptr);
|
||||
|
||||
for (int index = 0; index < substitution.size(); ++index) {
|
||||
QPair<const Identifier *, FullySpecifiedType> s = substitution.at(index);
|
||||
|
||||
@@ -98,7 +98,7 @@ void FindUsages::operator()(Symbol *symbol)
|
||||
|
||||
void FindUsages::reportResult(unsigned tokenIndex, const Name *name, Scope *scope)
|
||||
{
|
||||
if (! (tokenIndex && name != 0))
|
||||
if (! (tokenIndex && name != nullptr))
|
||||
return;
|
||||
|
||||
if (name->identifier() != _id)
|
||||
@@ -298,7 +298,7 @@ const Name *FindUsages::name(NameAST *ast)
|
||||
return ast->name;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FindUsages::specifier(SpecifierAST *ast)
|
||||
@@ -1867,7 +1867,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
|
||||
if (NameAST *class_or_namespace_name = nested_name_specifier->class_or_namespace_name) {
|
||||
SimpleNameAST *simple_name = class_or_namespace_name->asSimpleName();
|
||||
|
||||
TemplateIdAST *template_id = 0;
|
||||
TemplateIdAST *template_id = nullptr;
|
||||
if (! simple_name) {
|
||||
template_id = class_or_namespace_name->asTemplateId();
|
||||
|
||||
@@ -1897,7 +1897,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
|
||||
else if (DestructorNameAST *dtor = unqualified_name->asDestructorName())
|
||||
identifier_token = dtor->unqualified_name->firstToken();
|
||||
|
||||
TemplateIdAST *template_id = 0;
|
||||
TemplateIdAST *template_id = nullptr;
|
||||
if (! identifier_token) {
|
||||
template_id = unqualified_name->asTemplateId();
|
||||
|
||||
|
||||
@@ -69,13 +69,13 @@ protected:
|
||||
|
||||
QString matchingLine(const Token &tk) const;
|
||||
|
||||
void reportResult(unsigned tokenIndex, const Name *name, Scope *scope = 0);
|
||||
void reportResult(unsigned tokenIndex, const Identifier *id, Scope *scope = 0);
|
||||
void reportResult(unsigned tokenIndex, const Name *name, Scope *scope = nullptr);
|
||||
void reportResult(unsigned tokenIndex, const Identifier *id, Scope *scope = nullptr);
|
||||
void reportResult(unsigned tokenIndex, const QList<LookupItem> &candidates);
|
||||
void reportResult(unsigned tokenIndex);
|
||||
|
||||
bool checkCandidates(const QList<LookupItem> &candidates) const;
|
||||
void checkExpression(unsigned startToken, unsigned endToken, Scope *scope = 0);
|
||||
void checkExpression(unsigned startToken, unsigned endToken, Scope *scope = nullptr);
|
||||
|
||||
static bool isLocalScope(Scope *scope);
|
||||
|
||||
@@ -90,7 +90,7 @@ protected:
|
||||
|
||||
void objCSelectorArgument(ObjCSelectorArgumentAST *ast);
|
||||
void attribute(GnuAttributeAST *ast);
|
||||
void declarator(DeclaratorAST *ast, Scope *symbol = 0);
|
||||
void declarator(DeclaratorAST *ast, Scope *symbol = nullptr);
|
||||
void qtPropertyDeclarationItem(QtPropertyDeclarationItemAST *ast);
|
||||
void qtInterfaceName(QtInterfaceNameAST *ast);
|
||||
void baseSpecifier(BaseSpecifierAST *ast);
|
||||
|
||||
@@ -234,7 +234,7 @@ static bool symbolIdentical(Symbol *s1, Symbol *s2)
|
||||
|
||||
static const Name *toName(const QList<const Name *> &names, Control *control)
|
||||
{
|
||||
const Name *n = 0;
|
||||
const Name *n = nullptr;
|
||||
for (int i = names.size() - 1; i >= 0; --i) {
|
||||
if (! n)
|
||||
n = names.at(i);
|
||||
@@ -260,7 +260,7 @@ static bool isInlineNamespace(ClassOrNamespace *con, const Name *name)
|
||||
|
||||
const Name *LookupContext::minimalName(Symbol *symbol, ClassOrNamespace *target, Control *control)
|
||||
{
|
||||
const Name *n = 0;
|
||||
const Name *n = nullptr;
|
||||
QList<const Name *> names = LookupContext::fullyQualifiedName(symbol);
|
||||
|
||||
for (int i = names.size() - 1; i >= 0; --i) {
|
||||
@@ -360,7 +360,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
|
||||
QSet<const Declaration *> typedefsBeingResolved) const
|
||||
{
|
||||
if (! scope || ! name) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
} else if (Block *block = scope->asBlock()) {
|
||||
for (int i = 0; i < block->memberCount(); ++i) {
|
||||
Symbol *m = block->memberAt(i);
|
||||
@@ -379,8 +379,8 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
|
||||
if (const NamedType *namedTy = d->type()->asNamedType()) {
|
||||
// Stop on recursive typedef declarations
|
||||
if (typedefsBeingResolved.contains(d))
|
||||
return 0;
|
||||
return lookupType(namedTy->name(), scope, 0,
|
||||
return nullptr;
|
||||
return lookupType(namedTy->name(), scope, nullptr,
|
||||
QSet<const Declaration *>(typedefsBeingResolved)
|
||||
<< d);
|
||||
}
|
||||
@@ -421,7 +421,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClassOrNamespace *LookupContext::lookupType(Symbol *symbol,
|
||||
@@ -438,8 +438,8 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
|
||||
return candidates;
|
||||
|
||||
for (; scope; scope = scope->enclosingScope()) {
|
||||
if (name->identifier() != 0 && scope->isBlock()) {
|
||||
bindings()->lookupInScope(name, scope, &candidates, /*templateId = */ 0, /*binding=*/ 0);
|
||||
if (name->identifier() != nullptr && scope->isBlock()) {
|
||||
bindings()->lookupInScope(name, scope, &candidates, /*templateId = */ nullptr, /*binding=*/ nullptr);
|
||||
|
||||
if (! candidates.isEmpty()) {
|
||||
// it's a local.
|
||||
@@ -475,7 +475,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
|
||||
}
|
||||
|
||||
} else if (Function *fun = scope->asFunction()) {
|
||||
bindings()->lookupInScope(name, fun, &candidates, /*templateId = */ 0, /*binding=*/ 0);
|
||||
bindings()->lookupInScope(name, fun, &candidates, /*templateId = */ nullptr, /*binding=*/ nullptr);
|
||||
|
||||
if (! candidates.isEmpty()) {
|
||||
// it's an argument or a template parameter.
|
||||
@@ -507,13 +507,13 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
|
||||
// continue, and look at the enclosing scope.
|
||||
|
||||
} else if (ObjCMethod *method = scope->asObjCMethod()) {
|
||||
bindings()->lookupInScope(name, method, &candidates, /*templateId = */ 0, /*binding=*/ 0);
|
||||
bindings()->lookupInScope(name, method, &candidates, /*templateId = */ nullptr, /*binding=*/ nullptr);
|
||||
|
||||
if (! candidates.isEmpty())
|
||||
break; // it's a formal argument.
|
||||
|
||||
} else if (Template *templ = scope->asTemplate()) {
|
||||
bindings()->lookupInScope(name, templ, &candidates, /*templateId = */ 0, /*binding=*/ 0);
|
||||
bindings()->lookupInScope(name, templ, &candidates, /*templateId = */ nullptr, /*binding=*/ nullptr);
|
||||
|
||||
if (! candidates.isEmpty()) {
|
||||
// it's a template parameter.
|
||||
@@ -569,7 +569,7 @@ ClassOrNamespace *LookupContext::lookupParent(Symbol *symbol) const
|
||||
foreach (const Name *name, fqName) {
|
||||
binding = binding->findType(name);
|
||||
if (!binding)
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return binding;
|
||||
@@ -578,11 +578,11 @@ ClassOrNamespace *LookupContext::lookupParent(Symbol *symbol) const
|
||||
ClassOrNamespace::ClassOrNamespace(CreateBindings *factory, ClassOrNamespace *parent)
|
||||
: _factory(factory)
|
||||
, _parent(parent)
|
||||
, _scopeLookupCache(0)
|
||||
, _templateId(0)
|
||||
, _instantiationOrigin(0)
|
||||
, _rootClass(0)
|
||||
, _name(0)
|
||||
, _scopeLookupCache(nullptr)
|
||||
, _templateId(nullptr)
|
||||
, _instantiationOrigin(nullptr)
|
||||
, _rootClass(nullptr)
|
||||
, _name(nullptr)
|
||||
{
|
||||
Q_ASSERT(factory);
|
||||
}
|
||||
@@ -667,7 +667,7 @@ QList<LookupItem> ClassOrNamespace::lookup_helper(const Name *name, bool searchI
|
||||
// It's also possible that there are matches in the parent binding through
|
||||
// a qualified name. For instance, a nested class which is forward declared
|
||||
// in the class but defined outside it - we should capture both.
|
||||
Symbol *match = 0;
|
||||
Symbol *match = nullptr;
|
||||
QSet<ClassOrNamespace *> processed;
|
||||
for (ClassOrNamespace *parentBinding = binding->parent();
|
||||
parentBinding && !match;
|
||||
@@ -696,7 +696,7 @@ QList<LookupItem> ClassOrNamespace::lookup_helper(const Name *name, bool searchI
|
||||
if (processedOwnParents.contains(binding))
|
||||
break;
|
||||
processedOwnParents.insert(binding);
|
||||
lookup_helper(name, binding, &result, &processed, /*templateId = */ 0);
|
||||
lookup_helper(name, binding, &result, &processed, /*templateId = */ nullptr);
|
||||
binding = binding->_parent;
|
||||
} while (searchInEnclosingScope && binding);
|
||||
}
|
||||
@@ -829,7 +829,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
|
||||
ClassOrNamespace *ClassOrNamespace::lookupType(const Name *name)
|
||||
{
|
||||
if (! name)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
QSet<ClassOrNamespace *> processed;
|
||||
return lookupType_helper(name, &processed, /*searchInEnclosingScope =*/ true, this);
|
||||
@@ -857,7 +857,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType(const Name *name, Block *block)
|
||||
return foundNestedBlock;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClassOrNamespace *ClassOrNamespace::findType(const Name *name)
|
||||
@@ -889,7 +889,7 @@ ClassOrNamespace *ClassOrNamespace::findBlock_helper(Block *block,
|
||||
if (!searchInEnclosingScope)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClassOrNamespace *ClassOrNamespace::findBlock(Block *block)
|
||||
@@ -935,7 +935,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
|
||||
if (ClassOrNamespace *binding = lookupType_helper(q->base(), processed, true, origin))
|
||||
return binding->lookupType_helper(q->name(), &innerProcessed, false, origin);
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
} else if (! processed->contains(this)) {
|
||||
processed->insert(this);
|
||||
@@ -985,7 +985,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
|
||||
return _parent->lookupType_helper(name, processed, searchInEnclosingScope, origin);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static ClassOrNamespace *findSpecializationWithMatchingTemplateArgument(const Name *argumentName,
|
||||
@@ -1008,7 +1008,7 @@ static ClassOrNamespace *findSpecializationWithMatchingTemplateArgument(const Na
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClassOrNamespace *ClassOrNamespace::findSpecialization(const TemplateNameId *templId,
|
||||
@@ -1057,7 +1057,7 @@ ClassOrNamespace *ClassOrNamespace::findSpecialization(const TemplateNameId *tem
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClassOrNamespace *ClassOrNamespace::findOrCreateNestedAnonymousType(
|
||||
@@ -1080,7 +1080,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
QSet<ClassOrNamespace *> *processed,
|
||||
ClassOrNamespace *origin)
|
||||
{
|
||||
Q_ASSERT(name != 0);
|
||||
Q_ASSERT(name != nullptr);
|
||||
Q_ASSERT(name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId());
|
||||
|
||||
const_cast<ClassOrNamespace *>(this)->flush();
|
||||
@@ -1090,7 +1090,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
|
||||
Table::const_iterator it = _classOrNamespaces.find(name);
|
||||
if (it == _classOrNamespaces.end())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
ClassOrNamespace *reference = it->second;
|
||||
ClassOrNamespace *baseTemplateClassReference = reference;
|
||||
@@ -1151,7 +1151,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
// are templates. We need to collect them now. First, we track the bases which are already
|
||||
// part of the binding so we can identify the missings ones later.
|
||||
|
||||
Class *referenceClass = 0;
|
||||
Class *referenceClass = nullptr;
|
||||
QList<const Name *> allBases;
|
||||
foreach (Symbol *s, reference->symbols()) {
|
||||
if (Class *clazz = s->asClass()) {
|
||||
@@ -1272,7 +1272,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
templParams.insert(templateSpecialization->templateParameterAt(i)->name(), i);
|
||||
|
||||
foreach (const Name *baseName, allBases) {
|
||||
ClassOrNamespace *baseBinding = 0;
|
||||
ClassOrNamespace *baseBinding = nullptr;
|
||||
|
||||
if (const Identifier *nameId = baseName->asNameId()) {
|
||||
// This is the simple case in which a template parameter is itself a base.
|
||||
@@ -1354,7 +1354,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
if (const QualifiedNameId *qBaseName = baseName->asQualifiedNameId()) {
|
||||
if (const Name *qualification = qBaseName->base())
|
||||
binding = lookupType(qualification);
|
||||
else if (binding->parent() != 0)
|
||||
else if (binding->parent() != nullptr)
|
||||
//if this is global identifier we take global namespace
|
||||
//Ex: class A{}; namespace NS { class A: public ::A{}; }
|
||||
binding = binding->globalNamespace();
|
||||
@@ -1471,7 +1471,7 @@ NamedType *ClassOrNamespace::NestedClassInstantiator::findNamedType(Type *member
|
||||
else if (ReferenceType *referenceType = memberType->asReferenceType())
|
||||
return findNamedType(referenceType->elementType().type());
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ClassOrNamespace::flush()
|
||||
@@ -1539,7 +1539,7 @@ ClassOrNamespace *ClassOrNamespace::findOrCreateType(const Name *name, ClassOrNa
|
||||
return e;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CreateBindings::CreateBindings(Document::Ptr thisDocument, const Snapshot &snapshot)
|
||||
@@ -1547,7 +1547,7 @@ CreateBindings::CreateBindings(Document::Ptr thisDocument, const Snapshot &snaps
|
||||
, _control(QSharedPointer<Control>(new Control))
|
||||
, _expandTemplates(false)
|
||||
{
|
||||
_globalNamespace = allocClassOrNamespace(/*parent = */ 0);
|
||||
_globalNamespace = allocClassOrNamespace(/*parent = */ nullptr);
|
||||
_currentClassOrNamespace = _globalNamespace;
|
||||
|
||||
process(thisDocument);
|
||||
@@ -1636,7 +1636,7 @@ void CreateBindings::process(Document::Ptr doc)
|
||||
|
||||
ClassOrNamespace *CreateBindings::enterClassOrNamespaceBinding(Symbol *symbol)
|
||||
{
|
||||
ClassOrNamespace *entity = _currentClassOrNamespace->findOrCreateType(symbol->name(), 0,
|
||||
ClassOrNamespace *entity = _currentClassOrNamespace->findOrCreateType(symbol->name(), nullptr,
|
||||
symbol->asClass());
|
||||
entity->addSymbol(symbol);
|
||||
|
||||
@@ -1645,7 +1645,7 @@ ClassOrNamespace *CreateBindings::enterClassOrNamespaceBinding(Symbol *symbol)
|
||||
|
||||
ClassOrNamespace *CreateBindings::enterGlobalClassOrNamespace(Symbol *symbol)
|
||||
{
|
||||
ClassOrNamespace *entity = _globalNamespace->findOrCreateType(symbol->name(), 0,
|
||||
ClassOrNamespace *entity = _globalNamespace->findOrCreateType(symbol->name(), nullptr,
|
||||
symbol->asClass());
|
||||
entity->addSymbol(symbol);
|
||||
|
||||
@@ -1678,13 +1678,13 @@ bool CreateBindings::visit(Namespace *ns)
|
||||
bool CreateBindings::visit(Class *klass)
|
||||
{
|
||||
ClassOrNamespace *previous = _currentClassOrNamespace;
|
||||
ClassOrNamespace *binding = 0;
|
||||
ClassOrNamespace *binding = nullptr;
|
||||
|
||||
if (klass->name() && klass->name()->isQualifiedNameId())
|
||||
binding = _currentClassOrNamespace->lookupType(klass->name());
|
||||
|
||||
if (! binding)
|
||||
binding = _currentClassOrNamespace->findOrCreateType(klass->name(), 0, klass);
|
||||
binding = _currentClassOrNamespace->findOrCreateType(klass->name(), nullptr, klass);
|
||||
|
||||
_currentClassOrNamespace = binding;
|
||||
_currentClassOrNamespace->addSymbol(klass);
|
||||
@@ -1737,7 +1737,7 @@ bool CreateBindings::visit(Declaration *decl)
|
||||
} else if (Class *klass = ty->asClassType()) {
|
||||
if (const Identifier *nameId = decl->name()->asNameId()) {
|
||||
ClassOrNamespace *binding
|
||||
= _currentClassOrNamespace->findOrCreateType(nameId, 0, klass);
|
||||
= _currentClassOrNamespace->findOrCreateType(nameId, nullptr, klass);
|
||||
binding->addSymbol(klass);
|
||||
}
|
||||
}
|
||||
@@ -1794,7 +1794,7 @@ bool CreateBindings::visit(Block *block)
|
||||
_entities.append(binding);
|
||||
} else {
|
||||
delete binding;
|
||||
binding = 0;
|
||||
binding = nullptr;
|
||||
}
|
||||
|
||||
_currentClassOrNamespace = previous;
|
||||
|
||||
@@ -97,8 +97,8 @@ private:
|
||||
void flush();
|
||||
|
||||
/// \internal
|
||||
ClassOrNamespace *findOrCreateType(const Name *name, ClassOrNamespace *origin = 0,
|
||||
Class *clazz = 0);
|
||||
ClassOrNamespace *findOrCreateType(const Name *name, ClassOrNamespace *origin = nullptr,
|
||||
Class *clazz = nullptr);
|
||||
|
||||
ClassOrNamespace *findOrCreateNestedAnonymousType(const AnonymousNameId *anonymousNameId);
|
||||
|
||||
@@ -196,9 +196,9 @@ public:
|
||||
ClassOrNamespace *globalNamespace() const;
|
||||
|
||||
/// Finds the binding associated to the given symbol.
|
||||
ClassOrNamespace *lookupType(Symbol *symbol, ClassOrNamespace *enclosingBinding = 0);
|
||||
ClassOrNamespace *lookupType(Symbol *symbol, ClassOrNamespace *enclosingBinding = nullptr);
|
||||
ClassOrNamespace *lookupType(const QList<const Name *> &path,
|
||||
ClassOrNamespace *enclosingBinding = 0);
|
||||
ClassOrNamespace *enclosingBinding = nullptr);
|
||||
|
||||
/// Returns the Control that must be used to create temporary symbols.
|
||||
/// \internal
|
||||
@@ -303,11 +303,11 @@ public:
|
||||
|
||||
QList<LookupItem> lookup(const Name *name, Scope *scope) const;
|
||||
ClassOrNamespace *lookupType(const Name *name, Scope *scope,
|
||||
ClassOrNamespace *enclosingBinding = 0,
|
||||
ClassOrNamespace *enclosingBinding = nullptr,
|
||||
QSet<const Declaration *> typedefsBeingResolved
|
||||
= QSet<const Declaration *>()) const;
|
||||
ClassOrNamespace *lookupType(Symbol *symbol,
|
||||
ClassOrNamespace *enclosingBinding = 0) const;
|
||||
ClassOrNamespace *enclosingBinding = nullptr) const;
|
||||
ClassOrNamespace *lookupParent(Symbol *symbol) const;
|
||||
|
||||
/// \internal
|
||||
|
||||
@@ -41,7 +41,7 @@ uint CPlusPlus::qHash(const LookupItem &key)
|
||||
}
|
||||
|
||||
LookupItem::LookupItem()
|
||||
: _scope(0), _declaration(0), _binding(0)
|
||||
: _scope(nullptr), _declaration(nullptr), _binding(nullptr)
|
||||
{ }
|
||||
|
||||
FullySpecifiedType LookupItem::type() const
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
using namespace CPlusPlus;
|
||||
|
||||
Macro::Macro()
|
||||
: _next(0),
|
||||
: _next(nullptr),
|
||||
_hashcode(0),
|
||||
_fileRevision(0),
|
||||
_line(0),
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
static bool shouldInsertMatchingText(const QTextCursor &tc);
|
||||
static bool shouldInsertMatchingText(QChar lookAhead);
|
||||
|
||||
static bool isInCommentHelper(const QTextCursor &currsor, Token *retToken = 0);
|
||||
static bool isInCommentHelper(const QTextCursor &currsor, Token *retToken = nullptr);
|
||||
static CPlusPlus::Kind stringKindAtCursor(const QTextCursor &cursor);
|
||||
|
||||
static QString insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
||||
|
||||
@@ -43,12 +43,12 @@ public:
|
||||
QString operator()(const QList<const Name *> &fullyQualifiedName) const
|
||||
{ return prettyName(fullyQualifiedName); }
|
||||
|
||||
QString operator()(const FullySpecifiedType &type, const Name *name = 0) const
|
||||
QString operator()(const FullySpecifiedType &type, const Name *name = nullptr) const
|
||||
{ return prettyType(type, name); }
|
||||
|
||||
QString prettyName(const Name *name) const;
|
||||
QString prettyName(const QList<const Name *> &fullyQualifiedName) const;
|
||||
QString prettyType(const FullySpecifiedType &type, const Name *name = 0) const;
|
||||
QString prettyType(const FullySpecifiedType &type, const Name *name = nullptr) const;
|
||||
QString prettyType(const FullySpecifiedType &type, const QString &name) const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -67,10 +67,10 @@ static unsigned hashCode(const char *str, int length)
|
||||
Environment::Environment()
|
||||
: currentLine(0),
|
||||
hideNext(false),
|
||||
_macros(0),
|
||||
_macros(nullptr),
|
||||
_allocated_macros(0),
|
||||
_macro_count(-1),
|
||||
_hash(0),
|
||||
_hash(nullptr),
|
||||
_hash_count(401)
|
||||
{
|
||||
}
|
||||
@@ -153,10 +153,10 @@ void Environment::reset()
|
||||
if (_hash)
|
||||
free(_hash);
|
||||
|
||||
_macros = 0;
|
||||
_macros = nullptr;
|
||||
_allocated_macros = 0;
|
||||
_macro_count = -1;
|
||||
_hash = 0;
|
||||
_hash = nullptr;
|
||||
_hash_count = 401;
|
||||
}
|
||||
|
||||
@@ -230,14 +230,14 @@ Environment::iterator Environment::lastMacro() const
|
||||
Macro *Environment::resolve(const ByteArrayRef &name) const
|
||||
{
|
||||
if (! _macros)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
Macro *it = _hash[hashCode(name.start(), name.size()) % _hash_count];
|
||||
for (; it; it = it->_next) {
|
||||
if (it->name() != name)
|
||||
continue;
|
||||
else if (it->isHidden())
|
||||
return 0;
|
||||
return nullptr;
|
||||
else break;
|
||||
}
|
||||
return it;
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
// use an "alreadyResolved" container. FIXME: We might overcome this by resolving the
|
||||
// template parameters.
|
||||
unsigned maxDepth = 15;
|
||||
for (NamedType *namedTy = 0; maxDepth && (namedTy = getNamedType(*type)); --maxDepth) {
|
||||
for (NamedType *namedTy = nullptr; maxDepth && (namedTy = getNamedType(*type)); --maxDepth) {
|
||||
QList<LookupItem> namedTypeItems = getNamedTypeItems(namedTy->name(), *scope, _binding);
|
||||
|
||||
if (Q_UNLIKELY(debug))
|
||||
@@ -125,9 +125,9 @@ private:
|
||||
QList<LookupItem> results;
|
||||
if (!scope)
|
||||
return results;
|
||||
Scope *enclosingBlockScope = 0;
|
||||
Scope *enclosingBlockScope = nullptr;
|
||||
for (Block *block = scope->asBlock(); block;
|
||||
block = enclosingBlockScope ? enclosingBlockScope->asBlock() : 0) {
|
||||
block = enclosingBlockScope ? enclosingBlockScope->asBlock() : nullptr) {
|
||||
const unsigned memberCount = block->memberCount();
|
||||
for (unsigned i = 0; i < memberCount; ++i) {
|
||||
Symbol *symbol = block->memberAt(i);
|
||||
@@ -233,7 +233,7 @@ static int evaluateFunctionArgument(const FullySpecifiedType &actualTy,
|
||||
ResolveExpression::ResolveExpression(const LookupContext &context,
|
||||
const QSet<const Declaration *> &autoDeclarationsBeingResolved)
|
||||
: ASTVisitor(context.expressionDocument()->translationUnit()),
|
||||
_scope(0),
|
||||
_scope(nullptr),
|
||||
_context(context),
|
||||
bind(context.expressionDocument()->translationUnit()),
|
||||
_autoDeclarationsBeingResolved(autoDeclarationsBeingResolved),
|
||||
@@ -314,9 +314,9 @@ bool ResolveExpression::visit(IdExpressionAST *ast)
|
||||
|
||||
bool ResolveExpression::visit(BinaryExpressionAST *ast)
|
||||
{
|
||||
if (tokenKind(ast->binary_op_token) == T_COMMA && ast->right_expression && ast->right_expression->asQtMethod() != 0) {
|
||||
if (tokenKind(ast->binary_op_token) == T_COMMA && ast->right_expression && ast->right_expression->asQtMethod() != nullptr) {
|
||||
|
||||
if (ast->left_expression && ast->left_expression->asQtMethod() != 0)
|
||||
if (ast->left_expression && ast->left_expression->asQtMethod() != nullptr)
|
||||
thisObject();
|
||||
else
|
||||
accept(ast->left_expression);
|
||||
@@ -404,7 +404,7 @@ bool ResolveExpression::visit(TypeidExpressionAST *)
|
||||
{
|
||||
const Name *stdName = control()->identifier("std");
|
||||
const Name *tiName = control()->identifier("type_info");
|
||||
const Name *q = control()->qualifiedNameId(control()->qualifiedNameId(/* :: */ 0, stdName), tiName);
|
||||
const Name *q = control()->qualifiedNameId(control()->qualifiedNameId(/* :: */ nullptr, stdName), tiName);
|
||||
|
||||
FullySpecifiedType ty(control()->namedType(q));
|
||||
addResult(ty, _scope);
|
||||
@@ -443,7 +443,7 @@ bool ResolveExpression::visit(NumericLiteralAST *ast)
|
||||
{
|
||||
const Token &tk = tokenAt(ast->literal_token);
|
||||
|
||||
Type *type = 0;
|
||||
Type *type = nullptr;
|
||||
bool isUnsigned = false;
|
||||
|
||||
if (tk.is(T_CHAR_LITERAL)) {
|
||||
@@ -591,7 +591,7 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
|
||||
LookupItem &p = _results[i];
|
||||
FullySpecifiedType ty = p.type();
|
||||
NamedType *namedTy = ty->asNamedType();
|
||||
if (namedTy != 0) {
|
||||
if (namedTy != nullptr) {
|
||||
const QList<LookupItem> types = _context.lookup(namedTy->name(), p.scope());
|
||||
if (!types.empty())
|
||||
ty = types.front().type();
|
||||
@@ -600,7 +600,7 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
|
||||
if (PointerType *ptrTy = ty->asPointerType()) {
|
||||
p.setType(ptrTy->elementType());
|
||||
added = true;
|
||||
} else if (namedTy != 0) {
|
||||
} else if (namedTy != nullptr) {
|
||||
const Name *starOp = control()->operatorNameId(OperatorNameId::StarOp);
|
||||
if (ClassOrNamespace *b = _context.lookupType(namedTy->name(), p.scope(), p.binding())) {
|
||||
foreach (const LookupItem &r, b->find(starOp)) {
|
||||
@@ -719,7 +719,7 @@ bool ResolveExpression::visit(SimpleNameAST *ast)
|
||||
if (!item.type()->isUndefinedType())
|
||||
continue;
|
||||
|
||||
if (item.declaration() == 0)
|
||||
if (item.declaration() == nullptr)
|
||||
continue;
|
||||
|
||||
if (item.type().isAuto()) {
|
||||
@@ -732,7 +732,7 @@ bool ResolveExpression::visit(SimpleNameAST *ast)
|
||||
continue;
|
||||
|
||||
const StringLiteral *initializationString = decl->getInitializer();
|
||||
if (initializationString == 0)
|
||||
if (initializationString == nullptr)
|
||||
continue;
|
||||
|
||||
const QByteArray &initializer =
|
||||
@@ -765,7 +765,7 @@ bool ResolveExpression::visit(SimpleNameAST *ast)
|
||||
Clone cloner(_context.bindings()->control().data());
|
||||
|
||||
for (int n = 0; n < typeItems.size(); ++ n) {
|
||||
FullySpecifiedType newType = cloner.type(typeItems[n].type(), 0);
|
||||
FullySpecifiedType newType = cloner.type(typeItems[n].type(), nullptr);
|
||||
if (n == 0) {
|
||||
item.setType(newType);
|
||||
item.setScope(typeItems[n].scope());
|
||||
@@ -1017,7 +1017,7 @@ bool ResolveExpression::visit(MemberAccessAST *ast)
|
||||
const QList<LookupItem> baseResults = resolve(ast->base_expression, _scope);
|
||||
|
||||
// Evaluate the expression-id that follows the access operator.
|
||||
const Name *memberName = 0;
|
||||
const Name *memberName = nullptr;
|
||||
if (ast->member_name)
|
||||
memberName = ast->member_name->name;
|
||||
|
||||
@@ -1034,7 +1034,7 @@ ClassOrNamespace *ResolveExpression::findClass(const FullySpecifiedType &origina
|
||||
ClassOrNamespace *enclosingBinding) const
|
||||
{
|
||||
FullySpecifiedType ty = originalTy.simplified();
|
||||
ClassOrNamespace *binding = 0;
|
||||
ClassOrNamespace *binding = nullptr;
|
||||
|
||||
if (Class *klass = ty->asClassType()) {
|
||||
if (scope->isBlock())
|
||||
@@ -1113,7 +1113,7 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
FullySpecifiedType overloadTy
|
||||
= instantiate(binding->templateId(), overload);
|
||||
Function *instantiatedFunction = overloadTy->asFunctionType();
|
||||
Q_ASSERT(instantiatedFunction != 0);
|
||||
Q_ASSERT(instantiatedFunction != nullptr);
|
||||
|
||||
FullySpecifiedType retTy
|
||||
= instantiatedFunction->returnType().simplified();
|
||||
@@ -1162,7 +1162,7 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
return binding;
|
||||
}
|
||||
|
||||
ClassOrNamespace *enclosingBinding = 0;
|
||||
ClassOrNamespace *enclosingBinding = nullptr;
|
||||
if (ClassOrNamespace *binding = r.binding()) {
|
||||
if (binding->instantiationOrigin())
|
||||
enclosingBinding = binding;
|
||||
@@ -1173,7 +1173,7 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClassOrNamespace *ResolveExpression::findClassForTemplateParameterInExpressionScope(
|
||||
@@ -1191,7 +1191,7 @@ ClassOrNamespace *ResolveExpression::findClassForTemplateParameterInExpressionSc
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FullySpecifiedType ResolveExpression::instantiate(const Name *className, Symbol *candidate) const
|
||||
@@ -1213,7 +1213,7 @@ bool ResolveExpression::visit(ObjCMessageExpressionAST *ast)
|
||||
|
||||
foreach (const LookupItem &result, receiverResults) {
|
||||
FullySpecifiedType ty = result.type().simplified();
|
||||
ClassOrNamespace *binding = 0;
|
||||
ClassOrNamespace *binding = nullptr;
|
||||
|
||||
if (ObjCClass *clazz = ty->asObjCClassType()) {
|
||||
// static access, e.g.:
|
||||
|
||||
@@ -49,13 +49,13 @@ public:
|
||||
|
||||
ClassOrNamespace *baseExpression(const QList<LookupItem> &baseResults,
|
||||
int accessOp,
|
||||
bool *replacedDotOperator = 0) const;
|
||||
bool *replacedDotOperator = nullptr) const;
|
||||
|
||||
const LookupContext &context() const;
|
||||
|
||||
protected:
|
||||
ClassOrNamespace *findClass(const FullySpecifiedType &ty, Scope *scope,
|
||||
ClassOrNamespace *enclosingBinding = 0) const;
|
||||
ClassOrNamespace *enclosingBinding = nullptr) const;
|
||||
|
||||
QList<LookupItem> expression(ExpressionAST *ast);
|
||||
|
||||
@@ -66,7 +66,7 @@ protected:
|
||||
|
||||
void thisObject();
|
||||
|
||||
void addResult(const FullySpecifiedType &ty, Scope *scope, ClassOrNamespace *binding = 0);
|
||||
void addResult(const FullySpecifiedType &ty, Scope *scope, ClassOrNamespace *binding = nullptr);
|
||||
void addResults(const QList<Symbol *> &symbols);
|
||||
void addResults(const QList<LookupItem> &items);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
using namespace CPlusPlus;
|
||||
|
||||
SymbolNameVisitor::SymbolNameVisitor()
|
||||
: _symbol(0)
|
||||
: _symbol(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
using namespace CPlusPlus;
|
||||
|
||||
TypeOfExpression::TypeOfExpression():
|
||||
m_ast(0),
|
||||
m_scope(0),
|
||||
m_ast(nullptr),
|
||||
m_scope(nullptr),
|
||||
m_expandTemplates(false)
|
||||
{
|
||||
}
|
||||
@@ -50,8 +50,8 @@ void TypeOfExpression::init(Document::Ptr thisDocument, const Snapshot &snapshot
|
||||
{
|
||||
m_thisDocument = thisDocument;
|
||||
m_snapshot = snapshot;
|
||||
m_ast = 0;
|
||||
m_scope = 0;
|
||||
m_ast = nullptr;
|
||||
m_scope = nullptr;
|
||||
m_lookupContext = LookupContext();
|
||||
|
||||
Q_ASSERT(m_bindings.isNull());
|
||||
@@ -178,7 +178,7 @@ QByteArray TypeOfExpression::preprocessedExpression(const QByteArray &utf8code)
|
||||
m_environment = QSharedPointer<Environment>(env);
|
||||
}
|
||||
|
||||
Preprocessor preproc(0, m_environment.data());
|
||||
Preprocessor preproc(nullptr, m_environment.data());
|
||||
return preproc.run(QLatin1String("<expression>"), utf8code);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace CPlusPlus {
|
||||
ExpressionAST *extractExpressionAST(Document::Ptr doc)
|
||||
{
|
||||
if (! doc->translationUnit()->ast())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
return doc->translationUnit()->ast()->asExpression();
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ void TypePrettyPrinter::visit(Function *type)
|
||||
if (index + 1 == _overview->markedArgument)
|
||||
const_cast<Overview*>(_overview)->markedArgumentBegin = _text.length();
|
||||
|
||||
const Name *name = 0;
|
||||
const Name *name = nullptr;
|
||||
|
||||
if (_overview->showArgumentNames)
|
||||
name = arg->name();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
namespace CPlusPlus {
|
||||
|
||||
static CppModelManagerBase *g_instance = 0;
|
||||
static CppModelManagerBase *g_instance = nullptr;
|
||||
|
||||
CppModelManagerBase::CppModelManagerBase(QObject *parent)
|
||||
: QObject(parent)
|
||||
@@ -39,7 +39,7 @@ CppModelManagerBase::CppModelManagerBase(QObject *parent)
|
||||
CppModelManagerBase::~CppModelManagerBase()
|
||||
{
|
||||
Q_ASSERT(g_instance == this);
|
||||
g_instance = 0;
|
||||
g_instance = nullptr;
|
||||
}
|
||||
|
||||
CppModelManagerBase *CppModelManagerBase::instance()
|
||||
|
||||
@@ -40,7 +40,7 @@ class CPLUSPLUS_EXPORT CppModelManagerBase : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CppModelManagerBase(QObject *parent = 0);
|
||||
CppModelManagerBase(QObject *parent = nullptr);
|
||||
~CppModelManagerBase();
|
||||
|
||||
static CppModelManagerBase *instance();
|
||||
|
||||
@@ -343,7 +343,7 @@ class ExpressionEvaluator
|
||||
|
||||
public:
|
||||
ExpressionEvaluator(Client *client, Environment *env)
|
||||
: client(client), env(env), _lex(0)
|
||||
: client(client), env(env), _lex(nullptr)
|
||||
{ }
|
||||
|
||||
Value operator()(const Token *firstToken, const Token *lastToken,
|
||||
@@ -422,7 +422,7 @@ protected:
|
||||
(*_lex)->byteOffset,
|
||||
(*_lex)->utf16charOffset,
|
||||
(*_lex)->lineno, env, client)
|
||||
!= 0);
|
||||
!= nullptr);
|
||||
++(*_lex);
|
||||
} else if ((*_lex)->is(T_LPAREN)) {
|
||||
++(*_lex);
|
||||
@@ -432,7 +432,7 @@ protected:
|
||||
(*_lex)->utf16charOffset,
|
||||
(*_lex)->lineno,
|
||||
env, client)
|
||||
!= 0);
|
||||
!= nullptr);
|
||||
++(*_lex);
|
||||
if ((*_lex)->is(T_RPAREN))
|
||||
++(*_lex);
|
||||
@@ -600,21 +600,21 @@ private:
|
||||
} // end of anonymous namespace
|
||||
|
||||
Preprocessor::State::State()
|
||||
: m_lexer(0)
|
||||
: m_lexer(nullptr)
|
||||
, m_skipping(MAX_LEVEL)
|
||||
, m_trueTest(MAX_LEVEL)
|
||||
, m_ifLevel(0)
|
||||
, m_tokenBufferDepth(0)
|
||||
, m_tokenBuffer(0)
|
||||
, m_tokenBuffer(nullptr)
|
||||
, m_inPreprocessorDirective(false)
|
||||
, m_markExpandedTokens(true)
|
||||
, m_noLines(false)
|
||||
, m_inCondition(false)
|
||||
, m_bytesOffsetRef(0)
|
||||
, m_utf16charsOffsetRef(0)
|
||||
, m_result(0)
|
||||
, m_result(nullptr)
|
||||
, m_lineRef(1)
|
||||
, m_currentExpansion(0)
|
||||
, m_currentExpansion(nullptr)
|
||||
, m_includeGuardState(IncludeGuardState_BeforeIfndef)
|
||||
{
|
||||
m_skipping[m_ifLevel] = false;
|
||||
@@ -848,7 +848,7 @@ void Preprocessor::handleDefined(PPToken *tk)
|
||||
void Preprocessor::pushToken(Preprocessor::PPToken *tk)
|
||||
{
|
||||
const PPToken currentTokenBuffer[] = {*tk};
|
||||
m_state.pushTokenBuffer(currentTokenBuffer, currentTokenBuffer + 1, 0);
|
||||
m_state.pushTokenBuffer(currentTokenBuffer, currentTokenBuffer + 1, nullptr);
|
||||
}
|
||||
|
||||
void Preprocessor::lex(PPToken *tk)
|
||||
@@ -1774,7 +1774,7 @@ void Preprocessor::handleDefineDirective(PPToken *tk)
|
||||
unsigned previousBytesOffset = 0;
|
||||
unsigned previousUtf16charsOffset = 0;
|
||||
unsigned previousLine = 0;
|
||||
Macro *macroReference = 0;
|
||||
Macro *macroReference = nullptr;
|
||||
while (isContinuationToken(*tk)) {
|
||||
// Macro tokens are always marked as expanded. However, only for object-like macros
|
||||
// we mark them as generated too. For function-like macros we postpone it until the
|
||||
@@ -1791,7 +1791,7 @@ void Preprocessor::handleDefineDirective(PPToken *tk)
|
||||
if (!macroReference->isFunctionLike()) {
|
||||
m_client->notifyMacroReference(tk->byteOffset, tk->utf16charOffset,
|
||||
tk->lineno, *macroReference);
|
||||
macroReference = 0;
|
||||
macroReference = nullptr;
|
||||
}
|
||||
}
|
||||
} else if (macroReference) {
|
||||
@@ -1799,7 +1799,7 @@ void Preprocessor::handleDefineDirective(PPToken *tk)
|
||||
m_client->notifyMacroReference(previousBytesOffset, previousUtf16charsOffset,
|
||||
previousLine, *macroReference);
|
||||
}
|
||||
macroReference = 0;
|
||||
macroReference = nullptr;
|
||||
}
|
||||
|
||||
previousBytesOffset = tk->byteOffset;
|
||||
@@ -1870,7 +1870,7 @@ QByteArray Preprocessor::expand(PPToken *tk, PPToken *lastConditionToken)
|
||||
// qDebug("*** Condition before: [%s]", condition.constData());
|
||||
QByteArray result;
|
||||
result.reserve(256);
|
||||
preprocess(m_state.m_currentFileName, condition, &result, 0, true, false, true,
|
||||
preprocess(m_state.m_currentFileName, condition, &result, nullptr, true, false, true,
|
||||
bytesBegin, utf16charsBegin, line);
|
||||
result.squeeze();
|
||||
// qDebug("*** Condition after: [%s]", result.constData());
|
||||
|
||||
@@ -181,7 +181,7 @@ private:
|
||||
/// \param idToken the identifier token that ought to be in the input
|
||||
/// after a #ifndef or a #define .
|
||||
inline void updateIncludeGuardState(IncludeGuardStateHint hint,
|
||||
PPToken *idToken = 0)
|
||||
PPToken *idToken = nullptr)
|
||||
{
|
||||
// some quick checks for the majority of the uninteresting cases:
|
||||
if (m_includeGuardState == IncludeGuardState_NoGuard)
|
||||
@@ -227,7 +227,7 @@ private:
|
||||
void handlePreprocessorDirective(PPToken *tk);
|
||||
void handleIncludeDirective(PPToken *tk, bool includeNext);
|
||||
void handleDefineDirective(PPToken *tk);
|
||||
QByteArray expand(PPToken *tk, PPToken *lastConditionToken = 0);
|
||||
QByteArray expand(PPToken *tk, PPToken *lastConditionToken = nullptr);
|
||||
const Internal::PPToken evalExpression(PPToken *tk, Value &result);
|
||||
void handleIfDirective(PPToken *tk);
|
||||
void handleElifDirective(PPToken *tk, const PPToken £Token);
|
||||
|
||||
Reference in New Issue
Block a user