summaryrefslogtreecommitdiffstats
path: root/clang/bindings/python/tests/cindex/test_cursor.py
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2012-02-05 11:42:20 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2012-02-05 11:42:20 +0000
commit062d2a3c89d801ac3075f926c5d04a2556aaa9dc (patch)
tree3deb2439a37e3fdea86895a9ad0664bff256b079 /clang/bindings/python/tests/cindex/test_cursor.py
parent13d92a4b8f39c3f5dd3494b64f97b7e443da0b4d (diff)
downloadbcm5719-llvm-062d2a3c89d801ac3075f926c5d04a2556aaa9dc.tar.gz
bcm5719-llvm-062d2a3c89d801ac3075f926c5d04a2556aaa9dc.zip
[clang.py] Implement Cursor.underlying_typedef_type
Contributed by: Gregory Szorc <gregory.szorc@gmail.com> llvm-svn: 149829
Diffstat (limited to 'clang/bindings/python/tests/cindex/test_cursor.py')
-rw-r--r--clang/bindings/python/tests/cindex/test_cursor.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/test_cursor.py b/clang/bindings/python/tests/cindex/test_cursor.py
index efcede90154..d86830334dd 100644
--- a/clang/bindings/python/tests/cindex/test_cursor.py
+++ b/clang/bindings/python/tests/cindex/test_cursor.py
@@ -62,3 +62,18 @@ def test_get_children():
assert tu_nodes[2].spelling == 'f0'
assert tu_nodes[2].displayname == 'f0(int, int)'
assert tu_nodes[2].is_definition() == True
+
+def test_underlying_type():
+ source = 'typedef int foo;'
+ index = Index.create()
+ tu = index.parse('test.c', unsaved_files=[('test.c', source)])
+ assert tu is not None
+
+ for cursor in tu.cursor.get_children():
+ if cursor.spelling == 'foo':
+ typedef = cursor
+ break
+
+ assert typedef.kind.is_declaration()
+ underlying = typedef.underlying_typedef_type
+ assert underlying.kind == TypeKind.INT
OpenPOWER on IntegriCloud