Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Factor out _has_other_supported_type().
  • Loading branch information
ericsnowcurrently committed Aug 25, 2022
commit 0d2db68061a74aa04f7f0e4d98b4bf2eb1007774
14 changes: 9 additions & 5 deletions Tools/c-analyzer/cpython/_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,7 @@ def _check_typedep(decl, typedecl, types, knowntypes):
# XXX Fail?
return 'typespec (missing)'
elif typedecl is _info.UNKNOWN:
vartype = str(decl.vartype).split()
if vartype[0] == 'struct':
vartype = vartype[1:]
vartype = ''.join(vartype)
if vartype in _OTHER_SUPPORTED_TYPES:
if _has_other_supported_type(decl):
return None
# XXX Is this right?
return 'typespec (unknown)'
Expand All @@ -250,6 +246,14 @@ def _check_typedep(decl, typedecl, types, knowntypes):
raise NotImplementedError(decl)


def _has_other_supported_type(decl):
vartype = str(decl.vartype).split()
if vartype[0] == 'struct':
vartype = vartype[1:]
vartype = ''.join(vartype)
return vartype in _OTHER_SUPPORTED_TYPES


def _check_vartype(decl, typedecl, types, knowntypes):
"""Return failure reason."""
checked = _check_typespec(decl, typedecl, types, knowntypes)
Expand Down