class documentation
class RevenPrototypes(object):
Access prototypes-parsing capability from a reven2.RevenServer
Method | __init__ |
No summary |
Method | parse |
Helper function to parse the first function from the given translation unit to a ready to use Prototype |
Method | parse |
Parse functions from the given translation unit. |
Property | calling |
Available calling conventions. |
Instance Variable | _reven |
Undocumented |
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
Parameters | |
translationstr | content of the translation unit. |
calling_CallingConvention | calling convention to use for resolving arguments. |
Returns | |
Prototype | Prototype instance. |
Raises | |
RuntimeError | if translation unit parsing fails. |
IndexError | if no function found in translation unit. |
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
Parameters | |
translationstr | content of the translation unit. |
Returns | |
ParsedTranslationUnit | ParsedTranslationUnit instance. |