Commit Graph

159 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 4590498d05 [libclang/python] Use a Python standard library module to create a temporary file.
Patch by Brian Gesiak!

llvm-svn: 201762
2014-02-20 07:24:03 +00:00
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
Dmitri Gribenko d9febeb884 Documentation parsing: add support for \throws \throw \exception commands
llvm-svn: 194521
2013-11-12 22:16:08 +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
Dmitri Gribenko 02489eb406 Comment parsing: allow "\param ..." to describe variadic arguments
Original patch by Fariborz Jahanian; extended by me.

Fixes rdar://14124644

llvm-svn: 184688
2013-06-24 04:41:32 +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
Fariborz Jahanian 828b8d2415 doxygen command. Add 'attention' command to list of similar
doxygen commands. // rdar://12379053

llvm-svn: 176127
2013-02-26 22:12:16 +00:00
Dmitri Gribenko 2e72dd4a43 Comment parsing: improve the fidelity of XML output for many block commands
This change introduces a 'kind' attribute for the <Para> tag, that captures the
kind of the parent block command.

For example:

\todo Meow.

used to be just <Para>Meow.</Para>, but now it is
<Para kind="todo">Meow.</Para>

llvm-svn: 174216
2013-02-01 20:23:57 +00:00
Dmitri Gribenko d2f96ef091 Fix indent
llvm-svn: 174201
2013-02-01 18:18:00 +00:00
Fariborz Jahanian 1a0cf80533 [Comment parsing] Add support for recognizing
\headerfile command and representing it in an xml
document. Patch reviewed by Dmitri Gribenko.
// rdar://12397511

llvm-svn: 174109
2013-01-31 23:12:39 +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
Fariborz Jahanian a7d76d2672 [Doc parsing]: This patch adds <Declaration> tag to
XML comment for declarations which pretty-prints
declaration. I had to XFAIL one test annotate-comments.cpp.
This test is currently unmaintainable as written.
Dmitri G., can you see what we can do about this test.
We should change this test such that adding a new tag does not wreck
havoc to the test.

llvm-svn: 166130
2012-10-17 21:58:03 +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 61b1db1629 Comment to XML conversion: escape XML special chars correctly; use correct
regex for version tuples.

llvm-svn: 165104
2012-10-03 09:04:56 +00:00
Fariborz Jahanian e61fc44c3d [Doc parse]: SUpport for message in deprecated/unavailable
attribute going iinto XML document.

llvm-svn: 165066
2012-10-02 23:01:04 +00:00
Fariborz Jahanian de0ae1e406 [Doc parsing]: Add available and deprecated attribute info
to XML output. // rdar://12378879

llvm-svn: 165039
2012-10-02 20:05:47 +00:00
Fariborz Jahanian c491c3f27a availability in structured documents. Takes
care of comments by Dimitri and Doug.

llvm-svn: 164957
2012-10-01 18:42:25 +00:00
Dmitri Gribenko 261c9683e2 Comment XML schema: correct indentation.
llvm-svn: 164889
2012-09-29 08:27:37 +00:00
Fariborz Jahanian 35760a8937 [Doc parsing] Add availability information to generated Comment XML.
(I still need to add a test once I figure it out).
Reviewed off-line by Doug. // rdar://12378879

llvm-svn: 164861
2012-09-28 22:35:49 +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
Dmitri Gribenko 0b1a96a876 Comment to XML conversion: we try not to emit empty <Discussion> elements, but
it is not possible to guarantee that without duplicating logic or buffering
<Discussion> element contents.  So, allow empty <Discussion> elements in schema.

llvm-svn: 163842
2012-09-13 21:32:58 +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