forked from qt-creator/qt-creator
CppTools: modernize
Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -55,7 +55,7 @@ const LookupContext &CanonicalSymbol::context() const
|
||||
Scope *CanonicalSymbol::getScopeAndExpression(const QTextCursor &cursor, QString *code)
|
||||
{
|
||||
if (!m_document)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
QTextCursor tc = cursor;
|
||||
int line, column;
|
||||
@@ -65,7 +65,7 @@ Scope *CanonicalSymbol::getScopeAndExpression(const QTextCursor &cursor, QString
|
||||
QTextDocument *textDocument = cursor.document();
|
||||
if (!CppTools::isValidIdentifierChar(textDocument->characterAt(pos)))
|
||||
if (!(pos > 0 && CppTools::isValidIdentifierChar(textDocument->characterAt(pos - 1))))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
while (CppTools::isValidIdentifierChar(textDocument->characterAt(pos)))
|
||||
++pos;
|
||||
@@ -83,7 +83,7 @@ Symbol *CanonicalSymbol::operator()(const QTextCursor &cursor)
|
||||
if (Scope *scope = getScopeAndExpression(cursor, &code))
|
||||
return operator()(scope, code);
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Symbol *CanonicalSymbol::operator()(Scope *scope, const QString &code)
|
||||
@@ -118,14 +118,12 @@ Symbol *CanonicalSymbol::canonicalSymbol(Scope *scope, const QString &code,
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < results.size(); ++i) {
|
||||
const LookupItem &r = results.at(i);
|
||||
|
||||
if (r.declaration())
|
||||
for (const auto &r : results) {
|
||||
if (r.declaration())
|
||||
return r.declaration();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace CppEditor
|
||||
|
||||
Reference in New Issue
Block a user