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; ...@@ -42,14 +42,11 @@ using namespace CPlusPlus;
FindUsages::FindUsages(const QByteArray &originalSource, Document::Ptr doc, const Snapshot &snapshot) FindUsages::FindUsages(const QByteArray &originalSource, Document::Ptr doc, const Snapshot &snapshot)
: ASTVisitor(doc->translationUnit()), : ASTVisitor(doc->translationUnit()),
_id(0),
_declSymbol(0),
_doc(doc), _doc(doc),
_snapshot(snapshot), _snapshot(snapshot),
_context(doc, snapshot), _context(doc, snapshot),
_originalSource(originalSource), _originalSource(originalSource),
_source(_doc->utf8Source()), _source(_doc->utf8Source())
_currentScope(0)
{ {
_snapshot.insert(_doc); _snapshot.insert(_doc);
typeofExpression.init(_doc, _snapshot, _context.bindings()); typeofExpression.init(_doc, _snapshot, _context.bindings());
...@@ -59,14 +56,11 @@ FindUsages::FindUsages(const QByteArray &originalSource, Document::Ptr doc, cons ...@@ -59,14 +56,11 @@ FindUsages::FindUsages(const QByteArray &originalSource, Document::Ptr doc, cons
FindUsages::FindUsages(const LookupContext &context) FindUsages::FindUsages(const LookupContext &context)
: ASTVisitor(context.thisDocument()->translationUnit()), : ASTVisitor(context.thisDocument()->translationUnit()),
_id(0),
_declSymbol(0),
_doc(context.thisDocument()), _doc(context.thisDocument()),
_snapshot(context.snapshot()), _snapshot(context.snapshot()),
_context(context), _context(context),
_originalSource(_doc->utf8Source()), _originalSource(_doc->utf8Source()),
_source(_doc->utf8Source()), _source(_doc->utf8Source())
_currentScope(0)
{ {
typeofExpression.init(_doc, _snapshot, _context.bindings()); typeofExpression.init(_doc, _snapshot, _context.bindings());
......
...@@ -38,18 +38,16 @@ namespace CPlusPlus { ...@@ -38,18 +38,16 @@ namespace CPlusPlus {
class CPLUSPLUS_EXPORT Usage class CPLUSPLUS_EXPORT Usage
{ {
public: public:
Usage() Usage() = default;
: line(0), col(0), len(0) {}
Usage(const QString &path, const QString &lineText, int line, int col, int len) Usage(const QString &path, const QString &lineText, int line, int col, int len)
: path(path), lineText(lineText), line(line), col(col), len(len) {} : path(path), lineText(lineText), line(line), col(col), len(len) {}
public: public:
QString path; QString path;
QString lineText; QString lineText;
int line; int line = 0;
int col; int col = 0;
int len; int len = 0;
}; };
class CPLUSPLUS_EXPORT FindUsages: protected ASTVisitor class CPLUSPLUS_EXPORT FindUsages: protected ASTVisitor
...@@ -286,8 +284,8 @@ private: ...@@ -286,8 +284,8 @@ private:
QString fetchLine(unsigned lineNr) const; QString fetchLine(unsigned lineNr) const;
private: private:
const Identifier *_id; const Identifier *_id = nullptr;
Symbol *_declSymbol; Symbol *_declSymbol = nullptr;
QList<const Name *> _declSymbolFullyQualifiedName; QList<const Name *> _declSymbolFullyQualifiedName;
Document::Ptr _doc; Document::Ptr _doc;
Snapshot _snapshot; Snapshot _snapshot;
...@@ -299,7 +297,7 @@ private: ...@@ -299,7 +297,7 @@ private:
QList<Usage> _usages; QList<Usage> _usages;
QSet<unsigned> _processed; QSet<unsigned> _processed;
TypeOfExpression typeofExpression; TypeOfExpression typeofExpression;
Scope *_currentScope; Scope *_currentScope = nullptr;
}; };
} // namespace CPlusPlus } // 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