C++, support inline variables

This commit is contained in:
Jakob Lykke Andersen
2021-06-24 19:15:54 +02:00
parent d10c9deb2c
commit 57237dbb07
3 changed files with 8 additions and 4 deletions

View File

@@ -53,6 +53,7 @@ Features added
* #9097: Optimize the paralell build
* #9131: Add :confval:`nitpick_ignore_regex` to ignore nitpicky warnings using
regular expressions
* C++, add support for inline variables.
Bugs fixed

View File

@@ -5957,12 +5957,13 @@ class DefinitionParser(BaseParser):
if threadLocal:
continue
if not inline and outer in ('function', 'member'):
inline = self.skip_word('inline')
if inline:
continue
if outer == 'function':
# function-specifiers
if not inline:
inline = self.skip_word('inline')
if inline:
continue
if not friend:
friend = self.skip_word('friend')
if friend:

View File

@@ -435,6 +435,8 @@ def test_domain_cpp_ast_member_definitions():
# check('member', 'int b : (true ? 8 : a) = 42', {1: 'b__i', 2: '1b'})
check('member', 'int b : 1 || new int{0}', {1: 'b__i', 2: '1b'})
check('member', 'inline int n', {1: 'n__i', 2: '1n'})
def test_domain_cpp_ast_function_definitions():
check('function', 'void f(volatile int)', {1: "f__iV", 2: "1fVi"})