class RevenPrototypes(object):
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 |
Parse functions from the given translation unit.
>>> 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
| Parameters | translation_unit | content of the translation unit. (type: str) |
| Returns | ParsedTranslationUnit instance. (type: ParsedTranslationUnit) | |
Helper function to parse the first function from the given translation unit to a ready to use Prototype
>>> 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
| Parameters | translation_unit | content of the translation unit. (type: str) |
| calling_convention | calling convention to use for resolving arguments. (type: _CallingConvention) | |
| Returns | Prototype instance. (type: Prototype) | |
| Raises | RuntimeError | if translation unit parsing fails. |
| IndexError | if no function found in translation unit. | |