Commit 2f7384dd authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

C++: Use direct member initialization in FindUsages

Change-Id: Ibe717dc587d817d53356771507b4aa3072554cb1
Reviewed-by: Nikolai Kosjar's avatarNikolai Kosjar <nikolai.kosjar@qt.io>
parent cd7ab5d3
......@@ -42,14 +42,11 @@ using namespace CPlusPlus;
FindUsages::FindUsages(const QByteArray &originalSource, Document::Ptr doc, const Snapshot &snapshot)
: ASTVisitor(doc->translationUnit()),
_id(0),
_declSymbol(0),
_doc(doc),
_snapshot(snapshot),
_context(doc, snapshot),
_originalSource(originalSource),
_source(_doc->utf8Source()),
_currentScope(0)
_source(_doc->utf8Source())
{
_snapshot.insert(_doc);
typeofExpression.init(_doc, _snapshot, _context.bindings());
......@@ -59,14 +56,11 @@ FindUsages::FindUsages(const QByteArray &originalSource, Document::Ptr doc, cons
FindUsages::FindUsages(const LookupContext &context)
: ASTVisitor(context.thisDocument()->translationUnit()),
_id(0),
_declSymbol(0),
_doc(context.thisDocument()),
_snapshot(context.snapshot()),
_context(context),
_originalSource(_doc->utf8Source()),
_source(_doc->utf8Source()),
_currentScope(0)
_source(_doc->utf8Source())
{
typeofExpression.init(_doc, _snapshot, _context.bindings());
......
......@@ -38,18 +38,16 @@ namespace CPlusPlus {
class CPLUSPLUS_EXPORT Usage
{
public:
Usage()
: line(0), col(0), len(0) {}
Usage() = default;
Usage(const QString &path, const QString &lineText, int line, int col, int len)
: path(path), lineText(lineText), line(line), col(col), len(len) {}
public:
QString path;
QString lineText;
int line;
int col;
int len;
int line = 0;
int col = 0;
int len = 0;
};
class CPLUSPLUS_EXPORT FindUsages: protected ASTVisitor
......@@ -286,8 +284,8 @@ private:
QString fetchLine(unsigned lineNr) const;
private:
const Identifier *_id;
Symbol *_declSymbol;
const Identifier *_id = nullptr;
Symbol *_declSymbol = nullptr;
QList<const Name *> _declSymbolFullyQualifiedName;
Document::Ptr _doc;
Snapshot _snapshot;
......@@ -299,7 +297,7 @@ private:
QList<Usage> _usages;
QSet<unsigned> _processed;
TypeOfExpression typeofExpression;
Scope *_currentScope;
Scope *_currentScope = nullptr;
};
} // namespace CPlusPlus
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment