Skip to content

Commit 64f2d99

Browse files
committed
issue doxygen#11307 C++ 20 module partition: Links to class members not found
1 parent ba083a9 commit 64f2d99

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

src/docnode.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ DocRef::DocRef(DocParser *parser,DocNodeVariant *parent,const QCString &target,c
707707
{
708708
const Definition *compound = nullptr;
709709
QCString anchor;
710-
//printf("DocRef::DocRef(target=%s,context=%s)\n",qPrint(target),qPrint(context));
710+
AUTO_TRACE("target='{}',context='{}'",target,context);
711711
ASSERT(!target.isEmpty());
712712
m_relPath = parser->context.relPath;
713713
const SectionInfo *sec = SectionManager::instance().find(parser->context.prefix+target);
@@ -745,6 +745,7 @@ DocRef::DocRef(DocParser *parser,DocNodeVariant *parent,const QCString &target,c
745745
m_sectionType = sec->type();
746746
//printf("m_text=%s,m_ref=%s,m_file=%s,type=%d\n",
747747
// qPrint(m_text),qPrint(m_ref),qPrint(m_file),m_refType);
748+
AUTO_TRACE_EXIT("section");
748749
return;
749750
}
750751
else if (resolveLink(context,target,true,&compound,anchor,parser->context.prefix))
@@ -781,6 +782,7 @@ DocRef::DocRef(DocParser *parser,DocNodeVariant *parent,const QCString &target,c
781782
m_ref = compound->getReference();
782783
//printf("isFile=%d compound=%s (%d)\n",isFile,qPrint(compound->name()),
783784
// compound->definitionType());
785+
AUTO_TRACE_EXIT("compound");
784786
return;
785787
}
786788
else if (compound && compound->definitionType()==Definition::TypeFile &&
@@ -789,8 +791,13 @@ DocRef::DocRef(DocParser *parser,DocNodeVariant *parent,const QCString &target,c
789791
{
790792
m_file = compound->getSourceFileBase();
791793
m_ref = compound->getReference();
794+
AUTO_TRACE_EXIT("source");
792795
return;
793796
}
797+
else
798+
{
799+
AUTO_TRACE_EXIT("compound '{}' not linkable",compound?compound->name():"none");
800+
}
794801
}
795802
m_text = target;
796803
warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"unable to resolve reference to '%s' for \\ref command",

src/moduledef.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ class ModuleDefImpl : public DefinitionMixin<ModuleDef>
5959
QCString displayName(bool=TRUE) const override { return name(); }
6060
QCString getOutputFileBase() const override;
6161
QCString anchor() const override { return ""; }
62-
bool isLinkableInProject() const override { return isLinkable() && !isHidden() && !isReference(); }
63-
bool isLinkable() const override { return hasDocumentation(); }
62+
bool isLinkableInProject() const override {
63+
if (m_primaryInterface) return m_primaryInterface->isLinkableInProject();
64+
else return isLinkable() && !isHidden() && !isReference(); }
65+
bool isLinkable() const override {
66+
if (m_primaryInterface) return m_primaryInterface->isLinkable();
67+
else return hasDocumentation(); }
6468
QCString qualifiedName() const override;
6569
void writeSummaryLinks(OutputList &ol) const override;
6670

src/util.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3135,7 +3135,7 @@ bool resolveLink(/* in */ const QCString &scName,
31353135

31363136
QCString linkRef=lr;
31373137
QCString linkRefWithoutTemplates = stripTemplateSpecifiersFromScope(linkRef,FALSE);
3138-
//printf("ResolveLink linkRef=%s\n",qPrint(lr));
3138+
AUTO_TRACE("scName='{}',ref='{}'",scName,lr);
31393139
const FileDef *fd = nullptr;
31403140
const GroupDef *gd = nullptr;
31413141
const PageDef *pd = nullptr;
@@ -3147,6 +3147,7 @@ bool resolveLink(/* in */ const QCString &scName,
31473147
bool ambig = false;
31483148
if (linkRef.isEmpty()) // no reference name!
31493149
{
3150+
AUTO_TRACE_EXIT("no_ref");
31503151
return FALSE;
31513152
}
31523153
else if ((pd=Doxygen::pageLinkedMap->find(linkRef))) // link to a page
@@ -3162,70 +3163,82 @@ bool resolveLink(/* in */ const QCString &scName,
31623163
{
31633164
*resContext=pd;
31643165
}
3166+
AUTO_TRACE_EXIT("page");
31653167
return TRUE;
31663168
}
31673169
else if ((si=SectionManager::instance().find(prefix+linkRef)))
31683170
{
31693171
*resContext=si->definition();
31703172
resAnchor = si->label();
3173+
AUTO_TRACE_EXIT("section");
31713174
return TRUE;
31723175
}
31733176
else if ((pd=Doxygen::exampleLinkedMap->find(linkRef))) // link to an example
31743177
{
31753178
*resContext=pd;
3179+
AUTO_TRACE_EXIT("example");
31763180
return TRUE;
31773181
}
31783182
else if ((gd=Doxygen::groupLinkedMap->find(linkRef))) // link to a group
31793183
{
31803184
*resContext=gd;
3185+
AUTO_TRACE_EXIT("group");
31813186
return TRUE;
31823187
}
31833188
else if ((fd=findFileDef(Doxygen::inputNameLinkedMap,linkRef,ambig)) // file link
31843189
&& fd->isLinkable())
31853190
{
31863191
*resContext=fd;
3192+
AUTO_TRACE_EXIT("file");
31873193
return TRUE;
31883194
}
31893195
else if ((cd=getClass(linkRef))) // class link
31903196
{
31913197
*resContext=cd;
31923198
resAnchor=cd->anchor();
3199+
AUTO_TRACE_EXIT("class");
31933200
return TRUE;
31943201
}
31953202
else if ((cd=getClass(linkRefWithoutTemplates))) // C#/Java generic class link
31963203
{
31973204
*resContext=cd;
31983205
resAnchor=cd->anchor();
3206+
AUTO_TRACE_EXIT("generic");
31993207
return TRUE;
32003208
}
32013209
else if ((cd=getClass(linkRef+"-p"))) // Obj-C protocol link
32023210
{
32033211
*resContext=cd;
32043212
resAnchor=cd->anchor();
3213+
AUTO_TRACE_EXIT("protocol");
32053214
return TRUE;
32063215
}
32073216
else if ((cnd=getConcept(linkRef))) // C++20 concept definition
32083217
{
32093218
*resContext=cnd;
32103219
resAnchor=cnd->anchor();
3220+
AUTO_TRACE_EXIT("concept");
32113221
return TRUE;
32123222
}
32133223
else if ((nd=Doxygen::namespaceLinkedMap->find(linkRef)))
32143224
{
32153225
*resContext=nd;
3226+
AUTO_TRACE_EXIT("namespace");
32163227
return TRUE;
32173228
}
32183229
else if ((dir=Doxygen::dirLinkedMap->find(FileInfo(linkRef.str()).absFilePath()+"/"))
32193230
&& dir->isLinkable()) // TODO: make this location independent like filedefs
32203231
{
32213232
*resContext=dir;
3233+
AUTO_TRACE_EXIT("directory");
32223234
return TRUE;
32233235
}
32243236
else // probably a member reference
32253237
{
32263238
const MemberDef *md = nullptr;
32273239
bool res = resolveRef(scName,lr,TRUE,resContext,&md);
32283240
if (md) resAnchor=md->anchor();
3241+
AUTO_TRACE_EXIT("member? res={}",res);
32293242
return res;
32303243
}
32313244
}

0 commit comments

Comments
 (0)