forked from qt-creator/qt-creator
CppEditor: Harden FunctionHelper::overrides
Task-number: QTCREATORBUG-10333 Change-Id: I2ba7e0d5b8b8eb856445e737dfa21ec8a543f85d Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user