summaryrefslogtreecommitdiff
path: root/bindings/python
Commit message (Collapse)AuthorAge
* cindex.py: remove obsolete workaround and FIXMEAlp Toker2014-06-22
| | | | | | | | | clang_getCursorSpelling() doesn't assert on non-declarations any more and the behaviour is covered by c-index tests. Passes nosetests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211482 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a convenience recursive walk method over a cursor and its descendants.Eli Bendersky2014-05-29
| | | | | | | | | | | | | | | Before r160106 there was a way to recursively visit all descendants of a cursor via Cursor_visit, but it was removed. Since then, every user needs to reimplement the recursive descent into get_children. Adding a walk_preorder() method to Cursor that conveniently implements recursive walking in a Pythonic way. This also greatly simplifies get_cursor and get_cursors in tests/cindex/util.py (walk_preorder is now tested through these utility functions, since they are used in many tests). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209793 91177308-0d34-0410-b5e6-96231b3b80d8
* Expose CUDA function attributes to the C interface.Eli Bendersky2014-05-28
| | | | | | | | | | Until now all CUDA-specific attributes were represented with CXCursor_UnexposedAttr; now they are actually implemented, including the Python bindings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209767 91177308-0d34-0410-b5e6-96231b3b80d8
* Trim trailing whitespace in cindex.pyEli Bendersky2014-05-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209754 91177308-0d34-0410-b5e6-96231b3b80d8
* cindex/test_cursor.py: no need to skip implicit decls in testsAlp Toker2014-05-21
| | | | | | | | | clang was fixed some time ago to always skip "builtins and other cruft" so tools no longer need hacks like this. Passes nosetests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209316 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up language and grammar.Eric Christopher2014-05-20
| | | | | | | Based on a patch by jfcaron3@gmail.com! PR19806 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209215 91177308-0d34-0410-b5e6-96231b3b80d8
* cindex-dump.py: fix the --show-ids description stringAlp Toker2014-05-05
| | | | | | It looks like this was botched back in r94936. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207947 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix cindex-dump.py --show-idsAlp Toker2014-05-05
| | | | | | | | | | | | | This option flag was incorrectly expecting an argument: $ cindex-dump.py --show-ids test.cpp cindex-dump.py: error: invalid number arguments With this change the feature correctly gets enabled by --show-ids. No tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207946 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Add attribute support for 'pure', 'const' and 'noduplicate'.Joey Gouly2014-05-01
| | | | | | | This bumps CINDEX_VERSION_MINOR up (to 26). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207767 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the method len of the CompletionString object. Patch by Christopher GreeneSylvestre Ledru2014-04-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207348 91177308-0d34-0410-b5e6-96231b3b80d8
* bindings: expose C++ access specifiersSaleem Abdulrasool2014-04-25
| | | | | | | | | | Expose the enum CX_CXXAccessSpecifier in the python bindings as a property of the cursor. If access specifier is not applicable to the node, return the INVALID specifier rather than raising an exception. Patch by Tamás Szeli! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207173 91177308-0d34-0410-b5e6-96231b3b80d8
* cindex.py: Avoid deprecated functionAlp Toker2014-04-20
| | | | | | | | | Implement Diagnostic::category_name() using clang_getDiagnosticCategoryText() instead of the deprected clang_getDiagnosticCategoryName(). Preserves existing behaviour and API covered by existing tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206712 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the correct symbol for a left bracket.Bill Wendling2014-03-14
| | | | | | PR19089 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203906 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang/python] Use a Python standard library module to create a temporary ↵Argyrios Kyrtzidis2014-02-20
| | | | | | | | file. Patch by Brian Gesiak! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201762 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang/python] Add CompilationDatabase.getAllCompileCommands to the ↵Argyrios Kyrtzidis2013-12-20
| | | | | | | | python bindings. Patch by Laszlo Nagy! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197765 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196510 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang/python] Add __contains__ to SourceRange class.Argyrios Kyrtzidis2013-10-31
| | | | | | Patch by Loïc Jaquemet! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193725 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Introduce clang_Type_getCXXRefQualifier whichexposes ↵Argyrios Kyrtzidis2013-10-11
| | | | | | | | ref-qualifier information of function type. Patch by Che-Liang Chiou! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192493 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Add some tests by Loïc Jaquemet that I forgot to add earlier.Argyrios Kyrtzidis2013-10-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192108 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] python: expose a few functions, patch by Loïc Jaquemet!Argyrios Kyrtzidis2013-10-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191907 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Introduce clang_Type_getClassType which returns the class type of ↵Argyrios Kyrtzidis2013-10-03
| | | | | | | | a member pointer type. Patch by Che-Liang Chiou! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191906 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] python: fix return type of clang_Type_getSizeOf().Argyrios Kyrtzidis2013-09-25
| | | | | | Patch by Loïc Jaquemet! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191346 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Provide location for attributes and expose 'packed' attribute.Argyrios Kyrtzidis2013-09-25
| | | | | | Patch by Loïc Jaquemet! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191345 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Don't report a DecayedType as "unexposed", report it as the ↵Argyrios Kyrtzidis2013-09-16
| | | | | | | | original (as written) type. Patch by Anders Waldenborg! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190796 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Expose the rest of the array types.Argyrios Kyrtzidis2013-07-23
| | | | | | Patch by Che-Liang Chiou! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186967 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang/python] Add a few "cursor kinds" that were missing in the python ↵Argyrios Kyrtzidis2013-06-11
| | | | | | | | binding for libclang. Patch by Mathieu Baudet! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183760 91177308-0d34-0410-b5e6-96231b3b80d8
* libclang: add a function to check whether a member function is pure virtualDmitri Gribenko2013-05-17
| | | | | | | Patch by Seth Fowler. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182139 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix return type of isBitfield in the binding definitionDmitri Gribenko2013-04-21
| | | | | | | Patch by Loïc Jaquemet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179984 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Expose record layout info via new libclang functions:Argyrios Kyrtzidis2013-04-11
| | | | | | | | | | | clang_Type_getAlignOf clang_Type_getSizeOf clang_Type_getOffsetOf clang_Cursor_isBitField Patch by Loïc Jaquemet! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179251 91177308-0d34-0410-b5e6-96231b3b80d8
* cindex.py: Handle NULL pointers when parsing translation unitsTobias Grosser2013-03-19
| | | | | | | | | | | | | | The code inside cindex.py was comparing NULL pointer returned by clang_parseTranslationUnit and clang_createTranslationUnit with None. However, as illustrated by the two tests I've added, those conditions were ineffective which resulted in assert triggering later on. Instead, a pointer is now treated as a boolean value, a NULL pointer being False. Contributed-by: Xavier Deguillard <deguilx@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177408 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py]: Use spaces instead of tabsTobias Grosser2013-01-20
| | | | | | The tabs slipped in accidentally. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172934 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py] Add cache for CompletionChunk spellingsTobias Grosser2013-01-19
| | | | | | | | | | | | | Most of the CompletionChunks represent braces, colons or other one character spellings. There is no need to call libclang, to figure out how to write a colon. Instead we use an internal cache to retrieve the correct spelling. As function calls from python are very expensive and this is a performance critical part of auto completion this patch makes formatting of auto completion results a lot faster. Formatting time changes from 0.57 to 0.45 seconds git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172901 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py] Replace CachedProperty with our own implementationTobias Grosser2013-01-19
| | | | | | | | | | | | This is a very performance critical point for auto completion. The manual implementation gives a large speedup. As it does not complicate the code a lot, I figured it is worth the change. If anybody understands why the CachedProperty is here so much slower, I am very interested in working on an improvement of CachedProperty. Formatting time changes from 0.72 to 0.57 seconds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172900 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py]: Speed up lookup of the completion kindTobias Grosser2013-01-19
| | | | | | | | | We can directly the number of the kind instead of going through the completionChunkKindMap. Formatting time changes from 0.84 to 0.72 seconds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172899 91177308-0d34-0410-b5e6-96231b3b80d8
* [python bindings] Expose cursor.referenced (clang_getCursorReferenced).Argyrios Kyrtzidis2013-01-02
| | | | | | Patch by Matthew King! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171423 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a copypasto bug. Also rename the parameter in question to not shadow theMatt Beaumont-Gay2012-12-11
| | | | | | | | 'file' builtin, and fix up a docstring a little. Hat tip to Sebastian Kreft Carreno at Google for noticing the bug. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169887 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang.py] Add Cursor.get_arguments()Gregory Szorc2012-11-01
| | | | | | Patch provided by Matthias Kleine <matthias_kleine@gmx.de> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167216 91177308-0d34-0410-b5e6-96231b3b80d8
* Python bindings: fix typo.Benjamin Kramer2012-10-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165375 91177308-0d34-0410-b5e6-96231b3b80d8
* Python bindings: Add missing availability kind.Benjamin Kramer2012-10-07
| | | | | | Patch by Leo Liu, test case by me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165374 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix cindex.py compatibility with older libclang.soDmitri Gribenko2012-09-22
| | | | | | | | The issue is that we were calling clang_getCompletionBriefComment unconditionally. New we check if this function is available before calling it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164464 91177308-0d34-0410-b5e6-96231b3b80d8
* Add bindings for clang_getCompletionBriefComment to cindex.py.Dmitri Gribenko2012-09-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163966 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py] Make the use of a compatibilty check explicitTobias Grosser2012-09-05
| | | | | | | | | | | | | | | | At the moment, we implictly check compatibility between the python bindings and libclang, as the python bindings will fail to load in case a method we use in libclang is not available. This patch makes the use of this compatibility check explicit and introduces a flag to optionally disable the check. This will allow us to further harden the compatibility check, but it also gives the user the possibility to disable the compatibility check to evaluate compatibility with older libclang versions. I added documentation that makes clear the python bindings are only tested with the libclang version they have been shipped with. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163238 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py] Allow to configure the path of libclangTobias Grosser2012-09-03
| | | | | | | | | | | By calling cindex.Config.set_library_path(path) or cindex.Config.set_library_file(file) it is possible to specify from where we load libclang. This fixes an open FIXME. We also point the user to these functions, in case libclang can not be loaded sucessfully. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163121 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py] Add helper to initialize libclang functionsTobias Grosser2012-09-01
| | | | | | | | | | | | | | | | The helper allows us to define how the initialization of functions should behave. We use this patch to provide an informative error message, in case a function is not available: "LibclangError: /home/grosser/Projekte/llvm/install/lib/libclang.so: undefined symbol: clang_method_added_in_2020. Please ensure that your python bindings are compatible with your libclang.so version." This patch also ensures that no spelling mistakes slip into the library initialization. At the moment, there are a couple of 'argtype' -> 'argtypes' mispellings that have been overlooked. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163057 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py] Cache the number of chunks in CompletionStringTobias Grosser2012-08-20
| | | | | | | | Without this patch, lib.clang_getNumCompletionChunks is called at each _iteration_ of a 'for chunk in CompletionString' loop. Now we call it just once. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162200 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py] Add CachedProperty to CompletionChunkTobias Grosser2012-08-19
| | | | | | Suggested by: Francisco Lopes <oblita@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162191 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang.py] Add CachedProperty decoratorGregory Szorc2012-08-19
| | | | | | It isn't used anywhere yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162190 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py] Use spaces, not tabs for indentationTobias Grosser2012-08-18
| | | | | | Reported by: Francisco Lopes <oblita@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162182 91177308-0d34-0410-b5e6-96231b3b80d8
* [cindex.py] Dispose code completion results properlyTobias Grosser2012-08-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162181 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang.py] Implement Token APIGregory Szorc2012-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160111 91177308-0d34-0410-b5e6-96231b3b80d8