---
 bindings/python/clang/cindex.py           |    8 ++++++++
 bindings/python/tests/cindex/test_type.py |   17 +++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
index 003f475..364547b 100644
--- a/bindings/python/clang/cindex.py
+++ b/bindings/python/clang/cindex.py
@@ -1194,16 +1194,20 @@ class Type(Structure):
         return Type_is_restrict_qualified(self)
 
     def is_function_variadic(self):
         """Determine whether this function Type is a variadic function type."""
         assert self.type == TypeKind.FUNCTIONPROTO
 
         return Type_is_variadic(self)
 
+    def is_pod(self):
+        """Determine whether this Type represents plain old data (POD)."""
+        return Type_is_pod(self)
+
     def get_pointee(self):
         """
         For pointer types, returns the type of the pointee.
         """
         return Type_get_pointee(self)
 
     def get_declaration(self):
         """
@@ -1896,16 +1900,20 @@ Type_is_volatile_qualified.restype = bool
 Type_is_restrict_qualified = lib.clang_isRestrictQualifiedType
 Type_is_restrict_qualified.argtypes = [Type]
 Type_is_restrict_qualified.restype = bool
 
 Type_is_variadic = lib.clang_isFunctionTypeVariadic
 Type_is_variadic.argtypes = [Type]
 Type_is_variadic.restype = bool
 
+Type_is_pod = lib.clang_isPODType
+Type_is_pod.argtypes = [Type]
+Type_is_pod.restype = bool
+
 Type_get_pointee = lib.clang_getPointeeType
 Type_get_pointee.argtypes = [Type]
 Type_get_pointee.restype = Type
 Type_get_pointee.errcheck = Type.from_result
 
 Type_get_declaration = lib.clang_getTypeDeclaration
 Type_get_declaration.argtypes = [Type]
 Type_get_declaration.restype = Cursor
diff --git a/bindings/python/tests/cindex/test_type.py b/bindings/python/tests/cindex/test_type.py
index d2616bd..c131a4b 100644
--- a/bindings/python/tests/cindex/test_type.py
+++ b/bindings/python/tests/cindex/test_type.py
@@ -131,8 +131,25 @@ def test_function_arguments():
 
     t0 = f.type.get_arg_type(0)
     assert t0.kind == TypeKind.INT
     t1 = f.type.get_arg_type(1)
     assert t1.kind == TypeKind.INT
 
     args = list(f.type.argument_types)
     assert len(args) == 2
+
+def test_is_pod():
+    index = Index.create()
+    tu = index.parse('t.c', unsaved_files=[('t.c', 'int i; void f();')])
+    assert tu is not None
+
+    for cursor in tu.cursor.get_children():
+        if cursor.spelling == 'i':
+            i = cursor
+        elif cursor.spelling == 'f':
+            f = cursor
+
+    assert i is not None
+    assert f is not None
+
+    assert i.type.is_pod()
+    assert not f.type.is_pod()
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to