forked from qt-creator/qt-creator
CplusPlus: Fix minimal name construction
... when creating the constructor implementation for a derived class.
We would erroneously strip off the class name.
Amends aae3ce15aa.
Change-Id: I62c800d490626e8cb9416829633f9ef7b0c666cd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -273,9 +273,9 @@ const Name *LookupContext::minimalName(Symbol *symbol, ClassOrNamespace *target,
|
||||
ClassOrNamespace *current = target;
|
||||
|
||||
const auto getNameFromItems = [symbol, target, control](const QList<LookupItem> &items,
|
||||
const QList<const Name *> &names, bool checkSymbols) -> const Name * {
|
||||
const QList<const Name *> &names) -> const Name * {
|
||||
for (const LookupItem &item : items) {
|
||||
if (checkSymbols && !symbolIdentical(item.declaration(), symbol))
|
||||
if (!symbol->asUsingDeclaration() && !symbolIdentical(item.declaration(), symbol))
|
||||
continue;
|
||||
|
||||
// eliminate inline namespaces
|
||||
@@ -300,7 +300,7 @@ const Name *LookupContext::minimalName(Symbol *symbol, ClassOrNamespace *target,
|
||||
|
||||
// once we're qualified enough to get the same symbol, break
|
||||
if (target) {
|
||||
const Name * const minimal = getNameFromItems(target->lookup(n), names.mid(i), true);
|
||||
const Name * const minimal = getNameFromItems(target->lookup(n), names.mid(i));
|
||||
if (minimal)
|
||||
return minimal;
|
||||
}
|
||||
@@ -312,7 +312,7 @@ const Name *LookupContext::minimalName(Symbol *symbol, ClassOrNamespace *target,
|
||||
const QList<ClassOrNamespace *> usings = nested->usings();
|
||||
for (ClassOrNamespace * const u : usings) {
|
||||
const Name * const minimal = getNameFromItems(u->lookup(symbol->name()),
|
||||
nameList, false);
|
||||
nameList);
|
||||
if (minimal)
|
||||
return minimal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user