On Tue, Feb 07, 2012 at 02:16:32PM +0100, Tobias Grosser wrote:
> The patches are where?
Here :)
Sorry, forgot to attach.
>From a913e4c030da07b9193579f7604774657c31e9fa Mon Sep 17 00:00:00 2001
From: Anders Waldenborg <[email protected]>
Date: Mon, 19 Dec 2011 13:53:53 +0100
Subject: [PATCH 1/2] PYTHON: Add testcase for annotation cursor kind
---
bindings/python/tests/cindex/test_cursor_kind.py | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/bindings/python/tests/cindex/test_cursor_kind.py b/bindings/python/tests/cindex/test_cursor_kind.py
index f8466e5..9ff6bf2 100644
--- a/bindings/python/tests/cindex/test_cursor_kind.py
+++ b/bindings/python/tests/cindex/test_cursor_kind.py
@@ -1,4 +1,4 @@
-from clang.cindex import CursorKind
+from clang.cindex import Index,CursorKind
def test_name():
assert CursorKind.UNEXPOSED_DECL.name is 'UNEXPOSED_DECL'
@@ -38,3 +38,22 @@ def test_kind_groups():
assert len(group) == 0
else:
assert len(group) == 1
+
+annotationInput="""
+int foo (void) __attribute__ ((annotate("here be annotation attribute")));
+"""
+def test_annotation_attribute():
+ index = Index.create()
+ tu = index.parse('t.c', unsaved_files = [('t.c',annotationInput)])
+
+ for n in tu.cursor.get_children():
+ if n.spelling == 'foo':
+ for c in n.get_children():
+ if c.kind == CursorKind.ANNOTATE_ATTR:
+ assert c.displayname == "here be annotation attribute"
+ break
+ else:
+ assert False, "Couldn't find annotation"
+ break
+ else:
+ assert False, "Didn't find foo??"
--
1.7.2.5
>From 6cb471bf0addf43f204cea3b475a4d75fafc9df6 Mon Sep 17 00:00:00 2001
From: Anders Waldenborg <[email protected]>
Date: Mon, 19 Dec 2011 13:59:20 +0100
Subject: [PATCH 2/2] PYTHON: Add missing vector TypeKind
---
bindings/python/tests/cindex/test_type.py | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/bindings/python/tests/cindex/test_type.py b/bindings/python/tests/cindex/test_type.py
index 26ed795..85e7cae 100644
--- a/bindings/python/tests/cindex/test_type.py
+++ b/bindings/python/tests/cindex/test_type.py
@@ -98,6 +98,7 @@ def testConstantArray():
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();')])
@@ -115,3 +116,18 @@ def test_is_pod():
assert i.type.is_pod()
assert not f.type.is_pod()
+
+testvectorInput="""
+ float float4 __attribute__((vector_size(4)));
+"""
+def test_vector():
+ index = Index.create()
+ tu = index.parse('t.c', unsaved_files = [('t.c',testvectorInput)])
+
+ for n in tu.cursor.get_children():
+ if n.spelling == 'float4':
+ assert n.type.kind == TypeKind.VECTOR
+ break
+ else:
+ assert False, "Didn't find float4??"
+
--
1.7.2.5
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits