Commit Graph

128 Commits

Author SHA1 Message Date
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
Dmitri Gribenko 6cffc1928a Comment XML: use xml:space="preserve" in Verbatim tags, so that XML tidy does
not compress spaces in verbatim content.

llvm-svn: 161531
2012-08-08 22:10:24 +00:00
Dmitri Gribenko 168d23414a Comment AST: DeclInfo: add a special kind for enums.
Comment XML: add a root node kind for enums.

llvm-svn: 161442
2012-08-07 18:59:04 +00:00
Dmitri Gribenko 740c0fbe0e 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!

llvm-svn: 161431
2012-08-07 17:54:38 +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
Gregory Szorc c4b649d50a [clang.py] Followup to TranslationUnit refactor
* Document index argument in TranslationUnit.from_source
* Add numeric error code to TranslationUnitSaveError string representation
* Use None instead of [] for default argument value in
  TranslationUnit.codeComplete

llvm-svn: 156722
2012-05-12 20:49:13 +00:00
Gregory Szorc 23cfc9f760 [clang.py] Remove trailing whitespace from recent commits
llvm-svn: 156373
2012-05-08 06:01:34 +00:00
Gregory Szorc dfc894f3aa [clang.py] TranslationUnit API improvements
* TranslationUnit reading and parsing now implemented as
  TranslationUnit.from_ast() and TranslationUnit.from_source().
* Index.parse() and Index.read() implemented through above.
* Index.parse() and Index.read() now raise a TanslationUnitLoadException
  instead of returning None if a TranslationUnit could not be
  instantiated. This is backwards incompatible.
* Ability to save TranslationUnits via TranslationUnit.save().
* TranslationUnit now holds onto Index instance that created. This means
  the Index can't be GC'd until the TranslationUnit is itself GC'd,
  making memory management thoughtless.
* Don't use [] as a default argument value, as the initial value used is
  reused for the duration of the program.

llvm-svn: 156372
2012-05-08 05:56:38 +00:00
Manuel Klimek 297e9c3091 - Adding lexical_parent and semantic_parent properties to clang.cindex.Cursor
- Two new tests (one for each property), require libclang built from r155858 or later to pass
- New test utility function (get_cursors) that gets all the nodes with a specific spelling.

Patch by Evan Pipho.

llvm-svn: 156286
2012-05-07 05:56:03 +00:00
Anders Waldenborg 750c04f1a5 [python] Add testcase for annotation cursor
llvm-svn: 156022
2012-05-02 21:28:34 +00:00
Anders Waldenborg 94c71052e7 [python] Add Cursor.enum_value wrapping clang_getEnumConstantDeclValue
llvm-svn: 156017
2012-05-02 20:57:33 +00:00
Anders Waldenborg c2d64c428a [python] Add testcase for enum with specified underlaying type
llvm-svn: 156009
2012-05-02 19:39:46 +00:00
Anders Waldenborg 23373c73f0 [python] Run tests for c++ with std=c++11
llvm-svn: 156008
2012-05-02 19:37:16 +00:00
Anders Waldenborg d8f66426a1 [python] Fix warning in c-code inside testcase
llvm-svn: 156007
2012-05-02 19:35:37 +00:00
Gregory Szorc 5a833d6680 [clang.py] Implement TypeKind.spelling
llvm-svn: 154769
2012-04-15 18:51:10 +00:00
Gregory Szorc a8b30c5b61 [clang.py] Implement Cursor.objc_type_encoding
llvm-svn: 152513
2012-03-10 22:23:27 +00:00
Gregory Szorc 0e20a09165 [clang.py] Refactor get_tu and get_cursor test helper functions into util.py
llvm-svn: 152510
2012-03-10 22:19:05 +00:00
Gregory Szorc 74226d3597 [clang.py] Return bool from Cursor.__eq__
llvm-svn: 152011
2012-03-05 00:42:15 +00:00