aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/c-index-test/c-index-test.c
AgeCommit message (Collapse)AuthorFilesLines
2018-08-03[libclang 6/8] Add support for reading implicit attributesMichael Wu1-0/+22
Summary: Having access to implicit attributes is sometimes useful so users of libclang don't have to duplicate some of the logic in sema. This depends on D49081 since it also adds a CXTranslationUnit flag. Reviewers: yvvan, jbcoe Reviewed By: yvvan Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49631 llvm-svn: 338815
2018-08-03[libclang 4/8] Add the clang_Type_getNullability() APIMichael Wu1-0/+28
Summary: This patch adds a clang-c API for querying the nullability of an AttributedType. The test here also tests D49081 Reviewers: yvvan, jbcoe Reviewed By: yvvan Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49082 llvm-svn: 338809
2018-08-03[libclang 1/8] Add support for ObjCObjectTypeMichael Wu1-1/+36
Summary: This patch adds support to the clang-c API for identifying ObjCObjects in CXTypes, enumerating type args and protocols on ObjCObjectTypes, and retrieving the base type of ObjCObjectTypes. Currently only ObjCInterfaceTypes are exposed, which do not have type args or protocols. Reviewers: yvvan, jbcoe Reviewed By: yvvan Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49063 llvm-svn: 338804
2018-07-20[Index] Set OrigD before D is changed.Eric Liu1-0/+2
Reviewers: akyrtzi, arphaman Reviewed By: akyrtzi Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49476 llvm-svn: 337529
2018-06-13[libclang] Make c-index-test.c ISO C90 compliant.Matt Morehouse1-1/+1
Fixes a build bot breakage caused by r334593. llvm-svn: 334612
2018-06-13[libclang] Optionally add code completion results for arrow instead of dotIvan Donchevskii1-5/+45
Follow up for D41537 - libclang part. Differential Revision: https://reviews.llvm.org/D46862 llvm-svn: 334593
2018-05-17[libclang] Allow skipping function bodies in preamble onlyIvan Donchevskii1-0/+2
Second attempt. Fix line endings and warning. As an addition to CXTranslationUnit_SkipFunctionBodies, provide the new option CXTranslationUnit_LimitSkipFunctionBodiesToPreamble, which constraints the skipping of functions bodies to the preamble only. Function bodies in the main file are not affected if this option is set. Skipping function bodies only in the preamble is what clangd already does and the introduced flag implements it for libclang clients. Patch by Nikolai Kosjar. Differential Revision: https://reviews.llvm.org/D45815 llvm-svn: 332587
2018-05-17Revert https://reviews.llvm.org/D46050 and https://reviews.llvm.org/D45815Ivan Donchevskii1-8/+6
Windows line endings. Requires proper resubmission. llvm-svn: 332585
2018-05-17[libclang] Allow skipping function bodies in preamble onlyIvan Donchevskii1-6/+8
As an addition to CXTranslationUnit_SkipFunctionBodies, provide the new option CXTranslationUnit_LimitSkipFunctionBodiesToPreamble, which constraints the skipping of functions bodies to the preamble only. Function bodies in the main file are not affected if this option is set. Skipping function bodies only in the preamble is what clangd already does and the introduced flag implements it for libclang clients. Patch by Nikolai Kosjar. Differential Revision: https://reviews.llvm.org/D45815 llvm-svn: 332578
2018-05-09Remove \brief commands from doxygen comments.Adrian Prantl1-2/+2
This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
2018-04-06Fix typos in clangAlexander Kornienko1-1/+1
Found via codespell -q 3 -I ../clang-whitelist.txt Where whitelist consists of: archtype cas classs checkk compres definit frome iff inteval ith lod methode nd optin ot pres statics te thru Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few files that have dubious fixes reverted.) Differential revision: https://reviews.llvm.org/D44188 llvm-svn: 329399
2018-02-21Clean up use of C allocation functionsSerge Pavlov1-0/+14
If the value returned by `malloc`, `calloc` or `realloc` is not checked for null pointer, this change replaces them for `safe_malloc`, `safe_calloc` or `safe_realloc`, which are defined in the namespace `llvm`. These function report fatal error on out of memory. In the plain C files, assertion statements are added to ensure that memory is successfully allocated. The aim of this change is to get better diagnostics of OOM on Windows. Differential Revision: https://reviews.llvm.org/D43017 llvm-svn: 325661
2018-02-12[libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfoFangrui Song1-2/+25
Summary: CXIdxEntityRefInfo contains the member `CXIdxEntityRefKind kind;` to differentiate implicit and direct calls. However, there are more roles defined in SymbolRole. Among them, `Read/Write` are probably the most useful ones as they can be used to differentiate Read/Write occurrences of a symbol for document highlight in a text document. See `export namespace DocumentHighlightKind` on https://microsoft.github.io/language-server-protocol/specification Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42895 llvm-svn: 324914
2018-01-18c-index-test: small fix to CXString handling and disposalSteve O'Brien1-17/+19
Summary: (Separating some unrelated changes out of D42043) Reviewers: vsk, benlangmuir, akyrtzi Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42259 llvm-svn: 322883
2018-01-18Convert comment to C-style to prevent warningSam Clegg1-1/+1
llvm-svn: 322880
2018-01-18Fix MSVC "uninitialized variable" warning.Simon Pilgrim1-1/+4
llvm-svn: 322845
2018-01-17[Index] Fix GCC warning again :-(Sam McCall1-2/+2
llvm-svn: 322720
2018-01-17[Index] Fix GCC warning. This is silly, but no llvm_unreachable and no C99.Sam McCall1-1/+3
llvm-svn: 322672
2018-01-16Squash -Wcovered-switch-default wairningSam McCall1-2/+1
llvm-svn: 322549
2018-01-16[libclang] Add PrintingPolicy for pretty printing declarationsJonathan Coe1-6/+98
Summary: Introduce clang_getCursorPrettyPrinted() for pretty printing declarations. Expose also PrintingPolicy, so the user gets more fine-grained control of the entities being printed. The already existing clang_getCursorDisplayName() is pretty limited - for example, it does not handle return types, parameter names or default arguments for function declarations. Addressing these issues in clang_getCursorDisplayName() would mean to duplicate existing code (e.g. clang::DeclPrinter), so rather expose new API to access the existing functionality. Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by nik (Nikolai Kosjar) Differential Revision: https://reviews.llvm.org/D39903 llvm-svn: 322540
2018-01-12[CodeComplete] Add an option to omit results from the preamble.Sam McCall1-0/+2
Summary: Enumerating the contents of a namespace or global scope will omit any decls that aren't already loaded, instead of deserializing them from the PCH. This allows a fast hybrid code completion where symbols from headers are provided by an external index. (Sema already exposes the information needed to do a reasonabl job of filtering them). Clangd plans to implement this hybrid. This option is just a hint - callers still need to postfilter results if they want to *avoid* completing decls outside the main file. Reviewers: bkramer, ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41989 llvm-svn: 322371
2018-01-04[libclang] Support querying whether a declaration is invalidIvan Donchevskii1-0/+2
This is useful for e.g. highlighting purposes in an IDE. Note: First version of this patch was reverted due to failing tests in opencl-types.cl with -target ppc64le-unknown-linux. These tests are adapted now. Patch by Nikolai Kosjar. Differential Revision: https://reviews.llvm.org/D40072 llvm-svn: 321794
2018-01-03Revert r321697 "[libclang] Support querying whether a declaration is ↵Hans Wennborg1-2/+0
invalid" and follow-ups. This broke test/Index/opencl-types.cl on several buildbots: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/3294 http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/6498 http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/5239 > [libclang] Support querying whether a declaration is invalid > > This is useful for e.g. highlighting purposes in an IDE. > > Patch by Nikolai Kosjar. > > Differential Revision: https://reviews.llvm.org/D40072 Also reverting follow-ups that otherwise caused conflicts for the revert: r321700 "Fix line endings." r321701 "Fix more line endings." r321698 "[libclang] Fix cursors for functions with trailing return type" > For the function declaration > > auto foo5(Foo) -> Foo; > the parameter tokens were mapped to cursors representing the > FunctionDecl: > > Keyword: "auto" [1:1 - 1:5] FunctionDecl=test5:1:6 > Identifier: "test5" [1:6 - 1:11] FunctionDecl=test5:1:6 > Punctuation: "(" [1:11 - 1:12] FunctionDecl=test5:1:6 > Identifier: "X" [1:12 - 1:13] FunctionDecl=test5:1:6 // Ops, not a TypeRef > Punctuation: ")" [1:13 - 1:14] FunctionDecl=test5:1:6 > Punctuation: "->" [1:15 - 1:17] FunctionDecl=test5:1:6 > Identifier: "X" [1:18 - 1:19] TypeRef=struct X:7:8 > Punctuation: ";" [1:19 - 1:20] > > Fix this by ensuring that the trailing return type is not visited as > first. > > Patch by Nikolai Kosjar. > > Differential Revision: https://reviews.llvm.org/D40561 llvm-svn: 321708
2018-01-03Fix line endings.Ivan Donchevskii1-8/+8
llvm-svn: 321700
2018-01-03[libclang] Support querying whether a declaration is invalidIvan Donchevskii1-6/+8
This is useful for e.g. highlighting purposes in an IDE. Patch by Nikolai Kosjar. Differential Revision: https://reviews.llvm.org/D40072 llvm-svn: 321697
2017-12-14[libclang] Add support for checking abstractness of recordsAlex Lorenz1-0/+2
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
2017-12-07[libclang] Record code-completion invocations to a temporary file whenAlex Lorenz1-2/+6
requested by client This is a follow up to r319702 which records parsing invocations. These files are not emitted by default, and the client has to specify the invocation emission path first. rdar://35322543 llvm-svn: 320085
2017-12-04[libclang] Record parsing invocation to a temporary file when requestedAlex Lorenz1-0/+4
by client This patch extends libclang by allowing it to record parsing operations to a temporary JSON file. The file is deleted after parsing succeeds. When a crash happens during parsing, the file is preserved and the client will be able to use it to generate a reproducer for the crash. These files are not emitted by default, and the client has to specify the invocation emission path first. rdar://35322543 Differential Revision: https://reviews.llvm.org/D40527 llvm-svn: 319702
2017-09-22[index] Generate class & metaclass manglings for objcDave Lee1-4/+13
Summary: ObjC classes have two associated symbols, one for the class and one for the metaclass. This change overloads `CodegenNameGenerator::getAllManglings` to produce both class and metaclass symbols. While this function is called by `clang_Cursor_getCXXManglings`, it's only called for CXXRecordDecl and CXXMethodDecl, and so libclang's behavior is unchanged. Reviewers: arphaman, abdulras, alexshap, compnerd Reviewed By: compnerd Subscribers: compnerd Differential Revision: https://reviews.llvm.org/D37671 llvm-svn: 313997
2017-07-12[libclang] Support for querying whether an enum is scopedAlex Lorenz1-0/+2
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
2017-07-12Revert r307769 (Forgot to mention the name of the contributor).Alex Lorenz1-2/+0
llvm-svn: 307770
2017-07-12[libclang] Support for querying whether an enum is scopedAlex Lorenz1-0/+2
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
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