From 38d2d5539e72ce3d92c4746b632f3a7c2e48b4a2 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 19 Oct 2011 05:50:34 +0000 Subject: [PATCH] Add TypeKind.CONSTANTARRAY, from Anders Waldenborg! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142476 91177308-0d34-0410-b5e6-96231b3b80d8 --- bindings/python/clang/cindex.py | 2 +- bindings/python/tests/cindex/test_type.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index ee8c5e8384..8f1a8b8cce 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -1019,7 +1019,7 @@ TypeKind.OBJCINTERFACE = TypeKind(108) TypeKind.OBJCOBJECTPOINTER = TypeKind(109) TypeKind.FUNCTIONNOPROTO = TypeKind(110) TypeKind.FUNCTIONPROTO = TypeKind(111) - +TypeKind.CONSTANTARRAY = TypeKind(112) class Type(Structure): """ diff --git a/bindings/python/tests/cindex/test_type.py b/bindings/python/tests/cindex/test_type.py index cd27a4cbb9..35c7bbbfa2 100644 --- a/bindings/python/tests/cindex/test_type.py +++ b/bindings/python/tests/cindex/test_type.py @@ -74,3 +74,22 @@ def test_a_struct(): 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??" -- 2.50.1