Displaying 5 results from an estimated 5 matches for "cursorkind".
2013 Oct 19
2
[LLVMdev] Parsing C++ headers with Clang bindings for Python
...example session:
>>> import clang.cindex
>>> idx = clang.cindex.Index.create()
>>> tu = idx.parse('/usr/include/math.h', ['-x', 'c++-header'])
>>> c = tu.cursor
>>> for d in c.get_children():
... print d.kind, d.spelling
...
CursorKind.TYPEDEF_DECL __int128_t
CursorKind.TYPEDEF_DECL __uint128_t
CursorKind.TYPEDEF_DECL __builtin_va_list
CursorKind.UNEXPOSED_DECL
>>> print len(tu.diagnostics)
0
Now that list clearly does not represent the contents of math.h. However,
as you can see, I don't get an error, and the list...
2013 Oct 19
0
[LLVMdev] Parsing C++ headers with Clang bindings for Python
...ort clang.cindex
> >>> idx = clang.cindex.Index.create()
> >>> tu = idx.parse('/usr/include/math.h', ['-x', 'c++-header'])
> >>> c = tu.cursor
> >>> for d in c.get_children():
> ... print d.kind, d.spelling
> ...
> CursorKind.TYPEDEF_DECL __int128_t
> CursorKind.TYPEDEF_DECL __uint128_t
> CursorKind.TYPEDEF_DECL __builtin_va_list
> CursorKind.UNEXPOSED_DECL
>
It would seem that the contents on the entire module are hidden inside this
UNEXPOSED_DECL. I'd be interesting in knowing why that is, but for now...
2013 Oct 20
1
[LLVMdev] Parsing C++ headers with Clang bindings for Python
...rt clang.cindex
> >>> idx = clang.cindex.Index.create()
> >>> tu = idx.parse('/usr/include/math.h', ['-x', 'c++-header'])
> >>> c = tu.cursor
> >>> for d in c.get_children():
> ... print d.kind, d.spelling
> ...
> CursorKind.TYPEDEF_DECL __int128_t
> CursorKind.TYPEDEF_DECL __uint128_t
> CursorKind.TYPEDEF_DECL __builtin_va_list
> CursorKind.UNEXPOSED_DECL
>
> It would seem that the contents on the entire module are hidden inside this UNEXPOSED_DECL. I'd be interesting in knowing why that is, but f...
2012 Sep 13
1
[LLVMdev] Parsing C++ template parameters using cindex.py
....data[1], node.data[2]
print tabs + " children"
children = [c for c in node.get_children()]
for c in children:
DeepPrint(c, depth + 2)
index = Index.create()
tu = index.parse(None, ['testfile.cpp'])
children = [c for c in tu.cursor.get_children() if c.kind ==
CursorKind.VAR_DECL]
for c in children:
DeepPrint(c)
Dump output:
cursor test_int
location <SourceLocation file 'testfile.cpp', line 11, column 11>
result TypeKind.INVALID
kind CursorKind.VAR_DECL
type
kind TypeKind.UNEXPOSED
xdata 0
data 48356112 1 4106544
children
cursor None...
2016 May 08
2
typedef not present in the python AST
...with
index = clang.cindex.Index.create()
tu = index.parse(f, ['-x', 'c++', '-std=c++11', '-fsyntax-only', '-I', '.'])
and then I display the node kinds of every node in the AST
(recursively calling get_children() on every node), I get a node of
type CursorKind.TYPEDEF_DECL, but only if it is top-level (or inside a
namespace or class).
If the typedef is in a function body, it doesn't get reported at all
(even though variable declarations before and after are reported).
Why are they not reported?
Thanks,
--
Valentin Tolmer