C++, fix parsing of types prefixed with 'enum'.

Fixes michaeljones/breathe#223.
This commit is contained in:
Jakob Lykke Andersen 2015-10-01 22:28:54 +09:00
parent 3fb3fdbd53
commit df3d6476a4
3 changed files with 12 additions and 2 deletions

View File

@ -68,6 +68,7 @@ Bugs fixed
* C++, add missing support for 'friend' functions. * C++, add missing support for 'friend' functions.
* C++, add missing support for virtual base classes (thanks to Rapptz). * C++, add missing support for virtual base classes (thanks to Rapptz).
* C++, add support for final classes. * C++, add support for final classes.
* C++, fix parsing of types prefixed with 'enum'.
Documentation Documentation
------------- -------------

View File

@ -38,7 +38,9 @@ from sphinx.util.docfields import Field, GroupedField
All versions are generated and attached to elements. The newest is used for All versions are generated and attached to elements. The newest is used for
the index. All of the versions should work as permalinks. the index. All of the versions should work as permalinks.
See http://www.nongnu.org/hcb/ for the grammar. See http://www.nongnu.org/hcb/ for the grammar,
or https://github.com/cplusplus/draft/blob/master/source/grammar.tex
for the newest grammar.
common grammar things: common grammar things:
template-declaration -> template-declaration ->
@ -2387,7 +2389,7 @@ class DefinitionParser(object):
'float', 'double', 'auto' 'float', 'double', 'auto'
) )
_prefix_keys = ('class', 'struct', 'union', 'typename') _prefix_keys = ('class', 'struct', 'enum', 'union', 'typename')
def __init__(self, definition, warnEnv): def __init__(self, definition, warnEnv):
self.definition = definition.strip() self.definition = definition.strip()

View File

@ -226,6 +226,13 @@ def test_type_definitions():
check('function', 'friend std::ostream &f(std::ostream&, int)', check('function', 'friend std::ostream &f(std::ostream&, int)',
'f__osR.i', '1fRNSt7ostreamEi') 'f__osR.i', '1fRNSt7ostreamEi')
# from breathe#223
check('function', 'void f(struct E e)', 'f__E', '1f1E')
check('function', 'void f(class E e)', 'f__E', '1f1E')
check('function', 'void f(typename E e)', 'f__E', '1f1E')
check('function', 'void f(enum E e)', 'f__E', '1f1E')
check('function', 'void f(union E e)', 'f__E', '1f1E')
check('class', 'public A', "A", "1A", output='A') check('class', 'public A', "A", "1A", output='A')
check('class', 'private A', "A", "1A") check('class', 'private A', "A", "1A")