Tobias Grosser
a87dbcc049
python bindings: Add support for different kind of completion chunks
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124959 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 17:54:10 +00:00
Tobias Grosser
6d2a40c191
python bindings: Get the string representation of a CompletionChunk
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124958 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 17:54:07 +00:00
Tobias Grosser
0a16680067
python bindings: Add CodeCompletionResults
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124957 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 17:54:04 +00:00
Tobias Grosser
265e6b2d17
python bindings: Add support for translationUnit.reparse().
...
This is the first step to make the clang_complete vim plugin work with
libclang. Reparsing improves parsing time from 0.8 to 0.25 secs for
one of my LLVM .cpp files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124956 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 17:54:00 +00:00
Tobias Grosser
88f9c6ca6e
python bindings: Include local headers the right way.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124955 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 17:53:55 +00:00
Tobias Grosser
f784ff0c8a
python bindings: Remove unneeded instruction
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124954 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 17:53:53 +00:00
Tobias Grosser
f498e00a30
python bindings: fix Diagnostics.range iterator
...
The iterator did never throw an IndexError. It was therefore not possible
to use it in a normal foreach loop as that loop would never stop.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124953 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 17:53:51 +00:00
Tobias Grosser
ff090ca42a
python bindings: Use python Diagnostics as function arguments
...
This improves the readability of the code and fixes one testsuite bug.
The bug happend, because we only stored the pointer to the diagnostic in the
FixIt iterator, but not the python Diagnostic object. So it could happen that
the FixIt iterator still exists, but the python Diagnostic object is freed.
However, as the python Diagnostic is freed the pointer to the diagnostic is also
freed and the FixIt iterator is referencing a freed pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124952 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 17:53:48 +00:00
Tobias Grosser
4ed73ce03b
python bindings: Synchronize cursor kinds
...
clang-c/Index.h contained cursor kinds not yet available in the python bindings.
Contributed-By: jmuizelaar@mozilla.com
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124951 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 17:53:47 +00:00
Daniel Dunbar
f51f20fa34
Rename 'CIndex' to 'libclang', since it has basically become our stable public
...
(C) API, and will likely grow further in this direction in the future.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102779 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 21:51:10 +00:00
Benjamin Kramer
1d02ccd1aa
Rename the new Iterator objects and raise an assertion instead of returning invalid objects when the key is out of range.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97881 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-06 15:38:03 +00:00
Benjamin Kramer
3b0cf09f9c
Update the python bindings for recent changes in the CIndex API.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97880 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-06 14:53:07 +00:00
Daniel Dunbar
d52864bd33
CIndex: Switch CXSourceRange to proper half-open intervals.
...
- Doug, please review.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96162 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14 10:02:57 +00:00
Daniel Dunbar
8bb44d5c86
cindex/Python: Fix cindex-{dump,includes} examples to just pass all args
...
directly to Index, instead of requiring the input file to be first. This makes
the examples behave more like 'clang'.
For example,
ddunbar@giles:tmp$ echo '#include <string>' | python ~/llvm/tools/clang/bindings/python/examples/cindex/cindex-includes.py -- -x c++ - | wc -l
114
ddunbar@giles:tmp$ echo '#include <stdio.h>' | python ~/llvm/tools/clang/bindings/python/examples/cindex/cindex-includes.py -- -x c - | wc -l
10
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96107 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 18:33:28 +00:00
Daniel Dunbar
ef7f798c09
cindex/Python: Add TranslationUnit.get_includes, patch by Andrew Sutton!
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96106 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 18:33:18 +00:00
Daniel Dunbar
b51abe9b5f
cindex/Python: Update for clang_getDiagnosticRange... API changes.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96105 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 18:33:03 +00:00
Daniel Dunbar
8958dc9bf3
cindex/Python: Turn off showing IDs by default, they are really slow to compute
...
pending a hash function. Also added a --max-depth argument, handy for timing and
limiting the volume of output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94936 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-31 00:41:15 +00:00
Daniel Dunbar
6d32cb85ee
cindex/Python: Add a simple example which dumps assorted information about a translation unit.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94934 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:59:14 +00:00
Daniel Dunbar
532fc63b51
cindex/Python: Add full support for Diagnostic and FixIt objects, available via TranslationUnit.diagnostics.
...
Several important FIXMEs remain:
- We aren't getting all the notes?
- There is still no way to get diagnostics for invalid inputs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:59:02 +00:00
Daniel Dunbar
e32af4213e
cindex/Python: Update SourceLocation and SourceRange structures to match API changes.
...
Hurray for exposing implementation details!!!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94932 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:58:50 +00:00
Daniel Dunbar
2791dfc0fc
cindex/Python: Update Index.create for removal of displayDiagnostics.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-30 23:58:39 +00:00
Daniel Dunbar
3239a67361
cindex/Python: Update to support _getInstantiationLocation's new offset value.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94813 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 17:02:32 +00:00
Daniel Dunbar
061bae930b
cindex/Python: Move translation unit load functions to Index, there isn't a good reason to have separate static methods for this.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94419 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 09:16:55 +00:00
Daniel Dunbar
db59a7700e
cindex/Python: Support file objects as unsaved_files, albeit inefficiently.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94418 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 09:16:41 +00:00
Daniel Dunbar
90859ae3b6
cindex/Python: Add Cursor test.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94397 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 00:44:21 +00:00
Daniel Dunbar
5b534f6794
cindex/Python: Implement support for unsaved/remapped files.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 00:44:11 +00:00
Daniel Dunbar
1f8d7f94c7
cindex/Python: Fix/simplify Index.parse() passing command line arguments.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94394 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 00:43:31 +00:00
Daniel Dunbar
4efd632322
cindex/Python: Update comments, add module docstrings, add LLVM headers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94392 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 00:43:08 +00:00
Daniel Dunbar
a6a6499a90
cindex/Python: Move Cursor.is_ methods to CursorKind, and add test.
...
Also, add CursorKind.get_all_kinds().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94389 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 21:20:39 +00:00
Daniel Dunbar
12bf15c48a
cindex/Python: Implement explicit objects for CursorKind enumeration values.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94388 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 21:20:29 +00:00
Daniel Dunbar
f869083cbf
cindex/Python: Fetch SourceLocation instantiation location information on lazily, it isn't free.
...
Also, add repr() support to SourceRange.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 21:20:21 +00:00
Daniel Dunbar
3d855f8d48
cindex/Python: Add Cursor.get_usr().
...
Also, change Cursor.spelling to return None for non-decls, for consistency with get_usr().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 21:20:13 +00:00
Daniel Dunbar
fb8ae1796e
cindex/Python: Return null cursors as None instead of exposing this notion.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94385 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 21:20:05 +00:00
Daniel Dunbar
a33dca490a
cindex/Python: Convert CXString objects to regular Python strings below API.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94384 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 21:19:57 +00:00
Daniel Dunbar
be0b555b80
Simplify.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94383 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 21:19:48 +00:00
Daniel Dunbar
0263a1e517
cindex/Python: Remove Cursor.file forwarding method, this doesn't really fit the API.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 21:19:40 +00:00
Daniel Dunbar
de3b8e525a
cindex/Python: Add Cursor.get_children()
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94359 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 04:10:22 +00:00
Daniel Dunbar
2c7bcaa1d8
cindex/Python: Remove Declaration class, this has been removed from the API.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94358 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 04:10:06 +00:00
Daniel Dunbar
149f38abf5
cindex/Python: Eliminate Entity class, it has been removed from CIndex.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94357 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 04:09:58 +00:00
Daniel Dunbar
99d593ed41
Simplify.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 04:09:51 +00:00
Daniel Dunbar
1b945a7455
cindex/Python: Add TranslationUnit.cursor.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94355 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 04:09:43 +00:00
Daniel Dunbar
7b48b3519a
cindex/Python: Tweak Source{Location,Range}
...
- Add __repr__ on SourceLocation.
- Fix File object construction to use c_object_p type, and use None instead of
invalid File objects.
- Make SourceRange.{start,end} properties.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94354 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 04:09:34 +00:00
Daniel Dunbar
aa22984a82
cindex/Python: Make Cursor.is_... functions not properties.
...
Also, add ValueError check before calling Cursor_spelling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94353 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 04:09:23 +00:00
Daniel Dunbar
30c0f2637c
Initial checkin of CIndex Python bindings, by Andrew Sutton!
...
- Some tweaks by me for API changes, Darwin, and x86_64 support. Still needs
substantial updating to match recent CIndex API changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94349 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 02:02:07 +00:00