summaryrefslogtreecommitdiff
path: root/python/platform.py
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-05-20 20:42:12 -0400
committerGlenn Smith <glenn@vector35.com>2022-05-25 14:22:45 -0400
commit0569365d79aaeb74aa134f52db13aa54f9619c56 (patch)
treeaaf8f0d9913c08336b761e1130418368bd930ee4 /python/platform.py
parentf5715d76bb50fbaaaad450aecf9c192e8450e0d9 (diff)
Add BinaryView::ParseTypesFromSource for clang+typelibs
Diffstat (limited to 'python/platform.py')
-rw-r--r--python/platform.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/python/platform.py b/python/platform.py
index fc46882b..05cbaabf 100644
--- a/python/platform.py
+++ b/python/platform.py
@@ -26,6 +26,7 @@ from typing import List, Dict, Optional
import binaryninja
from . import _binaryninjacore as core
from . import types
+from . import typeparser
from . import callingconvention
from . import typelibrary
from . import architecture
@@ -411,8 +412,8 @@ class Platform(metaclass=_PlatformMetaClass):
:param include_dirs: optional list of string filename include directories
:type include_dirs: list(str)
:param str auto_type_source: optional source of types if used for automatically generated types
- :return: :py:class:`TypeParserResult` (a SyntaxError is thrown on parse error)
- :rtype: TypeParserResult
+ :return: :py:class:`BasicTypeParserResult` (a SyntaxError is thrown on parse error)
+ :rtype: BasicTypeParserResult
:Example:
>>> platform.parse_types_from_source('int foo;\\nint bar(int x);\\nstruct bas{int x,y;};\\n')
@@ -453,7 +454,7 @@ class Platform(metaclass=_PlatformMetaClass):
name = types.QualifiedName._from_core_struct(parse.functions[i].name)
functions[name] = types.Type.create(core.BNNewTypeReference(parse.functions[i].type), platform=self)
core.BNFreeTypeParserResult(parse)
- return types.TypeParserResult(type_dict, variables, functions)
+ return typeparser.BasicTypeParserResult(type_dict, variables, functions)
def parse_types_from_source_file(self, filename, include_dirs: Optional[List[str]] = None, auto_type_source=None):
"""
@@ -464,8 +465,8 @@ class Platform(metaclass=_PlatformMetaClass):
:param include_dirs: optional list of string filename include directories
:type include_dirs: list(str)
:param str auto_type_source: optional source of types if used for automatically generated types
- :return: :py:class:`TypeParserResult` (a SyntaxError is thrown on parse error)
- :rtype: TypeParserResult
+ :return: :py:class:`BasicTypeParserResult` (a SyntaxError is thrown on parse error)
+ :rtype: BasicTypeParserResult
:Example:
>>> file = "/Users/binja/tmp.c"
@@ -506,7 +507,7 @@ class Platform(metaclass=_PlatformMetaClass):
name = types.QualifiedName._from_core_struct(parse.functions[i].name)
functions[name] = types.Type.create(core.BNNewTypeReference(parse.functions[i].type), platform=self)
core.BNFreeTypeParserResult(parse)
- return types.TypeParserResult(type_dict, variables, functions)
+ return typeparser.BasicTypeParserResult(type_dict, variables, functions)
@property
def arch(self):