summaryrefslogtreecommitdiff
path: root/bindings/python/clang/cindex.py
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/python/clang/cindex.py')
-rw-r--r--bindings/python/clang/cindex.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
index 70f4f36a2cfd..880a1502a4ba 100644
--- a/bindings/python/clang/cindex.py
+++ b/bindings/python/clang/cindex.py
@@ -1314,6 +1314,18 @@ class Cursor(Structure):
"""
return TokenGroup.get_tokens(self._tu, self.extent)
+ def is_bitfield(self):
+ """
+ Check if the field is a bitfield.
+ """
+ return conf.lib.clang_Cursor_isBitField(self)
+
+ def get_bitfield_width(self):
+ """
+ Retrieve the width of a bitfield.
+ """
+ return conf.lib.clang_getFieldDeclBitWidth(self)
+
@staticmethod
def from_result(res, fn, args):
assert isinstance(res, Cursor)
@@ -1613,6 +1625,24 @@ class Type(Structure):
"""
return conf.lib.clang_getArraySize(self)
+ def get_align(self):
+ """
+ Retrieve the alignment of the record.
+ """
+ return conf.lib.clang_Type_getAlignOf(self)
+
+ def get_size(self):
+ """
+ Retrieve the size of the record.
+ """
+ return conf.lib.clang_Type_getSizeOf(self)
+
+ def get_offset(self, fieldname):
+ """
+ Retrieve the offset of a field in the record.
+ """
+ return conf.lib.clang_Type_getOffsetOf(self, c_char_p(fieldname))
+
def __eq__(self, other):
if type(other) != type(self):
return False
@@ -2623,6 +2653,10 @@ functionList = [
[Type],
c_longlong),
+ ("clang_getFieldDeclBitWidth",
+ [Cursor],
+ c_int),
+
("clang_getCanonicalCursor",
[Cursor],
Cursor,
@@ -3038,6 +3072,22 @@ functionList = [
[Cursor, c_uint],
Cursor,
Cursor.from_result),
+
+ ("clang_Cursor_isBitField",
+ [Cursor],
+ bool),
+
+ ("clang_Type_getAlignOf",
+ [Type],
+ c_longlong),
+
+ ("clang_Type_getOffsetOf",
+ [Type, c_char_p],
+ c_longlong),
+
+ ("clang_Type_getSizeOf",
+ [Type],
+ c_ulonglong),
]
class LibclangError(Exception):