mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fixed a C++ bug that caused bad references to be generated. This also
adds a note on overloads always ending up on the first version of the method in case more than one is defined.
This commit is contained in:
parent
35f0b555a4
commit
475c3ba93b
@ -511,6 +511,15 @@ These roles link to the given object types:
|
||||
Reference a C++ object. You can give the full signature (and need to, for
|
||||
overloaded functions.)
|
||||
|
||||
.. admonition:: Note on References
|
||||
|
||||
It is currently impossible to link to a specific version of an
|
||||
overloaded method. Currently the C++ domain is the first domain
|
||||
that has basic support for overloaded methods and until there is more
|
||||
data for comparison we don't want to select a bad syntax to reference a
|
||||
specific overload. Currently Sphinx will link to the first overloaded
|
||||
version of the method / function.
|
||||
|
||||
|
||||
The Standard Domain
|
||||
-------------------
|
||||
|
@ -828,8 +828,13 @@ class CPPObject(ObjectDescription):
|
||||
signode['ids'].append(theid)
|
||||
signode['first'] = (not self.names)
|
||||
self.state.document.note_explicit_target(signode)
|
||||
self.env.domaindata['cpp']['objects'][name] = \
|
||||
(self.env.docname, self.objtype)
|
||||
|
||||
# XXX: why is objtype function? How to get to func?
|
||||
typ = self.objtype
|
||||
if typ == 'function':
|
||||
typ = 'func'
|
||||
self.env.domaindata['cpp']['objects'].setdefault(name,
|
||||
(self.env.docname, typ, theid))
|
||||
|
||||
indextext = self.get_index_text(name)
|
||||
if indextext:
|
||||
@ -1053,7 +1058,7 @@ class CPPDomain(Domain):
|
||||
}
|
||||
|
||||
def clear_doc(self, docname):
|
||||
for fullname, (fn, _) in self.data['objects'].items():
|
||||
for fullname, (fn, _, _) in self.data['objects'].items():
|
||||
if fn == docname:
|
||||
del self.data['objects'][fullname]
|
||||
|
||||
@ -1066,7 +1071,7 @@ class CPPDomain(Domain):
|
||||
obj = self.data['objects'][name]
|
||||
if obj[1] != typ:
|
||||
return None
|
||||
return make_refnode(builder, fromdocname, obj[0], expr.get_id(),
|
||||
return make_refnode(builder, fromdocname, obj[0], obj[2],
|
||||
contnode, name)
|
||||
|
||||
parser = DefinitionParser(target)
|
||||
@ -1094,5 +1099,5 @@ class CPPDomain(Domain):
|
||||
return _create_refnode(expr.prefix(parent))
|
||||
|
||||
def get_objects(self):
|
||||
for refname, (docname, type) in self.data['objects'].iteritems():
|
||||
for refname, (docname, type, theid) in self.data['objects'].iteritems():
|
||||
yield (refname, refname, type, docname, refname, 1)
|
||||
|
Loading…
Reference in New Issue
Block a user