Commit 4eb40af9 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Skip constructors and destructors when searching for the canonical symbol.

parent 9c1fc97a
......@@ -344,17 +344,23 @@ struct CanonicalSymbol
for (int i = results.size() - 1; i != -1; --i) {
const LookupItem &r = results.at(i);
Symbol *decl = r.declaration();
if (! r.declaration())
break;
else if (! r.declaration()->scope())
break;
else if (! r.declaration()->scope()->isClass())
if (! (decl && decl->scope()))
break;
if (Function *funTy = r.declaration()->type()->asFunctionType())
if (funTy->isVirtual())
return r.declaration();
if (Class *classScope = r.declaration()->scope()->asClass()) {
const Identifier *declId = decl->identifier();
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) {
......
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