Skip to content

Commit b3438f2

Browse files
committed
issue doxygen#11758 Const parameter in implementation can confuse function signature matching
1 parent 321b30e commit b3438f2

File tree

4 files changed

+19
-29
lines changed

4 files changed

+19
-29
lines changed

src/doxygen.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5675,6 +5675,9 @@ static const ClassDef *findClassDefinition(FileDef *fd,NamespaceDef *nd,
56755675
{
56765676
SymbolResolver resolver(fd);
56775677
const ClassDef *tcd = resolver.resolveClass(nd,scopeName,true,true);
5678+
//printf("findClassDefinition(fd=%s,ns=%s,scopeName=%s)='%s'\n",
5679+
// qPrint(fd?fd->name():""),qPrint(nd?nd->name():""),
5680+
// qPrint(scopeName),qPrint(tcd?tcd->name():""));
56785681
return tcd;
56795682
}
56805683

@@ -6198,8 +6201,8 @@ static void addMemberFunction(const Entry *root,
61986201
// don't be fooled by anonymous scopes
61996202
tcd=cd;
62006203
}
6201-
//printf("Looking for %s inside nd=%s result=%p (%s) cd=%p\n",
6202-
// qPrint(scopeName),nd?qPrint(nd->name()):"<none>",tcd,tcd?qPrint(tcd->name()):"",cd);
6204+
//printf("Looking for %s inside nd=%s result=%s cd=%s\n",
6205+
// qPrint(scopeName),nd?qPrint(nd->name()):"<none>",tcd?qPrint(tcd->name()):"",qPrint(cd->name()));
62036206

62046207
if (cd && tcd==cd) // member's classes match
62056208
{

src/symbolresolver.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ struct SymbolResolver::Private
124124
{
125125
m_fileScope = fileScope;
126126
}
127+
const FileDef *fileScope() const { return m_fileScope; }
127128

128129
QCString resolvedType;
129130
const MemberDef *typeDef = nullptr;
@@ -1204,7 +1205,8 @@ const Definition *SymbolResolver::Private::followPath(VisitedKeys &visitedKeys,
12041205
// try to resolve the part if it is a typedef
12051206
const MemberDef *memTypeDef=nullptr;
12061207
QCString qualScopePart = substTypedef(visitedKeys,current,path.mid(is,l),&memTypeDef);
1207-
AUTO_TRACE_ADD("qualScopePart={}",qualScopePart);
1208+
AUTO_TRACE_ADD("qualScopePart={} memTypeDef={}",qualScopePart,memTypeDef?memTypeDef->name():"");
1209+
const Definition *next = nullptr;
12081210
if (memTypeDef)
12091211
{
12101212
const ClassDef *type = newResolveTypedef(visitedKeys,m_fileScope,memTypeDef,nullptr,nullptr,nullptr);
@@ -1214,7 +1216,14 @@ const Definition *SymbolResolver::Private::followPath(VisitedKeys &visitedKeys,
12141216
return type;
12151217
}
12161218
}
1217-
const Definition *next = current->findInnerCompound(qualScopePart);
1219+
else if (m_fileScope)
1220+
{
1221+
next = endOfPathIsUsedClass(m_fileScope->getUsedDefinitions(),qualScopePart);
1222+
}
1223+
if (next==nullptr)
1224+
{
1225+
next = current->findInnerCompound(qualScopePart);
1226+
}
12181227
AUTO_TRACE_ADD("Looking for {} inside {} result={}",
12191228
qualScopePart, current->name(), next?next->name():QCString());
12201229
if (next==nullptr)
@@ -1622,7 +1631,9 @@ const ClassDef *SymbolResolver::resolveClass(const Definition *scope,
16221631
scope?scope->name():QCString(), name, mayBeUnlinkable, mayBeHidden);
16231632
p->reset();
16241633

1625-
auto lang = scope ? scope->getLanguage() : SrcLangExt::Cpp;
1634+
auto lang = scope ? scope->getLanguage() :
1635+
p->fileScope() ? p->fileScope()->getLanguage() :
1636+
SrcLangExt::Cpp; // fallback to C++
16261637

16271638
if (scope==nullptr ||
16281639
(scope->definitionType()!=Definition::TypeClass &&

src/util.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4847,28 +4847,6 @@ QCString stripExtension(const QCString &fName)
48474847
return stripExtensionGeneral(fName, Doxygen::htmlFileExtension);
48484848
}
48494849

4850-
#if 0
4851-
void replaceNamespaceAliases(QCString &scope,size_t i)
4852-
{
4853-
printf("replaceNamespaceAliases(%s,%zu)\n",qPrint(scope),i);
4854-
while (i>0)
4855-
{
4856-
QCString ns = scope.left(i);
4857-
if (!ns.isEmpty())
4858-
{
4859-
auto it = Doxygen::namespaceAliasMap.find(ns.str());
4860-
if (it!=Doxygen::namespaceAliasMap.end())
4861-
{
4862-
scope=it->second+scope.right(scope.length()-i);
4863-
i=it->second.length();
4864-
}
4865-
}
4866-
if (i>0 && ns==scope.left(i)) break;
4867-
}
4868-
printf("result=%s\n",qPrint(scope));
4869-
}
4870-
#endif
4871-
48724850
QCString stripPath(const QCString &s)
48734851
{
48744852
QCString result=s;

src/util.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,6 @@ QCString stripExtensionGeneral(const QCString &fName, const QCString &ext);
349349

350350
QCString stripExtension(const QCString &fName);
351351

352-
//void replaceNamespaceAliases(QCString &scope,size_t i);
353-
354352
int computeQualifiedIndex(const QCString &name);
355353

356354
void addDirPrefix(QCString &fileName);

0 commit comments

Comments
 (0)