C++, do not add index entries for decls in concepts

This commit is contained in:
Jakob Lykke Andersen 2017-12-12 15:03:41 +01:00
parent d9006ef5b2
commit 809388d836
2 changed files with 20 additions and 7 deletions

View File

@ -86,7 +86,8 @@ Bugs fixed
* #3882: Update the order of files for HTMLHelp and QTHelp * #3882: Update the order of files for HTMLHelp and QTHelp
* #3962: sphinx-apidoc does not recognize implicit namespace packages correctly * #3962: sphinx-apidoc does not recognize implicit namespace packages correctly
* #4094: C++, allow empty template argument lists. * #4094: C++, allow empty template argument lists.
* C++: also hyperlink types in the name of declarations with qualified names. * C++, also hyperlink types in the name of declarations with qualified names.
* C++, do not add index entries for declarations inside concepts.
Testing Testing
-------- --------

View File

@ -5474,13 +5474,25 @@ class CPPObject(ObjectDescription):
'report as bug (id=%s).' % (text_type(ast), newestId)) 'report as bug (id=%s).' % (text_type(ast), newestId))
name = text_type(ast.symbol.get_full_nested_name()).lstrip(':') name = text_type(ast.symbol.get_full_nested_name()).lstrip(':')
strippedName = name # Add index entry, but not if it's a declaration inside a concept
for prefix in self.env.config.cpp_index_common_prefix: isInConcept = False
if name.startswith(prefix): s = ast.symbol.parent
strippedName = strippedName[len(prefix):] while s is not None:
decl = s.declaration
s = s.parent
if decl is None:
continue
if decl.objectType == 'concept':
isInConcept = True
break break
indexText = self.get_index_text(strippedName) if not isInConcept:
self.indexnode['entries'].append(('single', indexText, newestId, '', None)) strippedName = name
for prefix in self.env.config.cpp_index_common_prefix:
if name.startswith(prefix):
strippedName = strippedName[len(prefix):]
break
indexText = self.get_index_text(strippedName)
self.indexnode['entries'].append(('single', indexText, newestId, '', None))
if newestId not in self.state.document.ids: if newestId not in self.state.document.ids:
# if the name is not unique, the first one will win # if the name is not unique, the first one will win