forked from qt-creator/qt-creator
Skip constructors and destructors when searching for the canonical symbol.
This commit is contained in:
@@ -344,17 +344,23 @@ struct CanonicalSymbol
|
|||||||
|
|
||||||
for (int i = results.size() - 1; i != -1; --i) {
|
for (int i = results.size() - 1; i != -1; --i) {
|
||||||
const LookupItem &r = results.at(i);
|
const LookupItem &r = results.at(i);
|
||||||
|
Symbol *decl = r.declaration();
|
||||||
|
|
||||||
if (! r.declaration())
|
if (! (decl && decl->scope()))
|
||||||
break;
|
|
||||||
else if (! r.declaration()->scope())
|
|
||||||
break;
|
|
||||||
else if (! r.declaration()->scope()->isClass())
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (Function *funTy = r.declaration()->type()->asFunctionType())
|
if (Class *classScope = r.declaration()->scope()->asClass()) {
|
||||||
if (funTy->isVirtual())
|
const Identifier *declId = decl->identifier();
|
||||||
return r.declaration();
|
const Identifier *classId = classScope->identifier();
|
||||||
|
|
||||||
|
if (classId && classId->isEqualTo(declId))
|
||||||
|
continue; // skip it, it's a ctor or a dtor.
|
||||||
|
|
||||||
|
else if (Function *funTy = r.declaration()->type()->asFunctionType()) {
|
||||||
|
if (funTy->isVirtual())
|
||||||
|
return r.declaration();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < results.size(); ++i) {
|
for (int i = 0; i < results.size(); ++i) {
|
||||||
|
Reference in New Issue
Block a user