Skip to content

Commit

Permalink
Bug 771152 - C++11 ref-qualifiers do not appear in Member Function Do…
Browse files Browse the repository at this point in the history
…cumentation section
  • Loading branch information
Dimitri van Heesch committed Sep 21, 2016
1 parent e12ec76 commit 9ef1bf9
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 8 deletions.
17 changes: 10 additions & 7 deletions src/arguments.cpp
Expand Up @@ -33,6 +33,7 @@ ArgumentList *ArgumentList::deepCopy() const
argList->pureSpecifier = pureSpecifier;
argList->trailingReturnType = trailingReturnType;
argList->isDeleted = isDeleted;
argList->refQualifier = refQualifier;

return argList;
}
Expand Down Expand Up @@ -63,6 +64,7 @@ ArgumentList *ArgumentList::unmarshal(StorageIntf *s)
result->pureSpecifier = unmarshalBool(s);
result->trailingReturnType = unmarshalQCString(s);
result->isDeleted = unmarshalBool(s);
result->refQualifier = (RefQualifierType)unmarshalInt(s);
return result;
}

Expand All @@ -81,13 +83,13 @@ void ArgumentList::marshal(StorageIntf *s,ArgumentList *argList)
Argument *a;
for (ali.toFirst();(a=ali.current());++ali)
{
marshalQCString(s,a->attrib);
marshalQCString(s,a->type);
marshalQCString(s,a->canType);
marshalQCString(s,a->name);
marshalQCString(s,a->array);
marshalQCString(s,a->defval);
marshalQCString(s,a->docs);
marshalQCString(s,a->attrib);
marshalQCString(s,a->type);
marshalQCString(s,a->canType);
marshalQCString(s,a->name);
marshalQCString(s,a->array);
marshalQCString(s,a->defval);
marshalQCString(s,a->docs);
marshalQCString(s,a->typeConstraint);
}
}
Expand All @@ -96,6 +98,7 @@ void ArgumentList::marshal(StorageIntf *s,ArgumentList *argList)
marshalBool(s,argList->pureSpecifier);
marshalQCString(s,argList->trailingReturnType);
marshalBool(s,argList->isDeleted);
marshalInt(s,(int)argList->refQualifier);
}
}

12 changes: 11 additions & 1 deletion src/arguments.h
Expand Up @@ -73,6 +73,13 @@ struct Argument
QCString typeConstraint; /*!< Used for Java generics: \<T extends C\> */
};

enum RefQualifierType
{
RefQualifierNone,
RefQualifierLValue,
RefQualifierRValue
};

/*! \brief This class represents an function or template argument list.
*
* This class also stores some information about member that is typically
Expand All @@ -87,7 +94,8 @@ class ArgumentList : public QList<Argument>
constSpecifier(FALSE),
volatileSpecifier(FALSE),
pureSpecifier(FALSE),
isDeleted(FALSE)
isDeleted(FALSE),
refQualifier(RefQualifierNone)
{ setAutoDelete(TRUE); }
/*! Destroys the argument list */
~ArgumentList() {}
Expand All @@ -105,6 +113,8 @@ class ArgumentList : public QList<Argument>
QCString trailingReturnType;
/*! method with =delete */
bool isDeleted;
/*! C++11 ref qualifier */
RefQualifierType refQualifier;

static ArgumentList *unmarshal(StorageIntf *s);
static void marshal(StorageIntf *s,ArgumentList *argList);
Expand Down
12 changes: 12 additions & 0 deletions src/context.cpp
Expand Up @@ -3969,6 +3969,8 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
s_inst.addProperty("parameters", &Private::parameters);
s_inst.addProperty("hasConstQualifier", &Private::hasConstQualifier);
s_inst.addProperty("hasVolatileQualifier",&Private::hasVolatileQualifier);
s_inst.addProperty("hasRefQualifierLValue", &Private::hasRefQualifierLValue);
s_inst.addProperty("hasRefQualifierRValue", &Private::hasRefQualifierRValue);
s_inst.addProperty("trailingReturnType", &Private::trailingReturnType);
s_inst.addProperty("extraTypeChars", &Private::extraTypeChars);
s_inst.addProperty("templateDecls", &Private::templateDecls);
Expand Down Expand Up @@ -4571,6 +4573,16 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
ArgumentList *al = getDefArgList();
return al ? al->volatileSpecifier : FALSE;
}
TemplateVariant hasRefQualifierLValue() const
{
ArgumentList *al = getDefArgList();
return al ? al->refQualifier==RefQualifierLValue : FALSE;
}
TemplateVariant hasRefQualifierRValue() const
{
ArgumentList *al = getDefArgList();
return al ? al->refQualifier==RefQualifierRValue : FALSE;
}
TemplateVariant trailingReturnType() const
{
ArgumentList *al = getDefArgList();
Expand Down
6 changes: 6 additions & 0 deletions src/defargs.l
Expand Up @@ -479,6 +479,12 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
<FuncQual>"volatile" {
g_argList->volatileSpecifier=TRUE;
}
<FuncQual>"&" {
g_argList->refQualifier=RefQualifierLValue;
}
<FuncQual>"&&" {
g_argList->refQualifier=RefQualifierRValue;
}
<FuncQual,TrailingReturn>"="{B}*"0" {
g_argList->pureSpecifier=TRUE;
BEGIN(FuncQual);
Expand Down
8 changes: 8 additions & 0 deletions src/memberdef.cpp
Expand Up @@ -357,6 +357,14 @@ static bool writeDefArgumentList(OutputList &ol,Definition *scope,MemberDef *md)
{
ol.docify(" volatile");
}
if (defArgList->refQualifier==RefQualifierLValue)
{
ol.docify(" &");
}
else if (defArgList->refQualifier==RefQualifierRValue)
{
ol.docify(" &&");
}
if (!defArgList->trailingReturnType.isEmpty())
{
linkifyText(TextGeneratorOLImpl(ol), // out
Expand Down
9 changes: 9 additions & 0 deletions src/scanner.l
Expand Up @@ -4659,6 +4659,15 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
roundCount=0;
BEGIN(CopyRound);
}
<FuncQual>{BN}*"&" {
current->args += " &";
current->argList->refQualifier=RefQualifierLValue;
}
<FuncQual>{BN}*"&&" {
current->args += " &&";
current->argList->refQualifier=RefQualifierRValue;
}
<FuncQual,TrailingReturn>{BN}*"="{BN}*"0"{BN}* { // pure virtual member function
lineCount() ;
current->args += " = 0";
Expand Down
14 changes: 14 additions & 0 deletions src/util.cpp
Expand Up @@ -2268,6 +2268,8 @@ QCString argListToString(ArgumentList *al,bool useCanonicalType,bool showDefVals
result+=")";
if (al->constSpecifier) result+=" const";
if (al->volatileSpecifier) result+=" volatile";
if (al->refQualifier==RefQualifierLValue) result+=" &";
else if (al->refQualifier==RefQualifierRValue) result+=" &&";
if (!al->trailingReturnType.isEmpty()) result+=" -> "+al->trailingReturnType;
if (al->pureSpecifier) result+=" =0";
return removeRedundantWhiteSpace(result);
Expand Down Expand Up @@ -3362,6 +3364,12 @@ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl,
}
}

if (srcAl->refQualifier != dstAl->refQualifier)
{
NOMATCH
return FALSE; // one member is has a different ref-qualifier than the other
}

// so far the argument list could match, so we need to compare the types of
// all arguments.
ArgumentListIterator srcAli(*srcAl),dstAli(*dstAl);
Expand Down Expand Up @@ -3795,6 +3803,12 @@ bool matchArguments2(Definition *srcScope,FileDef *srcFileScope,ArgumentList *sr
}
}

if (srcAl->refQualifier != dstAl->refQualifier)
{
NOMATCH
return FALSE; // one member is has a different ref-qualifier than the other
}

// so far the argument list could match, so we need to compare the types of
// all arguments.
ArgumentListIterator srcAli(*srcAl),dstAli(*dstAl);
Expand Down
7 changes: 7 additions & 0 deletions src/xmlgen.cpp
Expand Up @@ -620,6 +620,13 @@ static void generateXMLForMember(MemberDef *md,FTextStream &ti,FTextStream &t,De
if (md->isInline()) t << "yes"; else t << "no";
t << "\"";

if (al->refQualifier!=RefQualifierNone)
{
t << " refqual=\"";
if (al->refQualifier==RefQualifierLValue) t << "lvalue"; else t << "rvalue";
t << "\"";
}

if (md->isFinal())
{
t << " final=\"yes\"";
Expand Down
2 changes: 2 additions & 0 deletions templates/html/htmlmemdef.tpl
Expand Up @@ -94,6 +94,8 @@
{{ member.extraTypeChars }}
{% if member.hasConstQualifier %} const {% endif %}
{% if member.hasVolatileQualifier %} volatile {% endif %}
{% if member.hasRefQualifierLValue %} &amp; {% endif %}
{% if member.hasRefQualifierRValue %} &amp;&amp; {% endif %}
{{ member.trailingReturnType }}
{% endif %}
{% endif %}
Expand Down
8 changes: 8 additions & 0 deletions templates/xml/compound.xsd
Expand Up @@ -149,6 +149,7 @@
<xsd:attribute name="const" type="DoxBool" use="optional"/>
<xsd:attribute name="explicit" type="DoxBool" use="optional"/>
<xsd:attribute name="inline" type="DoxBool" use="optional"/>
<xsd:attribute name="refqual" type="DoxRefQualifierKind" use="optional"/>
<xsd:attribute name="virt" type="DoxVirtualKind" use="optional"/>
<xsd:attribute name="volatile" type="DoxBool" use="optional"/>
<xsd:attribute name="mutable" type="DoxBool" use="optional"/>
Expand Down Expand Up @@ -689,6 +690,13 @@
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="DoxRefQualifierKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="lvalue" />
<xsd:enumeration value="rvalue" />
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="DoxLanguage">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Unknown" />
Expand Down

0 comments on commit 9ef1bf9

Please sign in to comment.