summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-09-16 18:56:52 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-09-16 18:56:52 (GMT)
commit544843db399c51b77674755f70992f0bdc8403ea (patch)
tree5b81b4d5e8d966a6dd9a5ea304da840383ed6465 /src
parentc1901d07755826803e92618e60d8af9720dbb1e7 (diff)
parent09b04bcb61a0e127cf502bc0533cd9bce9293406 (diff)
downloadDoxygen-544843db399c51b77674755f70992f0bdc8403ea.zip
Doxygen-544843db399c51b77674755f70992f0bdc8403ea.tar.gz
Doxygen-544843db399c51b77674755f70992f0bdc8403ea.tar.bz2
Merge branch 'tolnaisz-arg_name_as_comment'
Diffstat (limited to 'src')
-rw-r--r--src/config.xml9
-rw-r--r--src/memberdef.cpp67
-rw-r--r--src/memberdef.h1
3 files changed, 76 insertions, 1 deletions
diff --git a/src/config.xml b/src/config.xml
index b3718be..39e83ad 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -916,6 +916,15 @@ Go to the <a href="commands.html">next</a> section or return to the
]]>
</docs>
</option>
+ <option type='bool' id='RESOLVE_UNNAMED_PARAMS' defval='1'>
+ <docs>
+<![CDATA[
+ If this flag is set to \c YES, the name of an unnamed parameter in a declaration will be
+ determined by the corresponding definition. By default unnamed parameters remain unnamed
+ in the output.
+]]>
+ </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..6d179c2 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -330,6 +330,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef
const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,
bool onlyText=FALSE) const;
virtual void addToSearchIndex() const;
+ virtual void resolveUnnamedParameters(const MemberDef *md);
private:
void _computeLinkableInProject();
@@ -850,6 +851,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef
virtual void warnIfUndocumented() const {}
virtual void warnIfUndocumentedParams() const {}
virtual void detectUndocumentedParams(bool hasParamCommand,bool hasReturnCommand) const {}
+ virtual void resolveUnnamedParameters(const MemberDef *md) {}
private:
MemberGroup *m_memberGroup; // group's member definition
};
@@ -5485,6 +5487,54 @@ const ArgumentList &MemberDefImpl::declArgumentList() const
return m_impl->declArgList;
}
+void MemberDefImpl::resolveUnnamedParameters(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,17 @@ static void transferArgumentDocumentation(ArgumentList &decAl,ArgumentList &defA
{
defA.docs = decA.docs;
}
+ if (Config_getBool(RESOLVE_UNNAMED_PARAMS))
+ {
+ 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 +6043,11 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef)
// mdec->getFileDef()->name().data(),mdec->documentation().data()
// );
+ if (Config_getBool(RESOLVE_UNNAMED_PARAMS))
+ {
+ mdec->resolveUnnamedParameters(mdef);
+ }
+
// first merge argument documentation
transferArgumentDocumentation(mdecAl,mdefAl);
@@ -6043,7 +6109,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..cc467ea 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 resolveUnnamedParameters(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;