Skip to content

Commit a7179f0

Browse files
committed
issue #11010 Automatic link to typedef no longer generated if typedef declared twice
1 parent 4ff9550 commit a7179f0

File tree

1 file changed

+56
-2
lines changed

1 file changed

+56
-2
lines changed

src/doxygen.cpp

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,7 +2999,60 @@ static void buildTypedefList(const Entry *root)
29992999
)
30003000
{
30013001
AUTO_TRACE();
3002-
addVariable(root);
3002+
QCString rname = removeRedundantWhiteSpace(root->name);
3003+
MemberName *mn = Doxygen::functionNameLinkedMap->find(rname);
3004+
bool found=false;
3005+
if (mn) // symbol with the same name already found
3006+
{
3007+
for (auto &imd : *mn)
3008+
{
3009+
QCString rtype = root->type;
3010+
rtype.stripPrefix("typedef ");
3011+
bool notBothGrouped = root->groups.empty() || imd->getGroupDef()==nullptr; // see example #100
3012+
//printf("imd->isTypedef()=%d imd->typeString()=%s root->type=%s\n",imd->isTypedef(),
3013+
// qPrint(imd->typeString()),qPrint(root->type));
3014+
if (imd->isTypedef() && notBothGrouped && imd->typeString()==rtype)
3015+
{
3016+
MemberDefMutable *md = toMemberDefMutable(imd.get());
3017+
if (md)
3018+
{
3019+
md->setDocumentation(root->doc,root->docFile,root->docLine);
3020+
md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine);
3021+
md->setDocsForDefinition(!root->proto);
3022+
md->setBriefDescription(root->brief,root->briefFile,root->briefLine);
3023+
md->addSectionsToDefinition(root->anchors);
3024+
md->setRefItems(root->sli);
3025+
md->addQualifiers(root->qualifiers);
3026+
3027+
// merge ingroup specifiers
3028+
if (md->getGroupDef()==nullptr && !root->groups.empty())
3029+
{
3030+
addMemberToGroups(root,md);
3031+
}
3032+
else if (md->getGroupDef()!=nullptr && root->groups.empty())
3033+
{
3034+
//printf("existing member is grouped, new member not\n");
3035+
}
3036+
else if (md->getGroupDef()!=nullptr && !root->groups.empty())
3037+
{
3038+
//printf("both members are grouped\n");
3039+
}
3040+
found=true;
3041+
break;
3042+
}
3043+
}
3044+
}
3045+
}
3046+
if (found)
3047+
{
3048+
AUTO_TRACE_ADD("typedef '{}' already found",rname);
3049+
}
3050+
else
3051+
{
3052+
AUTO_TRACE_ADD("new typedef '{}'",rname);
3053+
addVariable(root);
3054+
}
3055+
30033056
}
30043057
for (const auto &e : root->children())
30053058
if (!e->section.isEnum())
@@ -3053,7 +3106,8 @@ static void buildVarList(const Entry *root)
30533106
if (!root->name.isEmpty() &&
30543107
(root->type.isEmpty() || g_compoundKeywords.find(root->type.str())==g_compoundKeywords.end()) &&
30553108
(
3056-
(root->section.isVariable() // it's a variable
3109+
(root->section.isVariable() && // it's a variable
3110+
root->type.find("typedef ")==-1 // and not a typedef
30573111
) ||
30583112
(root->section.isFunction() && // or maybe a function pointer variable
30593113
(isFuncPtr=findFunctionPtr(root->type.str(),root->lang))!=-1

0 commit comments

Comments
 (0)