aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/c-index-test/c-index-test.c
AgeCommit message (Collapse)AuthorFilesLines
2017-06-27[libclang] Support for querying the exception specification type through ↵Jonathan Coe1-0/+31
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 llvm-svn: 306483
2017-06-09[libclang] Introduce a new parsing option ↵Argyrios Kyrtzidis1-0/+30
'CXTranslationUnit_SingleFileParse' that puts preprocessor in a mode for parsing a single file only. This is useful for parsing a single file, as a fast/inaccurate 'mode' that can still provide declarations from the file, like the classes and their methods. llvm-svn: 305044
2017-05-30[libclang] Allow to suspend a translation unit.Erik Verbruggen1-0/+2
A suspended translation unit uses significantly less memory but on the other side does not support any other calls than clang_reparseTranslationUnit to resume it or clang_disposeTranslationUnit to dispose it completely. This helps IDEs to reduce the memory footprint. The data that is freed by a call to clang_suspendTranslationUnit will be re-generated on the next (re)parse anyway. Used with a preamble, this allows pretty fast resumption of the translation unit for further use (compared to disposal of the translation unit and a parse from scratch). Patch by Nikolai Kosjar! llvm-svn: 304212
2017-05-10[libclang] Introduce clang_Cursor_isExternalSymbol that provides info about ↵Argyrios Kyrtzidis1-0/+13
decls marked with external_source_symbol attribute llvm-svn: 302677
2017-04-28[libclang] Expose some target information via the C API.Emilio Cobos Alvarez1-2/+50
This allows users to query the target triple and target pointer width, which would make me able to fix https://github.com/servo/rust-bindgen/issues/593 and other related bugs in an elegant way (without having to manually parse the target triple in the command line arguments). Differential Revision: https://reviews.llvm.org/D32389 llvm-svn: 301648
2017-04-27[libclang] Enhance clang_Cursor_isDynamicCall and ↵Argyrios Kyrtzidis1-4/+7
clang_Cursor_getReceiverType to handle ObjC property references Also enhance clang_Cursor_getReceiverType to handle C++ method calls. llvm-svn: 301568
2017-04-24[index] If the 'external_source_symbol' attribute indicates 'Swift' as the ↵Argyrios Kyrtzidis1-0/+1
language then report it accordingly llvm-svn: 301183
2017-03-21[c-index-test] Fix memory leak in c-index-test tool.Argyrios Kyrtzidis1-0/+1
llvm-svn: 298441
2017-03-21[index/AST] Determine if a typedef shares a name and spelling location with ↵Argyrios Kyrtzidis1-0/+9
its underlying tag type In such a case, as when using the NS_ENUM macro, for indexing purposes treat the typedef as 'transparent', meaning we treat its references as symbols of the underlying tag symbol. Also provide a libclang API to check for such typedefs. llvm-svn: 298392
2017-02-23[c-index-test] For the 'core' invocation, avoid running it under a new thread.Argyrios Kyrtzidis1-3/+3
It's unnecessary. llvm-svn: 295934
2016-12-16[libclang] Restore the CXXRecordDecl path for ↵Argyrios Kyrtzidis1-15/+22
clang_Type_getNumTemplateArguments and clang_Type_getTemplateArgumentAsType Patch by Emilio Cobos Álvarez! See https://reviews.llvm.org/D26907 llvm-svn: 289995
2016-12-01[libclang] Add APIs to check the result of an integer expression in ↵Argyrios Kyrtzidis1-2/+8
CXEvalResult without overflow Patch by Emilio Cobos Álvarez! See https://reviews.llvm.org/D26788 llvm-svn: 288438
2016-07-30[c-index-test] Make sure to check that clang_Cursor_getNumTemplateArguments ↵Argyrios Kyrtzidis1-2/+5
did not return -1. llvm-svn: 277261
2016-06-09Update to match LLVM r272232.Richard Smith1-4/+1
llvm-svn: 272233
2016-05-31Indexer: add CXObjCPropertyAttr_class for class properties.Manman Ren1-0/+1
rdar://25963227 llvm-svn: 271351
2016-05-31clang-c: Add the clang_getCursorVisibility() APIEhsan Akhgari1-0/+30
This patch adds an API for querying the visibility of the entity referred to by a cursor. Patch by Michael Wu <mwu@mozilla.com>. llvm-svn: 271292
2016-05-31Revert r253909 because it was committed with an incorrect messageEhsan Akhgari1-30/+0
llvm-svn: 271291
2016-05-03[scan-build] fix dead store warnings emitted on clang code baseDavid Blaikie1-2/+2
This fixes dead store warnings of the type "dead assignment" reported by CLang Static Analyzer on the following file: - tools/c-index-test/c-index-test.c. Patch by Apelete Seketeli <apelete@seketeli.net>! Differential Revision: http://reviews.llvm.org/D19831 llvm-svn: 268453
2016-04-27Expose cxx constructor and method properties through libclang and python ↵Jonathan Coe1-1/+12
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-03[c-index-test] Fix leak in print_completion_result, NFCVedant Kumar1-3/+5
llvm-svn: 265252
2016-03-30[c-index-test] Delete dead function, NFCVedant Kumar1-19/+0
llvm-svn: 264874
2016-03-01Optionally demote fatal errors to non-fatal errors.Manuel Klimek1-0/+2
This behavior is enabled when the new CXTranslationUnit_KeepGoing option is passed to clang_parseTranslationUnit{,2}. It is geared towards use by IDEs and similar consumers of the clang-c API where fatal errors may arise when parsing incomplete code mid-edit, or when include paths are not properly configured yet. In such situations one still wants to get as much information as possible about a TU. Previously, the semantic analysis would not instantiate templates or report additional fatal errors after the first fatal error was encountered. Fixes PR24268. Patch by Milian Wolff. llvm-svn: 262318
2016-02-14[index] Enhance c-index-test tool and have it link and test the clangIndex ↵Argyrios Kyrtzidis1-4/+16
library directly. llvm-svn: 260842
2016-01-16[libclang] Introduce APIs for evaluating a cursor and checking if a macro is ↵Argyrios Kyrtzidis1-70/+195
builtin/function. rdar://24091595 llvm-svn: 257968
2016-01-07[libclang] Handle AutoType in clang_getTypeDeclarationSergey Kalinichev1-0/+20
Differential Revision: http://reviews.llvm.org/D13001 llvm-svn: 257043
2016-01-06Show inclusions from a preamble in clang_getInclusions.Erik Verbruggen1-0/+21
When reparsing a translation unit with preamble generation turned on, no includes are found. This is due to the fact that all SLocs from AST/PCH files are skipped as they are 'loaded', and inclusions from a preamble are also 'loaded'. So, in case a file has a preamble, it first needs to process those loaded inclusions, and then check for any local inclusions. This latter one is for any includes that are not part of the preamble, like includes half-way through a file. This fixes PR24748. Differential Revision: http://reviews.llvm.org/D14329 llvm-svn: 256939
2015-12-15[libclang] Add a flag to create the precompiled preamble on the first parse.Benjamin Kramer1-1/+3
Summary: The current default is to create the preamble on the first reparse, aka second parse. This is useful for clients that do not want to block when opening a file because serializing the preamble takes a bit of time. However, this makes the reparse much more expensive and that may be on the critical path as it's the first interaction a user has with the source code. YouCompleteMe currently optimizes for the first code interaction by parsing the file twice when loaded. That's just unnecessarily slow and this flag helps to avoid that. Reviewers: doug.gregor, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15490 llvm-svn: 255635
2015-11-23Make clang_Cursor_getMangling not mangle if the declaration isn't mangledEhsan Akhgari1-0/+30
Right now clang_Cursor_getMangling will attempt to mangle any declaration, even if the declaration isn't mangled (extern C). This results in a partially mangled name which isn't useful for much. This patch makes clang_Cursor_getMangling return an empty string if the declaration isn't mangled. Patch by Michael Wu <mwu@mozilla.com>. llvm-svn: 253909
2015-11-12libclang: add clang_Cursor_getCXXManglingsSaleem Abdulrasool1-0/+21
This function permits the mangling of a C++ 'structor. Depending on the ABI and the declaration, the declaration may contain more than one associated symbol for a given declaration. This allows the consumer to retrieve all of the associated symbols for the declaration the cursor points to. llvm-svn: 252853
2015-10-27Index: expose is_mutable_fieldSaleem Abdulrasool1-0/+2
Expose isMutable via libClang and python bindings. Patch by Jonathan B Coe! llvm-svn: 251410
2015-10-08Fix a -Wdeclaration-after-statement warning.Craig Topper1-1/+1
llvm-svn: 249652
2015-10-08Make clang_Cursor_getMangling not mangle if the declaration isn't mangledEhsan Akhgari1-0/+2
Right now clang_Cursor_getMangling will attempt to mangle any declaration, even if the declaration isn't mangled (extern C). This results in a partially mangled name which isn't useful for much. This patch makes clang_Cursor_getMangling return an empty string if the declaration isn't mangled. Patch by Michael Wu <mwu@mozilla.com>. llvm-svn: 249639
2015-10-06Revert r249437Ehsan Akhgari1-2/+0
llvm-svn: 249440
2015-10-06Make clang_Cursor_getMangling don't mangle if the declaration isn't mangledEhsan Akhgari1-0/+2
Right now clang_Cursor_getMangling will attempt to mangle any declaration, even if the declaration isn't mangled (extern "C"). This results in a partially mangled name which isn't useful for much. This patch makes clang_Cursor_getMangling return an empty string if the declaration isn't mangled. Patch by Michael Wu <mwu@mozilla.com>. llvm-svn: 249437
2015-08-04[UB] Avoid a really broken call to realloc that would later result inChandler Carruth1-0/+11
a bad call to memcpy. When we only have a buffer from one of the two reparse calls, we can just return that buffer rather than going through the realloc/memcpy dance. Found with UBsan. llvm-svn: 243950
2015-06-18Fix a typo.Adrian Prantl1-1/+1
llvm-svn: 240025
2015-05-14Revert r237339 as sanitizer-ppc64-linux1 does not like it.Yaron Keren1-7/+6
Complains: /home/buildbots/sanitizerslave1/sanitizer-ppc64-1/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:829:30: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat] I, TAK, clang_Cursor_getTemplateArgumentValue(Cursor, I)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I'm not sure now how this should be fixed. %lld is non-standard and not accepted by mingw on Windows while PRId64 is bad for this bot. Is long long longer than 64 bits here? if not, why is PRId64 incompatible with it? something seems wrong. Probably all the datatypes should be replaced to unsigned or uint64_t depending upin requirements instead of the non standard long long. llvm-svn: 237346
2015-05-14Replace non-standard %lld printf usage with PRId64.Yaron Keren1-6/+7
See also r180024. llvm-svn: 237339
2015-04-13[libclang] Add functions to get information about fields.Argyrios Kyrtzidis1-18/+41
Patch by Loïc Jaquemet! llvm-svn: 234762
2015-01-29This reverts commit r227432, r227438 and r227448.Rafael Espindola1-41/+18
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-29libclang: Add three functions useful for dealing with anonymous fields:Francois Pichet1-18/+41
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
2014-10-10Add libclang capabilities to retriete template arguments from specializations.Eli Bendersky1-2/+29
Includes Python bindings. Reviewed in http://reviews.llvm.org/D5621 Patch by Rob Springer llvm-svn: 219529
2014-08-18Fix a memory leak in one of the test unit. Silent coverity warning CID 1095912Sylvestre Ledru1-0/+1
llvm-svn: 215898
2014-08-01Fix a memory leak - dispose of the CXString after printing it in mangling.Eli Bendersky1-0/+1
Thanks to kcc@ for noticing. llvm-svn: 214506
2014-07-31Exposes a C API to name mangling for a given cursor.Eli Bendersky1-0/+15
Inspired by https://gist.github.com/tritao/2766291, and was previously discussed on cfe-dev: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-June/037577.html Adding testing capability via c-index-test. llvm-svn: 214410
2014-06-06Fix C++ style // comments in a couple of C filesTimur Iskhodzhanov1-2/+2
llvm-svn: 210325
2014-06-05Flush C stdio streams upon process terminationReid Kleckner1-3/+9
Due to what can only be described as a CRT bug, stdout and amazingly even stderr are not always flushed upon process termination, especially when the system is under high threading pressure. I have found two repros for this: 1) In lib\Support\Threading.cpp, change sys::Mutex to an std::recursive_mutex and run check-clang. Usually between 30 and 40 tests will fail. 2) Add OutputDebugStrings in code that runs during static initialization and static shutdown. This will sometimes generate similar failures. After a substantial amount of troubleshooting and debugging, I found that I could reproduce this from the command line without running check-clang. Simply make the mutex change described in #1, then manually run the following command many times by running it once, then pressing Up -> Enter very quickly: D:\src\llvm\build\vs2013\Debug\bin\c-index-test.EXE -cursor-at=D:\src\llvm\tools\clang\test\Index\targeted-preamble.h:2:15 D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -include D:\src\llvm\build\vs2013\tools\clang\test\Index\Output\targeted-cursor.c.tmp.h -Xclang -error-on-deserialized-decl=NestedVar1 -Xclang -error-on-deserialized-decl=TopVar | D:\src\llvm\build\vs2013\Debug\bin\FileCheck.EXE D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -check-prefix=PREAMBLE-CURSOR1 Sporadically they will fail, and attaching a debugger to a failed instance indicates that stdin of FileCheck.exe is empty. Note that due to the repro in #2, we can rule out a bug in the STL's mutex implementation, and instead conclude that this is a real flake in the windows test harness. Test Plan: Without patch: Ran check-clang 10 times and saw over 30 Unexpected failures on every run. With patch: Ran check-clang 10 times and saw 0 unexpected failures across all runs. Reviewers: rnk Differential Revision: http://reviews.llvm.org/D4021 Patch by Zachary Turner! llvm-svn: 210225
2014-06-04Remove the last remaining llvm/Config/config.h includesAlp Toker1-1/+1
This corrects long-standing misuses of LLVM's internal config.h. In most cases the public llvm-config.h header was intended and we can now remove the old hacks thanks to LLVM r210144. The config.h header is private, won't be installed and should no longer be included by clang or other modules. llvm-svn: 210145
2014-05-15[libclang] Introduce clang_Module_isSystem(), which returns non-zero if the ↵Argyrios Kyrtzidis1-2/+2
given CXModule is a system one. llvm-svn: 208846
2014-05-14[liblang] Introduce clang_getModuleForFile, which given a CXFile header ↵Argyrios Kyrtzidis1-1/+15
file, returns the module that contains it, if one exists. llvm-svn: 208822