Commit Graph

61 Commits

Author SHA1 Message Date
Rafael Espindola 30ccf36224 Add CXX_FINAL_ATTR, CXX_OVERRIDE_ATTR, ANNOTATE_ATTR and ASM_LABEL_ATTR to the
python bindinds.
patch by Tom Schuster!

llvm-svn: 147378
2011-12-30 15:27:22 +00:00
Benjamin Kramer e56f393249 Mass rename C1x references to C11. The name hasn't proliferated like "C++0x" so this patch is surprisingly small.
Also drop -Wc1x-extensions in favor of -Wc11-extensions. I don't think we need to keep this around for compatibility.

llvm-svn: 147221
2011-12-23 17:00:35 +00:00
Tobias Grosser 3510e999c4 cindex.py: Remove more ternary operator + whitespace fixes
Another batch of ternary operators and some whitespace fixes
(Getting in sync with the clang_complete version of this file)

llvm-svn: 143330
2011-10-31 02:06:50 +00:00
Tobias Grosser 237f5a07fa clang.py: Remove use of ternary operators
This change is necessary to make this file python 2.4 compatible.

llvm-svn: 143324
2011-10-31 00:49:07 +00:00
Tobias Grosser e15496f1d7 cindex.py: Allow to create a cursor from file/row/column
We add a constructor to create a SourceLocation from a position in
a file and we use this SourceLocation to retrieve a cursor.

llvm-svn: 143322
2011-10-31 00:31:32 +00:00
Tobias Grosser 80c4b81f54 cindex.py: Add File.create_from_name()
llvm-svn: 143321
2011-10-31 00:07:19 +00:00
Douglas Gregor 5fdc4de718 Add support for constant arrays, from Anders Waldenborg!.
llvm-svn: 142477
2011-10-19 05:51:43 +00:00
Douglas Gregor 89861066ed Add TypeKind.CONSTANTARRAY, from Anders Waldenborg!
llvm-svn: 142476
2011-10-19 05:50:34 +00:00
Douglas Gregor d59d02cc38 Fix error message for unknown type kind, from Anders Waldenborg!
llvm-svn: 142475
2011-10-19 05:49:29 +00:00
Douglas Gregor 32df3664be This new field was introduced in clang-c in r141277
Python needs this in its structure definition so it allocates enough
memory. From Anders Waldenborg!

llvm-svn: 142474
2011-10-19 05:47:46 +00:00
Douglas Gregor 4c362d5310 Expose more statement, expression, and declaration kinds in libclang,
from Manuel Holtgrewe!

llvm-svn: 141200
2011-10-05 19:00:14 +00:00
Douglas Gregor 506d34a0df Update python testcase for GNU old-style field designator warning,
from Anders Waldenborg!

llvm-svn: 138786
2011-08-30 00:16:30 +00:00
Douglas Gregor 7c7c068251 Add support for Cursor.displayname in python bindings, from Anders Waldenborg!
llvm-svn: 138785
2011-08-30 00:15:34 +00:00
Argyrios Kyrtzidis 3fce368d87 [python] Fix bug of the SourceLocation binding.
Patch by Anders Waldenborg!

llvm-svn: 137829
2011-08-17 17:20:24 +00:00
Argyrios Kyrtzidis 8f6bd2d653 [python] Add test_type.py by Anders Waldenborg, which I forgot to commit in r137797.
llvm-svn: 137828
2011-08-17 17:01:10 +00:00
Argyrios Kyrtzidis f872dc4c3b [python] Add support for CXType to python bindings.
Patch by Anders Waldenborg!

llvm-svn: 137797
2011-08-17 00:43:03 +00:00
Douglas Gregor a98034a25e Improve the Python bindings for libclang in a few ways, from Eli
Bendersky. Specifically: 

* Implemented a new function in libclang: clang_isAttribute

* Fixing TranslationUnit.get_includes to only go through the argument
* buffer when it contains something. This fixed a crash on Windows 

* clang_getFileName returns CXString, not char*. Made appropriate
* fixes in cindex.py - now the relevant tests pass and we can see the
* full locations correctly again (previously there was garbage in
* place of the file name) 
* Exposed clang_getCursorDisplayName to the python bindings

llvm-svn: 134460
2011-07-06 03:00:34 +00:00
Tobias Grosser b0e0597d07 python bindings: Add support for different kind of completion chunks
llvm-svn: 124959
2011-02-05 17:54:10 +00:00
Tobias Grosser b0949a17a0 python bindings: Get the string representation of a CompletionChunk
llvm-svn: 124958
2011-02-05 17:54:07 +00:00
Tobias Grosser 85bb48fce7 python bindings: Add CodeCompletionResults
llvm-svn: 124957
2011-02-05 17:54:04 +00:00
Tobias Grosser 2a8aac5ff4 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.

llvm-svn: 124956
2011-02-05 17:54:00 +00:00
Tobias Grosser 4748651060 python bindings: Include local headers the right way.
llvm-svn: 124955
2011-02-05 17:53:55 +00:00
Tobias Grosser 0e19c192f5 python bindings: Remove unneeded instruction
llvm-svn: 124954
2011-02-05 17:53:53 +00:00
Tobias Grosser 5153e79931 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.

llvm-svn: 124953
2011-02-05 17:53:51 +00:00
Tobias Grosser 82c18a502f 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.

llvm-svn: 124952
2011-02-05 17:53:48 +00:00
Tobias Grosser 2128823e74 python bindings: Synchronize cursor kinds
clang-c/Index.h contained cursor kinds not yet available in the python bindings.

Contributed-By: jmuizelaar@mozilla.com
llvm-svn: 124951
2011-02-05 17:53:47 +00:00
Daniel Dunbar d5a2a073a0 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.

llvm-svn: 102779
2010-04-30 21:51:10 +00:00
Benjamin Kramer aaff78ec9c Rename the new Iterator objects and raise an assertion instead of returning invalid objects when the key is out of range.
llvm-svn: 97881
2010-03-06 15:38:03 +00:00
Benjamin Kramer ff90813e42 Update the python bindings for recent changes in the CIndex API.
llvm-svn: 97880
2010-03-06 14:53:07 +00:00
Daniel Dunbar 02968e53cf CIndex: Switch CXSourceRange to proper half-open intervals.
- Doug, please review.

llvm-svn: 96162
2010-02-14 10:02:57 +00:00
Daniel Dunbar ae4b77d99d 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

llvm-svn: 96107
2010-02-13 18:33:28 +00:00
Daniel Dunbar 43813bf023 cindex/Python: Add TranslationUnit.get_includes, patch by Andrew Sutton!
llvm-svn: 96106
2010-02-13 18:33:18 +00:00
Daniel Dunbar 2037d4e4ea cindex/Python: Update for clang_getDiagnosticRange... API changes.
llvm-svn: 96105
2010-02-13 18:33:03 +00:00
Daniel Dunbar 288edb5bda 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.

llvm-svn: 94936
2010-01-31 00:41:15 +00:00
Daniel Dunbar 45dc842a0e cindex/Python: Add a simple example which dumps assorted information about a translation unit.
llvm-svn: 94934
2010-01-30 23:59:14 +00:00
Daniel Dunbar a7a354e3e3 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.

llvm-svn: 94933
2010-01-30 23:59:02 +00:00
Daniel Dunbar 15635b8f5c cindex/Python: Update SourceLocation and SourceRange structures to match API changes.
Hurray for exposing implementation details!!!

llvm-svn: 94932
2010-01-30 23:58:50 +00:00
Daniel Dunbar 1e079a48ad cindex/Python: Update Index.create for removal of displayDiagnostics.
llvm-svn: 94931
2010-01-30 23:58:39 +00:00
Daniel Dunbar ce9a4faea5 cindex/Python: Update to support _getInstantiationLocation's new offset value.
llvm-svn: 94813
2010-01-29 17:02:32 +00:00
Daniel Dunbar f91a8d64d4 cindex/Python: Move translation unit load functions to Index, there isn't a good reason to have separate static methods for this.
llvm-svn: 94419
2010-01-25 09:16:55 +00:00
Daniel Dunbar dacede8349 cindex/Python: Support file objects as unsaved_files, albeit inefficiently.
llvm-svn: 94418
2010-01-25 09:16:41 +00:00
Daniel Dunbar 90986f5d3f cindex/Python: Add Cursor test.
llvm-svn: 94397
2010-01-25 00:44:21 +00:00
Daniel Dunbar 9ad194dc18 cindex/Python: Implement support for unsaved/remapped files.
llvm-svn: 94396
2010-01-25 00:44:11 +00:00
Daniel Dunbar 7baaee93e7 cindex/Python: Fix/simplify Index.parse() passing command line arguments.
llvm-svn: 94394
2010-01-25 00:43:31 +00:00
Daniel Dunbar 36104a8665 cindex/Python: Update comments, add module docstrings, add LLVM headers.
llvm-svn: 94392
2010-01-25 00:43:08 +00:00
Daniel Dunbar 3e555fd85f cindex/Python: Move Cursor.is_ methods to CursorKind, and add test.
Also, add CursorKind.get_all_kinds().

llvm-svn: 94389
2010-01-24 21:20:39 +00:00
Daniel Dunbar 195cdeceaf cindex/Python: Implement explicit objects for CursorKind enumeration values.
llvm-svn: 94388
2010-01-24 21:20:29 +00:00
Daniel Dunbar 55d6964e28 cindex/Python: Fetch SourceLocation instantiation location information on lazily, it isn't free.
Also, add repr() support to SourceRange.

llvm-svn: 94387
2010-01-24 21:20:21 +00:00
Daniel Dunbar aca5acfd01 cindex/Python: Add Cursor.get_usr().
Also, change Cursor.spelling to return None for non-decls, for consistency with get_usr().

llvm-svn: 94386
2010-01-24 21:20:13 +00:00
Daniel Dunbar 501e91f3b7 cindex/Python: Return null cursors as None instead of exposing this notion.
llvm-svn: 94385
2010-01-24 21:20:05 +00:00