]> granicus.if.org Git - clang/commitdiff
Add support for Cursor.displayname in python bindings, from Anders Waldenborg!
authorDouglas Gregor <dgregor@apple.com>
Tue, 30 Aug 2011 00:15:34 +0000 (00:15 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 30 Aug 2011 00:15:34 +0000 (00:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138785 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/python/clang/cindex.py
bindings/python/tests/cindex/test_cursor.py

index 4b7dc005f6a2cde051d94efb454602c8e5e747b4..5b8f814c056658732c45db36adc27fcb484fbb99 100644 (file)
@@ -618,6 +618,17 @@ class Cursor(Structure):
             return None
         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):
         """
index 04e483894560fcf045365d7203f192da891711c8..3dde891a9c264814ccc69550529b27bfa34c3cce 100644 (file)
@@ -54,8 +54,10 @@ def test_get_children():
 
     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