1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[update_cc_test_checks.py] Correctly skip function definitions

Function declarations can in fact have an 'inner' node that lists the
ParmVarDecls. It seems like either the JSON output has changed or that I
tested the original JSON parsing change with test files that only have
function definitions without arguments.

Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D80913
This commit is contained in:
Alex Richardson 2020-06-18 15:10:54 +01:00
parent 87b0a8da93
commit 2200a72e09

View File

@ -76,8 +76,18 @@ def get_line2spell_and_mangled(args, clang_args):
if line is None:
common.debug('Skipping function without line number:', node['name'], '@', node['loc'])
return
# If there is no 'inner' object, it is a function declaration -> skip
if 'inner' not in node:
# If there is no 'inner' object, it is a function declaration and we can
# skip it. However, function declarations may also contain an 'inner' list,
# but in that case it will only contains ParmVarDecls. If we find an entry
# that is not a ParmVarDecl, we know that this is a function definition.
has_body = False
if 'inner' in node:
for i in node['inner']:
if i.get('kind', 'ParmVarDecl') != 'ParmVarDecl':
has_body = True
break
if not has_body:
common.debug('Skipping function without body:', node['name'], '@', node['loc'])
return
spell = node['name']