Commit Graph

181 Commits

Author SHA1 Message Date
Rafael Espindola 3c5f2354b8 This reverts commit r227432, r227438 and r227448.
It should bring the bots back.

Original messagses:

r227448:
   Remove unnecessary default.

r227438:
   Fix Index/print-type.cpp test following r227432.

r227432:
    libclang: Add three functions useful for dealing with anonymous fields:
       clang_Cursor_getOffsetOfField
       clang_Cursor_isAnonymous
       clang_Type_visitFields
    Python: Add corresponding methods for dealing with anonymous fields.

    Patch by Loïc Jaquemet

llvm-svn: 227472
2015-01-29 17:22:53 +00:00
Francois Pichet f3be1cc5a9 libclang: Add three functions useful for dealing with anonymous fields:
clang_Cursor_getOffsetOfField
   clang_Cursor_isAnonymous
   clang_Type_visitFields
Python: Add corresponding methods for dealing with anonymous fields.

Patch by Loïc Jaquemet

llvm-svn: 227432
2015-01-29 12:45:29 +00:00
Argyrios Kyrtzidis 4e0854f23c [libclang] Add function to retrieve storage class in libclang.
Patch by guibufolo!

llvm-svn: 219809
2014-10-15 17:05:31 +00:00
Eli Bendersky c27a0c490c Add libclang capabilities to retriete template arguments from specializations.
Includes Python bindings.

Reviewed in http://reviews.llvm.org/D5621
Patch by Rob Springer

llvm-svn: 219529
2014-10-10 20:01:05 +00:00
Eli Bendersky 9b07147fc9 Expose the CUDA shared attribute to the C API.
Similar to r209767, which exposed other CUDA-related attributes.

Patch by Rob Springer.

llvm-svn: 215208
2014-08-08 14:59:00 +00:00
Eli Bendersky d28bc5e2f2 Expose the name mangling C API to Python bindings.
llvm-svn: 214930
2014-08-05 22:27:50 +00:00
Eli Bendersky e4f02eceea Reformat docstring to 80-col
llvm-svn: 214412
2014-07-31 18:12:17 +00:00
Alp Toker 1a923b42cb cindex.py: remove obsolete workaround and FIXME
clang_getCursorSpelling() doesn't assert on non-declarations any more and the
behaviour is covered by c-index tests.

Passes nosetests.

llvm-svn: 211482
2014-06-22 23:28:54 +00:00
Eli Bendersky 086e5816b0 Implement a convenience recursive walk method over a cursor and its descendants.
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).

llvm-svn: 209793
2014-05-29 02:35:27 +00:00
Eli Bendersky 2581e66e7a Expose CUDA function attributes to the C interface.
Until now all CUDA-specific attributes were represented with
CXCursor_UnexposedAttr; now they are actually implemented, including the Python
bindings.

llvm-svn: 209767
2014-05-28 19:29:58 +00:00
Eli Bendersky d31b5963ff Trim trailing whitespace in cindex.py
llvm-svn: 209754
2014-05-28 17:35:14 +00:00
Alp Toker ab54f46eec cindex/test_cursor.py: no need to skip implicit decls in tests
clang was fixed some time ago to always skip "builtins and other cruft" so
tools no longer need hacks like this.

Passes nosetests.

llvm-svn: 209316
2014-05-21 19:17:38 +00:00
Eric Christopher c9e2a68905 Clean up language and grammar.
Based on a patch by jfcaron3@gmail.com!
PR19806

llvm-svn: 209215
2014-05-20 17:10:39 +00:00
Alp Toker d29607871f cindex-dump.py: fix the --show-ids description string
It looks like this was botched back in r94936.

llvm-svn: 207947
2014-05-05 04:42:26 +00:00
Alp Toker 777fce64cc Fix cindex-dump.py --show-ids
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.

llvm-svn: 207946
2014-05-05 04:39:18 +00:00
Joey Gouly 81228382cf [libclang] Add attribute support for 'pure', 'const' and 'noduplicate'.
This bumps CINDEX_VERSION_MINOR up (to 26).

llvm-svn: 207767
2014-05-01 15:41:58 +00:00
Dmitri Gribenko 0b2026de6b Comment parsing: remove HTML attribute validation
Since the community says that a blacklist is not good enough, and I don't have
enough time now to implement a proper whitelist, let's just remove the
attribute validation.

But, nevertheless, we can still communicate in the generated XML if our parser
found an issue with the HTML.  But this bit is best-effort and is specifically
called out in the schema as such.

llvm-svn: 207712
2014-04-30 21:54:30 +00:00
Sylvestre Ledru d08e5b9655 Fix the method len of the CompletionString object. Patch by Christopher Greene
llvm-svn: 207348
2014-04-27 04:42:55 +00:00
Saleem Abdulrasool 05f9613610 bindings: expose C++ access specifiers
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!

llvm-svn: 207173
2014-04-25 02:58:03 +00:00
Dmitri Gribenko 93043620bc Comment parsing: in the generated XML file, mark HTML that is safe to pass
through to the output even if the input comment comes from an untrusted source

Attribute filtering is currently based on a blacklist, which right now includes
all event handler attributes (they contain JavaScipt code).  It should be
switched to a whitelist, but going over all of the HTML5 spec requires a
significant amount of time.

llvm-svn: 206882
2014-04-22 10:59:13 +00:00
Alp Toker 3a3ee3e376 cindex.py: Avoid deprecated function
Implement Diagnostic::category_name() using clang_getDiagnosticCategoryText()
instead of the deprected clang_getDiagnosticCategoryName().

Preserves existing behaviour and API covered by existing tests.

llvm-svn: 206712
2014-04-20 01:07:03 +00:00
Bill Wendling 81eeb82a56 Use the correct symbol for a left bracket.
PR19089

llvm-svn: 203906
2014-03-14 08:39:06 +00:00
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