[C++] Support attributes on class and union and improve formatting

This commit is contained in:
Jeremy Maitin-Shepard
2022-03-10 22:03:42 -08:00
parent b3812f72a9
commit 670e8b149f
3 changed files with 65 additions and 11 deletions

View File

@@ -996,6 +996,15 @@ def test_domain_cpp_ast_attributes():
# position: parameters and qualifiers
check('function', 'void f() [[attr1]] [[attr2]]', {1: 'f', 2: '1fv'})
# position: class
check('class', '{key}[[nodiscard]] Foo', {1: 'Foo', 2: '3Foo', 3: '3Foo', 4: '3Foo'},
key='class')
check('union', '{key}[[nodiscard]] Foo', {1: None, 2: '3Foo', 3: '3Foo', 4: '3Foo'},
key='union')
# position: enum
check('enum', '{key}[[nodiscard]] Foo', {1: None, 2: '3Foo', 3: '3Foo', 4: '3Foo'},
key='enum')
def test_domain_cpp_ast_xref_parsing():
def check(target):