Commit Graph

114 Commits

Author SHA1 Message Date
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
Gregory Szorc 5b4173912f [clang.py] Test Cursor.__ne__
llvm-svn: 151504
2012-02-26 21:56:32 +00:00
Gregory Szorc 19bf2398ba [clang.py] Format and add documention for Type
llvm-svn: 150972
2012-02-20 17:58:40 +00:00
Gregory Szorc a5a89b9564 [clang.py] Add tests for Type.is_volatile_qualified and Type.is_restrict_qualified
llvm-svn: 150971
2012-02-20 17:58:02 +00:00
Gregory Szorc 495c7dae5d [clang.py] Implement Type.argument_types()
llvm-svn: 150970
2012-02-20 17:45:30 +00:00
Gregory Szorc 8a840febac [clang.py] Implement Type.__eq__ and Type.__ne__
llvm-svn: 150969
2012-02-20 17:44:49 +00:00
Gregory Szorc 8428c242b8 [clang.py] Implement Type.is_function_variadic
llvm-svn: 150936
2012-02-19 18:28:33 +00:00
Gregory Szorc dd19169988 [clang.py] Implement Type.element_count
llvm-svn: 150800
2012-02-17 07:47:38 +00:00
Gregory Szorc e1e9ec1082 [clang.py] Implement Type.element_type
llvm-svn: 150799
2012-02-17 07:44:46 +00:00
Gregory Szorc 04d612aa12 [clang.py] Implement Type.is_pod
llvm-svn: 149842
2012-02-05 19:42:06 +00:00
Tobias Grosser 6a7644683c [clang.py] Change type -> Type
Names that have corresponding classes in python are commonly started with an
uppercase letter. Let's follow that convention.

llvm-svn: 149831
2012-02-05 12:15:56 +00:00
Tobias Grosser a0022e911e [clang.py] Implement Cursor.enum_type
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149830
2012-02-05 11:42:25 +00:00
Tobias Grosser 062d2a3c89 [clang.py] Implement Cursor.underlying_typedef_type
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149829
2012-02-05 11:42:20 +00:00
Tobias Grosser 13d92a4b8f [clang.py] add TypeKind.VECTOR
Added a missing enumeration.

Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149828
2012-02-05 11:42:14 +00:00
Tobias Grosser 49bd32c1d2 [clang.py] Add CursorKind.{is_translation_unit, is_preprocessing, is_unexposed}
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149827
2012-02-05 11:42:09 +00:00