Jonathan Coe
2956535b7c
Expose cxx constructor and method properties through libclang and python bindings.
...
Summary:
I have exposed the following function through libclang and the clang.cindex python bindings:
clang_CXXConstructor_isConvertingConstructor,
clang_CXXConstructor_isCopyConstructor,
clang_CXXConstructor_isDefaultConstructor,
clang_CXXConstructor_isMoveConstructor,
clang_CXXMethod_isDefaulted
I need (some of) these methods for a C++ code model I am building in Python to drive a code generator.
Reviewers: compnerd, skalinichev
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D15469
llvm-svn: 267706
2016-04-27 12:48:25 +00:00
Guillaume Papin
06eff5f2c8
python binding: expose compile command filename
...
Reviewers: compnerd, skalinichev
Differential Revision: http://reviews.llvm.org/D17278
llvm-svn: 262845
2016-03-07 18:44:42 +00:00
Sergey Kalinichev
8f3b187e21
[libclang] Visit TypeAliasTemplateDecl
...
This makes TypeAliasTemplateDecl accessible via LibClang and python bindings
Differential Revision: http://reviews.llvm.org/D13844
llvm-svn: 253166
2015-11-15 13:48:32 +00:00
Saleem Abdulrasool
6ea75dbeb0
Index: expose is_mutable_field
...
Expose isMutable via libClang and python bindings.
Patch by Jonathan B Coe!
llvm-svn: 251410
2015-10-27 15:50:22 +00:00
Saleem Abdulrasool
d79eec97fc
bindings: add new C++ function attribute accessors
...
Add methods to index Cursor to see if a cxx method is pure_virtual,
virtual or const methods.
Patch by Jonathan B Coe!
llvm-svn: 250008
2015-10-12 03:10:20 +00:00
Manuel Klimek
e0495d987c
[libclang] Return deduced type for auto type, not the one written in the source.
...
It used to work, but was accidentally broken by r179769.
The issue with decayed types was fixed by r190796.
So this patch partially reverts r179769, and adds more tests.
This also fixes PR 18669.
Patch by Sergey Kalinichev.
llvm-svn: 246778
2015-09-03 16:11:10 +00:00
Argyrios Kyrtzidis
2bff5161c4
[libclang] Add functions to get information about fields.
...
Patch by Loïc Jaquemet!
llvm-svn: 234762
2015-04-13 16:55:04 +00:00
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
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
d28bc5e2f2
Expose the name mangling C API to Python bindings.
...
llvm-svn: 214930
2014-08-05 22:27:50 +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
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
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
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
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
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
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
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
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
Gregory Szorc
245296ed40
[clang.py] Add Cursor.get_arguments()
...
Patch provided by Matthias Kleine <matthias_kleine@gmx.de>
llvm-svn: 167216
2012-11-01 05:46:30 +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
98f93adefc
Add bindings for clang_getCompletionBriefComment to cindex.py.
...
llvm-svn: 163966
2012-09-15 11:56:32 +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
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
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
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
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
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
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
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
Tobias Grosser
ebb0ae82a2
[clang.py] Implement Cursor.hash
...
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>
llvm-svn: 149826
2012-02-05 11:42:03 +00:00
Tobias Grosser
9fc76f2cbf
[clang.py] Expose diagnostic category and option info to Python binding
...
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>
llvm-svn: 149825
2012-02-05 11:41:58 +00:00
Tobias Grosser
fb7b4aa45a
[clang.py] Implement __eq__ and __ne__ on SourceLocation and SourceRange
...
There is no type checking in __eq__, so ctypes will throw if the wrong
Python type is passed in to the C function. Personally, I feel garbage
in means garbage out and it isn't worth testing for this explicitly.
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>
llvm-svn: 149824
2012-02-05 11:40:59 +00:00
Tobias Grosser
e15496f1d7
cindex.py: Allow to create a cursor from file/row/column
...
We add a constructor to create a SourceLocation from a position in
a file and we use this SourceLocation to retrieve a cursor.
llvm-svn: 143322
2011-10-31 00:31:32 +00:00
Tobias Grosser
80c4b81f54
cindex.py: Add File.create_from_name()
...
llvm-svn: 143321
2011-10-31 00:07:19 +00:00
Douglas Gregor
5fdc4de718
Add support for constant arrays, from Anders Waldenborg!.
...
llvm-svn: 142477
2011-10-19 05:51:43 +00:00
Douglas Gregor
89861066ed
Add TypeKind.CONSTANTARRAY, from Anders Waldenborg!
...
llvm-svn: 142476
2011-10-19 05:50:34 +00:00
Douglas Gregor
506d34a0df
Update python testcase for GNU old-style field designator warning,
...
from Anders Waldenborg!
llvm-svn: 138786
2011-08-30 00:16:30 +00:00
Douglas Gregor
7c7c068251
Add support for Cursor.displayname in python bindings, from Anders Waldenborg!
...
llvm-svn: 138785
2011-08-30 00:15:34 +00:00
Argyrios Kyrtzidis
3fce368d87
[python] Fix bug of the SourceLocation binding.
...
Patch by Anders Waldenborg!
llvm-svn: 137829
2011-08-17 17:20:24 +00:00
Argyrios Kyrtzidis
8f6bd2d653
[python] Add test_type.py by Anders Waldenborg, which I forgot to commit in r137797.
...
llvm-svn: 137828
2011-08-17 17:01:10 +00:00
Argyrios Kyrtzidis
f872dc4c3b
[python] Add support for CXType to python bindings.
...
Patch by Anders Waldenborg!
llvm-svn: 137797
2011-08-17 00:43:03 +00:00
Douglas Gregor
a98034a25e
Improve the Python bindings for libclang in a few ways, from Eli
...
Bendersky. Specifically:
* Implemented a new function in libclang: clang_isAttribute
* Fixing TranslationUnit.get_includes to only go through the argument
* buffer when it contains something. This fixed a crash on Windows
* clang_getFileName returns CXString, not char*. Made appropriate
* fixes in cindex.py - now the relevant tests pass and we can see the
* full locations correctly again (previously there was garbage in
* place of the file name)
* Exposed clang_getCursorDisplayName to the python bindings
llvm-svn: 134460
2011-07-06 03:00:34 +00:00
Tobias Grosser
2a8aac5ff4
python bindings: Add support for translationUnit.reparse().
...
This is the first step to make the clang_complete vim plugin work with
libclang. Reparsing improves parsing time from 0.8 to 0.25 secs for
one of my LLVM .cpp files.
llvm-svn: 124956
2011-02-05 17:54:00 +00:00
Tobias Grosser
4748651060
python bindings: Include local headers the right way.
...
llvm-svn: 124955
2011-02-05 17:53:55 +00:00
Tobias Grosser
0e19c192f5
python bindings: Remove unneeded instruction
...
llvm-svn: 124954
2011-02-05 17:53:53 +00:00
Tobias Grosser
5153e79931
python bindings: fix Diagnostics.range iterator
...
The iterator did never throw an IndexError. It was therefore not possible
to use it in a normal foreach loop as that loop would never stop.
llvm-svn: 124953
2011-02-05 17:53:51 +00:00
Daniel Dunbar
02968e53cf
CIndex: Switch CXSourceRange to proper half-open intervals.
...
- Doug, please review.
llvm-svn: 96162
2010-02-14 10:02:57 +00:00
Daniel Dunbar
43813bf023
cindex/Python: Add TranslationUnit.get_includes, patch by Andrew Sutton!
...
llvm-svn: 96106
2010-02-13 18:33:18 +00:00
Daniel Dunbar
a7a354e3e3
cindex/Python: Add full support for Diagnostic and FixIt objects, available via TranslationUnit.diagnostics.
...
Several important FIXMEs remain:
- We aren't getting all the notes?
- There is still no way to get diagnostics for invalid inputs.
llvm-svn: 94933
2010-01-30 23:59:02 +00:00
Daniel Dunbar
1e079a48ad
cindex/Python: Update Index.create for removal of displayDiagnostics.
...
llvm-svn: 94931
2010-01-30 23:58:39 +00:00
Daniel Dunbar
dacede8349
cindex/Python: Support file objects as unsaved_files, albeit inefficiently.
...
llvm-svn: 94418
2010-01-25 09:16:41 +00:00
Daniel Dunbar
90986f5d3f
cindex/Python: Add Cursor test.
...
llvm-svn: 94397
2010-01-25 00:44:21 +00:00
Daniel Dunbar
9ad194dc18
cindex/Python: Implement support for unsaved/remapped files.
...
llvm-svn: 94396
2010-01-25 00:44:11 +00:00
Daniel Dunbar
7baaee93e7
cindex/Python: Fix/simplify Index.parse() passing command line arguments.
...
llvm-svn: 94394
2010-01-25 00:43:31 +00:00
Daniel Dunbar
3e555fd85f
cindex/Python: Move Cursor.is_ methods to CursorKind, and add test.
...
Also, add CursorKind.get_all_kinds().
llvm-svn: 94389
2010-01-24 21:20:39 +00:00
Daniel Dunbar
942453284f
cindex/Python: Convert CXString objects to regular Python strings below API.
...
llvm-svn: 94384
2010-01-24 21:19:57 +00:00
Daniel Dunbar
e79aba4c72
cindex/Python: Add TranslationUnit.cursor.
...
llvm-svn: 94355
2010-01-24 04:09:43 +00:00
Daniel Dunbar
74716e5ebd
Initial checkin of CIndex Python bindings, by Andrew Sutton!
...
- Some tweaks by me for API changes, Darwin, and x86_64 support. Still needs
substantial updating to match recent CIndex API changes.
llvm-svn: 94349
2010-01-24 02:02:07 +00:00