Commit 3e8919de authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppEditor: Harden FunctionHelper::overrides

Task-number: QTCREATORBUG-10333

Change-Id: I2ba7e0d5b8b8eb856445e737dfa21ec8a543f85d
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent b8dbac0b
......@@ -282,13 +282,14 @@ bool FunctionHelper::isPureVirtualFunction(const Function *function, const Snaps
}
QList<Symbol *> FunctionHelper::overrides(Class *startClass, Function *function,
const Snapshot &snapshot)
const Snapshot &snapshot)
{
QList<Symbol *> result;
QTC_ASSERT(function && startClass, return result);
QTC_ASSERT(startClass && function, return result);
FullySpecifiedType referenceType = function->type();
const Name *referenceName = function->name();
QTC_ASSERT(referenceName && referenceType.isValid(), return result);
// Add itself
result << function;
......@@ -315,7 +316,9 @@ QList<Symbol *> FunctionHelper::overrides(Class *startClass, Function *function,
for (int i = 0, total = c->memberCount(); i < total; ++i) {
Symbol *candidate = c->memberAt(i);
const Name *candidateName = candidate->name();
FullySpecifiedType candidateType = candidate->type();
const FullySpecifiedType candidateType = candidate->type();
if (!candidateName || !candidateType.isValid())
continue;
if (candidateName->isEqualTo(referenceName) && candidateType.isEqualTo(referenceType))
result << candidate;
}
......
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