summaryrefslogtreecommitdiff
path: root/bindings
AgeCommit message (Collapse)Author
2017-12-14Remove duplicate python libclang changes from r320748Alex Lorenz
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320766 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[libclang] Add support for checking abstractness of recordsAlex Lorenz
This patch allows checking whether a C++ record declaration is abstract through libclang and clang.cindex (Python). Patch by Johann Klähn! Differential Revision: https://reviews.llvm.org/D36952 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320748 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-11[python] [tests] Fix test_linkage for unique external linkageMichal Gorny
Starting with r314037, anonymous namespaces no longer give unique-external linkage to variables. However, this linkage can still be achieved by using a type which is not exterally visible, e.g. through being declared in an anonymous namespace but used outside it. Fix the test to take advantage of that. Differential Revision: https://reviews.llvm.org/D39810 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317986 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10[python] [tests] Rewrite to use standard unittest moduleMichal Gorny
Rewrite the tests from using plain 'assert' mixed with some nosetests methods to the standard unittest module layout. Improve the code to use the most canonical assertion methods whenever possible. This has a few major advantages: - the code uses standard methods now, resulting in a reduced number of WTFs whenever someone with basic Python knowledge gets to read it, - completely unnecessary dependency on nosetests is removed since the standard library supplies all that is necessary for the tests to run, - the tests can be run via any test runner, including the one built-in in Python, - the failure output for most of the tests is improved from 'assertion x == y failed' to actually telling the values. Differential Revision: https://reviews.llvm.org/D39763 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317897 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09[python] [tests] Update priority values in code completion testMichal Gorny
The priority for destructors and operators was reduced in r314019. Adjust the values used in the test appropriately to fix the test failure. Differential Revision: https://reviews.llvm.org/D39838 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317828 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08[bindings] fix TLS test failureMasud Rahman
Since cfe commit r237337, '__declspec(thread)' and 'thread_local' have been the same since MSVC 2015. i.e. they are both considered to supply a dynamic TLS kind, not a static TLS kind. This test originally did not specify which version of MS compatibility to assume. As a result, the test was brittle, since changing the default compatibility version could break the test. This commit adds a specific version when building up the flags used to parse the translation unit, and tests both versions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317706 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-21Reverting r316278 due to failing build bots.Aaron Ballman
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/11896 http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/12380 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316279 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-21[libclang, bindings]: add spelling locationMasud Rahman
o) Add a 'Location' class that represents the four properties of a physical location o) Enhance 'SourceLocation' to provide 'expansion' and 'spelling' locations, maintaining backwards compatibility with existing code by forwarding the four properties to 'expansion'. o) Update the implementation to use 'clang_getExpansionLocation' instead of the deprecated 'clang_getInstantiationLocation', which has been present since 2011. o) Update the implementation of 'clang_getSpellingLocation' to actually obtain spelling location instead of file location. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316278 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-21[bindings] allow null strings in Python 3Masud Rahman
Some API calls accept 'NULL' instead of a char array (e.g. the second argument to 'clang_ParseTranslationUnit'). For Python 3 compatibility, all strings are passed through 'c_interop_string' which expects to receive only 'bytes' or 'str' objects. This change extends this behavior to additionally allow 'None' to be supplied. A test case was added which breaks in Python 3, and is fixed by this change. All the test cases pass in both, Python 2 and Python 3. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316264 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-16[libclang] Add support for querying cursor availabilityJonathan Coe
Summary: This patch allows checking the availability of cursors through libclang and clang.cindex (Python). This e.g. allows to check whether a C++ member function has been marked as deleted. Reviewers: arphaman, jbcoe Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by jklaehn (Johann Klähn) Differential Revision: https://reviews.llvm.org/D36973 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315959 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-16[libclang] Visit attributes for function and class templatesJonathan Coe
Summary: Previously, `VisitAttributes` was not called for function and class templates and thus their attributes were not accessible using libclang. Reviewers: bkramer, arphaman, rsmith, jbcoe Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by jklaehn (Johann Klähn) Differential Revision: https://reviews.llvm.org/D36955 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315958 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22bindings: expose Linkage to the python bindingsSaleem Abdulrasool
Add Python bindings for the 'clang_getCursorLinkage', and tests to validate the functionality. Patch by Masud Rahman! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314009 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[libclang] Keep track of TranslationUnit instance when annotating tokensJonathan Coe
Summary: Previously the `_tu` was not propagated to the returned cursor, leading to errors when calling any method on that cursor (e.g. `cursor.referenced`). Reviewers: jbcoe, rsmith Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by jklaehn (Johann Klähn) Differential Revision: https://reviews.llvm.org/D36953 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313913 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-13libclang: expose `clang_getCursorTLSKind`Saleem Abdulrasool
Introduce the 'TLS Kind' property of variable declarations through libclang. Additionally, provide a Python accessor for it, and test that functionality. Patch by Masud Rahman! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313111 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-06Fix __repr__ for Diagnostic in clang.cindexJonathan Coe
Summary: Also move misplaced tests for exception specification to fix failing Python tests. Reviewers: hans, compnerd Reviewed By: compnerd Subscribers: cfe-commits Tags: #clang-c Differential Revision: https://reviews.llvm.org/D37490 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312622 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12[libclang] Support for querying whether an enum is scopedAlex Lorenz
This commit allows checking whether an enum declaration is scoped through libclang and clang.cindex (Python). Patch by Johann Klähn! Differential Revision: https://reviews.llvm.org/D35187 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307771 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12Revert r307769 (Forgot to mention the name of the contributor).Alex Lorenz
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307770 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12[libclang] Support for querying whether an enum is scopedAlex Lorenz
This commit allows checking whether an enum declaration is scoped through libclang and clang.cindex (Python). Differential Revision: https://reviews.llvm.org/D35187 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307769 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-03fix trivial typos in comments; NFCHiroshi Inoue
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307007 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27[libclang] Support for querying the exception specification type through ↵Jonathan Coe
libclang Summary: This patch exposes the exception specification type (noexcept, etc.) of a C++ function through libclang and Python clang.cindex. Reviewers: rsmith, aaron.ballman Reviewed By: aaron.ballman Subscribers: jbcoe, cfe-commits Differential Revision: https://reviews.llvm.org/D34091 Patch by Andrew Bennieston git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306483 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08[libclang] Expose typedef and address space functionsSven van Haastregt
Expose the following functions: - clang_getTypedefName - clang_getAddressSpace Patch by Simon Perretta. Differential Revision: https://reviews.llvm.org/D33598 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304978 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-23[libclang] [OpenCL] Expose more OpenCL CIndex typesSven van Haastregt
Expose pipe, sampler_t, clk_event_t, queue_t, reserve_id_t, and all image types. Update the opencl-types.cl test RUN line such that we can test the OpenCL 2.0 types. Patch by Simon Perretta. Differential Revision: https://reviews.llvm.org/D33197 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303626 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20Add Python 3 support to clang.cindexJonathan Coe
Summary: Introduce an interop string to convert from unicode to c-strings where needed. Add missing conversions from _CXString to strings in function registrations. Explicitly evaluate lists where Python 3's lazy iterators would not otherwise do so. This is an improvement upon the reverted change proposed in https://reviews.llvm.org/D26082 Reviewers: compnerd, skalinichev, modocache, MathieuDuponchelle Reviewed By: compnerd Subscribers: cfe-commits Tags: #clang-c Differential Revision: https://reviews.llvm.org/D31568 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300829 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10[libclang] [OpenCL] Expose half type.Joey Gouly
Expose the half type (fp16) through libclang and the python bindings. It seems CXType_LastBuiltin was not updated in b2ea6d9 ("Enable support for __float128 in Clang", 2016-04-13), so update it now. Add an Index test for OpenCL types; in the future we will add other OpenCL types such as images to this test. Patch by Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D29718 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294754 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-17Fix Python 3 language issues and add an explicit check for Python version == 2.Jonathan Coe
Summary: Python bindings cannot support Python 3 without work being done to fix Unicode c-string conversion. This was attempted in https://reviews.llvm.org/D26082. That patch was reverted due to memory access issues on Linux. This revision fixes enough language compatibility issues for the clang module to be loaded and raise an error if the Python version is not 2. Reviewers: mgorny, MathieuDuponchelle, rengolin, compnerd Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D28682 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292247 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-13Revert "Support for Python 3 in libclang python bindings"Jonathan Coe
This reverts commit 4464581bb63e9789e9ee231a8c8800be5f614743. Memory access issues on Linux were reported by Mathieu Duponchelle and discussed here: https://reviews.llvm.org/D26082. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291907 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-03[libclang] Fix python testsSergey Kalinichev
It was broken in r286421 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288582 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-04[python bindings] Expose CXCursor_FriendDecl as CursorKind.FRIEND_DECLOlivier Goffart
CXCursor_FriendDecl was added in r285984 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285986 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-03Support for Python 3 in libclang python bindingsJonathan Coe
Summary: Python bindings tests now pass in Python 3. `map` in Python 3 is lazily evaluated so the method by which functions are registered needed updating. Strings are unicode in Python 3 not UTF-8, I've tried to create an new c_types-like class (c_string_p) to automate the conversion. String conversions made explicit where required. Reviewers: eliben, nemanjai, skalinichev, compnerd Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D26082 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18[libclang] Add missing cursor kinds to python bindings.Igor Kudrin
Differential Revision: https://reviews.llvm.org/D25673 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284464 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18[libclang] Fix a failure in a test for python bindings on ↵Igor Kudrin
CursorKind.OVERLOAD_CANDIDATE. The test fails because the value does not lay in any existing group. Differential Revision: https://reviews.llvm.org/D25470 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284463 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11bindings: expose diagnostic formatting to PythonSaleem Abdulrasool
This makes it easier for tools using the Python libclang bindings to display diagnostics in a manner consistent with clang. Patch by Omar Sandoval! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278315 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-09Enable support for __float128 in Clang and enable it on pertinent platformsNemanja Ivanovic
This patch corresponds to reviews: http://reviews.llvm.org/D15120 http://reviews.llvm.org/D19125 It adds support for the __float128 keyword, literals and target feature to enable it. Based on the latter of the two aforementioned reviews, this feature is enabled on Linux on i386/X86 as well as SystemZ. This is also the second attempt in commiting this feature. The first attempt did not enable it on required platforms which caused failures when compiling type_traits with -std=gnu++11. If you see failures with compiling this header on your platform after this commit, it is likely that your platform needs to have this feature enabled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268898 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03[libclang] Expose the ElaboratedTypeSergey Kalinichev
Differential Revision: http://reviews.llvm.org/D11797 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268366 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-30python: add bindings for children of diagnosticsSaleem Abdulrasool
This exposes the Clang API bindings clang_getChildDiagnostics (which returns a CXDiagnosticSet) and clang_getNumDiagnosticsInSet / clang_getDiagnosticInSet (to traverse the CXDiagnosticSet), and adds a helper children property in the Python Diagnostic wrapper. Also, this adds the missing OVERLOAD_CANDIDATE (700) cursor type. Patch by Hanson Wang! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268167 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27Expose cxx constructor and method properties through libclang and python ↵Jonathan Coe
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267706 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15Revert 266186 as it breaks anything that includes type_traits on some platformsNemanja Ivanovic
Since this patch provided support for the __float128 type but disabled it on all platforms by default, some platforms can't compile type_traits with -std=gnu++11 since there is a specialization with __float128. This reverts the patch until D19125 is approved (i.e. we know which platforms need this support enabled). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266460 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-13Enable support for __float128 in ClangNemanja Ivanovic
This patch corresponds to review: http://reviews.llvm.org/D15120 It adds support for the __float128 keyword, literals and a target feature to enable it. This support is disabled by default on all targets and any target that has support for this type is free to add it. Based on feedback that I've received from target maintainers, this appears to be the right thing for most targets. I have not heard from the maintainers of X86 which I believe supports this type. I will subsequently investigate the impact of enabling this on X86. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-10libclang python bindings: Fix for bug 26394Jonathan Coe
Summary: https://llvm.org/bugs/show_bug.cgi?id=26394 reports that clang's python bindings tests are failing. I can confirm that the bug exists and that the proposed fix is good. Differential Revision: http://reviews.llvm.org/D17226 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263170 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-07python binding: expose compile command filenameGuillaume Papin
Reviewers: compnerd, skalinichev Differential Revision: http://reviews.llvm.org/D17278 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262845 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-10libclang: expose dllexport, dllimport attributesSaleem Abdulrasool
These attributes were previously unexposed. Expose them through the libclang interfaces. Add tests that cover both the MSVC spelling and the GNU spelling. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255273 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-15[libclang] Visit TypeAliasTemplateDeclSergey Kalinichev
This makes TypeAliasTemplateDecl accessible via LibClang and python bindings Differential Revision: http://reviews.llvm.org/D13844 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253166 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-15[libclang] Expose AutoTypeSergey Kalinichev
Expose the AutoType via LibClang and python bindings Differential Revision: http://reviews.llvm.org/D13000 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253165 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27Index: expose is_mutable_fieldSaleem Abdulrasool
Expose isMutable via libClang and python bindings. Patch by Jonathan B Coe! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251410 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12bindings: add new C++ function attribute accessorsSaleem Abdulrasool
Add methods to index Cursor to see if a cxx method is pure_virtual, virtual or const methods. Patch by Jonathan B Coe! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250008 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-05Index: expose visibility attributeSaleem Abdulrasool
Expose the previously unexposed visibility attribute via the python and C bindings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246931 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03[libclang] Return deduced type for auto type, not the one written in the source.Manuel Klimek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246778 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-13[libclang] Add functions to get information about fields.Argyrios Kyrtzidis
Patch by Loïc Jaquemet! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234762 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29This reverts commit r227432, r227438 and r227448.Rafael Espindola
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227472 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29libclang: Add three functions useful for dealing with anonymous fields:Francois Pichet
clang_Cursor_getOffsetOfField clang_Cursor_isAnonymous clang_Type_visitFields Python: Add corresponding methods for dealing with anonymous fields. Patch by Loïc Jaquemet git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227432 91177308-0d34-0410-b5e6-96231b3b80d8