summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config.xml8
-rw-r--r--src/memberdef.cpp64
-rw-r--r--src/memberdef.h1
3 files changed, 72 insertions, 1 deletions
diff --git a/src/config.xml b/src/config.xml
index b3718be..7bacf3e 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -916,6 +916,14 @@ Go to the <a href="commands.html">next</a> section or return to the
]]>
</docs>
</option>
+ <option type='bool' id='EXTRACT_ANON_ARGUMENTS' defval='0'>
+ <docs>
+<![CDATA[
+ If this flag is set to \c YES, the name of anonymous arguments in declarations will be
+ extracted from the definitions. By default anonymous arguments will stay nameless.
+]]>
+ </docs>
+ </option>
<option type='bool' id='HIDE_UNDOC_MEMBERS' defval='0'>
<docs>
<![CDATA[
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index 4951240..1901970 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) {}
@@ -5485,6 +5487,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;
@@ -5951,6 +6001,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;
+ }
}
}
@@ -5982,6 +6040,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);
@@ -6043,7 +6106,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)
{
diff --git a/src/memberdef.h b/src/memberdef.h
index f15c31e..da30c9f 100644
--- a/src/memberdef.h
+++ b/src/memberdef.h
@@ -336,6 +336,7 @@ class MemberDef : virtual public Definition
// argument related members
virtual void moveArgumentList(std::unique_ptr<ArgumentList> al) = 0;
virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al) = 0;
+ virtual void extractArgumentNames(const MemberDef& md) = 0;
virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists) = 0;
virtual void setTypeConstraints(const ArgumentList &al) = 0;
virtual void setType(const char *t) = 0;