diff options
| author | Eric Snow <ericsnowcurrently@gmail.com> | 2022-08-17 22:54:59 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-17 22:54:59 (GMT) |
| commit | 586fc02be5b3e103bfddd49654034a898a8d6dfc (patch) | |
| tree | 6602f98e30e0964c5e1dea463dd288078e507202 /Tools/c-analyzer/c_parser/info.py | |
| parent | 5aac85101b3b0285770bf5739a94cb26245b9eaf (diff) | |
| download | cpython-586fc02be5b3e103bfddd49654034a898a8d6dfc.zip cpython-586fc02be5b3e103bfddd49654034a898a8d6dfc.tar.gz cpython-586fc02be5b3e103bfddd49654034a898a8d6dfc.tar.bz2 | |
gh-90110: Update the c-analyzer Tool (gh-96058)
Diffstat (limited to 'Tools/c-analyzer/c_parser/info.py')
| -rw-r--r-- | Tools/c-analyzer/c_parser/info.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/Tools/c-analyzer/c_parser/info.py b/Tools/c-analyzer/c_parser/info.py index a1d349d..e9783cc 100644 --- a/Tools/c-analyzer/c_parser/info.py +++ b/Tools/c-analyzer/c_parser/info.py @@ -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): |
