Граф коммитов

142 Коммитов

Автор SHA1 Сообщение Дата
Argyrios Kyrtzidis 411d33aa0b [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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179251 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-11 01:20:11 +00:00
Tobias Grosser 11d6cd318d 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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177408 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19 15:30:48 +00:00
Fariborz Jahanian 9db0fe97f5 doxygen command. Add 'attention' command to list of similar
doxygen commands. // rdar://12379053


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176127 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 22:12:16 +00:00
Dmitri Gribenko af01bed59b 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>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174216 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01 20:23:57 +00:00
Dmitri Gribenko d9a9f19fd7 Fix indent
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174201 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01 18:18:00 +00:00
Fariborz Jahanian f843a580c4 [Comment parsing] Add support for recognizing
\headerfile command and representing it in an xml
document. Patch reviewed by Dmitri Gribenko.
// rdar://12397511


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174109 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31 23:12:39 +00:00
Tobias Grosser bba99ad6e2 [cindex.py]: Use spaces instead of tabs
The tabs slipped in accidentally.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172934 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-20 00:42:16 +00:00
Tobias Grosser 69a8552f85 [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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172901 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-19 11:03:44 +00:00
Tobias Grosser eca36d1ae2 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172900 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-19 11:03:42 +00:00
Tobias Grosser e43d3861d9 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172899 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-19 11:03:40 +00:00
Argyrios Kyrtzidis d829379ed9 [python bindings] Expose cursor.referenced (clang_getCursorReferenced).
Patch by Matthew King!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171423 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-02 22:31:57 +00:00
Matt Beaumont-Gay 379ffe444f 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169887 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-11 17:37:46 +00:00
Gregory Szorc b03b57d149 [clang.py] Add Cursor.get_arguments()
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
2012-11-01 05:46:30 +00:00
Fariborz Jahanian 1bfb00dabf [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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166130 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-17 21:58:03 +00:00
Benjamin Kramer 6988666289 Python bindings: fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165375 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-07 11:51:45 +00:00
Benjamin Kramer 724d0dcc4d Python bindings: Add missing availability kind.
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
2012-10-07 11:46:37 +00:00
Dmitri Gribenko 7d9c975bf2 Comment to XML conversion: escape XML special chars correctly; use correct
regex for version tuples.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165104 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 09:04:56 +00:00
Fariborz Jahanian 8da68b8b03 [Doc parse]: SUpport for message in deprecated/unavailable
attribute going iinto XML document.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165066 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02 23:01:04 +00:00
Fariborz Jahanian 2a46533633 [Doc parsing]: Add available and deprecated attribute info
to XML output. // rdar://12378879


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165039 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02 20:05:47 +00:00
Fariborz Jahanian faab5618b5 availability in structured documents. Takes
care of comments by Dimitri and Doug.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164957 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-01 18:42:25 +00:00
Dmitri Gribenko fa4f4b33d3 Comment XML schema: correct indentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164889 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-29 08:27:37 +00:00
Fariborz Jahanian 257e2e8361 [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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164861 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-28 22:35:49 +00:00
Dmitri Gribenko c12d6a0276 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164464 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-22 17:52:29 +00:00
Dmitri Gribenko c69e067f24 Add bindings for clang_getCompletionBriefComment to cindex.py.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163966 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-15 11:56:32 +00:00
Dmitri Gribenko 7b4362ec11 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163842 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-13 21:32:58 +00:00
Tobias Grosser 857134ed84 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163238 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-05 20:23:53 +00:00
Tobias Grosser fcbc0fbaa4 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163121 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-03 18:32:30 +00:00
Tobias Grosser 010556ef87 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163057 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-01 08:55:17 +00:00
Tobias Grosser 147785b852 [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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162200 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-20 10:38:16 +00:00
Tobias Grosser d9ee06b2fa [cindex.py] Add CachedProperty to CompletionChunk
Suggested by:  Francisco Lopes  <oblita@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162191 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-19 22:26:15 +00:00
Gregory Szorc b15b15c7f6 [clang.py] Add CachedProperty decorator
It isn't used anywhere yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162190 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-19 21:17:46 +00:00
Tobias Grosser 58308d8469 [cindex.py] Use spaces, not tabs for indentation
Reported by: Francisco Lopes  <oblita@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162182 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-18 23:52:41 +00:00
Tobias Grosser 73719240e6 [cindex.py] Dispose code completion results properly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162181 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-18 23:04:08 +00:00
Dmitri Gribenko 6cd4420945 Comment XML: use xml:space="preserve" in Verbatim tags, so that XML tidy does
not compress spaces in verbatim content.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161531 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 22:10:24 +00:00
Dmitri Gribenko cff339a60a Comment AST: DeclInfo: add a special kind for enums.
Comment XML: add a root node kind for enums.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161442 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 18:59:04 +00:00
Dmitri Gribenko f303d4cb10 libclang API for comment-to-xml conversion.
The implementation also includes a Relax NG schema and tests for the schema
itself.  The schema is used in c-index-test to verify that XML documents we
produce are valid.  In order to do the validation, we add an optional libxml2
dependency for c-index-test.

Credits for CMake part go to Doug Gregor.  Credits for Autoconf part go to Eric
Christopher.  Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161431 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 17:54:38 +00:00
Gregory Szorc be51e43ba2 [clang.py] Implement Token API
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160111 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 07:21:12 +00:00
Gregory Szorc 0f1964a5c1 [clang.py] Add TranslationUnit.get_{file,source_location,source_range}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160107 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 05:05:56 +00:00
Gregory Szorc 9537e209be [clang.py] Refactor how ctypes functions are registered
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160106 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 04:56:46 +00:00
Arnaud A. de Grandmaison a910f47654 [cindex.py] Make CompileCommand.arguments usage consistent with CompileCommand.directory and the rest of the python binding
Patch by David Röthlisberger

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159970 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 00:00:05 +00:00
Arnaud A. de Grandmaison b1614041ac [cindex.py] fix infinite iteration of compilation database CompileCommands
Patch by David Röthlisberger

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159926 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 11:57:30 +00:00
Arnaud A. de Grandmaison 577c530fe2 [cindex.py] Fix erroneous comment for CompileCommands
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159810 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 08:22:05 +00:00
Arnaud A. de Grandmaison c70851b74c [libclang] CompilationDatabase naming and comment fixes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159682 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03 20:38:12 +00:00
Arnaud A. de Grandmaison 4439478c38 [cindex.py] Fix comments
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-30 20:43:37 +00:00
Arnaud A. de Grandmaison 910ff3f7f0 [cindex.py] add CompilationDatabase support
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159485 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-30 11:28:04 +00:00
Gregory Szorc 74bb710e73 [clang.py] Implement SourceLocation.from_offset
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158307 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-11 11:11:48 +00:00
Gregory Szorc e65b34deb1 [clang.py] Implement Cursor.is_static_method
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158277 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-09 16:21:34 +00:00
Douglas Gregor 39a03d1015 Fix typo "CursorKind.CONDITONAL_OPERATOR" in Python bindings, from
Manish Verma!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158182 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-08 00:16:27 +00:00
Gregory Szorc a63ef1f63f [clang.py] Store reference to TranslationUnit in Cursor and Type
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156846 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-15 19:51:02 +00:00
Gregory Szorc 2c40835c21 [clang.py] Implement Cursor.canonical
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156753 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-14 03:56:33 +00:00