[cfe-commits] r142476 - in /cfe/trunk/bindings/python: clang/cindex.py tests/cindex/test_type.py

Douglas Gregor dgregor at apple.com
Tue Oct 18 22:50:34 PDT 2011


Author: dgregor
Date: Wed Oct 19 00:50:34 2011
New Revision: 142476

URL: http://llvm.org/viewvc/llvm-project?rev=142476&view=rev
Log:
Add TypeKind.CONSTANTARRAY, from  Anders Waldenborg!

Modified:
    cfe/trunk/bindings/python/clang/cindex.py
    cfe/trunk/bindings/python/tests/cindex/test_type.py

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=142476&r1=142475&r2=142476&view=diff
==============================================================================
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Wed Oct 19 00:50:34 2011
@@ -1019,7 +1019,7 @@
 TypeKind.OBJCOBJECTPOINTER = TypeKind(109)
 TypeKind.FUNCTIONNOPROTO = TypeKind(110)
 TypeKind.FUNCTIONPROTO = TypeKind(111)
-
+TypeKind.CONSTANTARRAY = TypeKind(112)
 
 class Type(Structure):
     """

Modified: cfe/trunk/bindings/python/tests/cindex/test_type.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_type.py?rev=142476&r1=142475&r2=142476&view=diff
==============================================================================
--- cfe/trunk/bindings/python/tests/cindex/test_type.py (original)
+++ cfe/trunk/bindings/python/tests/cindex/test_type.py Wed Oct 19 00:50:34 2011
@@ -74,3 +74,22 @@
 
     else:
         assert False, "Didn't find teststruct??"
+
+
+constarrayInput="""
+struct teststruct {
+  void *A[2];
+};
+"""
+def testConstantArray():
+    index = Index.create()
+    tu = index.parse('t.c', unsaved_files = [('t.c',constarrayInput)])
+
+    for n in tu.cursor.get_children():
+        if n.spelling == 'teststruct':
+            fields = list(n.get_children())
+            assert fields[0].spelling == 'A'
+            assert fields[0].type.kind == TypeKind.CONSTANTARRAY
+            break
+    else:
+        assert False, "Didn't find teststruct??"





More information about the cfe-commits mailing list