class documentation

class RevenPrototypes(object):

View In Hierarchy

Access prototypes-parsing capability from a reven2.RevenServer

Method __init__
Property calling_conventions Available calling conventions.
Method parse_translation_unit Parse functions from the given translation unit.
Method parse_one_function Helper function to parse the first function from the given translation unit to a ready to use Prototype
Instance Variable _reven_server Undocumented
def __init__(self, reven_server):
Parametersreven_serverreven2.RevenServer (type: _RevenServer)
_reven_server =

Undocumented

@property
calling_conventions =

Available calling conventions.

(type: CallingConventions)
def parse_translation_unit(self, translation_unit):

Parse functions from the given translation unit.

Examples

>>> rvnproto = RevenPrototypes(reven_server)
>>> parsed = rvnproto.parse_translation_unit("int foo(bool bar);")
>>> print(parsed.diagnostics)
[]
>>> print(parsed.unknown_types)
[]
>>> for f in parsed.functions:
...     print(f"{f.name} -> {f.return_type.name}")
...     for p in f.parameters:
...         print(f"- {p.name}: {p.type.name}")
foo -> int
- bar: bool

Information

Parameterstranslation_unitcontent of the translation unit. (type: str)
ReturnsParsedTranslationUnit instance. (type: ParsedTranslationUnit)
def parse_one_function(self, translation_unit, calling_convention):

Helper function to parse the first function from the given translation unit to a ready to use Prototype

Examples

>>> rvnproto = RevenPrototypes(reven_server)
>>> proto = rvnproto.parse_one_function(
...     "using Bar = int; int foo(Bar bar);",
...      rvnproto.calling_conventions.Ms64
... )
>>> call_tr = reven_server.trace.transition(1234)
>>> foo = proto.call_site_values(call_tr)
>>> print(foo.ret())
0
>>> print(foo.arg("bar"))
4

Information

Parameterstranslation_unitcontent of the translation unit. (type: str)
calling_conventioncalling convention to use for resolving arguments. (type: _CallingConvention)
ReturnsPrototype instance. (type: Prototype)
RaisesRuntimeErrorif translation unit parsing fails.
IndexErrorif no function found in translation unit.
API Documentation for reven2, generated by pydoctor 21.2.2 at 2022-03-08 15:23:15.