Find patch attached
>From ee2ec9b66e2ba600cb649d0fa1e36cbf6f9e6923 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 missing attribute cursorkinds
---
bindings/python/clang/cindex.py | 6 +++++-
bindings/python/tests/cindex/test_cursor_kind.py | 21 ++++++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
index cd6ab45..9c60fe4 100644
--- a/bindings/python/clang/cindex.py
+++ b/bindings/python/clang/cindex.py
@@ -312,7 +312,7 @@ class CursorKind(object):
@staticmethod
def from_id(id):
if id >= len(CursorKind._kinds) or CursorKind._kinds[id] is None:
- raise ValueError,'Unknown cursor kind'
+ raise ValueError,'Unknown cursor kind %d' % id
return CursorKind._kinds[id]
@staticmethod
@@ -815,6 +815,10 @@ CursorKind.UNEXPOSED_ATTR = CursorKind(400)
CursorKind.IB_ACTION_ATTR = CursorKind(401)
CursorKind.IB_OUTLET_ATTR = CursorKind(402)
CursorKind.IB_OUTLET_COLLECTION_ATTR = CursorKind(403)
+CursorKind.CXX_FINAL_ATTR = CursorKind(404)
+CursorKind.CXX_OVERRIDE_ATTR = CursorKind(405)
+CursorKind.ANNOTATE_ATTR = CursorKind(406)
+CursorKind.ASMLABEL_ATTR = CursorKind(407)
###
# Preprocessing
diff --git a/bindings/python/tests/cindex/test_cursor_kind.py b/bindings/python/tests/cindex/test_cursor_kind.py
index d7a1cfa..fb8622b 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'
@@ -29,3 +29,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
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits