summaryrefslogtreecommitdiffstats
path: root/clang/bindings/python/tests/cindex
Commit message (Collapse)AuthorAgeFilesLines
* Fixed more -Wreturn-type testsDávid Bolvanský2019-11-091-1/+1
|
* [clang][Tooling] Infer target and mode from argv[0] when using ↵Kadir Cetinkaya2019-06-261-6/+8
| | | | | | | | | | | | | | | | | | | | | JSONCompilationDatabase Summary: Wraps JSON compilation database with a target and mode adding database wrapper. So that driver can correctly figure out which toolchain to use. Note that clients that wants to make use of this target discovery mechanism needs to link in TargetsInfos and initialize them at startup. Reviewers: ilya-biryukov Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63755 llvm-svn: 364386
* [CodeComplete] Update python tests after r360042Ilya Biryukov2019-05-061-2/+2
| | | | llvm-svn: 360048
* [libclang][test] Suppress annoying 'LIBCLANG TOOLING ERROR' outputFangrui Song2019-04-031-0/+9
| | | | | | | | | | | check-all invokes check-clang-python which prints the annoying message: LIBCLANG TOOLING ERROR: fixed-compilation-database: Error while opening fixed database: No such file or directory json-compilation-database: Error while opening JSON database: No such file or directory Let's fix it now with os.dup os.dup2 trick. llvm-svn: 357562
* Make -Wstring-plus-int warns even if when the result is not out of boundsArnaud Bienner2019-01-031-2/+2
| | | | | | | | | | | | | | Summary: Patch by Arnaud Bienner Reviewers: sylvestre.ledru, thakis, serge-sans-paille Reviewed By: thakis Subscribers: arphaman, dyung, anemet, llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D55382 llvm-svn: 350335
* Portable Python script across Python versionSerge Guelton2019-01-031-3/+4
| | | | | | | | StringIO is obsoleted in Python3, replaced by io.BytesIO or io.StringIO depending on the use. Differential Revision: https://reviews.llvm.org/D55196 llvm-svn: 350318
* Revert "Try to update the test to fix the breakage With the new warning, we ↵Adam Nemet2018-12-141-1/+1
| | | | | | | | | | | | | | | | | | | are showing one more output in the test." This reverts commit r349064. This wasn't updating the right test. Causing (not the different line number from the previous revert): ====================================================================== FAIL: test_diagnostic_warning (tests.cindex.test_diagnostics.TestDiagnostics) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py", line 18, in test_diagnostic_warning self.assertEqual(len(tu.diagnostics), 2) AssertionError: 1 != 2 llvm-svn: 349118
* Try to update the test to fix the breakageSylvestre Ledru2018-12-131-1/+1
| | | | | | With the new warning, we are showing one more output in the test. llvm-svn: 349064
* [python] Support PathLike filenames and directoriesMichal Gorny2018-11-104-0/+120
| | | | | | | | | | | | | | | Python 3.6 introduced a file system path protocol (PEP 519[1]). The standard library APIs accepting file system paths now accept path objects too. It could be useful to add this here as well for convenience. [1] https://www.python.org/dev/peps/pep-0519 Authored by: jstasiak (Jakub Stasiak) Differential Revision: https://reviews.llvm.org/D54120 llvm-svn: 346586
* [python] [tests] Remove cdb lookup failure testMichal Gorny2018-10-121-5/+0
| | | | | | | | | | Remove the test checking for compilation db lookup failure. Since r342228, JSONCompilationDatabasePlugin infers compile commands for missing files, therefore making the lookup always succeed. Differential Revision: https://reviews.llvm.org/D53202 llvm-svn: 344364
* [python] [tests] Support overriding library path via environmentMichal Gorny2018-10-1117-0/+84
| | | | | | | | | | | | | | | | | Support a new CLANG_LIBRARY_PATH environment variable for the Python binding tests. This variable can be used to force the bindings to load libclang.* from a specific directory. I plan to use this when integrating Python binding tests with the CMake build system. Currently, those tests load libclang.so from default search paths, so I would have to rely on platform-specific mechanics such as LD_LIBRARY_PATH. Instead of copying the whole logic necessary to handle platform differences into yet another place, it's easier to just add a dedicated variable for this purpose. Differential Revision: https://reviews.llvm.org/D52806 llvm-svn: 344240
* [python] [tests] Update test_code_completionMichal Gorny2018-09-241-4/+4
| | | | | | | | Update expected completions to match output generated by clang-7.0. Differential Revision: https://reviews.llvm.org/D50171 llvm-svn: 342897
* [python bindings] Expose getNumTemplateArgumentsJonathan Coe2018-09-111-0/+25
| | | | | | | | | | | | | | | Expose the C bindings for clang_Type_getNumTemplateArguments() and clang_Type_getTemplateArgumentAsType() in the python API. Patch by kjteske (Kyle Teske). Reviewed By: jbcoe Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51299 llvm-svn: 341930
* [bindings] Fix most Python binding unittests on WindowsJonathan Coe2018-06-213-22/+21
| | | | | | | | | | | | | | | | | | Summary: This fixes all but one of the test cases for Windows. TestCDB will take more work to debug, as CompilationDatabase seems not to work correctly. Reviewers: bkramer, wanders, jbcoe Reviewed By: bkramer, jbcoe Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47864 Patch written by ethanhs (Ethan) llvm-svn: 335282
* implementing Cursor.get_included_file in python bindingsJonathan Coe2018-05-101-0/+12
| | | | | | | | | | | | | | | | | | | | Summary: adding function: `Cursor.get_included_file` , so the C API's `clang_getIncludedFile` function is available on the python binding interface also adding test to unittests related ticket: https://bugs.llvm.org/show_bug.cgi?id=15223 Reviewers: mgorny, arphaman, jbcoe Reviewed By: jbcoe Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46383 Patch by jlaz (József Láz) llvm-svn: 332045
* [python bindings] Fix Cursor.result_type for ObjC method declarations - Bug ↵Jonathan Coe2018-04-221-0/+12
| | | | | | | | | | | | | | | | | | | | | 36677 Summary: In cindex.py, Cursor.result_type called into the wrong libclang function, causing cursors for ObjC method declarations to return invalid result types. Fixes Bug 36677. Reviewers: jbcoe, rsmith Reviewed By: jbcoe Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D45671 Patch by kjteske (Kyle Teske). llvm-svn: 330557
* Remove duplicate python libclang changes from r320748Alex Lorenz2017-12-141-11/+0
| | | | llvm-svn: 320766
* [libclang] Add support for checking abstractness of recordsAlex Lorenz2017-12-141-0/+22
| | | | | | | | | | | 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 llvm-svn: 320748
* [python] [tests] Fix test_linkage for unique external linkageMichal Gorny2017-11-111-1/+2
| | | | | | | | | | | | 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 llvm-svn: 317986
* [python] [tests] Rewrite to use standard unittest moduleMichal Gorny2017-11-1017-1594/+1655
| | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 317897
* [python] [tests] Update priority values in code completion testMichal Gorny2017-11-091-2/+2
| | | | | | | | | | 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 llvm-svn: 317828
* [bindings] fix TLS test failureMasud Rahman2017-11-081-4/+14
| | | | | | | | | | | | | | | 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. llvm-svn: 317706
* Reverting r316278 due to failing build bots.Aaron Ballman2017-10-211-7/+0
| | | | | | | http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/11896 http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/12380 llvm-svn: 316279
* [libclang, bindings]: add spelling locationMasud Rahman2017-10-211-0/+7
| | | | | | | | | | | | | | | | | | 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. llvm-svn: 316278
* [bindings] allow null strings in Python 3Masud Rahman2017-10-211-0/+2
| | | | | | | | | | | | | 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. llvm-svn: 316264
* [libclang] Add support for querying cursor availabilityJonathan Coe2017-10-161-0/+25
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 315959
* [libclang] Visit attributes for function and class templatesJonathan Coe2017-10-161-0/+20
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 315958
* bindings: expose Linkage to the python bindingsSaleem Abdulrasool2017-09-221-0/+30
| | | | | | | | | Add Python bindings for the 'clang_getCursorLinkage', and tests to validate the functionality. Patch by Masud Rahman! llvm-svn: 314009
* [libclang] Keep track of TranslationUnit instance when annotating tokensJonathan Coe2017-09-211-0/+22
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 313913
* libclang: expose `clang_getCursorTLSKind`Saleem Abdulrasool2017-09-131-0/+37
| | | | | | | | | | 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! llvm-svn: 313111
* Fix __repr__ for Diagnostic in clang.cindexJonathan Coe2017-09-062-0/+35
| | | | | | | | | | | | | | | | 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 llvm-svn: 312622
* [libclang] Support for querying whether an enum is scopedAlex Lorenz2017-07-121-0/+16
| | | | | | | | | | | 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 llvm-svn: 307771
* Revert r307769 (Forgot to mention the name of the contributor).Alex Lorenz2017-07-121-16/+0
| | | | llvm-svn: 307770
* [libclang] Support for querying whether an enum is scopedAlex Lorenz2017-07-121-0/+16
| | | | | | | | | This commit allows checking whether an enum declaration is scoped through libclang and clang.cindex (Python). Differential Revision: https://reviews.llvm.org/D35187 llvm-svn: 307769
* [libclang] Expose typedef and address space functionsSven van Haastregt2017-06-081-0/+17
| | | | | | | | | | | | Expose the following functions: - clang_getTypedefName - clang_getAddressSpace Patch by Simon Perretta. Differential Revision: https://reviews.llvm.org/D33598 llvm-svn: 304978
* Add Python 3 support to clang.cindexJonathan Coe2017-04-201-2/+5
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 300829
* Revert "Support for Python 3 in libclang python bindings"Jonathan Coe2017-01-131-6/+2
| | | | | | | | | This reverts commit 4464581bb63e9789e9ee231a8c8800be5f614743. Memory access issues on Linux were reported by Mathieu Duponchelle and discussed here: https://reviews.llvm.org/D26082. llvm-svn: 291907
* [libclang] Fix python testsSergey Kalinichev2016-12-032-2/+2
| | | | | | It was broken in r286421 llvm-svn: 288582
* Support for Python 3 in libclang python bindingsJonathan Coe2016-11-031-2/+6
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 285909
* [libclang] Fix a failure in a test for python bindings on ↵Igor Kudrin2016-10-181-1/+2
| | | | | | | | | | CursorKind.OVERLOAD_CANDIDATE. The test fails because the value does not lay in any existing group. Differential Revision: https://reviews.llvm.org/D25470 llvm-svn: 284463
* python: add bindings for children of diagnosticsSaleem Abdulrasool2016-04-301-0/+12
| | | | | | | | | | | | | 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! llvm-svn: 268167
* Expose cxx constructor and method properties through libclang and python ↵Jonathan Coe2016-04-271-0/+82
| | | | | | | | | | | | | | | | | | | | | | | 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
* python binding: expose compile command filenameGuillaume Papin2016-03-071-5/+12
| | | | | | | | Reviewers: compnerd, skalinichev Differential Revision: http://reviews.llvm.org/D17278 llvm-svn: 262845
* [libclang] Visit TypeAliasTemplateDeclSergey Kalinichev2015-11-151-0/+1
| | | | | | | | This makes TypeAliasTemplateDecl accessible via LibClang and python bindings Differential Revision: http://reviews.llvm.org/D13844 llvm-svn: 253166
* Index: expose is_mutable_fieldSaleem Abdulrasool2015-10-271-0/+15
| | | | | | | | Expose isMutable via libClang and python bindings. Patch by Jonathan B Coe! llvm-svn: 251410
* bindings: add new C++ function attribute accessorsSaleem Abdulrasool2015-10-121-0/+45
| | | | | | | | | 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
* [libclang] Return deduced type for auto type, not the one written in the source.Manuel Klimek2015-09-031-2/+2
| | | | | | | | | | | | 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
* [libclang] Add functions to get information about fields.Argyrios Kyrtzidis2015-04-131-6/+15
| | | | | | Patch by Loïc Jaquemet! llvm-svn: 234762
* This reverts commit r227432, r227438 and r227448.Rafael Espindola2015-01-291-15/+6
| | | | | | | | | | | | | | | | | | | | | | | 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
* libclang: Add three functions useful for dealing with anonymous fields:Francois Pichet2015-01-291-6/+15
| | | | | | | | | | | 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
OpenPOWER on IntegriCloud