gh-90110: Update the c-analyzer Tool (gh-96058)

This commit is contained in:
Eric Snow 2022-08-17 16:54:59 -06:00 committed by GitHub
parent 5aac85101b
commit 586fc02be5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 87 additions and 8 deletions

View file

@ -385,6 +385,9 @@ def get_parsed_vartype(decl):
elif isinstance(decl, Variable):
storage = decl.storage
typequal, typespec, abstract = decl.vartype
elif isinstance(decl, Signature):
storage = None
typequal, typespec, abstract = decl.returntype
elif isinstance(decl, Function):
storage = decl.storage
typequal, typespec, abstract = decl.signature.returntype
@ -1012,6 +1015,18 @@ class Signature(namedtuple('Signature', 'params returntype inline isforward')):
def returns(self):
return self.returntype
@property
def typequal(self):
return self.returntype.typequal
@property
def typespec(self):
return self.returntype.typespec
@property
def abstract(self):
return self.returntype.abstract
class Function(Declaration):
kind = KIND.FUNCTION
@ -1106,9 +1121,16 @@ class TypeDef(TypeDeclaration):
def _resolve_data(cls, data):
if not data:
raise NotImplementedError(data)
vartype = dict(data)
del vartype['storage']
return VarType(**vartype), None
kwargs = dict(data)
del kwargs['storage']
if 'returntype' in kwargs:
vartype = kwargs['returntype']
del vartype['storage']
kwargs['returntype'] = VarType(**vartype)
datacls = Signature
else:
datacls = VarType
return datacls(**kwargs), None
@classmethod
def _raw_data(self, data):

View file

@ -9,7 +9,11 @@ from ._regexes import (
def log_match(group, m):
from . import _logger
_logger.debug(f'matched <{group}> ({m.group(0)})')
text = m.group(0)
if text.startswith(('(', ')')) or text.endswith(('(', ')')):
_logger.debug(f'matched <{group}> ({text!r})')
else:
_logger.debug(f'matched <{group}> ({text})')
#############################