Content-Length: 854235 | pFad | https://github.com/doxygen/doxygen/commit/35711f2d14acc81cff83f81f04c566ad8c8c6fe8

6C Fix regressions introduced by changing the way references are resolved · doxygen/doxygen@35711f2 · GitHub
Skip to content

Commit 35711f2

Browse files
committed
Fix regressions introduced by changing the way references are resolved
- grouped members where stored in the tag file without scope - strong enum values where not linkable
1 parent a1ccbc3 commit 35711f2

File tree

9 files changed

+76
-42
lines changed

9 files changed

+76
-42
lines changed

src/doxygen.cpp

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ QCString stripTemplateSpecifiers(const QCString &s)
717717
* full qualified name \a name. Creates an artificial scope if the scope is
718718
* not found and set the parent/child scope relation if the scope is found.
719719
*/
720+
[[maybe_unused]]
720721
static Definition *buildScopeFromQualifiedName(const QCString &name_,SrcLangExt lang,const TagInfo *tagInfo)
721722
{
722723
QCString name = stripTemplateSpecifiers(name_);
@@ -2858,16 +2859,27 @@ static void addVariable(const Entry *root,int isFuncPtr=-1)
28582859
name=removeRedundantWhiteSpace(name);
28592860

28602861
// find the scope of this variable
2861-
Entry *p = root->parent();
2862-
while ((p->section & Entry::SCOPE_MASK))
2862+
int index = computeQualifiedIndex(name);
2863+
if (index!=-1 && root->parent()->section==Entry::GROUPDOC_SEC && root->parent()->tagInfo())
2864+
// grouped members are stored with full scope
28632865
{
2864-
QCString scopeName = p->name;
2865-
if (!scopeName.isEmpty())
2866+
buildScopeFromQualifiedName(name.left(index+2),root->lang,root->tagInfo());
2867+
scope=name.left(index);
2868+
name=name.mid(index+2);
2869+
}
2870+
else
2871+
{
2872+
Entry *p = root->parent();
2873+
while ((p->section & Entry::SCOPE_MASK))
28662874
{
2867-
scope.prepend(scopeName);
2868-
break;
2875+
QCString scopeName = p->name;
2876+
if (!scopeName.isEmpty())
2877+
{
2878+
scope.prepend(scopeName);
2879+
break;
2880+
}
2881+
p=p->parent();
28692882
}
2870-
p=p->parent();
28712883
}
28722884

28732885
MemberType mtype;
@@ -3423,6 +3435,10 @@ static void addGlobalFunction(const Entry *root,const QCString &rname,const QCSt
34233435
nd = getResolvedNamespaceMutable(nscope);
34243436
}
34253437
}
3438+
else if (root->parent()->section==Entry::GROUPDOC_SEC && !scope.isEmpty())
3439+
{
3440+
nd = getResolvedNamespaceMutable(sc);
3441+
}
34263442

34273443
if (!scope.isEmpty())
34283444
{
@@ -3450,7 +3466,7 @@ static void addGlobalFunction(const Entry *root,const QCString &rname,const QCSt
34503466
" '%s' '%s'::'%s' '%s' proto=%d\n"
34513467
" def='%s'\n",
34523468
qPrint(root->type),
3453-
qPrint(root->parent()->name),
3469+
qPrint(scope),
34543470
qPrint(rname),
34553471
qPrint(root->args),
34563472
root->proto,
@@ -3461,10 +3477,6 @@ static void addGlobalFunction(const Entry *root,const QCString &rname,const QCSt
34613477
md->enableCallerGraph(root->callerGraph);
34623478
md->enableReferencedByRelation(root->referencedByRelation);
34633479
md->enableReferencesRelation(root->referencesRelation);
3464-
//if (root->mGrpId!=-1)
3465-
//{
3466-
// md->setMemberGroup(memberGroupDict[root->mGrpId]);
3467-
//}
34683480

34693481
md->setRefItems(root->sli);
34703482
if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@')
@@ -3523,7 +3535,19 @@ static void buildFunctionList(const Entry *root)
35233535
QCString rname = removeRedundantWhiteSpace(root->name);
35243536
//printf("rname=%s\n",qPrint(rname));
35253537

3526-
QCString scope=root->parent()->name; //stripAnonymousNamespaceScope(root->parent->name);
3538+
QCString scope;
3539+
int index = computeQualifiedIndex(rname);
3540+
if (index!=-1 && root->parent()->section==Entry::GROUPDOC_SEC && root->parent()->tagInfo())
3541+
// grouped members are stored with full scope
3542+
{
3543+
buildScopeFromQualifiedName(rname.left(index+2),root->lang,root->tagInfo());
3544+
scope=rname.left(index);
3545+
rname=rname.mid(index+2);
3546+
}
3547+
else
3548+
{
3549+
scope=root->parent()->name; //stripAnonymousNamespaceScope(root->parent->name);
3550+
}
35273551
if (!rname.isEmpty() && scope.find('@')==-1)
35283552
{
35293553
ClassDefMutable *cd=0;
@@ -7069,7 +7093,10 @@ static void findEnums(const Entry *root)
70697093
{
70707094
scope=root->name.left(i); // extract scope
70717095
name=root->name.right(root->name.length()-i-2); // extract name
7072-
if ((cd=getClassMutable(scope))==0) nd=getResolvedNamespaceMutable(scope);
7096+
if ((cd=getClassMutable(scope))==0)
7097+
{
7098+
nd=toNamespaceDefMutable(buildScopeFromQualifiedName(root->name.left(i+2),root->lang,root->tagInfo()));
7099+
}
70737100
}
70747101
else // no scope, check the scope in which the docs where found
70757102
{
@@ -7236,7 +7263,10 @@ static void addEnumValuesToEnums(const Entry *root)
72367263
{
72377264
scope=root->name.left(i); // extract scope
72387265
name=root->name.right(root->name.length()-i-2); // extract name
7239-
if ((cd=getClassMutable(scope))==0) nd=getResolvedNamespaceMutable(scope);
7266+
if ((cd=getClassMutable(scope))==0)
7267+
{
7268+
nd=toNamespaceDefMutable(buildScopeFromQualifiedName(root->name.left(i+2),root->lang,root->tagInfo()));
7269+
}
72407270
}
72417271
else // no scope, check the scope in which the docs where found
72427272
{
@@ -7302,30 +7332,26 @@ static void addEnumValuesToEnums(const Entry *root)
73027332
// use raw pointer in this loop, since we modify mn and can then invalidate mdp.
73037333
if (md && md->isEnumerate() && !root->children().empty())
73047334
{
7305-
//printf(" enum with %d children\n",root->children()->count());
7335+
//printf(" enum with %zu children\n",root->children().size());
73067336
for (const auto &e : root->children())
73077337
{
7308-
SrcLangExt sle;
7309-
if (
7310-
(sle=root->lang)==SrcLangExt_CSharp ||
7311-
sle==SrcLangExt_Java ||
7312-
sle==SrcLangExt_XML ||
7338+
SrcLangExt sle = root->lang;
7339+
bool isJavaLike = sle==SrcLangExt_CSharp || sle==SrcLangExt_Java || sle==SrcLangExt_XML;
7340+
if ( isJavaLike ||
73137341
(root->spec&Entry::Strong)
73147342
)
73157343
{
73167344
// Unlike classic C/C++ enums, for C++11, C# & Java enum
73177345
// values are only visible inside the enum scope, so we must create
73187346
// them here and only add them to the enum
73197347
//printf("md->qualifiedName()=%s e->name=%s tagInfo=%p name=%s\n",
7320-
// qPrint(md->qualifiedName()),qPrint(e->name),e->tagInfo,qPrint(e->name));
7321-
QCString qualifiedName = substitute(root->name,"::",".");
7322-
if (!scope.isEmpty() && root->tagInfo())
7348+
// qPrint(md->qualifiedName()),qPrint(e->name),(void*)e->tagInfo(),qPrint(e->name));
7349+
QCString qualifiedName = root->name;
7350+
if (isJavaLike)
73237351
{
7324-
qualifiedName=substitute(scope,"::",".")+"."+qualifiedName;
7352+
qualifiedName=substitute(qualifiedName,".","::");
73257353
}
7326-
if (substitute(md->qualifiedName(),"::",".")== // TODO: add function to get canonical representation
7327-
qualifiedName // enum value scope matches that of the enum
7328-
)
7354+
if (md->qualifiedName()==qualifiedName) // enum value scope matches that of the enum
73297355
{
73307356
QCString fileName = e->fileName;
73317357
if (fileName.isEmpty() && e->tagInfo())

src/groupdef.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ void GroupDefImpl::writeTagFile(TextStream &tagFile)
707707
MemberList * ml = getMemberList(lmd->type);
708708
if (ml)
709709
{
710-
ml->writeTagFile(tagFile);
710+
ml->writeTagFile(tagFile,true);
711711
}
712712
}
713713
}
@@ -716,7 +716,7 @@ void GroupDefImpl::writeTagFile(TextStream &tagFile)
716716
{
717717
for (const auto &mg : m_memberGroups)
718718
{
719-
mg->writeTagFile(tagFile);
719+
mg->writeTagFile(tagFile,true);
720720
}
721721
}
722722
break;

src/memberdef.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
320320
virtual void writeMemberDocSimple(OutputList &ol,const Definition *container) const;
321321
virtual void writeEnumDeclaration(OutputList &typeDecl,
322322
const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd) const;
323-
virtual void writeTagFile(TextStream &) const;
323+
virtual void writeTagFile(TextStream &,bool useQualifiedName) const;
324324
virtual void warnIfUndocumented() const;
325325
virtual void warnIfUndocumentedParams() const;
326326
virtual bool visibleInIndex() const;
@@ -4325,7 +4325,7 @@ Specifier MemberDefImpl::virtualness(int count) const
43254325
return v;
43264326
}
43274327

4328-
void MemberDefImpl::writeTagFile(TextStream &tagFile) const
4328+
void MemberDefImpl::writeTagFile(TextStream &tagFile,bool useQualifiedName) const
43294329
{
43304330
if (!isLinkableInProject()) return;
43314331
tagFile << " <member kind=\"";
@@ -4370,7 +4370,7 @@ void MemberDefImpl::writeTagFile(TextStream &tagFile) const
43704370
{
43714371
tagFile << " <type>" << convertToXML(typeString()) << "</type>\n";
43724372
}
4373-
tagFile << " <name>" << convertToXML(name()) << "</name>\n";
4373+
tagFile << " <name>" << convertToXML(useQualifiedName ? qualifiedName() : name()) << "</name>\n";
43744374
tagFile << " <anchorfile>" << addHtmlExtensionIfMissing(getOutputFileBase()) << "</anchorfile>\n";
43754375
tagFile << " <anchor>" << convertToXML(anchor()) << "</anchor>\n";
43764376
QCString idStr = id();

src/memberdef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ class MemberDefMutable : public DefinitionMutable, public MemberDef
417417
bool inGroup,bool showEnumValues=FALSE,bool
418418
showInline=FALSE) const = 0;
419419
virtual void writeMemberDocSimple(OutputList &ol,const Definition *container) const = 0;
420-
virtual void writeTagFile(TextStream &) const = 0;
420+
virtual void writeTagFile(TextStream &,bool useQualifiedName) const = 0;
421421
virtual void writeLink(OutputList &ol,
422422
const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,
423423
bool onlyText=FALSE) const = 0;

src/membergroup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ void MemberGroup::setRefItems(const RefItemVector &sli)
270270
m_xrefListItems.insert(m_xrefListItems.end(), sli.cbegin(), sli.cend());
271271
}
272272

273-
void MemberGroup::writeTagFile(TextStream &tagFile)
273+
void MemberGroup::writeTagFile(TextStream &tagFile,bool qualifiedName)
274274
{
275-
memberList->writeTagFile(tagFile);
275+
memberList->writeTagFile(tagFile,qualifiedName);
276276
}
277277

278278
//--------------------------------------------------------------------------

src/membergroup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class MemberGroup
5959
const Definition *container,bool showEnumValues,bool showInline) const;
6060
void writeDocumentationPage(OutputList &ol,const QCString &scopeName,
6161
const DefinitionMutable *container) const;
62-
void writeTagFile(TextStream &);
62+
void writeTagFile(TextStream &,bool qualifiedName=false);
6363
void addGroupedInheritedMembers(OutputList &ol,const ClassDef *cd,
6464
MemberListType lt,
6565
const ClassDef *inheritedFrom,const QCString &inheritId) const;

src/memberlist.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ QCString MemberList::listTypeAsString(MemberListType type)
937937
return "";
938938
}
939939

940-
void MemberList::writeTagFile(TextStream &tagFile)
940+
void MemberList::writeTagFile(TextStream &tagFile,bool useQualifiedName)
941941
{
942942
for (const auto &imd : m_members)
943943
{
@@ -946,15 +946,15 @@ void MemberList::writeTagFile(TextStream &tagFile)
946946
{
947947
if (md->getLanguage()!=SrcLangExt_VHDL)
948948
{
949-
md->writeTagFile(tagFile);
949+
md->writeTagFile(tagFile,useQualifiedName);
950950
if (md->memberType()==MemberType_Enumeration && !md->isStrong())
951951
{
952952
for (const auto &ivmd : md->enumFieldList())
953953
{
954954
MemberDefMutable *vmd = toMemberDefMutable(ivmd);
955955
if (vmd)
956956
{
957-
vmd->writeTagFile(tagFile);
957+
vmd->writeTagFile(tagFile,useQualifiedName);
958958
}
959959
}
960960
}
@@ -967,7 +967,7 @@ void MemberList::writeTagFile(TextStream &tagFile)
967967
}
968968
for (const auto &mg : m_memberGroupRefList)
969969
{
970-
mg->writeTagFile(tagFile);
970+
mg->writeTagFile(tagFile,useQualifiedName);
971971
}
972972
}
973973

src/memberlist.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class MemberList : public MemberVector
109109
void writeSimpleDocumentation(OutputList &ol,const Definition *container) const;
110110
void writeDocumentationPage(OutputList &ol,
111111
const QCString &scopeName, const DefinitionMutable *container) const;
112-
void writeTagFile(TextStream &);
112+
void writeTagFile(TextStream &,bool useQualifiedName=false);
113113
bool declVisible() const;
114114
void addMemberGroup(MemberGroup *mg);
115115
void addListReferences(Definition *def);

src/symbolresolver.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,14 @@ const Definition *SymbolResolver::Private::followPath(const Definition *start,co
11321132
next = classMember;
11331133
}
11341134
}
1135+
else if (current->definitionType()==Definition::TypeNamespace)
1136+
{
1137+
const MemberDef *namespaceMember = toNamespaceDef(current)->getMemberByName(qualScopePart);
1138+
if (namespaceMember && namespaceMember->isEnumerate())
1139+
{
1140+
next = namespaceMember;
1141+
}
1142+
}
11351143
else if (current==Doxygen::globalScope || current->definitionType()==Definition::TypeFile)
11361144
{
11371145
auto &range = Doxygen::symbolMap->find(qualScopePart);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/doxygen/doxygen/commit/35711f2d14acc81cff83f81f04c566ad8c8c6fe8

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy