summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorGregory Szorc <gregory.szorc@gmail.com>2012-02-05 19:42:06 +0000
committerGregory Szorc <gregory.szorc@gmail.com>2012-02-05 19:42:06 +0000
commit04d612aa12efd1aca4505ad07e23e7e82fe93823 (patch)
tree1c85c61418f8a4cc377aa0da7dcc7a279404ef03 /clang
parent994c1103c88bca9d92b26be2a297d4e91b3cbbe2 (diff)
downloadbcm5719-llvm-04d612aa12efd1aca4505ad07e23e7e82fe93823.tar.gz
bcm5719-llvm-04d612aa12efd1aca4505ad07e23e7e82fe93823.zip
[clang.py] Implement Type.is_pod
llvm-svn: 149842
Diffstat (limited to 'clang')
-rw-r--r--clang/bindings/python/clang/cindex.py8
-rw-r--r--clang/bindings/python/tests/cindex/test_type.py18
2 files changed, 26 insertions, 0 deletions
diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py
index a5e3ed68450..58182f3e09c 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -1178,6 +1178,10 @@ class Type(Structure):
"""
return Type_is_restrict_qualified(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.
@@ -1858,6 +1862,10 @@ Type_is_restrict_qualified = lib.clang_isRestrictQualifiedType
Type_is_restrict_qualified.argtypes = [Type]
Type_is_restrict_qualified.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
diff --git a/clang/bindings/python/tests/cindex/test_type.py b/clang/bindings/python/tests/cindex/test_type.py
index 2a35f6e7566..26ed79553e0 100644
--- a/clang/bindings/python/tests/cindex/test_type.py
+++ b/clang/bindings/python/tests/cindex/test_type.py
@@ -97,3 +97,21 @@ def testConstantArray():
break
else:
assert False, "Didn't find teststruct??"
+
+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
+ i, f = None, 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()
OpenPOWER on IntegriCloud