Commit Graph

141 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis b0188f246a [libclang/python] Add CompilationDatabase.getAllCompileCommands to the python bindings.
Patch by Laszlo Nagy!

llvm-svn: 197765
2013-12-20 01:34:00 +00:00
Alp Toker f6a24ce40f Fix a tranche of comment, test and doc typos
llvm-svn: 196510
2013-12-05 16:25:25 +00:00
Argyrios Kyrtzidis 28d5b6bb11 [libclang/python] Add __contains__ to SourceRange class.
Patch by Loïc Jaquemet!

llvm-svn: 193725
2013-10-31 00:03:33 +00:00
Argyrios Kyrtzidis adff3ae3c8 [libclang] Introduce clang_Type_getCXXRefQualifier whichexposes ref-qualifier information of function type.
Patch by Che-Liang Chiou!

llvm-svn: 192493
2013-10-11 19:58:38 +00:00
Argyrios Kyrtzidis fe04fe0d41 [libclang] Add some tests by Loïc Jaquemet that I forgot to add earlier.
llvm-svn: 192108
2013-10-07 16:38:40 +00:00
Argyrios Kyrtzidis 53f45c7d55 [libclang] python: expose a few functions, patch by Loïc Jaquemet!
llvm-svn: 191907
2013-10-03 16:19:27 +00:00
Argyrios Kyrtzidis 7a4253b685 [libclang] Introduce clang_Type_getClassType which returns the class type of a member pointer type.
Patch by Che-Liang Chiou!

llvm-svn: 191906
2013-10-03 16:19:23 +00:00
Argyrios Kyrtzidis 18d37b539e [libclang] python: fix return type of clang_Type_getSizeOf().
Patch by Loïc Jaquemet!

llvm-svn: 191346
2013-09-25 00:14:43 +00:00
Argyrios Kyrtzidis 16834f1cf9 [libclang] Provide location for attributes and expose 'packed' attribute.
Patch by Loïc Jaquemet!

llvm-svn: 191345
2013-09-25 00:14:38 +00:00
Argyrios Kyrtzidis 07ee5c44b4 [libclang] Don't report a DecayedType as "unexposed", report it as the original (as written) type.
Patch by Anders Waldenborg!

llvm-svn: 190796
2013-09-16 17:26:23 +00:00
Argyrios Kyrtzidis 0661a71698 [libclang] Expose the rest of the array types.
Patch by Che-Liang Chiou!

llvm-svn: 186967
2013-07-23 17:36:21 +00:00
Argyrios Kyrtzidis 016fa1b899 [libclang/python] Add a few "cursor kinds" that were missing in the python binding for libclang.
Patch by Mathieu Baudet!

llvm-svn: 183760
2013-06-11 18:05:42 +00:00
Dmitri Gribenko 62770bea4b libclang: add a function to check whether a member function is pure virtual
Patch by Seth Fowler.

llvm-svn: 182139
2013-05-17 18:38:35 +00:00
Dmitri Gribenko 2dbe8f94a9 Fix return type of isBitfield in the binding definition
Patch by Loïc Jaquemet.

llvm-svn: 179984
2013-04-21 18:35:51 +00:00
Argyrios Kyrtzidis e822f58db4 [libclang] Expose record layout info via new libclang functions:
clang_Type_getAlignOf
clang_Type_getSizeOf
clang_Type_getOffsetOf
clang_Cursor_isBitField

Patch by Loïc Jaquemet!

llvm-svn: 179251
2013-04-11 01:20:11 +00:00
Tobias Grosser 14a2d7b9f0 cindex.py: Handle NULL pointers when parsing translation units
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>
llvm-svn: 177408
2013-03-19 15:30:48 +00:00
Tobias Grosser 44d7b4f6bf [cindex.py]: Use spaces instead of tabs
The tabs slipped in accidentally.

llvm-svn: 172934
2013-01-20 00:42:16 +00:00
Tobias Grosser a8ceb7a801 [cindex.py] Add cache for CompletionChunk spellings
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

llvm-svn: 172901
2013-01-19 11:03:44 +00:00
Tobias Grosser 2f1328b35b [cindex.py] Replace CachedProperty with our own implementation
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.

llvm-svn: 172900
2013-01-19 11:03:42 +00:00
Tobias Grosser 055f4b4d00 [cindex.py]: Speed up lookup of the completion kind
We can directly the number of the kind instead of going through the
completionChunkKindMap.

Formatting time changes from 0.84 to 0.72 seconds.

llvm-svn: 172899
2013-01-19 11:03:40 +00:00
Argyrios Kyrtzidis eedb5432c5 [python bindings] Expose cursor.referenced (clang_getCursorReferenced).
Patch by Matthew King!

llvm-svn: 171423
2013-01-02 22:31:57 +00:00
Matt Beaumont-Gay 9728393555 Fix a copypasto bug. Also rename the parameter in question to not shadow the
'file' builtin, and fix up a docstring a little.

Hat tip to Sebastian Kreft Carreno at Google for noticing the bug.

llvm-svn: 169887
2012-12-11 17:37:46 +00:00
Gregory Szorc 245296ed40 [clang.py] Add Cursor.get_arguments()
Patch provided by Matthias Kleine <matthias_kleine@gmx.de>

llvm-svn: 167216
2012-11-01 05:46:30 +00:00
Benjamin Kramer 8aa41a0908 Python bindings: fix typo.
llvm-svn: 165375
2012-10-07 11:51:45 +00:00
Benjamin Kramer 7c52cc4c77 Python bindings: Add missing availability kind.
Patch by Leo Liu, test case by me.

llvm-svn: 165374
2012-10-07 11:46:37 +00:00
Dmitri Gribenko b947e8239f Fix cindex.py compatibility with older libclang.so
The issue is that we were calling clang_getCompletionBriefComment
unconditionally.  New we check if this function is available before calling it.

llvm-svn: 164464
2012-09-22 17:52:29 +00:00
Dmitri Gribenko 98f93adefc Add bindings for clang_getCompletionBriefComment to cindex.py.
llvm-svn: 163966
2012-09-15 11:56:32 +00:00
Tobias Grosser d0855e180d [cindex.py] Make the use of a compatibilty check explicit
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.

llvm-svn: 163238
2012-09-05 20:23:53 +00:00
Tobias Grosser 73d3f826e7 [cindex.py] Allow to configure the path of libclang
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.

llvm-svn: 163121
2012-09-03 18:32:30 +00:00
Tobias Grosser 68e0e22a00 [cindex.py] Add helper to initialize libclang functions
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.

llvm-svn: 163057
2012-09-01 08:55:17 +00:00
Tobias Grosser 6e98cdebf4 [cindex.py] Cache the number of chunks in CompletionString
Without this patch, lib.clang_getNumCompletionChunks is called at
each _iteration_ of a 'for chunk in CompletionString' loop. Now we
call it just once.

llvm-svn: 162200
2012-08-20 10:38:16 +00:00
Tobias Grosser e9633f16bd [cindex.py] Add CachedProperty to CompletionChunk
Suggested by:  Francisco Lopes  <oblita@gmail.com>

llvm-svn: 162191
2012-08-19 22:26:15 +00:00
Gregory Szorc fbd4f4768c [clang.py] Add CachedProperty decorator
It isn't used anywhere yet.

llvm-svn: 162190
2012-08-19 21:17:46 +00:00
Tobias Grosser 83bc743bf4 [cindex.py] Use spaces, not tabs for indentation
Reported by: Francisco Lopes  <oblita@gmail.com>

llvm-svn: 162182
2012-08-18 23:52:41 +00:00
Tobias Grosser 2fb29363f9 [cindex.py] Dispose code completion results properly
llvm-svn: 162181
2012-08-18 23:04:08 +00:00
Gregory Szorc 9a2cb42451 [clang.py] Implement Token API
llvm-svn: 160111
2012-07-12 07:21:12 +00:00
Gregory Szorc bdbb73d276 [clang.py] Add TranslationUnit.get_{file,source_location,source_range}
llvm-svn: 160107
2012-07-12 05:05:56 +00:00
Gregory Szorc f1b7e3c7ba [clang.py] Refactor how ctypes functions are registered
llvm-svn: 160106
2012-07-12 04:56:46 +00:00
Arnaud A. de Grandmaison cdccafa53c [cindex.py] Make CompileCommand.arguments usage consistent with CompileCommand.directory and the rest of the python binding
Patch by David Röthlisberger

llvm-svn: 159970
2012-07-10 00:00:05 +00:00
Arnaud A. de Grandmaison 82dd00c5c3 [cindex.py] fix infinite iteration of compilation database CompileCommands
Patch by David Röthlisberger

llvm-svn: 159926
2012-07-09 11:57:30 +00:00
Arnaud A. de Grandmaison 89341e78c3 [cindex.py] Fix erroneous comment for CompileCommands
llvm-svn: 159810
2012-07-06 08:22:05 +00:00
Arnaud A. de Grandmaison fa6d73cc90 [libclang] CompilationDatabase naming and comment fixes
llvm-svn: 159682
2012-07-03 20:38:12 +00:00
Arnaud A. de Grandmaison 8599ccc6b8 [cindex.py] Fix comments
llvm-svn: 159492
2012-06-30 20:43:37 +00:00
Arnaud A. de Grandmaison c0560064dd [cindex.py] add CompilationDatabase support
llvm-svn: 159485
2012-06-30 11:28:04 +00:00
Gregory Szorc 1162fa0a97 [clang.py] Implement SourceLocation.from_offset
llvm-svn: 158307
2012-06-11 11:11:48 +00:00
Gregory Szorc 531880af77 [clang.py] Implement Cursor.is_static_method
llvm-svn: 158277
2012-06-09 16:21:34 +00:00
Douglas Gregor aadbfafcd1 Fix typo "CursorKind.CONDITONAL_OPERATOR" in Python bindings, from
Manish Verma!

llvm-svn: 158182
2012-06-08 00:16:27 +00:00
Gregory Szorc b25e3d143a [clang.py] Store reference to TranslationUnit in Cursor and Type
llvm-svn: 156846
2012-05-15 19:51:02 +00:00
Gregory Szorc 8eac05c362 [clang.py] Implement Cursor.canonical
llvm-svn: 156753
2012-05-14 03:56:33 +00:00
Gregory Szorc 71efa09fa7 [clang.py] Implement Cursor.result_type
llvm-svn: 156752
2012-05-14 03:53:29 +00:00