summaryrefslogtreecommitdiffstats
path: root/src/memberdef.cpp
diff options
context:
space:
mode:
authorSzabi Tolnai <Szabi.Tolnai@cirrus.com>2020-08-10 09:53:34 (GMT)
committerSzabi Tolnai <Szabi.Tolnai@cirrus.com>2020-08-11 13:52:36 (GMT)
commit970b3469a3beaf7041a2efce8d81515077003232 (patch)
tree13e85888a90134690f50fc18c17ab77e742db99d /src/memberdef.cpp
parent047adfbbc66eaa432ec9cea00e3801e3b4e1bca8 (diff)
downloadDoxygen-970b3469a3beaf7041a2efce8d81515077003232.zip
Doxygen-970b3469a3beaf7041a2efce8d81515077003232.tar.gz
Doxygen-970b3469a3beaf7041a2efce8d81515077003232.tar.bz2
Support commented out argument names in declarations controlled by new cofig EXTRACT_ANON_ARGUMENTS.
Diffstat (limited to 'src/memberdef.cpp')
-rw-r--r--src/memberdef.cpp64
1 files changed, 63 insertions, 1 deletions
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index 312e13e..dc4363a 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -277,6 +277,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef
virtual void setDeclFile(const QCString &df,int line,int column);
virtual void moveArgumentList(std::unique_ptr<ArgumentList> al);
virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al);
+ virtual void extractArgumentNames(const MemberDef& md);
virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists);
virtual void setTypeConstraints(const ArgumentList &al);
virtual void setType(const char *t);
@@ -789,6 +790,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef
virtual void setDeclFile(const QCString &df,int line,int column) {}
virtual void moveArgumentList(std::unique_ptr<ArgumentList> al) {}
virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al) {}
+ virtual void extractArgumentNames(const MemberDef& md) {}
virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists) {}
virtual void setTypeConstraints(const ArgumentList &al) {}
virtual void setType(const char *t) {}
@@ -5483,6 +5485,54 @@ const ArgumentList &MemberDefImpl::declArgumentList() const
return m_impl->declArgList;
}
+void MemberDefImpl::extractArgumentNames(const MemberDef& md)
+{
+ ArgumentList &decAl = m_impl->declArgList;
+ ArgumentList &defAl = m_impl->defArgList;
+ const ArgumentList &decAlSrc = md.declArgumentList();
+ const ArgumentList &defAlSrc = md.argumentList();
+ auto decSrc = decAlSrc.begin(), defSrc = defAlSrc.begin();
+ for (auto decIt = decAl.begin(), defIt = defAl.begin();
+ decIt != decAl.end() && defIt != defAl.end() && decSrc != decAlSrc.end() && defSrc != defAlSrc.end();
+ ++decIt, ++defIt, ++decSrc, ++defSrc++)
+ {
+ Argument &decA = *decIt;
+ Argument &defA = *defIt;
+ const Argument &decAS = *decSrc;
+ const Argument &defAS = *defSrc;
+ if (decA.name.isEmpty())
+ {
+ if (!defA.name.isEmpty())
+ {
+ decA.name = defA.name;
+ }
+ else if (!decAS.name.isEmpty())
+ {
+ decA.name = decAS.name;
+ }
+ else if (!defAS.name.isEmpty())
+ {
+ decA.name = defAS.name;
+ }
+ }
+ if (defA.name.isEmpty())
+ {
+ if (!decA.name.isEmpty())
+ {
+ defA.name = decA.name;
+ }
+ else if (!decAS.name.isEmpty())
+ {
+ defA.name = decAS.name;
+ }
+ else if (!defAS.name.isEmpty())
+ {
+ defA.name = defAS.name;
+ }
+ }
+ }
+}
+
const ArgumentList &MemberDefImpl::templateArguments() const
{
return m_impl->tArgList;
@@ -5949,6 +5999,14 @@ static void transferArgumentDocumentation(ArgumentList &decAl,ArgumentList &defA
{
defA.docs = decA.docs;
}
+ if (decA.name.isEmpty() && !defA.name.isEmpty())
+ {
+ decA.name = defA.name;
+ }
+ else if (defA.name.isEmpty() && !decA.name.isEmpty())
+ {
+ defA.name = decA.name;
+ }
}
}
@@ -5980,6 +6038,11 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef)
// mdec->getFileDef()->name().data(),mdec->documentation().data()
// );
+ if (Config_getBool(EXTRACT_ANON_ARGUMENTS))
+ {
+ mdec->extractArgumentNames(*mdef);
+ }
+
// first merge argument documentation
transferArgumentDocumentation(mdecAl,mdefAl);
@@ -6041,7 +6104,6 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef)
mdec->mergeMemberSpecifiers(mdef->getMemberSpecifiers());
mdef->mergeMemberSpecifiers(mdec->getMemberSpecifiers());
-
// copy group info.
if (mdec->getGroupDef()==0 && mdef->getGroupDef()!=0)
{