clang_getCursorSpelling() doesn't assert on non-declarations any more and the
behaviour is covered by c-index tests.
Passes nosetests.
llvm-svn: 211482
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
Until now all CUDA-specific attributes were represented with
CXCursor_UnexposedAttr; now they are actually implemented, including the Python
bindings.
llvm-svn: 209767
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
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
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
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
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
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
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
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
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
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