CPlusPlus: Drop the OverView::operator() overloads

Use the named members instead. The operator() versions have been used
only in a handful places, not using them makes things clearer on the
user code side.

Change-Id: I9b44371e094d498ff6ebfa9ecbe32f8654a63d4d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-06-27 11:31:36 +02:00
parent 96caffb8cf
commit 56eba24222
4 changed files with 9 additions and 18 deletions

View File

@@ -396,7 +396,8 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
if (d->isTypedef() && d->type()) {
if (Q_UNLIKELY(debug)) {
Overview oo;
qDebug() << "Looks like" << oo(name) << "is a typedef for" << oo(d->type());
qDebug() << "Looks like" << oo.prettyName(name)
<< "is a typedef for" << oo.prettyType(d->type());
}
if (const NamedType *namedTy = d->type()->asNamedType()) {
// Stop on recursive typedef declarations
@@ -835,7 +836,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
if (Q_UNLIKELY(debug)) {
Overview oo;
qDebug() << "Found" << id->chars() << "in"
<< (binding ? oo(binding->_name) : QString::fromLatin1("<null>"));
<< (binding ? oo.prettyName(binding->_name) : QString::fromLatin1("<null>"));
}
LookupItem item;
@@ -974,7 +975,7 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
{
if (Q_UNLIKELY(debug)) {
Overview oo;
qDebug() << "Looking up" << oo(name) << "in" << oo(_name);
qDebug() << "Looking up" << oo.prettyName(name) << "in" << oo.prettyName(_name);
}
if (const QualifiedNameId *q = name->asQualifiedNameId()) {
@@ -1358,14 +1359,14 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
oo.showFunctionSignatures = true;
oo.showReturnTypes = true;
oo.showTemplateParameters = true;
qDebug() << "cloned" << oo(clone->type());
qDebug() << "cloned" << oo.prettyType(clone->type());
if (Class *klass = clone->asClass()) {
const int klassMemberCount = klass->memberCount();
for (int i = 0; i < klassMemberCount; ++i){
Symbol *klassMemberAsSymbol = klass->memberAt(i);
if (klassMemberAsSymbol->isTypedef()) {
if (Declaration *declaration = klassMemberAsSymbol->asDeclaration())
qDebug() << "Member: " << oo(declaration->type(), declaration->name());
qDebug() << "Member: " << oo.prettyType(declaration->type(), declaration->name());
}
}
}

View File

@@ -115,8 +115,7 @@ QString Overview::prettyType(const FullySpecifiedType &ty, const Name *name) con
return prettyType(ty, prettyName(name));
}
QString Overview::prettyType(const FullySpecifiedType &ty,
const QString &name) const
QString Overview::prettyType(const FullySpecifiedType &ty, const QString &name) const
{
TypePrettyPrinter pp(this);
return pp(ty, name);

View File

@@ -37,15 +37,6 @@ class CPLUSPLUS_EXPORT Overview
public:
Overview();
QString operator()(const Name *name) const
{ return prettyName(name); }
QString operator()(const QList<const Name *> &fullyQualifiedName) const
{ return prettyName(fullyQualifiedName); }
QString operator()(const FullySpecifiedType &type, const Name *name = nullptr) const
{ return prettyType(type, name); }
QString prettyName(const Name *name) const;
QString prettyName(const QList<const Name *> &fullyQualifiedName) const;
QString prettyType(const FullySpecifiedType &type, const Name *name = nullptr) const;

View File

@@ -1079,13 +1079,13 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
if (Q_UNLIKELY(debug)) {
qDebug("trying result #%d", ++i);
qDebug() << "- before typedef resolving we have:" << oo(ty);
qDebug() << "- before typedef resolving we have:" << oo.prettyType(ty);
}
typedefsResolver.resolve(&ty, &scope, r.binding());
if (Q_UNLIKELY(debug))
qDebug() << "- after typedef resolving:" << oo(ty);
qDebug() << "- after typedef resolving:" << oo.prettyType(ty);
if (accessOp == T_ARROW) {
PointerType *ptrTy = ty->asPointerType();