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

Douglas Gregor dgregor at apple.com
Mon Aug 29 17:15:34 PDT 2011


Author: dgregor
Date: Mon Aug 29 19:15:34 2011
New Revision: 138785

URL: http://llvm.org/viewvc/llvm-project?rev=138785&view=rev
Log:
Add support for Cursor.displayname in python bindings, from Anders Waldenborg!

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

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=138785&r1=138784&r2=138785&view=diff
==============================================================================
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Mon Aug 29 19:15:34 2011
@@ -619,6 +619,17 @@
         return Cursor_spelling(self)
 
     @property
+    def displayname(self):
+        """
+        Return the display name for the entity referenced by this cursor.
+
+        The display name contains extra information that helps identify the cursor,
+        such as the parameters of a function or template or the arguments of a
+        class template specialization.
+        """
+        return Cursor_displayname(self)
+
+    @property
     def location(self):
         """
         Return the source location (the starting character) of the entity

Modified: cfe/trunk/bindings/python/tests/cindex/test_cursor.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_cursor.py?rev=138785&r1=138784&r2=138785&view=diff
==============================================================================
--- cfe/trunk/bindings/python/tests/cindex/test_cursor.py (original)
+++ cfe/trunk/bindings/python/tests/cindex/test_cursor.py Mon Aug 29 19:15:34 2011
@@ -54,8 +54,10 @@
 
     assert tu_nodes[1].kind == CursorKind.STRUCT_DECL
     assert tu_nodes[1].spelling == 's1'
+    assert tu_nodes[1].displayname == 's1'
     assert tu_nodes[1].is_definition() == False
 
     assert tu_nodes[2].kind == CursorKind.FUNCTION_DECL
     assert tu_nodes[2].spelling == 'f0'
+    assert tu_nodes[2].displayname == 'f0(int, int)'
     assert tu_nodes[2].is_definition() == True





More information about the cfe-commits mailing list