10000 gh-90110: Update the c-analyzer Tool by ericsnowcurrently · Pull Request #96058 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-90110: Update the c-analyzer Tool #96058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 17, 2022
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
Treat a signature as a vartype.
  • Loading branch information
ericsnowcurrently committed Aug 17, 2022
commit cda5d54c6a856e0e34d9b3e98c396b647eb21bc6
28 changes: 25 additions & 3 deletions Tools/c-analyzer/c_parser/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1012,6 +1015,18 @@ def __str__(self):
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
Expand Down Expand Up @@ -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):
Expand Down
0