From 89861066edf2f9d47991436e7444ac9b11c5b4c4 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! llvm-svn: 142476 --- clang/bindings/python/clang/cindex.py | 2 +- .../bindings/python/tests/cindex/test_type.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py index ee8c5e838474..8f1a8b8cce6b 100644 --- a/clang/bindings/python/clang/cindex.py +++ b/clang/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/clang/bindings/python/tests/cindex/test_type.py b/clang/bindings/python/tests/cindex/test_type.py index cd27a4cbb98d..35c7bbbfa2fa 100644 --- a/clang/bindings/python/tests/cindex/test_type.py +++ b/clang/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??"