| Ted Kremenek | b60d87c | 2009-08-26 22:36:44 +0000 | [diff] [blame] | 1 | /*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\ | 
|  | 2 | |*                                                                            *| | 
|  | 3 | |*                     The LLVM Compiler Infrastructure                       *| | 
|  | 4 | |*                                                                            *| | 
|  | 5 | |* This file is distributed under the University of Illinois Open Source      *| | 
|  | 6 | |* License. See LICENSE.TXT for details.                                      *| | 
|  | 7 | |*                                                                            *| | 
|  | 8 | |*===----------------------------------------------------------------------===*| | 
|  | 9 | |*                                                                            *| | 
| Marc-Andre Laperle | f9abd40 | 2017-06-16 20:58:26 +0000 | [diff] [blame] | 10 | |* This header provides a public interface to a Clang library for extracting  *| | 
| Ted Kremenek | b60d87c | 2009-08-26 22:36:44 +0000 | [diff] [blame] | 11 | |* high-level symbol information from source files without exposing the full  *| | 
|  | 12 | |* Clang C++ API.                                                             *| | 
|  | 13 | |*                                                                            *| | 
|  | 14 | \*===----------------------------------------------------------------------===*/ | 
|  | 15 |  | 
| Benjamin Kramer | 2f5db8b | 2014-08-13 16:25:19 +0000 | [diff] [blame] | 16 | #ifndef LLVM_CLANG_C_INDEX_H | 
|  | 17 | #define LLVM_CLANG_C_INDEX_H | 
| Ted Kremenek | b60d87c | 2009-08-26 22:36:44 +0000 | [diff] [blame] | 18 |  | 
| Chandler Carruth | aacafe5 | 2009-12-17 09:27:29 +0000 | [diff] [blame] | 19 | #include <time.h> | 
| Steve Naroff | 6231f18 | 2009-10-27 14:35:18 +0000 | [diff] [blame] | 20 |  | 
| Arnaud A. de Grandmaison | 0271b32 | 2012-06-28 22:01:06 +0000 | [diff] [blame] | 21 | #include "clang-c/Platform.h" | 
| Argyrios Kyrtzidis | 0b9682e | 2014-02-25 03:59:23 +0000 | [diff] [blame] | 22 | #include "clang-c/CXErrorCode.h" | 
| Arnaud A. de Grandmaison | 0271b32 | 2012-06-28 22:01:06 +0000 | [diff] [blame] | 23 | #include "clang-c/CXString.h" | 
| Argyrios Kyrtzidis | 09a439d | 2014-02-25 03:59:16 +0000 | [diff] [blame] | 24 | #include "clang-c/BuildSystem.h" | 
| Arnaud A. de Grandmaison | 0271b32 | 2012-06-28 22:01:06 +0000 | [diff] [blame] | 25 |  | 
| Argyrios Kyrtzidis | 1c4db8d | 2012-11-06 21:21:49 +0000 | [diff] [blame] | 26 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 27 | * The version constants for the libclang API. | 
| Argyrios Kyrtzidis | 1c4db8d | 2012-11-06 21:21:49 +0000 | [diff] [blame] | 28 | * CINDEX_VERSION_MINOR should increase when there are API additions. | 
|  | 29 | * CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes. | 
|  | 30 | * | 
|  | 31 | * The policy about the libclang API was always to keep it source and ABI | 
| Ivan Donchevskii | 65c766e | 2018-01-03 10:40:11 +0000 | [diff] [blame] | 32 | * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. | 
|  | 33 | */ | 
|  | 34 | #define CINDEX_VERSION_MAJOR 0 | 
| Fangrui Song | 31b9719 | 2018-02-12 17:42:09 +0000 | [diff] [blame] | 35 | #define CINDEX_VERSION_MINOR 48 | 
| Ivan Donchevskii | 65c766e | 2018-01-03 10:40:11 +0000 | [diff] [blame] | 36 |  | 
|  | 37 | #define CINDEX_VERSION_ENCODE(major, minor) ( \ | 
|  | 38 | ((major) * 10000)                       \ | 
| Argyrios Kyrtzidis | 5b216ed | 2012-10-29 23:24:44 +0000 | [diff] [blame] | 39 | + ((minor) *     1)) | 
|  | 40 |  | 
|  | 41 | #define CINDEX_VERSION CINDEX_VERSION_ENCODE( \ | 
|  | 42 | CINDEX_VERSION_MAJOR,                     \ | 
|  | 43 | CINDEX_VERSION_MINOR ) | 
|  | 44 |  | 
|  | 45 | #define CINDEX_VERSION_STRINGIZE_(major, minor)   \ | 
|  | 46 | #major"."#minor | 
|  | 47 | #define CINDEX_VERSION_STRINGIZE(major, minor)    \ | 
|  | 48 | CINDEX_VERSION_STRINGIZE_(major, minor) | 
|  | 49 |  | 
|  | 50 | #define CINDEX_VERSION_STRING CINDEX_VERSION_STRINGIZE( \ | 
|  | 51 | CINDEX_VERSION_MAJOR,                               \ | 
|  | 52 | CINDEX_VERSION_MINOR) | 
|  | 53 |  | 
| Ted Kremenek | b60d87c | 2009-08-26 22:36:44 +0000 | [diff] [blame] | 54 | #ifdef __cplusplus | 
|  | 55 | extern "C" { | 
|  | 56 | #endif | 
|  | 57 |  | 
| Douglas Gregor | 4a4e0eb | 2011-02-23 17:45:25 +0000 | [diff] [blame] | 58 | /** \defgroup CINDEX libclang: C Interface to Clang | 
| Douglas Gregor | 52606ff | 2010-01-20 01:10:47 +0000 | [diff] [blame] | 59 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 60 | * The C Interface to Clang provides a relatively small API that exposes | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 61 | * facilities for parsing source code into an abstract syntax tree (AST), | 
|  | 62 | * loading already-parsed ASTs, traversing the AST, associating | 
|  | 63 | * physical source locations with elements within the AST, and other | 
|  | 64 | * facilities that support Clang-based development tools. | 
| Douglas Gregor | 52606ff | 2010-01-20 01:10:47 +0000 | [diff] [blame] | 65 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 66 | * This C interface to Clang will never provide all of the information | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 67 | * representation stored in Clang's C++ AST, nor should it: the intent is to | 
|  | 68 | * maintain an API that is relatively stable from one release to the next, | 
|  | 69 | * providing only the basic functionality needed to support development tools. | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 70 | * | 
|  | 71 | * To avoid namespace pollution, data types are prefixed with "CX" and | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 72 | * functions are prefixed with "clang_". | 
| Douglas Gregor | 52606ff | 2010-01-20 01:10:47 +0000 | [diff] [blame] | 73 | * | 
|  | 74 | * @{ | 
|  | 75 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 76 |  | 
| Douglas Gregor | 802f12f | 2010-01-20 22:28:27 +0000 | [diff] [blame] | 77 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 78 | * An "index" that consists of a set of translation units that would | 
| Douglas Gregor | 802f12f | 2010-01-20 22:28:27 +0000 | [diff] [blame] | 79 | * typically be linked together into an executable or library. | 
|  | 80 | */ | 
|  | 81 | typedef void *CXIndex; | 
| Steve Naroff | d5e8e86 | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 82 |  | 
| Douglas Gregor | 802f12f | 2010-01-20 22:28:27 +0000 | [diff] [blame] | 83 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 84 | * An opaque type representing target information for a given translation | 
| Emilio Cobos Alvarez | 485ad42 | 2017-04-28 15:56:39 +0000 | [diff] [blame] | 85 | * unit. | 
|  | 86 | */ | 
|  | 87 | typedef struct CXTargetInfoImpl *CXTargetInfo; | 
|  | 88 |  | 
|  | 89 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 90 | * A single translation unit, which resides in an index. | 
| Douglas Gregor | 802f12f | 2010-01-20 22:28:27 +0000 | [diff] [blame] | 91 | */ | 
| Ted Kremenek | 7df92ae | 2010-11-17 23:24:11 +0000 | [diff] [blame] | 92 | typedef struct CXTranslationUnitImpl *CXTranslationUnit; | 
| Steve Naroff | d5e8e86 | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 93 |  | 
| Douglas Gregor | 802f12f | 2010-01-20 22:28:27 +0000 | [diff] [blame] | 94 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 95 | * Opaque pointer representing client data that will be passed through | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 96 | * to various callbacks and visitors. | 
| Douglas Gregor | 802f12f | 2010-01-20 22:28:27 +0000 | [diff] [blame] | 97 | */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 98 | typedef void *CXClientData; | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 99 |  | 
| Douglas Gregor | 9485bf9 | 2009-12-02 09:21:34 +0000 | [diff] [blame] | 100 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 101 | * Provides the contents of a file that has not yet been saved to disk. | 
| Douglas Gregor | 9485bf9 | 2009-12-02 09:21:34 +0000 | [diff] [blame] | 102 | * | 
|  | 103 | * Each CXUnsavedFile instance provides the name of a file on the | 
|  | 104 | * system along with the current contents of that file that have not | 
|  | 105 | * yet been saved to disk. | 
|  | 106 | */ | 
|  | 107 | struct CXUnsavedFile { | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 108 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 109 | * The file whose contents have not yet been saved. | 
| Douglas Gregor | 9485bf9 | 2009-12-02 09:21:34 +0000 | [diff] [blame] | 110 | * | 
|  | 111 | * This file must already exist in the file system. | 
|  | 112 | */ | 
|  | 113 | const char *Filename; | 
|  | 114 |  | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 115 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 116 | * A buffer containing the unsaved contents of this file. | 
| Douglas Gregor | 9485bf9 | 2009-12-02 09:21:34 +0000 | [diff] [blame] | 117 | */ | 
|  | 118 | const char *Contents; | 
|  | 119 |  | 
|  | 120 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 121 | * The length of the unsaved contents of this buffer. | 
| Douglas Gregor | 9485bf9 | 2009-12-02 09:21:34 +0000 | [diff] [blame] | 122 | */ | 
|  | 123 | unsigned long Length; | 
|  | 124 | }; | 
|  | 125 |  | 
| Peter Collingbourne | 5caf5af | 2010-08-24 00:31:37 +0000 | [diff] [blame] | 126 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 127 | * Describes the availability of a particular entity, which indicates | 
| Peter Collingbourne | 5caf5af | 2010-08-24 00:31:37 +0000 | [diff] [blame] | 128 | * whether the use of this entity will result in a warning or error due to | 
|  | 129 | * it being deprecated or unavailable. | 
|  | 130 | */ | 
| Douglas Gregor | f757a12 | 2010-08-23 23:00:57 +0000 | [diff] [blame] | 131 | enum CXAvailabilityKind { | 
| Peter Collingbourne | 5caf5af | 2010-08-24 00:31:37 +0000 | [diff] [blame] | 132 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 133 | * The entity is available. | 
| Peter Collingbourne | 5caf5af | 2010-08-24 00:31:37 +0000 | [diff] [blame] | 134 | */ | 
| Douglas Gregor | f757a12 | 2010-08-23 23:00:57 +0000 | [diff] [blame] | 135 | CXAvailability_Available, | 
| Peter Collingbourne | 5caf5af | 2010-08-24 00:31:37 +0000 | [diff] [blame] | 136 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 137 | * The entity is available, but has been deprecated (and its use is | 
| Peter Collingbourne | 5caf5af | 2010-08-24 00:31:37 +0000 | [diff] [blame] | 138 | * not recommended). | 
|  | 139 | */ | 
| Douglas Gregor | f757a12 | 2010-08-23 23:00:57 +0000 | [diff] [blame] | 140 | CXAvailability_Deprecated, | 
| Peter Collingbourne | 5caf5af | 2010-08-24 00:31:37 +0000 | [diff] [blame] | 141 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 142 | * The entity is not available; any use of it will be an error. | 
| Peter Collingbourne | 5caf5af | 2010-08-24 00:31:37 +0000 | [diff] [blame] | 143 | */ | 
| Erik Verbruggen | 2e657ff | 2011-10-06 07:27:49 +0000 | [diff] [blame] | 144 | CXAvailability_NotAvailable, | 
|  | 145 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 146 | * The entity is available, but not accessible; any use of it will be | 
| Erik Verbruggen | 2e657ff | 2011-10-06 07:27:49 +0000 | [diff] [blame] | 147 | * an error. | 
|  | 148 | */ | 
|  | 149 | CXAvailability_NotAccessible | 
| Douglas Gregor | f757a12 | 2010-08-23 23:00:57 +0000 | [diff] [blame] | 150 | }; | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 151 |  | 
|  | 152 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 153 | * Describes a version number of the form major.minor.subminor. | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 154 | */ | 
|  | 155 | typedef struct CXVersion { | 
|  | 156 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 157 | * The major version number, e.g., the '10' in '10.7.3'. A negative | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 158 | * value indicates that there is no version number at all. | 
|  | 159 | */ | 
|  | 160 | int Major; | 
|  | 161 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 162 | * The minor version number, e.g., the '7' in '10.7.3'. This value | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 163 | * will be negative if no minor version number was provided, e.g., for | 
|  | 164 | * version '10'. | 
|  | 165 | */ | 
|  | 166 | int Minor; | 
|  | 167 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 168 | * The subminor version number, e.g., the '3' in '10.7.3'. This value | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 169 | * will be negative if no minor or subminor version number was provided, | 
|  | 170 | * e.g., in version '10' or '10.7'. | 
|  | 171 | */ | 
|  | 172 | int Subminor; | 
|  | 173 | } CXVersion; | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 174 |  | 
|  | 175 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 176 | * Describes the exception specification of a cursor. | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 177 | * | 
|  | 178 | * A negative value indicates that the cursor is not a function declaration. | 
|  | 179 | */ | 
|  | 180 | enum CXCursor_ExceptionSpecificationKind { | 
|  | 181 |  | 
|  | 182 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 183 | * The cursor has no exception specification. | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 184 | */ | 
|  | 185 | CXCursor_ExceptionSpecificationKind_None, | 
|  | 186 |  | 
|  | 187 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 188 | * The cursor has exception specification throw() | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 189 | */ | 
|  | 190 | CXCursor_ExceptionSpecificationKind_DynamicNone, | 
|  | 191 |  | 
|  | 192 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 193 | * The cursor has exception specification throw(T1, T2) | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 194 | */ | 
|  | 195 | CXCursor_ExceptionSpecificationKind_Dynamic, | 
|  | 196 |  | 
|  | 197 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 198 | * The cursor has exception specification throw(...). | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 199 | */ | 
|  | 200 | CXCursor_ExceptionSpecificationKind_MSAny, | 
|  | 201 |  | 
|  | 202 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 203 | * The cursor has exception specification basic noexcept. | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 204 | */ | 
|  | 205 | CXCursor_ExceptionSpecificationKind_BasicNoexcept, | 
|  | 206 |  | 
|  | 207 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 208 | * The cursor has exception specification computed noexcept. | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 209 | */ | 
|  | 210 | CXCursor_ExceptionSpecificationKind_ComputedNoexcept, | 
|  | 211 |  | 
|  | 212 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 213 | * The exception specification has not yet been evaluated. | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 214 | */ | 
|  | 215 | CXCursor_ExceptionSpecificationKind_Unevaluated, | 
|  | 216 |  | 
|  | 217 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 218 | * The exception specification has not yet been instantiated. | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 219 | */ | 
|  | 220 | CXCursor_ExceptionSpecificationKind_Uninstantiated, | 
|  | 221 |  | 
|  | 222 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 223 | * The exception specification has not been parsed yet. | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 224 | */ | 
|  | 225 | CXCursor_ExceptionSpecificationKind_Unparsed | 
|  | 226 | }; | 
|  | 227 |  | 
| Douglas Gregor | 802f12f | 2010-01-20 22:28:27 +0000 | [diff] [blame] | 228 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 229 | * Provides a shared context for creating translation units. | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 230 | * | 
|  | 231 | * It provides two options: | 
| Steve Naroff | 531e284 | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 232 | * | 
|  | 233 | * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local" | 
|  | 234 | * declarations (when loading any new translation units). A "local" declaration | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 235 | * is one that belongs in the translation unit itself and not in a precompiled | 
| Steve Naroff | 531e284 | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 236 | * header that was used by the translation unit. If zero, all declarations | 
|  | 237 | * will be enumerated. | 
|  | 238 | * | 
| Steve Naroff | bb4568a | 2009-10-20 16:36:34 +0000 | [diff] [blame] | 239 | * Here is an example: | 
|  | 240 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 241 | * \code | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 242 | *   // excludeDeclsFromPCH = 1, displayDiagnostics=1 | 
|  | 243 | *   Idx = clang_createIndex(1, 1); | 
| Steve Naroff | bb4568a | 2009-10-20 16:36:34 +0000 | [diff] [blame] | 244 | * | 
|  | 245 | *   // IndexTest.pch was produced with the following command: | 
|  | 246 | *   // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch" | 
|  | 247 | *   TU = clang_createTranslationUnit(Idx, "IndexTest.pch"); | 
|  | 248 | * | 
|  | 249 | *   // This will load all the symbols from 'IndexTest.pch' | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 250 | *   clang_visitChildren(clang_getTranslationUnitCursor(TU), | 
| Douglas Gregor | 990b576 | 2010-01-20 21:37:00 +0000 | [diff] [blame] | 251 | *                       TranslationUnitVisitor, 0); | 
| Steve Naroff | bb4568a | 2009-10-20 16:36:34 +0000 | [diff] [blame] | 252 | *   clang_disposeTranslationUnit(TU); | 
|  | 253 | * | 
|  | 254 | *   // This will load all the symbols from 'IndexTest.c', excluding symbols | 
|  | 255 | *   // from 'IndexTest.pch'. | 
| Daniel Dunbar | d015926 | 2010-01-25 00:43:14 +0000 | [diff] [blame] | 256 | *   char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" }; | 
|  | 257 | *   TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args, | 
|  | 258 | *                                                  0, 0); | 
| Douglas Gregor | fed36b1 | 2010-01-20 23:57:43 +0000 | [diff] [blame] | 259 | *   clang_visitChildren(clang_getTranslationUnitCursor(TU), | 
|  | 260 | *                       TranslationUnitVisitor, 0); | 
| Steve Naroff | bb4568a | 2009-10-20 16:36:34 +0000 | [diff] [blame] | 261 | *   clang_disposeTranslationUnit(TU); | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 262 | * \endcode | 
| Steve Naroff | bb4568a | 2009-10-20 16:36:34 +0000 | [diff] [blame] | 263 | * | 
|  | 264 | * This process of creating the 'pch', loading it separately, and using it (via | 
|  | 265 | * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks | 
|  | 266 | * (which gives the indexer the same performance benefit as the compiler). | 
| Steve Naroff | 531e284 | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 267 | */ | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 268 | CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH, | 
|  | 269 | int displayDiagnostics); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 270 |  | 
| Douglas Gregor | 408bb74 | 2010-02-08 23:03:06 +0000 | [diff] [blame] | 271 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 272 | * Destroy the given index. | 
| Douglas Gregor | 408bb74 | 2010-02-08 23:03:06 +0000 | [diff] [blame] | 273 | * | 
|  | 274 | * The index must not be destroyed until all of the translation units created | 
|  | 275 | * within that index have been destroyed. | 
|  | 276 | */ | 
| Daniel Dunbar | 1108966 | 2009-12-03 01:54:28 +0000 | [diff] [blame] | 277 | CINDEX_LINKAGE void clang_disposeIndex(CXIndex index); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 278 |  | 
| Argyrios Kyrtzidis | 7317a5c | 2012-03-28 02:18:05 +0000 | [diff] [blame] | 279 | typedef enum { | 
|  | 280 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 281 | * Used to indicate that no special CXIndex options are needed. | 
| Argyrios Kyrtzidis | 7317a5c | 2012-03-28 02:18:05 +0000 | [diff] [blame] | 282 | */ | 
|  | 283 | CXGlobalOpt_None = 0x0, | 
|  | 284 |  | 
|  | 285 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 286 | * Used to indicate that threads that libclang creates for indexing | 
| Argyrios Kyrtzidis | 7317a5c | 2012-03-28 02:18:05 +0000 | [diff] [blame] | 287 | * purposes should use background priority. | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 288 | * | 
|  | 289 | * Affects #clang_indexSourceFile, #clang_indexTranslationUnit, | 
|  | 290 | * #clang_parseTranslationUnit, #clang_saveTranslationUnit. | 
| Argyrios Kyrtzidis | 7317a5c | 2012-03-28 02:18:05 +0000 | [diff] [blame] | 291 | */ | 
|  | 292 | CXGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1, | 
|  | 293 |  | 
|  | 294 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 295 | * Used to indicate that threads that libclang creates for editing | 
| Argyrios Kyrtzidis | 7317a5c | 2012-03-28 02:18:05 +0000 | [diff] [blame] | 296 | * purposes should use background priority. | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 297 | * | 
|  | 298 | * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt, | 
|  | 299 | * #clang_annotateTokens | 
| Argyrios Kyrtzidis | 7317a5c | 2012-03-28 02:18:05 +0000 | [diff] [blame] | 300 | */ | 
|  | 301 | CXGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2, | 
|  | 302 |  | 
|  | 303 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 304 | * Used to indicate that all threads that libclang creates should use | 
| Argyrios Kyrtzidis | 7317a5c | 2012-03-28 02:18:05 +0000 | [diff] [blame] | 305 | * background priority. | 
|  | 306 | */ | 
|  | 307 | CXGlobalOpt_ThreadBackgroundPriorityForAll = | 
|  | 308 | CXGlobalOpt_ThreadBackgroundPriorityForIndexing | | 
|  | 309 | CXGlobalOpt_ThreadBackgroundPriorityForEditing | 
|  | 310 |  | 
|  | 311 | } CXGlobalOptFlags; | 
|  | 312 |  | 
|  | 313 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 314 | * Sets general options associated with a CXIndex. | 
| Argyrios Kyrtzidis | 7317a5c | 2012-03-28 02:18:05 +0000 | [diff] [blame] | 315 | * | 
|  | 316 | * For example: | 
|  | 317 | * \code | 
|  | 318 | * CXIndex idx = ...; | 
|  | 319 | * clang_CXIndex_setGlobalOptions(idx, | 
|  | 320 | *     clang_CXIndex_getGlobalOptions(idx) | | 
|  | 321 | *     CXGlobalOpt_ThreadBackgroundPriorityForIndexing); | 
|  | 322 | * \endcode | 
|  | 323 | * | 
|  | 324 | * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags. | 
|  | 325 | */ | 
|  | 326 | CINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options); | 
|  | 327 |  | 
|  | 328 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 329 | * Gets the general options associated with a CXIndex. | 
| Argyrios Kyrtzidis | 7317a5c | 2012-03-28 02:18:05 +0000 | [diff] [blame] | 330 | * | 
|  | 331 | * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that | 
|  | 332 | * are associated with the given CXIndex object. | 
|  | 333 | */ | 
|  | 334 | CINDEX_LINKAGE unsigned clang_CXIndex_getGlobalOptions(CXIndex); | 
|  | 335 |  | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 336 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 337 | * Sets the invocation emission path option in a CXIndex. | 
| Alex Lorenz | 0861579 | 2017-12-04 21:56:36 +0000 | [diff] [blame] | 338 | * | 
|  | 339 | * The invocation emission path specifies a path which will contain log | 
|  | 340 | * files for certain libclang invocations. A null value (default) implies that | 
|  | 341 | * libclang invocations are not logged.. | 
|  | 342 | */ | 
|  | 343 | CINDEX_LINKAGE void | 
|  | 344 | clang_CXIndex_setInvocationEmissionPathOption(CXIndex, const char *Path); | 
|  | 345 |  | 
|  | 346 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 347 | * \defgroup CINDEX_FILES File manipulation routines | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 348 | * | 
|  | 349 | * @{ | 
|  | 350 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 351 |  | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 352 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 353 | * A particular source file that is part of a translation unit. | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 354 | */ | 
|  | 355 | typedef void *CXFile; | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 356 |  | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 357 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 358 | * Retrieve the complete file and path name of the given file. | 
| Steve Naroff | 6231f18 | 2009-10-27 14:35:18 +0000 | [diff] [blame] | 359 | */ | 
| Ted Kremenek | c560b68 | 2010-02-17 00:41:20 +0000 | [diff] [blame] | 360 | CINDEX_LINKAGE CXString clang_getFileName(CXFile SFile); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 361 |  | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 362 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 363 | * Retrieve the last modification time of the given file. | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 364 | */ | 
| Douglas Gregor | 249c121 | 2009-10-31 15:48:08 +0000 | [diff] [blame] | 365 | CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile); | 
| Steve Naroff | 6231f18 | 2009-10-27 14:35:18 +0000 | [diff] [blame] | 366 |  | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 367 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 368 | * Uniquely identifies a CXFile, that refers to the same underlying file, | 
| Argyrios Kyrtzidis | ac08b26 | 2013-01-26 04:52:52 +0000 | [diff] [blame] | 369 | * across an indexing session. | 
|  | 370 | */ | 
|  | 371 | typedef struct { | 
|  | 372 | unsigned long long data[3]; | 
|  | 373 | } CXFileUniqueID; | 
|  | 374 |  | 
|  | 375 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 376 | * Retrieve the unique ID for the given \c file. | 
| Argyrios Kyrtzidis | ac08b26 | 2013-01-26 04:52:52 +0000 | [diff] [blame] | 377 | * | 
|  | 378 | * \param file the file to get the ID for. | 
|  | 379 | * \param outID stores the returned CXFileUniqueID. | 
|  | 380 | * \returns If there was a failure getting the unique ID, returns non-zero, | 
|  | 381 | * otherwise returns 0. | 
|  | 382 | */ | 
|  | 383 | CINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID); | 
|  | 384 |  | 
|  | 385 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 386 | * Determine whether the given header is guarded against | 
| Douglas Gregor | 37aa493 | 2011-05-04 00:14:37 +0000 | [diff] [blame] | 387 | * multiple inclusions, either with the conventional | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 388 | * \#ifndef/\#define/\#endif macro guards or with \#pragma once. | 
| Douglas Gregor | 37aa493 | 2011-05-04 00:14:37 +0000 | [diff] [blame] | 389 | */ | 
|  | 390 | CINDEX_LINKAGE unsigned | 
|  | 391 | clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file); | 
|  | 392 |  | 
|  | 393 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 394 | * Retrieve a file handle within the given translation unit. | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 395 | * | 
|  | 396 | * \param tu the translation unit | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 397 | * | 
| Samuel Antao | 4c8035b | 2016-12-12 18:00:20 +0000 | [diff] [blame] | 398 | * \param file_name the name of the file. | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 399 | * | 
|  | 400 | * \returns the file handle for the named file in the translation unit \p tu, | 
|  | 401 | * or a NULL file handle if the file was not a part of this translation unit. | 
|  | 402 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 403 | CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu, | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 404 | const char *file_name); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 405 |  | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 406 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 407 | * Retrieve the buffer associated with the given file. | 
| Erik Verbruggen | 3afa3ce | 2017-12-06 09:02:52 +0000 | [diff] [blame] | 408 | * | 
|  | 409 | * \param tu the translation unit | 
|  | 410 | * | 
|  | 411 | * \param file the file for which to retrieve the buffer. | 
|  | 412 | * | 
|  | 413 | * \param size [out] if non-NULL, will be set to the size of the buffer. | 
|  | 414 | * | 
|  | 415 | * \returns a pointer to the buffer in memory that holds the contents of | 
|  | 416 | * \p file, or a NULL pointer when the file is not loaded. | 
|  | 417 | */ | 
|  | 418 | CINDEX_LINKAGE const char *clang_getFileContents(CXTranslationUnit tu, | 
|  | 419 | CXFile file, size_t *size); | 
|  | 420 |  | 
|  | 421 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 422 | * Returns non-zero if the \c file1 and \c file2 point to the same file, | 
| Argyrios Kyrtzidis | ac3997e | 2014-08-16 00:26:19 +0000 | [diff] [blame] | 423 | * or they are both NULL. | 
|  | 424 | */ | 
|  | 425 | CINDEX_LINKAGE int clang_File_isEqual(CXFile file1, CXFile file2); | 
|  | 426 |  | 
|  | 427 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 428 | * Returns the real path name of \c file. | 
| Fangrui Song | e46ac5f | 2018-04-07 20:50:35 +0000 | [diff] [blame] | 429 | * | 
|  | 430 | * An empty string may be returned. Use \c clang_getFileName() in that case. | 
|  | 431 | */ | 
|  | 432 | CINDEX_LINKAGE CXString clang_File_tryGetRealPathName(CXFile file); | 
|  | 433 |  | 
|  | 434 | /** | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 435 | * @} | 
|  | 436 | */ | 
|  | 437 |  | 
|  | 438 | /** | 
|  | 439 | * \defgroup CINDEX_LOCATIONS Physical source locations | 
|  | 440 | * | 
|  | 441 | * Clang represents physical source locations in its abstract syntax tree in | 
|  | 442 | * great detail, with file, line, and column information for the majority of | 
|  | 443 | * the tokens parsed in the source code. These data types and functions are | 
|  | 444 | * used to represent source location information, either for a particular | 
|  | 445 | * point in the program or for a range of points in the program, and extract | 
|  | 446 | * specific location information from those data types. | 
|  | 447 | * | 
|  | 448 | * @{ | 
|  | 449 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 450 |  | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 451 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 452 | * Identifies a specific source location within a translation | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 453 | * unit. | 
|  | 454 | * | 
| Chandler Carruth | 4aa01ef | 2011-08-31 16:53:37 +0000 | [diff] [blame] | 455 | * Use clang_getExpansionLocation() or clang_getSpellingLocation() | 
| Douglas Gregor | 229bebd | 2010-11-09 06:24:54 +0000 | [diff] [blame] | 456 | * to map a source location to a particular file, line, and column. | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 457 | */ | 
|  | 458 | typedef struct { | 
| Argyrios Kyrtzidis | 49d9d029 | 2013-01-11 22:29:47 +0000 | [diff] [blame] | 459 | const void *ptr_data[2]; | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 460 | unsigned int_data; | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 461 | } CXSourceLocation; | 
| Ted Kremenek | a44d99c | 2010-01-05 23:18:49 +0000 | [diff] [blame] | 462 |  | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 463 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 464 | * Identifies a half-open character range in the source code. | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 465 | * | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 466 | * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the | 
|  | 467 | * starting and end locations from a source range, respectively. | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 468 | */ | 
|  | 469 | typedef struct { | 
| Argyrios Kyrtzidis | 49d9d029 | 2013-01-11 22:29:47 +0000 | [diff] [blame] | 470 | const void *ptr_data[2]; | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 471 | unsigned begin_int_data; | 
|  | 472 | unsigned end_int_data; | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 473 | } CXSourceRange; | 
| Ted Kremenek | a44d99c | 2010-01-05 23:18:49 +0000 | [diff] [blame] | 474 |  | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 475 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 476 | * Retrieve a NULL (invalid) source location. | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 477 | */ | 
| NAKAMURA Takumi | eacd667 | 2013-01-10 02:12:38 +0000 | [diff] [blame] | 478 | CINDEX_LINKAGE CXSourceLocation clang_getNullLocation(void); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 479 |  | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 480 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 481 | * Determine whether two source locations, which must refer into | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 482 | * the same translation unit, refer to exactly the same point in the source | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 483 | * code. | 
|  | 484 | * | 
|  | 485 | * \returns non-zero if the source locations refer to the same location, zero | 
|  | 486 | * if they refer to different locations. | 
|  | 487 | */ | 
|  | 488 | CINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1, | 
|  | 489 | CXSourceLocation loc2); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 490 |  | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 491 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 492 | * Retrieves the source location associated with a given file/line/column | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 493 | * in a particular translation unit. | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 494 | */ | 
|  | 495 | CINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu, | 
|  | 496 | CXFile file, | 
|  | 497 | unsigned line, | 
|  | 498 | unsigned column); | 
| David Chisnall | 2e16ac5 | 2010-10-15 17:07:39 +0000 | [diff] [blame] | 499 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 500 | * Retrieves the source location associated with a given character offset | 
| David Chisnall | 2e16ac5 | 2010-10-15 17:07:39 +0000 | [diff] [blame] | 501 | * in a particular translation unit. | 
|  | 502 | */ | 
|  | 503 | CINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu, | 
|  | 504 | CXFile file, | 
|  | 505 | unsigned offset); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 506 |  | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 507 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 508 | * Returns non-zero if the given source location is in a system header. | 
| Argyrios Kyrtzidis | 25f7af1 | 2013-04-12 17:06:51 +0000 | [diff] [blame] | 509 | */ | 
|  | 510 | CINDEX_LINKAGE int clang_Location_isInSystemHeader(CXSourceLocation location); | 
|  | 511 |  | 
|  | 512 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 513 | * Returns non-zero if the given source location is in the main file of | 
| Stefanus Du Toit | db51c63 | 2013-08-08 17:48:14 +0000 | [diff] [blame] | 514 | * the corresponding translation unit. | 
|  | 515 | */ | 
|  | 516 | CINDEX_LINKAGE int clang_Location_isFromMainFile(CXSourceLocation location); | 
|  | 517 |  | 
|  | 518 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 519 | * Retrieve a NULL (invalid) source range. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 520 | */ | 
| NAKAMURA Takumi | eacd667 | 2013-01-10 02:12:38 +0000 | [diff] [blame] | 521 | CINDEX_LINKAGE CXSourceRange clang_getNullRange(void); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 522 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 523 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 524 | * Retrieve a source range given the beginning and ending source | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 525 | * locations. | 
|  | 526 | */ | 
|  | 527 | CINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin, | 
|  | 528 | CXSourceLocation end); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 529 |  | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 530 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 531 | * Determine whether two ranges are equivalent. | 
| Douglas Gregor | 757e38b | 2011-07-23 19:35:14 +0000 | [diff] [blame] | 532 | * | 
|  | 533 | * \returns non-zero if the ranges are the same, zero if they differ. | 
|  | 534 | */ | 
|  | 535 | CINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1, | 
|  | 536 | CXSourceRange range2); | 
|  | 537 |  | 
|  | 538 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 539 | * Returns non-zero if \p range is null. | 
| Argyrios Kyrtzidis | e7e4291 | 2011-09-28 18:14:21 +0000 | [diff] [blame] | 540 | */ | 
| Erik Verbruggen | d610b0f | 2011-10-06 12:11:57 +0000 | [diff] [blame] | 541 | CINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range); | 
| Argyrios Kyrtzidis | e7e4291 | 2011-09-28 18:14:21 +0000 | [diff] [blame] | 542 |  | 
|  | 543 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 544 | * Retrieve the file, line, column, and offset represented by | 
| Douglas Gregor | 9bd6db5 | 2010-01-26 19:19:08 +0000 | [diff] [blame] | 545 | * the given source location. | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 546 | * | 
| Chandler Carruth | 4aa01ef | 2011-08-31 16:53:37 +0000 | [diff] [blame] | 547 | * If the location refers into a macro expansion, retrieves the | 
|  | 548 | * location of the macro expansion. | 
| Douglas Gregor | 229bebd | 2010-11-09 06:24:54 +0000 | [diff] [blame] | 549 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 550 | * \param location the location within a source file that will be decomposed | 
|  | 551 | * into its parts. | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 552 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 553 | * \param file [out] if non-NULL, will be set to the file to which the given | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 554 | * source location points. | 
|  | 555 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 556 | * \param line [out] if non-NULL, will be set to the line to which the given | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 557 | * source location points. | 
|  | 558 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 559 | * \param column [out] if non-NULL, will be set to the column to which the given | 
|  | 560 | * source location points. | 
| Douglas Gregor | 9bd6db5 | 2010-01-26 19:19:08 +0000 | [diff] [blame] | 561 | * | 
|  | 562 | * \param offset [out] if non-NULL, will be set to the offset into the | 
|  | 563 | * buffer to which the given source location points. | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 564 | */ | 
| Chandler Carruth | 4aa01ef | 2011-08-31 16:53:37 +0000 | [diff] [blame] | 565 | CINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location, | 
|  | 566 | CXFile *file, | 
|  | 567 | unsigned *line, | 
|  | 568 | unsigned *column, | 
|  | 569 | unsigned *offset); | 
|  | 570 |  | 
|  | 571 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 572 | * Retrieve the file, line and column represented by the given source | 
| Vassil Vassilev | 4b8e29d | 2017-04-06 10:05:46 +0000 | [diff] [blame] | 573 | * location, as specified in a # line directive. | 
| Argyrios Kyrtzidis | 91672b3 | 2011-09-13 21:49:08 +0000 | [diff] [blame] | 574 | * | 
|  | 575 | * Example: given the following source code in a file somefile.c | 
|  | 576 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 577 | * \code | 
| Argyrios Kyrtzidis | 91672b3 | 2011-09-13 21:49:08 +0000 | [diff] [blame] | 578 | * #123 "dummy.c" 1 | 
|  | 579 | * | 
|  | 580 | * static int func(void) | 
|  | 581 | * { | 
|  | 582 | *     return 0; | 
|  | 583 | * } | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 584 | * \endcode | 
| Argyrios Kyrtzidis | 91672b3 | 2011-09-13 21:49:08 +0000 | [diff] [blame] | 585 | * | 
|  | 586 | * the location information returned by this function would be | 
|  | 587 | * | 
|  | 588 | * File: dummy.c Line: 124 Column: 12 | 
|  | 589 | * | 
|  | 590 | * whereas clang_getExpansionLocation would have returned | 
|  | 591 | * | 
|  | 592 | * File: somefile.c Line: 3 Column: 12 | 
|  | 593 | * | 
|  | 594 | * \param location the location within a source file that will be decomposed | 
|  | 595 | * into its parts. | 
|  | 596 | * | 
|  | 597 | * \param filename [out] if non-NULL, will be set to the filename of the | 
|  | 598 | * source location. Note that filenames returned will be for "virtual" files, | 
|  | 599 | * which don't necessarily exist on the machine running clang - e.g. when | 
|  | 600 | * parsing preprocessed output obtained from a different environment. If | 
|  | 601 | * a non-NULL value is passed in, remember to dispose of the returned value | 
|  | 602 | * using \c clang_disposeString() once you've finished with it. For an invalid | 
|  | 603 | * source location, an empty string is returned. | 
|  | 604 | * | 
|  | 605 | * \param line [out] if non-NULL, will be set to the line number of the | 
|  | 606 | * source location. For an invalid source location, zero is returned. | 
|  | 607 | * | 
|  | 608 | * \param column [out] if non-NULL, will be set to the column number of the | 
|  | 609 | * source location. For an invalid source location, zero is returned. | 
|  | 610 | */ | 
|  | 611 | CINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location, | 
|  | 612 | CXString *filename, | 
|  | 613 | unsigned *line, | 
|  | 614 | unsigned *column); | 
|  | 615 |  | 
|  | 616 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 617 | * Legacy API to retrieve the file, line, column, and offset represented | 
| Chandler Carruth | 4aa01ef | 2011-08-31 16:53:37 +0000 | [diff] [blame] | 618 | * by the given source location. | 
|  | 619 | * | 
|  | 620 | * This interface has been replaced by the newer interface | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 621 | * #clang_getExpansionLocation(). See that interface's documentation for | 
| Chandler Carruth | 4aa01ef | 2011-08-31 16:53:37 +0000 | [diff] [blame] | 622 | * details. | 
|  | 623 | */ | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 624 | CINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location, | 
|  | 625 | CXFile *file, | 
|  | 626 | unsigned *line, | 
| Douglas Gregor | 9bd6db5 | 2010-01-26 19:19:08 +0000 | [diff] [blame] | 627 | unsigned *column, | 
|  | 628 | unsigned *offset); | 
| Douglas Gregor | 47751d6 | 2010-01-26 03:07:15 +0000 | [diff] [blame] | 629 |  | 
|  | 630 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 631 | * Retrieve the file, line, column, and offset represented by | 
| Douglas Gregor | 229bebd | 2010-11-09 06:24:54 +0000 | [diff] [blame] | 632 | * the given source location. | 
|  | 633 | * | 
|  | 634 | * If the location refers into a macro instantiation, return where the | 
|  | 635 | * location was originally spelled in the source file. | 
|  | 636 | * | 
|  | 637 | * \param location the location within a source file that will be decomposed | 
|  | 638 | * into its parts. | 
|  | 639 | * | 
|  | 640 | * \param file [out] if non-NULL, will be set to the file to which the given | 
|  | 641 | * source location points. | 
|  | 642 | * | 
|  | 643 | * \param line [out] if non-NULL, will be set to the line to which the given | 
|  | 644 | * source location points. | 
|  | 645 | * | 
|  | 646 | * \param column [out] if non-NULL, will be set to the column to which the given | 
|  | 647 | * source location points. | 
|  | 648 | * | 
|  | 649 | * \param offset [out] if non-NULL, will be set to the offset into the | 
|  | 650 | * buffer to which the given source location points. | 
|  | 651 | */ | 
|  | 652 | CINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location, | 
|  | 653 | CXFile *file, | 
|  | 654 | unsigned *line, | 
|  | 655 | unsigned *column, | 
|  | 656 | unsigned *offset); | 
|  | 657 |  | 
|  | 658 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 659 | * Retrieve the file, line, column, and offset represented by | 
| Argyrios Kyrtzidis | 56be716 | 2013-01-04 18:30:13 +0000 | [diff] [blame] | 660 | * the given source location. | 
|  | 661 | * | 
|  | 662 | * If the location refers into a macro expansion, return where the macro was | 
|  | 663 | * expanded or where the macro argument was written, if the location points at | 
|  | 664 | * a macro argument. | 
|  | 665 | * | 
|  | 666 | * \param location the location within a source file that will be decomposed | 
|  | 667 | * into its parts. | 
|  | 668 | * | 
|  | 669 | * \param file [out] if non-NULL, will be set to the file to which the given | 
|  | 670 | * source location points. | 
|  | 671 | * | 
|  | 672 | * \param line [out] if non-NULL, will be set to the line to which the given | 
|  | 673 | * source location points. | 
|  | 674 | * | 
|  | 675 | * \param column [out] if non-NULL, will be set to the column to which the given | 
|  | 676 | * source location points. | 
|  | 677 | * | 
|  | 678 | * \param offset [out] if non-NULL, will be set to the offset into the | 
|  | 679 | * buffer to which the given source location points. | 
|  | 680 | */ | 
|  | 681 | CINDEX_LINKAGE void clang_getFileLocation(CXSourceLocation location, | 
|  | 682 | CXFile *file, | 
|  | 683 | unsigned *line, | 
|  | 684 | unsigned *column, | 
|  | 685 | unsigned *offset); | 
|  | 686 |  | 
|  | 687 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 688 | * Retrieve a source location representing the first character within a | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 689 | * source range. | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 690 | */ | 
|  | 691 | CINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range); | 
|  | 692 |  | 
|  | 693 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 694 | * Retrieve a source location representing the last character within a | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 695 | * source range. | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 696 | */ | 
|  | 697 | CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range); | 
|  | 698 |  | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 699 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 700 | * Identifies an array of ranges. | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 701 | */ | 
|  | 702 | typedef struct { | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 703 | /** The number of ranges in the \c ranges array. */ | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 704 | unsigned count; | 
|  | 705 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 706 | * An array of \c CXSourceRanges. | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 707 | */ | 
|  | 708 | CXSourceRange *ranges; | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 709 | } CXSourceRangeList; | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 710 |  | 
|  | 711 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 712 | * Retrieve all ranges that were skipped by the preprocessor. | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 713 | * | 
|  | 714 | * The preprocessor will skip lines when they are surrounded by an | 
|  | 715 | * if/ifdef/ifndef directive whose condition does not evaluate to true. | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 716 | */ | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 717 | CINDEX_LINKAGE CXSourceRangeList *clang_getSkippedRanges(CXTranslationUnit tu, | 
|  | 718 | CXFile file); | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 719 |  | 
|  | 720 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 721 | * Retrieve all ranges from all files that were skipped by the | 
| Cameron Desrochers | d809128 | 2016-08-18 15:43:55 +0000 | [diff] [blame] | 722 | * preprocessor. | 
|  | 723 | * | 
|  | 724 | * The preprocessor will skip lines when they are surrounded by an | 
|  | 725 | * if/ifdef/ifndef directive whose condition does not evaluate to true. | 
|  | 726 | */ | 
|  | 727 | CINDEX_LINKAGE CXSourceRangeList *clang_getAllSkippedRanges(CXTranslationUnit tu); | 
|  | 728 |  | 
|  | 729 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 730 | * Destroy the given \c CXSourceRangeList. | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 731 | */ | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 732 | CINDEX_LINKAGE void clang_disposeSourceRangeList(CXSourceRangeList *ranges); | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 733 |  | 
|  | 734 | /** | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 735 | * @} | 
|  | 736 | */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 737 |  | 
|  | 738 | /** | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 739 | * \defgroup CINDEX_DIAG Diagnostic reporting | 
|  | 740 | * | 
|  | 741 | * @{ | 
|  | 742 | */ | 
|  | 743 |  | 
|  | 744 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 745 | * Describes the severity of a particular diagnostic. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 746 | */ | 
|  | 747 | enum CXDiagnosticSeverity { | 
|  | 748 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 749 | * A diagnostic that has been suppressed, e.g., by a command-line | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 750 | * option. | 
|  | 751 | */ | 
|  | 752 | CXDiagnostic_Ignored = 0, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 753 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 754 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 755 | * This diagnostic is a note that should be attached to the | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 756 | * previous (non-note) diagnostic. | 
|  | 757 | */ | 
|  | 758 | CXDiagnostic_Note    = 1, | 
|  | 759 |  | 
|  | 760 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 761 | * This diagnostic indicates suspicious code that may not be | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 762 | * wrong. | 
|  | 763 | */ | 
|  | 764 | CXDiagnostic_Warning = 2, | 
|  | 765 |  | 
|  | 766 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 767 | * This diagnostic indicates that the code is ill-formed. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 768 | */ | 
|  | 769 | CXDiagnostic_Error   = 3, | 
|  | 770 |  | 
|  | 771 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 772 | * This diagnostic indicates that the code is ill-formed such | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 773 | * that future parser recovery is unlikely to produce useful | 
|  | 774 | * results. | 
|  | 775 | */ | 
|  | 776 | CXDiagnostic_Fatal   = 4 | 
|  | 777 | }; | 
|  | 778 |  | 
|  | 779 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 780 | * A single diagnostic, containing the diagnostic's severity, | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 781 | * location, text, source ranges, and fix-it hints. | 
|  | 782 | */ | 
|  | 783 | typedef void *CXDiagnostic; | 
|  | 784 |  | 
|  | 785 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 786 | * A group of CXDiagnostics. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 787 | */ | 
|  | 788 | typedef void *CXDiagnosticSet; | 
|  | 789 |  | 
|  | 790 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 791 | * Determine the number of diagnostics in a CXDiagnosticSet. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 792 | */ | 
|  | 793 | CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags); | 
|  | 794 |  | 
|  | 795 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 796 | * Retrieve a diagnostic associated with the given CXDiagnosticSet. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 797 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 798 | * \param Diags the CXDiagnosticSet to query. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 799 | * \param Index the zero-based diagnostic number to retrieve. | 
|  | 800 | * | 
|  | 801 | * \returns the requested diagnostic. This diagnostic must be freed | 
|  | 802 | * via a call to \c clang_disposeDiagnostic(). | 
|  | 803 | */ | 
|  | 804 | CINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags, | 
|  | 805 | unsigned Index); | 
|  | 806 |  | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 807 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 808 | * Describes the kind of error that occurred (if any) in a call to | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 809 | * \c clang_loadDiagnostics. | 
|  | 810 | */ | 
|  | 811 | enum CXLoadDiag_Error { | 
|  | 812 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 813 | * Indicates that no error occurred. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 814 | */ | 
|  | 815 | CXLoadDiag_None = 0, | 
|  | 816 |  | 
|  | 817 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 818 | * Indicates that an unknown error occurred while attempting to | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 819 | * deserialize diagnostics. | 
|  | 820 | */ | 
|  | 821 | CXLoadDiag_Unknown = 1, | 
|  | 822 |  | 
|  | 823 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 824 | * Indicates that the file containing the serialized diagnostics | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 825 | * could not be opened. | 
|  | 826 | */ | 
|  | 827 | CXLoadDiag_CannotLoad = 2, | 
|  | 828 |  | 
|  | 829 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 830 | * Indicates that the serialized diagnostics file is invalid or | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 831 | * corrupt. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 832 | */ | 
|  | 833 | CXLoadDiag_InvalidFile = 3 | 
|  | 834 | }; | 
|  | 835 |  | 
|  | 836 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 837 | * Deserialize a set of diagnostics from a Clang diagnostics bitcode | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 838 | * file. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 839 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 840 | * \param file The name of the file to deserialize. | 
|  | 841 | * \param error A pointer to a enum value recording if there was a problem | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 842 | *        deserializing the diagnostics. | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 843 | * \param errorString A pointer to a CXString for recording the error string | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 844 | *        if the file was not successfully loaded. | 
|  | 845 | * | 
|  | 846 | * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise.  These | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 847 | * diagnostics should be released using clang_disposeDiagnosticSet(). | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 848 | */ | 
|  | 849 | CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file, | 
|  | 850 | enum CXLoadDiag_Error *error, | 
|  | 851 | CXString *errorString); | 
|  | 852 |  | 
|  | 853 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 854 | * Release a CXDiagnosticSet and all of its contained diagnostics. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 855 | */ | 
|  | 856 | CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags); | 
|  | 857 |  | 
|  | 858 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 859 | * Retrieve the child diagnostics of a CXDiagnostic. | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 860 | * | 
|  | 861 | * This CXDiagnosticSet does not need to be released by | 
| Sylvestre Ledru | d29d97c | 2013-11-17 09:46:45 +0000 | [diff] [blame] | 862 | * clang_disposeDiagnosticSet. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 863 | */ | 
|  | 864 | CINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D); | 
|  | 865 |  | 
|  | 866 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 867 | * Determine the number of diagnostics produced for the given | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 868 | * translation unit. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 869 | */ | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 870 | CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit); | 
|  | 871 |  | 
|  | 872 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 873 | * Retrieve a diagnostic associated with the given translation unit. | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 874 | * | 
|  | 875 | * \param Unit the translation unit to query. | 
|  | 876 | * \param Index the zero-based diagnostic number to retrieve. | 
|  | 877 | * | 
|  | 878 | * \returns the requested diagnostic. This diagnostic must be freed | 
|  | 879 | * via a call to \c clang_disposeDiagnostic(). | 
|  | 880 | */ | 
|  | 881 | CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, | 
|  | 882 | unsigned Index); | 
|  | 883 |  | 
|  | 884 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 885 | * Retrieve the complete set of diagnostics associated with a | 
| Ted Kremenek | b4a8b05 | 2011-12-09 22:28:32 +0000 | [diff] [blame] | 886 | *        translation unit. | 
|  | 887 | * | 
|  | 888 | * \param Unit the translation unit to query. | 
|  | 889 | */ | 
|  | 890 | CINDEX_LINKAGE CXDiagnosticSet | 
|  | 891 | clang_getDiagnosticSetFromTU(CXTranslationUnit Unit); | 
|  | 892 |  | 
|  | 893 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 894 | * Destroy a diagnostic. | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 895 | */ | 
|  | 896 | CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic); | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 897 |  | 
|  | 898 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 899 | * Options to control the display of diagnostics. | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 900 | * | 
|  | 901 | * The values in this enum are meant to be combined to customize the | 
| Sylvestre Ledru | d29d97c | 2013-11-17 09:46:45 +0000 | [diff] [blame] | 902 | * behavior of \c clang_formatDiagnostic(). | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 903 | */ | 
|  | 904 | enum CXDiagnosticDisplayOptions { | 
|  | 905 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 906 | * Display the source-location information where the | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 907 | * diagnostic was located. | 
|  | 908 | * | 
|  | 909 | * When set, diagnostics will be prefixed by the file, line, and | 
|  | 910 | * (optionally) column to which the diagnostic refers. For example, | 
|  | 911 | * | 
|  | 912 | * \code | 
|  | 913 | * test.c:28: warning: extra tokens at end of #endif directive | 
|  | 914 | * \endcode | 
|  | 915 | * | 
|  | 916 | * This option corresponds to the clang flag \c -fshow-source-location. | 
|  | 917 | */ | 
|  | 918 | CXDiagnostic_DisplaySourceLocation = 0x01, | 
|  | 919 |  | 
|  | 920 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 921 | * If displaying the source-location information of the | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 922 | * diagnostic, also include the column number. | 
|  | 923 | * | 
|  | 924 | * This option corresponds to the clang flag \c -fshow-column. | 
|  | 925 | */ | 
|  | 926 | CXDiagnostic_DisplayColumn = 0x02, | 
|  | 927 |  | 
|  | 928 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 929 | * If displaying the source-location information of the | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 930 | * diagnostic, also include information about source ranges in a | 
|  | 931 | * machine-parsable format. | 
|  | 932 | * | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 933 | * This option corresponds to the clang flag | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 934 | * \c -fdiagnostics-print-source-range-info. | 
|  | 935 | */ | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 936 | CXDiagnostic_DisplaySourceRanges = 0x04, | 
|  | 937 |  | 
|  | 938 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 939 | * Display the option name associated with this diagnostic, if any. | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 940 | * | 
|  | 941 | * The option name displayed (e.g., -Wconversion) will be placed in brackets | 
|  | 942 | * after the diagnostic text. This option corresponds to the clang flag | 
|  | 943 | * \c -fdiagnostics-show-option. | 
|  | 944 | */ | 
|  | 945 | CXDiagnostic_DisplayOption = 0x08, | 
|  | 946 |  | 
|  | 947 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 948 | * Display the category number associated with this diagnostic, if any. | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 949 | * | 
|  | 950 | * The category number is displayed within brackets after the diagnostic text. | 
|  | 951 | * This option corresponds to the clang flag | 
|  | 952 | * \c -fdiagnostics-show-category=id. | 
|  | 953 | */ | 
|  | 954 | CXDiagnostic_DisplayCategoryId = 0x10, | 
|  | 955 |  | 
|  | 956 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 957 | * Display the category name associated with this diagnostic, if any. | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 958 | * | 
|  | 959 | * The category name is displayed within brackets after the diagnostic text. | 
|  | 960 | * This option corresponds to the clang flag | 
|  | 961 | * \c -fdiagnostics-show-category=name. | 
|  | 962 | */ | 
|  | 963 | CXDiagnostic_DisplayCategoryName = 0x20 | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 964 | }; | 
|  | 965 |  | 
|  | 966 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 967 | * Format the given diagnostic in a manner that is suitable for display. | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 968 | * | 
| Douglas Gregor | d770f73 | 2010-02-22 23:17:23 +0000 | [diff] [blame] | 969 | * This routine will format the given diagnostic to a string, rendering | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 970 | * the diagnostic according to the various options given. The | 
|  | 971 | * \c clang_defaultDiagnosticDisplayOptions() function returns the set of | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 972 | * options that most closely mimics the behavior of the clang compiler. | 
|  | 973 | * | 
|  | 974 | * \param Diagnostic The diagnostic to print. | 
|  | 975 | * | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 976 | * \param Options A set of options that control the diagnostic display, | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 977 | * created by combining \c CXDiagnosticDisplayOptions values. | 
| Douglas Gregor | d770f73 | 2010-02-22 23:17:23 +0000 | [diff] [blame] | 978 | * | 
|  | 979 | * \returns A new string containing for formatted diagnostic. | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 980 | */ | 
| Douglas Gregor | d770f73 | 2010-02-22 23:17:23 +0000 | [diff] [blame] | 981 | CINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, | 
|  | 982 | unsigned Options); | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 983 |  | 
|  | 984 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 985 | * Retrieve the set of display options most similar to the | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 986 | * default behavior of the clang compiler. | 
|  | 987 | * | 
|  | 988 | * \returns A set of display options suitable for use with \c | 
| Sylvestre Ledru | d29d97c | 2013-11-17 09:46:45 +0000 | [diff] [blame] | 989 | * clang_formatDiagnostic(). | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 990 | */ | 
|  | 991 | CINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void); | 
|  | 992 |  | 
|  | 993 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 994 | * Determine the severity of the given diagnostic. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 995 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 996 | CINDEX_LINKAGE enum CXDiagnosticSeverity | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 997 | clang_getDiagnosticSeverity(CXDiagnostic); | 
|  | 998 |  | 
|  | 999 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1000 | * Retrieve the source location of the given diagnostic. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1001 | * | 
|  | 1002 | * This location is where Clang would print the caret ('^') when | 
|  | 1003 | * displaying the diagnostic on the command line. | 
|  | 1004 | */ | 
|  | 1005 | CINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic); | 
|  | 1006 |  | 
|  | 1007 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1008 | * Retrieve the text of the given diagnostic. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1009 | */ | 
|  | 1010 | CINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic); | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1011 |  | 
|  | 1012 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1013 | * Retrieve the name of the command-line option that enabled this | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 1014 | * diagnostic. | 
|  | 1015 | * | 
|  | 1016 | * \param Diag The diagnostic to be queried. | 
|  | 1017 | * | 
|  | 1018 | * \param Disable If non-NULL, will be set to the option that disables this | 
|  | 1019 | * diagnostic (if any). | 
|  | 1020 | * | 
|  | 1021 | * \returns A string that contains the command-line option used to enable this | 
|  | 1022 | * warning, such as "-Wconversion" or "-pedantic". | 
|  | 1023 | */ | 
|  | 1024 | CINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag, | 
|  | 1025 | CXString *Disable); | 
|  | 1026 |  | 
|  | 1027 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1028 | * Retrieve the category number for this diagnostic. | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 1029 | * | 
|  | 1030 | * Diagnostics can be categorized into groups along with other, related | 
|  | 1031 | * diagnostics (e.g., diagnostics under the same warning flag). This routine | 
|  | 1032 | * retrieves the category number for the given diagnostic. | 
|  | 1033 | * | 
|  | 1034 | * \returns The number of the category that contains this diagnostic, or zero | 
|  | 1035 | * if this diagnostic is uncategorized. | 
|  | 1036 | */ | 
|  | 1037 | CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic); | 
|  | 1038 |  | 
|  | 1039 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1040 | * Retrieve the name of a particular diagnostic category.  This | 
| Ted Kremenek | 26a6d49 | 2012-04-12 00:03:31 +0000 | [diff] [blame] | 1041 | *  is now deprecated.  Use clang_getDiagnosticCategoryText() | 
|  | 1042 | *  instead. | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 1043 | * | 
|  | 1044 | * \param Category A diagnostic category number, as returned by | 
|  | 1045 | * \c clang_getDiagnosticCategory(). | 
|  | 1046 | * | 
|  | 1047 | * \returns The name of the given diagnostic category. | 
|  | 1048 | */ | 
| Ted Kremenek | 26a6d49 | 2012-04-12 00:03:31 +0000 | [diff] [blame] | 1049 | CINDEX_DEPRECATED CINDEX_LINKAGE | 
|  | 1050 | CXString clang_getDiagnosticCategoryName(unsigned Category); | 
|  | 1051 |  | 
|  | 1052 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1053 | * Retrieve the diagnostic category text for a given diagnostic. | 
| Ted Kremenek | 26a6d49 | 2012-04-12 00:03:31 +0000 | [diff] [blame] | 1054 | * | 
| Ted Kremenek | 26a6d49 | 2012-04-12 00:03:31 +0000 | [diff] [blame] | 1055 | * \returns The text of the given diagnostic category. | 
|  | 1056 | */ | 
|  | 1057 | CINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic); | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 1058 |  | 
|  | 1059 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1060 | * Determine the number of source ranges associated with the given | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1061 | * diagnostic. | 
|  | 1062 | */ | 
|  | 1063 | CINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1064 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1065 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1066 | * Retrieve a source range associated with the diagnostic. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1067 | * | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1068 | * A diagnostic's source ranges highlight important elements in the source | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1069 | * code. On the command line, Clang displays source ranges by | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1070 | * underlining them with '~' characters. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1071 | * | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1072 | * \param Diagnostic the diagnostic whose range is being extracted. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1073 | * | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1074 | * \param Range the zero-based index specifying which range to | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1075 | * | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1076 | * \returns the requested source range. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1077 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1078 | CINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic, | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1079 | unsigned Range); | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1080 |  | 
|  | 1081 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1082 | * Determine the number of fix-it hints associated with the | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1083 | * given diagnostic. | 
|  | 1084 | */ | 
|  | 1085 | CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic); | 
|  | 1086 |  | 
|  | 1087 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1088 | * Retrieve the replacement information for a given fix-it. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1089 | * | 
| Douglas Gregor | 836ec94 | 2010-02-19 18:16:06 +0000 | [diff] [blame] | 1090 | * Fix-its are described in terms of a source range whose contents | 
|  | 1091 | * should be replaced by a string. This approach generalizes over | 
|  | 1092 | * three kinds of operations: removal of source code (the range covers | 
|  | 1093 | * the code to be removed and the replacement string is empty), | 
|  | 1094 | * replacement of source code (the range covers the code to be | 
|  | 1095 | * replaced and the replacement string provides the new code), and | 
|  | 1096 | * insertion (both the start and end of the range point at the | 
|  | 1097 | * insertion location, and the replacement string provides the text to | 
|  | 1098 | * insert). | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1099 | * | 
| Douglas Gregor | 836ec94 | 2010-02-19 18:16:06 +0000 | [diff] [blame] | 1100 | * \param Diagnostic The diagnostic whose fix-its are being queried. | 
|  | 1101 | * | 
|  | 1102 | * \param FixIt The zero-based index of the fix-it. | 
|  | 1103 | * | 
|  | 1104 | * \param ReplacementRange The source range whose contents will be | 
|  | 1105 | * replaced with the returned replacement string. Note that source | 
|  | 1106 | * ranges are half-open ranges [a, b), so the source code should be | 
|  | 1107 | * replaced from a and up to (but not including) b. | 
|  | 1108 | * | 
|  | 1109 | * \returns A string containing text that should be replace the source | 
|  | 1110 | * code indicated by the \c ReplacementRange. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1111 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1112 | CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic, | 
| Douglas Gregor | 836ec94 | 2010-02-19 18:16:06 +0000 | [diff] [blame] | 1113 | unsigned FixIt, | 
|  | 1114 | CXSourceRange *ReplacementRange); | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1115 |  | 
|  | 1116 | /** | 
|  | 1117 | * @} | 
|  | 1118 | */ | 
|  | 1119 |  | 
|  | 1120 | /** | 
|  | 1121 | * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation | 
|  | 1122 | * | 
|  | 1123 | * The routines in this group provide the ability to create and destroy | 
|  | 1124 | * translation units from files, either by parsing the contents of the files or | 
|  | 1125 | * by reading in a serialized representation of a translation unit. | 
|  | 1126 | * | 
|  | 1127 | * @{ | 
|  | 1128 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1129 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1130 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1131 | * Get the original translation unit source file name. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1132 | */ | 
|  | 1133 | CINDEX_LINKAGE CXString | 
|  | 1134 | clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit); | 
|  | 1135 |  | 
|  | 1136 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1137 | * Return the CXTranslationUnit for a given source file and the provided | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1138 | * command line arguments one would pass to the compiler. | 
|  | 1139 | * | 
|  | 1140 | * Note: The 'source_filename' argument is optional.  If the caller provides a | 
|  | 1141 | * NULL pointer, the name of the source file is expected to reside in the | 
|  | 1142 | * specified command line arguments. | 
|  | 1143 | * | 
|  | 1144 | * Note: When encountered in 'clang_command_line_args', the following options | 
|  | 1145 | * are ignored: | 
|  | 1146 | * | 
|  | 1147 | *   '-c' | 
|  | 1148 | *   '-emit-ast' | 
|  | 1149 | *   '-fsyntax-only' | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 1150 | *   '-o \<output file>'  (both '-o' and '\<output file>' are ignored) | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1151 | * | 
| Ted Kremenek | bd497244 | 2010-11-08 04:28:51 +0000 | [diff] [blame] | 1152 | * \param CIdx The index object with which the translation unit will be | 
|  | 1153 | * associated. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1154 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 1155 | * \param source_filename The name of the source file to load, or NULL if the | 
| Ted Kremenek | bd497244 | 2010-11-08 04:28:51 +0000 | [diff] [blame] | 1156 | * source file is included in \p clang_command_line_args. | 
|  | 1157 | * | 
|  | 1158 | * \param num_clang_command_line_args The number of command-line arguments in | 
|  | 1159 | * \p clang_command_line_args. | 
|  | 1160 | * | 
|  | 1161 | * \param clang_command_line_args The command-line arguments that would be | 
|  | 1162 | * passed to the \c clang executable if it were being invoked out-of-process. | 
|  | 1163 | * These command-line options will be parsed and will affect how the translation | 
|  | 1164 | * unit is parsed. Note that the following options are ignored: '-c', | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 1165 | * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1166 | * | 
|  | 1167 | * \param num_unsaved_files the number of unsaved file entries in \p | 
|  | 1168 | * unsaved_files. | 
|  | 1169 | * | 
|  | 1170 | * \param unsaved_files the files that have not yet been saved to disk | 
|  | 1171 | * but may be required for code completion, including the contents of | 
| Ted Kremenek | de24a94 | 2010-04-12 18:47:26 +0000 | [diff] [blame] | 1172 | * those files.  The contents and name of these files (as specified by | 
|  | 1173 | * CXUnsavedFile) are copied when necessary, so the client only needs to | 
|  | 1174 | * guarantee their validity until the call to this function returns. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1175 | */ | 
|  | 1176 | CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile( | 
|  | 1177 | CXIndex CIdx, | 
|  | 1178 | const char *source_filename, | 
|  | 1179 | int num_clang_command_line_args, | 
| Douglas Gregor | 57879fa | 2010-09-01 16:43:19 +0000 | [diff] [blame] | 1180 | const char * const *clang_command_line_args, | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1181 | unsigned num_unsaved_files, | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 1182 | struct CXUnsavedFile *unsaved_files); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1183 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1184 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1185 | * Same as \c clang_createTranslationUnit2, but returns | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1186 | * the \c CXTranslationUnit instead of an error code.  In case of an error this | 
|  | 1187 | * routine returns a \c NULL \c CXTranslationUnit, without further detailed | 
|  | 1188 | * error codes. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1189 | */ | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1190 | CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit( | 
|  | 1191 | CXIndex CIdx, | 
|  | 1192 | const char *ast_filename); | 
|  | 1193 |  | 
|  | 1194 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1195 | * Create a translation unit from an AST file (\c -emit-ast). | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1196 | * | 
|  | 1197 | * \param[out] out_TU A non-NULL pointer to store the created | 
|  | 1198 | * \c CXTranslationUnit. | 
|  | 1199 | * | 
|  | 1200 | * \returns Zero on success, otherwise returns an error code. | 
|  | 1201 | */ | 
|  | 1202 | CINDEX_LINKAGE enum CXErrorCode clang_createTranslationUnit2( | 
|  | 1203 | CXIndex CIdx, | 
|  | 1204 | const char *ast_filename, | 
|  | 1205 | CXTranslationUnit *out_TU); | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1206 |  | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1207 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1208 | * Flags that control the creation of translation units. | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1209 | * | 
|  | 1210 | * The enumerators in this enumeration type are meant to be bitwise | 
|  | 1211 | * ORed together to specify which options should be used when | 
|  | 1212 | * constructing the translation unit. | 
|  | 1213 | */ | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1214 | enum CXTranslationUnit_Flags { | 
|  | 1215 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1216 | * Used to indicate that no special translation-unit options are | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1217 | * needed. | 
|  | 1218 | */ | 
|  | 1219 | CXTranslationUnit_None = 0x0, | 
|  | 1220 |  | 
|  | 1221 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1222 | * Used to indicate that the parser should construct a "detailed" | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1223 | * preprocessing record, including all macro definitions and instantiations. | 
|  | 1224 | * | 
|  | 1225 | * Constructing a detailed preprocessing record requires more memory | 
|  | 1226 | * and time to parse, since the information contained in the record | 
|  | 1227 | * is usually not retained. However, it can be useful for | 
|  | 1228 | * applications that require more detailed information about the | 
|  | 1229 | * behavior of the preprocessor. | 
|  | 1230 | */ | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1231 | CXTranslationUnit_DetailedPreprocessingRecord = 0x01, | 
|  | 1232 |  | 
|  | 1233 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1234 | * Used to indicate that the translation unit is incomplete. | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1235 | * | 
| Douglas Gregor | 4a47bca | 2010-08-09 22:28:58 +0000 | [diff] [blame] | 1236 | * When a translation unit is considered "incomplete", semantic | 
|  | 1237 | * analysis that is typically performed at the end of the | 
|  | 1238 | * translation unit will be suppressed. For example, this suppresses | 
|  | 1239 | * the completion of tentative declarations in C and of | 
|  | 1240 | * instantiation of implicitly-instantiation function templates in | 
|  | 1241 | * C++. This option is typically used when parsing a header with the | 
|  | 1242 | * intent of producing a precompiled header. | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1243 | */ | 
| Douglas Gregor | 4a47bca | 2010-08-09 22:28:58 +0000 | [diff] [blame] | 1244 | CXTranslationUnit_Incomplete = 0x02, | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1245 |  | 
|  | 1246 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1247 | * Used to indicate that the translation unit should be built with an | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1248 | * implicit precompiled header for the preamble. | 
|  | 1249 | * | 
|  | 1250 | * An implicit precompiled header is used as an optimization when a | 
|  | 1251 | * particular translation unit is likely to be reparsed many times | 
|  | 1252 | * when the sources aren't changing that often. In this case, an | 
|  | 1253 | * implicit precompiled header will be built containing all of the | 
|  | 1254 | * initial includes at the top of the main file (what we refer to as | 
|  | 1255 | * the "preamble" of the file). In subsequent parses, if the | 
|  | 1256 | * preamble or the files in it have not changed, \c | 
|  | 1257 | * clang_reparseTranslationUnit() will re-use the implicit | 
|  | 1258 | * precompiled header to improve parsing performance. | 
|  | 1259 | */ | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1260 | CXTranslationUnit_PrecompiledPreamble = 0x04, | 
|  | 1261 |  | 
|  | 1262 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1263 | * Used to indicate that the translation unit should cache some | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1264 | * code-completion results with each reparse of the source file. | 
|  | 1265 | * | 
|  | 1266 | * Caching of code-completion results is a performance optimization that | 
|  | 1267 | * introduces some overhead to reparsing but improves the performance of | 
|  | 1268 | * code-completion operations. | 
|  | 1269 | */ | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1270 | CXTranslationUnit_CacheCompletionResults = 0x08, | 
| Argyrios Kyrtzidis | 0db720f | 2012-10-11 16:05:00 +0000 | [diff] [blame] | 1271 |  | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1272 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1273 | * Used to indicate that the translation unit will be serialized with | 
| Argyrios Kyrtzidis | 0db720f | 2012-10-11 16:05:00 +0000 | [diff] [blame] | 1274 | * \c clang_saveTranslationUnit. | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1275 | * | 
| Argyrios Kyrtzidis | 0db720f | 2012-10-11 16:05:00 +0000 | [diff] [blame] | 1276 | * This option is typically used when parsing a header with the intent of | 
|  | 1277 | * producing a precompiled header. | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1278 | */ | 
| Argyrios Kyrtzidis | 0db720f | 2012-10-11 16:05:00 +0000 | [diff] [blame] | 1279 | CXTranslationUnit_ForSerialization = 0x10, | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1280 |  | 
|  | 1281 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1282 | * DEPRECATED: Enabled chained precompiled preambles in C++. | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1283 | * | 
|  | 1284 | * Note: this is a *temporary* option that is available only while | 
| Douglas Gregor | 2ed0ee1 | 2011-08-25 22:54:01 +0000 | [diff] [blame] | 1285 | * we are testing C++ precompiled preamble support. It is deprecated. | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1286 | */ | 
| Erik Verbruggen | 6e92251 | 2012-04-12 10:11:59 +0000 | [diff] [blame] | 1287 | CXTranslationUnit_CXXChainedPCH = 0x20, | 
|  | 1288 |  | 
|  | 1289 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1290 | * Used to indicate that function/method bodies should be skipped while | 
| Erik Verbruggen | 6e92251 | 2012-04-12 10:11:59 +0000 | [diff] [blame] | 1291 | * parsing. | 
|  | 1292 | * | 
|  | 1293 | * This option can be used to search for declarations/definitions while | 
|  | 1294 | * ignoring the usages. | 
|  | 1295 | */ | 
| Dmitri Gribenko | 3292d06 | 2012-07-02 17:35:10 +0000 | [diff] [blame] | 1296 | CXTranslationUnit_SkipFunctionBodies = 0x40, | 
|  | 1297 |  | 
|  | 1298 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1299 | * Used to indicate that brief documentation comments should be | 
| Dmitri Gribenko | 3292d06 | 2012-07-02 17:35:10 +0000 | [diff] [blame] | 1300 | * included into the set of code completions returned from this translation | 
|  | 1301 | * unit. | 
|  | 1302 | */ | 
| Benjamin Kramer | 5c248d8 | 2015-12-15 09:30:31 +0000 | [diff] [blame] | 1303 | CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80, | 
|  | 1304 |  | 
|  | 1305 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1306 | * Used to indicate that the precompiled preamble should be created on | 
| Benjamin Kramer | 5c248d8 | 2015-12-15 09:30:31 +0000 | [diff] [blame] | 1307 | * the first parse. Otherwise it will be created on the first reparse. This | 
|  | 1308 | * trades runtime on the first parse (serializing the preamble takes time) for | 
|  | 1309 | * reduced runtime on the second parse (can now reuse the preamble). | 
|  | 1310 | */ | 
| Manuel Klimek | 016c024 | 2016-03-01 10:56:19 +0000 | [diff] [blame] | 1311 | CXTranslationUnit_CreatePreambleOnFirstParse = 0x100, | 
|  | 1312 |  | 
|  | 1313 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1314 | * Do not stop processing when fatal errors are encountered. | 
| Manuel Klimek | 016c024 | 2016-03-01 10:56:19 +0000 | [diff] [blame] | 1315 | * | 
|  | 1316 | * When fatal errors are encountered while parsing a translation unit, | 
|  | 1317 | * semantic analysis is typically stopped early when compiling code. A common | 
|  | 1318 | * source for fatal errors are unresolvable include files. For the | 
|  | 1319 | * purposes of an IDE, this is undesirable behavior and as much information | 
|  | 1320 | * as possible should be reported. Use this flag to enable this behavior. | 
|  | 1321 | */ | 
| Argyrios Kyrtzidis | 735e92c | 2017-06-09 01:20:48 +0000 | [diff] [blame] | 1322 | CXTranslationUnit_KeepGoing = 0x200, | 
|  | 1323 |  | 
|  | 1324 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1325 | * Sets the preprocessor in a mode for parsing a single file only. | 
| Argyrios Kyrtzidis | 735e92c | 2017-06-09 01:20:48 +0000 | [diff] [blame] | 1326 | */ | 
|  | 1327 | CXTranslationUnit_SingleFileParse = 0x400 | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1328 | }; | 
|  | 1329 |  | 
|  | 1330 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1331 | * Returns the set of flags that is suitable for parsing a translation | 
| Douglas Gregor | 4a47bca | 2010-08-09 22:28:58 +0000 | [diff] [blame] | 1332 | * unit that is being edited. | 
|  | 1333 | * | 
|  | 1334 | * The set of flags returned provide options for \c clang_parseTranslationUnit() | 
|  | 1335 | * to indicate that the translation unit is likely to be reparsed many times, | 
|  | 1336 | * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly | 
|  | 1337 | * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag | 
|  | 1338 | * set contains an unspecified set of optimizations (e.g., the precompiled | 
|  | 1339 | * preamble) geared toward improving the performance of these routines. The | 
|  | 1340 | * set of optimizations enabled may change from one version to the next. | 
|  | 1341 | */ | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1342 | CINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void); | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1343 |  | 
|  | 1344 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1345 | * Same as \c clang_parseTranslationUnit2, but returns | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1346 | * the \c CXTranslationUnit instead of an error code.  In case of an error this | 
|  | 1347 | * routine returns a \c NULL \c CXTranslationUnit, without further detailed | 
|  | 1348 | * error codes. | 
|  | 1349 | */ | 
|  | 1350 | CINDEX_LINKAGE CXTranslationUnit | 
|  | 1351 | clang_parseTranslationUnit(CXIndex CIdx, | 
|  | 1352 | const char *source_filename, | 
|  | 1353 | const char *const *command_line_args, | 
|  | 1354 | int num_command_line_args, | 
|  | 1355 | struct CXUnsavedFile *unsaved_files, | 
|  | 1356 | unsigned num_unsaved_files, | 
|  | 1357 | unsigned options); | 
|  | 1358 |  | 
| Douglas Gregor | 4a47bca | 2010-08-09 22:28:58 +0000 | [diff] [blame] | 1359 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1360 | * Parse the given source file and the translation unit corresponding | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1361 | * to that file. | 
|  | 1362 | * | 
|  | 1363 | * This routine is the main entry point for the Clang C API, providing the | 
|  | 1364 | * ability to parse a source file into a translation unit that can then be | 
|  | 1365 | * queried by other functions in the API. This routine accepts a set of | 
|  | 1366 | * command-line arguments so that the compilation can be configured in the same | 
|  | 1367 | * way that the compiler is configured on the command line. | 
|  | 1368 | * | 
|  | 1369 | * \param CIdx The index object with which the translation unit will be | 
|  | 1370 | * associated. | 
|  | 1371 | * | 
|  | 1372 | * \param source_filename The name of the source file to load, or NULL if the | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1373 | * source file is included in \c command_line_args. | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1374 | * | 
|  | 1375 | * \param command_line_args The command-line arguments that would be | 
|  | 1376 | * passed to the \c clang executable if it were being invoked out-of-process. | 
|  | 1377 | * These command-line options will be parsed and will affect how the translation | 
|  | 1378 | * unit is parsed. Note that the following options are ignored: '-c', | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 1379 | * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1380 | * | 
|  | 1381 | * \param num_command_line_args The number of command-line arguments in | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1382 | * \c command_line_args. | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1383 | * | 
|  | 1384 | * \param unsaved_files the files that have not yet been saved to disk | 
| Douglas Gregor | 8e984da | 2010-08-04 16:47:14 +0000 | [diff] [blame] | 1385 | * but may be required for parsing, including the contents of | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1386 | * those files.  The contents and name of these files (as specified by | 
|  | 1387 | * CXUnsavedFile) are copied when necessary, so the client only needs to | 
|  | 1388 | * guarantee their validity until the call to this function returns. | 
|  | 1389 | * | 
|  | 1390 | * \param num_unsaved_files the number of unsaved file entries in \p | 
|  | 1391 | * unsaved_files. | 
|  | 1392 | * | 
|  | 1393 | * \param options A bitmask of options that affects how the translation unit | 
|  | 1394 | * is managed but not its compilation. This should be a bitwise OR of the | 
|  | 1395 | * CXTranslationUnit_XXX flags. | 
|  | 1396 | * | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1397 | * \param[out] out_TU A non-NULL pointer to store the created | 
|  | 1398 | * \c CXTranslationUnit, describing the parsed code and containing any | 
|  | 1399 | * diagnostics produced by the compiler. | 
|  | 1400 | * | 
|  | 1401 | * \returns Zero on success, otherwise returns an error code. | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1402 | */ | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1403 | CINDEX_LINKAGE enum CXErrorCode | 
|  | 1404 | clang_parseTranslationUnit2(CXIndex CIdx, | 
|  | 1405 | const char *source_filename, | 
|  | 1406 | const char *const *command_line_args, | 
|  | 1407 | int num_command_line_args, | 
|  | 1408 | struct CXUnsavedFile *unsaved_files, | 
|  | 1409 | unsigned num_unsaved_files, | 
|  | 1410 | unsigned options, | 
|  | 1411 | CXTranslationUnit *out_TU); | 
|  | 1412 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1413 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1414 | * Same as clang_parseTranslationUnit2 but requires a full command line | 
| Benjamin Kramer | c02670e | 2015-11-18 16:14:27 +0000 | [diff] [blame] | 1415 | * for \c command_line_args including argv[0]. This is useful if the standard | 
|  | 1416 | * library paths are relative to the binary. | 
|  | 1417 | */ | 
|  | 1418 | CINDEX_LINKAGE enum CXErrorCode clang_parseTranslationUnit2FullArgv( | 
|  | 1419 | CXIndex CIdx, const char *source_filename, | 
|  | 1420 | const char *const *command_line_args, int num_command_line_args, | 
|  | 1421 | struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files, | 
|  | 1422 | unsigned options, CXTranslationUnit *out_TU); | 
|  | 1423 |  | 
|  | 1424 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1425 | * Flags that control how translation units are saved. | 
| Douglas Gregor | 6bb92ec | 2010-08-13 15:35:05 +0000 | [diff] [blame] | 1426 | * | 
|  | 1427 | * The enumerators in this enumeration type are meant to be bitwise | 
|  | 1428 | * ORed together to specify which options should be used when | 
|  | 1429 | * saving the translation unit. | 
|  | 1430 | */ | 
|  | 1431 | enum CXSaveTranslationUnit_Flags { | 
|  | 1432 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1433 | * Used to indicate that no special saving options are needed. | 
| Douglas Gregor | 6bb92ec | 2010-08-13 15:35:05 +0000 | [diff] [blame] | 1434 | */ | 
|  | 1435 | CXSaveTranslationUnit_None = 0x0 | 
|  | 1436 | }; | 
|  | 1437 |  | 
|  | 1438 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1439 | * Returns the set of flags that is suitable for saving a translation | 
| Douglas Gregor | 6bb92ec | 2010-08-13 15:35:05 +0000 | [diff] [blame] | 1440 | * unit. | 
|  | 1441 | * | 
|  | 1442 | * The set of flags returned provide options for | 
|  | 1443 | * \c clang_saveTranslationUnit() by default. The returned flag | 
|  | 1444 | * set contains an unspecified set of options that save translation units with | 
|  | 1445 | * the most commonly-requested data. | 
|  | 1446 | */ | 
|  | 1447 | CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU); | 
|  | 1448 |  | 
|  | 1449 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1450 | * Describes the kind of error that occurred (if any) in a call to | 
| Douglas Gregor | 30c80fa | 2011-07-06 16:43:36 +0000 | [diff] [blame] | 1451 | * \c clang_saveTranslationUnit(). | 
|  | 1452 | */ | 
|  | 1453 | enum CXSaveError { | 
|  | 1454 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1455 | * Indicates that no error occurred while saving a translation unit. | 
| Douglas Gregor | 30c80fa | 2011-07-06 16:43:36 +0000 | [diff] [blame] | 1456 | */ | 
|  | 1457 | CXSaveError_None = 0, | 
|  | 1458 |  | 
|  | 1459 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1460 | * Indicates that an unknown error occurred while attempting to save | 
| Douglas Gregor | 30c80fa | 2011-07-06 16:43:36 +0000 | [diff] [blame] | 1461 | * the file. | 
|  | 1462 | * | 
|  | 1463 | * This error typically indicates that file I/O failed when attempting to | 
|  | 1464 | * write the file. | 
|  | 1465 | */ | 
|  | 1466 | CXSaveError_Unknown = 1, | 
|  | 1467 |  | 
|  | 1468 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1469 | * Indicates that errors during translation prevented this attempt | 
| Douglas Gregor | 30c80fa | 2011-07-06 16:43:36 +0000 | [diff] [blame] | 1470 | * to save the translation unit. | 
|  | 1471 | * | 
|  | 1472 | * Errors that prevent the translation unit from being saved can be | 
|  | 1473 | * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic(). | 
|  | 1474 | */ | 
|  | 1475 | CXSaveError_TranslationErrors = 2, | 
|  | 1476 |  | 
|  | 1477 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1478 | * Indicates that the translation unit to be saved was somehow | 
| Douglas Gregor | 30c80fa | 2011-07-06 16:43:36 +0000 | [diff] [blame] | 1479 | * invalid (e.g., NULL). | 
|  | 1480 | */ | 
|  | 1481 | CXSaveError_InvalidTU = 3 | 
|  | 1482 | }; | 
|  | 1483 |  | 
|  | 1484 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1485 | * Saves a translation unit into a serialized representation of | 
| Douglas Gregor | e938668 | 2010-08-13 05:36:37 +0000 | [diff] [blame] | 1486 | * that translation unit on disk. | 
|  | 1487 | * | 
|  | 1488 | * Any translation unit that was parsed without error can be saved | 
|  | 1489 | * into a file. The translation unit can then be deserialized into a | 
|  | 1490 | * new \c CXTranslationUnit with \c clang_createTranslationUnit() or, | 
|  | 1491 | * if it is an incomplete translation unit that corresponds to a | 
|  | 1492 | * header, used as a precompiled header when parsing other translation | 
|  | 1493 | * units. | 
|  | 1494 | * | 
|  | 1495 | * \param TU The translation unit to save. | 
| Douglas Gregor | 6bb92ec | 2010-08-13 15:35:05 +0000 | [diff] [blame] | 1496 | * | 
| Douglas Gregor | e938668 | 2010-08-13 05:36:37 +0000 | [diff] [blame] | 1497 | * \param FileName The file to which the translation unit will be saved. | 
|  | 1498 | * | 
| Douglas Gregor | 6bb92ec | 2010-08-13 15:35:05 +0000 | [diff] [blame] | 1499 | * \param options A bitmask of options that affects how the translation unit | 
|  | 1500 | * is saved. This should be a bitwise OR of the | 
|  | 1501 | * CXSaveTranslationUnit_XXX flags. | 
|  | 1502 | * | 
| Douglas Gregor | 30c80fa | 2011-07-06 16:43:36 +0000 | [diff] [blame] | 1503 | * \returns A value that will match one of the enumerators of the CXSaveError | 
|  | 1504 | * enumeration. Zero (CXSaveError_None) indicates that the translation unit was | 
|  | 1505 | * saved successfully, while a non-zero value indicates that a problem occurred. | 
| Douglas Gregor | e938668 | 2010-08-13 05:36:37 +0000 | [diff] [blame] | 1506 | */ | 
|  | 1507 | CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, | 
| Douglas Gregor | 6bb92ec | 2010-08-13 15:35:05 +0000 | [diff] [blame] | 1508 | const char *FileName, | 
|  | 1509 | unsigned options); | 
| Douglas Gregor | e938668 | 2010-08-13 05:36:37 +0000 | [diff] [blame] | 1510 |  | 
|  | 1511 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1512 | * Suspend a translation unit in order to free memory associated with it. | 
| Erik Verbruggen | 346066b | 2017-05-30 14:25:54 +0000 | [diff] [blame] | 1513 | * | 
|  | 1514 | * A suspended translation unit uses significantly less memory but on the other | 
|  | 1515 | * side does not support any other calls than \c clang_reparseTranslationUnit | 
|  | 1516 | * to resume it or \c clang_disposeTranslationUnit to dispose it completely. | 
|  | 1517 | */ | 
|  | 1518 | CINDEX_LINKAGE unsigned clang_suspendTranslationUnit(CXTranslationUnit); | 
|  | 1519 |  | 
|  | 1520 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1521 | * Destroy the specified CXTranslationUnit object. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1522 | */ | 
|  | 1523 | CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1524 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1525 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1526 | * Flags that control the reparsing of translation units. | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1527 | * | 
|  | 1528 | * The enumerators in this enumeration type are meant to be bitwise | 
|  | 1529 | * ORed together to specify which options should be used when | 
|  | 1530 | * reparsing the translation unit. | 
|  | 1531 | */ | 
|  | 1532 | enum CXReparse_Flags { | 
|  | 1533 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1534 | * Used to indicate that no special reparsing options are needed. | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1535 | */ | 
|  | 1536 | CXReparse_None = 0x0 | 
|  | 1537 | }; | 
|  | 1538 |  | 
|  | 1539 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1540 | * Returns the set of flags that is suitable for reparsing a translation | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1541 | * unit. | 
|  | 1542 | * | 
|  | 1543 | * The set of flags returned provide options for | 
|  | 1544 | * \c clang_reparseTranslationUnit() by default. The returned flag | 
|  | 1545 | * set contains an unspecified set of optimizations geared toward common uses | 
|  | 1546 | * of reparsing. The set of optimizations enabled may change from one version | 
|  | 1547 | * to the next. | 
|  | 1548 | */ | 
|  | 1549 | CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU); | 
|  | 1550 |  | 
|  | 1551 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1552 | * Reparse the source files that produced this translation unit. | 
| Douglas Gregor | aa21cc4 | 2010-07-19 21:46:24 +0000 | [diff] [blame] | 1553 | * | 
|  | 1554 | * This routine can be used to re-parse the source files that originally | 
|  | 1555 | * created the given translation unit, for example because those source files | 
|  | 1556 | * have changed (either on disk or as passed via \p unsaved_files). The | 
|  | 1557 | * source code will be reparsed with the same command-line options as it | 
|  | 1558 | * was originally parsed. | 
|  | 1559 | * | 
|  | 1560 | * Reparsing a translation unit invalidates all cursors and source locations | 
|  | 1561 | * that refer into that translation unit. This makes reparsing a translation | 
|  | 1562 | * unit semantically equivalent to destroying the translation unit and then | 
|  | 1563 | * creating a new translation unit with the same command-line arguments. | 
|  | 1564 | * However, it may be more efficient to reparse a translation | 
|  | 1565 | * unit using this routine. | 
|  | 1566 | * | 
|  | 1567 | * \param TU The translation unit whose contents will be re-parsed. The | 
|  | 1568 | * translation unit must originally have been built with | 
|  | 1569 | * \c clang_createTranslationUnitFromSourceFile(). | 
|  | 1570 | * | 
|  | 1571 | * \param num_unsaved_files The number of unsaved file entries in \p | 
|  | 1572 | * unsaved_files. | 
|  | 1573 | * | 
|  | 1574 | * \param unsaved_files The files that have not yet been saved to disk | 
|  | 1575 | * but may be required for parsing, including the contents of | 
|  | 1576 | * those files.  The contents and name of these files (as specified by | 
|  | 1577 | * CXUnsavedFile) are copied when necessary, so the client only needs to | 
|  | 1578 | * guarantee their validity until the call to this function returns. | 
|  | 1579 | * | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1580 | * \param options A bitset of options composed of the flags in CXReparse_Flags. | 
|  | 1581 | * The function \c clang_defaultReparseOptions() produces a default set of | 
|  | 1582 | * options recommended for most uses, based on the translation unit. | 
|  | 1583 | * | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1584 | * \returns 0 if the sources could be reparsed.  A non-zero error code will be | 
| Douglas Gregor | aa21cc4 | 2010-07-19 21:46:24 +0000 | [diff] [blame] | 1585 | * returned if reparsing was impossible, such that the translation unit is | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1586 | * invalid. In such cases, the only valid call for \c TU is | 
|  | 1587 | * \c clang_disposeTranslationUnit(TU).  The error codes returned by this | 
|  | 1588 | * routine are described by the \c CXErrorCode enum. | 
| Douglas Gregor | aa21cc4 | 2010-07-19 21:46:24 +0000 | [diff] [blame] | 1589 | */ | 
|  | 1590 | CINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU, | 
|  | 1591 | unsigned num_unsaved_files, | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1592 | struct CXUnsavedFile *unsaved_files, | 
|  | 1593 | unsigned options); | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1594 |  | 
|  | 1595 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1596 | * Categorizes how memory is being used by a translation unit. | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1597 | */ | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1598 | enum CXTUResourceUsageKind { | 
|  | 1599 | CXTUResourceUsage_AST = 1, | 
|  | 1600 | CXTUResourceUsage_Identifiers = 2, | 
|  | 1601 | CXTUResourceUsage_Selectors = 3, | 
|  | 1602 | CXTUResourceUsage_GlobalCompletionResults = 4, | 
| Ted Kremenek | 21735e6 | 2011-04-28 04:10:31 +0000 | [diff] [blame] | 1603 | CXTUResourceUsage_SourceManagerContentCache = 5, | 
| Ted Kremenek | f5df0ce | 2011-04-28 04:53:38 +0000 | [diff] [blame] | 1604 | CXTUResourceUsage_AST_SideTables = 6, | 
| Ted Kremenek | 8d58790 | 2011-04-28 20:36:42 +0000 | [diff] [blame] | 1605 | CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7, | 
| Ted Kremenek | 5e1ed7b | 2011-04-28 23:46:20 +0000 | [diff] [blame] | 1606 | CXTUResourceUsage_SourceManager_Membuffer_MMap = 8, | 
|  | 1607 | CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9, | 
|  | 1608 | CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10, | 
| Ted Kremenek | 2160a0d | 2011-05-04 01:38:46 +0000 | [diff] [blame] | 1609 | CXTUResourceUsage_Preprocessor = 11, | 
|  | 1610 | CXTUResourceUsage_PreprocessingRecord = 12, | 
| Ted Kremenek | 120992a | 2011-07-26 23:46:06 +0000 | [diff] [blame] | 1611 | CXTUResourceUsage_SourceManager_DataStructures = 13, | 
| Ted Kremenek | fbcce6f | 2011-07-26 23:46:11 +0000 | [diff] [blame] | 1612 | CXTUResourceUsage_Preprocessor_HeaderSearch = 14, | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1613 | CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST, | 
|  | 1614 | CXTUResourceUsage_MEMORY_IN_BYTES_END = | 
| Ted Kremenek | fbcce6f | 2011-07-26 23:46:11 +0000 | [diff] [blame] | 1615 | CXTUResourceUsage_Preprocessor_HeaderSearch, | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1616 |  | 
|  | 1617 | CXTUResourceUsage_First = CXTUResourceUsage_AST, | 
| Ted Kremenek | fbcce6f | 2011-07-26 23:46:11 +0000 | [diff] [blame] | 1618 | CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1619 | }; | 
|  | 1620 |  | 
|  | 1621 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1622 | * Returns the human-readable null-terminated C string that represents | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1623 | *  the name of the memory category.  This string should never be freed. | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1624 | */ | 
|  | 1625 | CINDEX_LINKAGE | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1626 | const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind); | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1627 |  | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1628 | typedef struct CXTUResourceUsageEntry { | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1629 | /* The memory usage category. */ | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1630 | enum CXTUResourceUsageKind kind; | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1631 | /* Amount of resources used. | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1632 | The units will depend on the resource kind. */ | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1633 | unsigned long amount; | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1634 | } CXTUResourceUsageEntry; | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1635 |  | 
|  | 1636 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1637 | * The memory usage of a CXTranslationUnit, broken into categories. | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1638 | */ | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1639 | typedef struct CXTUResourceUsage { | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1640 | /* Private data member, used for queries. */ | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1641 | void *data; | 
|  | 1642 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1643 | /* The number of entries in the 'entries' array. */ | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1644 | unsigned numEntries; | 
|  | 1645 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1646 | /* An array of key-value pairs, representing the breakdown of memory | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1647 | usage. */ | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1648 | CXTUResourceUsageEntry *entries; | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1649 |  | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1650 | } CXTUResourceUsage; | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1651 |  | 
|  | 1652 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1653 | * Return the memory usage of a translation unit.  This object | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1654 | *  should be released with clang_disposeCXTUResourceUsage(). | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1655 | */ | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1656 | CINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU); | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1657 |  | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1658 | CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage); | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1659 |  | 
| Douglas Gregor | aa21cc4 | 2010-07-19 21:46:24 +0000 | [diff] [blame] | 1660 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1661 | * Get target information for this translation unit. | 
| Emilio Cobos Alvarez | 485ad42 | 2017-04-28 15:56:39 +0000 | [diff] [blame] | 1662 | * | 
|  | 1663 | * The CXTargetInfo object cannot outlive the CXTranslationUnit object. | 
|  | 1664 | */ | 
|  | 1665 | CINDEX_LINKAGE CXTargetInfo | 
|  | 1666 | clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit); | 
|  | 1667 |  | 
|  | 1668 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1669 | * Destroy the CXTargetInfo object. | 
| Emilio Cobos Alvarez | 485ad42 | 2017-04-28 15:56:39 +0000 | [diff] [blame] | 1670 | */ | 
|  | 1671 | CINDEX_LINKAGE void | 
|  | 1672 | clang_TargetInfo_dispose(CXTargetInfo Info); | 
|  | 1673 |  | 
|  | 1674 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1675 | * Get the normalized target triple as a string. | 
| Emilio Cobos Alvarez | 485ad42 | 2017-04-28 15:56:39 +0000 | [diff] [blame] | 1676 | * | 
|  | 1677 | * Returns the empty string in case of any error. | 
|  | 1678 | */ | 
|  | 1679 | CINDEX_LINKAGE CXString | 
|  | 1680 | clang_TargetInfo_getTriple(CXTargetInfo Info); | 
|  | 1681 |  | 
|  | 1682 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1683 | * Get the pointer width of the target in bits. | 
| Emilio Cobos Alvarez | 485ad42 | 2017-04-28 15:56:39 +0000 | [diff] [blame] | 1684 | * | 
|  | 1685 | * Returns -1 in case of error. | 
|  | 1686 | */ | 
|  | 1687 | CINDEX_LINKAGE int | 
|  | 1688 | clang_TargetInfo_getPointerWidth(CXTargetInfo Info); | 
|  | 1689 |  | 
|  | 1690 | /** | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1691 | * @} | 
|  | 1692 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1693 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1694 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1695 | * Describes the kind of entity that a cursor refers to. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1696 | */ | 
|  | 1697 | enum CXCursorKind { | 
|  | 1698 | /* Declarations */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1699 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1700 | * A declaration whose specific kind is not exposed via this | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1701 | * interface. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1702 | * | 
|  | 1703 | * Unexposed declarations have the same operations as any other kind | 
|  | 1704 | * of declaration; one can extract their location information, | 
|  | 1705 | * spelling, find their definitions, etc. However, the specific kind | 
|  | 1706 | * of the declaration is not reported. | 
|  | 1707 | */ | 
|  | 1708 | CXCursor_UnexposedDecl                 = 1, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1709 | /** A C or C++ struct. */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1710 | CXCursor_StructDecl                    = 2, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1711 | /** A C or C++ union. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1712 | CXCursor_UnionDecl                     = 3, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1713 | /** A C++ class. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1714 | CXCursor_ClassDecl                     = 4, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1715 | /** An enumeration. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1716 | CXCursor_EnumDecl                      = 5, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1717 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1718 | * A field (in C) or non-static data member (in C++) in a | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1719 | * struct, union, or C++ class. | 
|  | 1720 | */ | 
|  | 1721 | CXCursor_FieldDecl                     = 6, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1722 | /** An enumerator constant. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1723 | CXCursor_EnumConstantDecl              = 7, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1724 | /** A function. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1725 | CXCursor_FunctionDecl                  = 8, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1726 | /** A variable. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1727 | CXCursor_VarDecl                       = 9, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1728 | /** A function or method parameter. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1729 | CXCursor_ParmDecl                      = 10, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1730 | /** An Objective-C \@interface. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1731 | CXCursor_ObjCInterfaceDecl             = 11, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1732 | /** An Objective-C \@interface for a category. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1733 | CXCursor_ObjCCategoryDecl              = 12, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1734 | /** An Objective-C \@protocol declaration. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1735 | CXCursor_ObjCProtocolDecl              = 13, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1736 | /** An Objective-C \@property declaration. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1737 | CXCursor_ObjCPropertyDecl              = 14, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1738 | /** An Objective-C instance variable. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1739 | CXCursor_ObjCIvarDecl                  = 15, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1740 | /** An Objective-C instance method. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1741 | CXCursor_ObjCInstanceMethodDecl        = 16, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1742 | /** An Objective-C class method. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1743 | CXCursor_ObjCClassMethodDecl           = 17, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1744 | /** An Objective-C \@implementation. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1745 | CXCursor_ObjCImplementationDecl        = 18, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1746 | /** An Objective-C \@implementation for a category. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1747 | CXCursor_ObjCCategoryImplDecl          = 19, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1748 | /** A typedef. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1749 | CXCursor_TypedefDecl                   = 20, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1750 | /** A C++ class method. */ | 
| Ted Kremenek | 225b8e3 | 2010-04-13 23:39:06 +0000 | [diff] [blame] | 1751 | CXCursor_CXXMethod                     = 21, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1752 | /** A C++ namespace. */ | 
| Ted Kremenek | bd67fb2 | 2010-05-06 23:38:21 +0000 | [diff] [blame] | 1753 | CXCursor_Namespace                     = 22, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1754 | /** A linkage specification, e.g. 'extern "C"'. */ | 
| Ted Kremenek | b80cba5 | 2010-05-07 01:04:29 +0000 | [diff] [blame] | 1755 | CXCursor_LinkageSpec                   = 23, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1756 | /** A C++ constructor. */ | 
| Douglas Gregor | 12bca22 | 2010-08-31 14:41:23 +0000 | [diff] [blame] | 1757 | CXCursor_Constructor                   = 24, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1758 | /** A C++ destructor. */ | 
| Douglas Gregor | 12bca22 | 2010-08-31 14:41:23 +0000 | [diff] [blame] | 1759 | CXCursor_Destructor                    = 25, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1760 | /** A C++ conversion function. */ | 
| Douglas Gregor | 12bca22 | 2010-08-31 14:41:23 +0000 | [diff] [blame] | 1761 | CXCursor_ConversionFunction            = 26, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1762 | /** A C++ template type parameter. */ | 
| Douglas Gregor | 713602b | 2010-08-31 17:01:39 +0000 | [diff] [blame] | 1763 | CXCursor_TemplateTypeParameter         = 27, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1764 | /** A C++ non-type template parameter. */ | 
| Douglas Gregor | 713602b | 2010-08-31 17:01:39 +0000 | [diff] [blame] | 1765 | CXCursor_NonTypeTemplateParameter      = 28, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1766 | /** A C++ template template parameter. */ | 
| Douglas Gregor | 713602b | 2010-08-31 17:01:39 +0000 | [diff] [blame] | 1767 | CXCursor_TemplateTemplateParameter     = 29, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1768 | /** A C++ function template. */ | 
| Douglas Gregor | 713602b | 2010-08-31 17:01:39 +0000 | [diff] [blame] | 1769 | CXCursor_FunctionTemplate              = 30, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1770 | /** A C++ class template. */ | 
| Douglas Gregor | 1fbaeb1 | 2010-08-31 19:02:00 +0000 | [diff] [blame] | 1771 | CXCursor_ClassTemplate                 = 31, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1772 | /** A C++ class template partial specialization. */ | 
| Douglas Gregor | f96abb2 | 2010-08-31 19:31:58 +0000 | [diff] [blame] | 1773 | CXCursor_ClassTemplatePartialSpecialization = 32, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1774 | /** A C++ namespace alias declaration. */ | 
| Douglas Gregor | a89314e | 2010-08-31 23:48:11 +0000 | [diff] [blame] | 1775 | CXCursor_NamespaceAlias                = 33, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1776 | /** A C++ using directive. */ | 
| Douglas Gregor | 01a43013 | 2010-09-01 03:07:18 +0000 | [diff] [blame] | 1777 | CXCursor_UsingDirective                = 34, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1778 | /** A C++ using declaration. */ | 
| Douglas Gregor | a9aa29c | 2010-09-01 19:52:22 +0000 | [diff] [blame] | 1779 | CXCursor_UsingDeclaration              = 35, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1780 | /** A C++ alias declaration */ | 
| Richard Smith | dda56e4 | 2011-04-15 14:24:37 +0000 | [diff] [blame] | 1781 | CXCursor_TypeAliasDecl                 = 36, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1782 | /** An Objective-C \@synthesize definition. */ | 
| Douglas Gregor | 4cd6596 | 2011-06-03 23:08:58 +0000 | [diff] [blame] | 1783 | CXCursor_ObjCSynthesizeDecl            = 37, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1784 | /** An Objective-C \@dynamic definition. */ | 
| Douglas Gregor | 4cd6596 | 2011-06-03 23:08:58 +0000 | [diff] [blame] | 1785 | CXCursor_ObjCDynamicDecl               = 38, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1786 | /** An access specifier. */ | 
| Argyrios Kyrtzidis | 12afd70 | 2011-09-30 17:58:23 +0000 | [diff] [blame] | 1787 | CXCursor_CXXAccessSpecifier            = 39, | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1788 |  | 
| Ted Kremenek | 08de5c1 | 2010-05-19 21:51:10 +0000 | [diff] [blame] | 1789 | CXCursor_FirstDecl                     = CXCursor_UnexposedDecl, | 
| Argyrios Kyrtzidis | 12afd70 | 2011-09-30 17:58:23 +0000 | [diff] [blame] | 1790 | CXCursor_LastDecl                      = CXCursor_CXXAccessSpecifier, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1791 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1792 | /* References */ | 
|  | 1793 | CXCursor_FirstRef                      = 40, /* Decl references */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1794 | CXCursor_ObjCSuperClassRef             = 40, | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1795 | CXCursor_ObjCProtocolRef               = 41, | 
|  | 1796 | CXCursor_ObjCClassRef                  = 42, | 
|  | 1797 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1798 | * A reference to a type declaration. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1799 | * | 
|  | 1800 | * A type reference occurs anywhere where a type is named but not | 
|  | 1801 | * declared. For example, given: | 
|  | 1802 | * | 
|  | 1803 | * \code | 
|  | 1804 | * typedef unsigned size_type; | 
|  | 1805 | * size_type size; | 
|  | 1806 | * \endcode | 
|  | 1807 | * | 
|  | 1808 | * The typedef is a declaration of size_type (CXCursor_TypedefDecl), | 
|  | 1809 | * while the type of the variable "size" is referenced. The cursor | 
|  | 1810 | * referenced by the type of size is the typedef for size_type. | 
|  | 1811 | */ | 
|  | 1812 | CXCursor_TypeRef                       = 43, | 
| Ted Kremenek | ae9e221 | 2010-08-27 21:34:58 +0000 | [diff] [blame] | 1813 | CXCursor_CXXBaseSpecifier              = 44, | 
| Douglas Gregor | a23e8f7 | 2010-08-31 20:37:03 +0000 | [diff] [blame] | 1814 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1815 | * A reference to a class template, function template, template | 
| Douglas Gregor | f3af311 | 2010-09-09 21:42:20 +0000 | [diff] [blame] | 1816 | * template parameter, or class template partial specialization. | 
| Douglas Gregor | a23e8f7 | 2010-08-31 20:37:03 +0000 | [diff] [blame] | 1817 | */ | 
|  | 1818 | CXCursor_TemplateRef                   = 45, | 
| Douglas Gregor | a89314e | 2010-08-31 23:48:11 +0000 | [diff] [blame] | 1819 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1820 | * A reference to a namespace or namespace alias. | 
| Douglas Gregor | a89314e | 2010-08-31 23:48:11 +0000 | [diff] [blame] | 1821 | */ | 
|  | 1822 | CXCursor_NamespaceRef                  = 46, | 
| Douglas Gregor | f3af311 | 2010-09-09 21:42:20 +0000 | [diff] [blame] | 1823 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1824 | * A reference to a member of a struct, union, or class that occurs in | 
| Douglas Gregor | a93ab66 | 2010-09-10 00:22:18 +0000 | [diff] [blame] | 1825 | * some non-expression context, e.g., a designated initializer. | 
| Douglas Gregor | f3af311 | 2010-09-09 21:42:20 +0000 | [diff] [blame] | 1826 | */ | 
|  | 1827 | CXCursor_MemberRef                     = 47, | 
| Douglas Gregor | a93ab66 | 2010-09-10 00:22:18 +0000 | [diff] [blame] | 1828 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1829 | * A reference to a labeled statement. | 
| Douglas Gregor | a93ab66 | 2010-09-10 00:22:18 +0000 | [diff] [blame] | 1830 | * | 
|  | 1831 | * This cursor kind is used to describe the jump to "start_over" in the | 
|  | 1832 | * goto statement in the following example: | 
|  | 1833 | * | 
|  | 1834 | * \code | 
|  | 1835 | *   start_over: | 
|  | 1836 | *     ++counter; | 
|  | 1837 | * | 
|  | 1838 | *     goto start_over; | 
|  | 1839 | * \endcode | 
|  | 1840 | * | 
|  | 1841 | * A label reference cursor refers to a label statement. | 
|  | 1842 | */ | 
|  | 1843 | CXCursor_LabelRef                      = 48, | 
|  | 1844 |  | 
| Douglas Gregor | 16a2bdd | 2010-09-13 22:52:57 +0000 | [diff] [blame] | 1845 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1846 | * A reference to a set of overloaded functions or function templates | 
| Douglas Gregor | 16a2bdd | 2010-09-13 22:52:57 +0000 | [diff] [blame] | 1847 | * that has not yet been resolved to a specific function or function template. | 
|  | 1848 | * | 
|  | 1849 | * An overloaded declaration reference cursor occurs in C++ templates where | 
|  | 1850 | * a dependent name refers to a function. For example: | 
|  | 1851 | * | 
|  | 1852 | * \code | 
|  | 1853 | * template<typename T> void swap(T&, T&); | 
|  | 1854 | * | 
|  | 1855 | * struct X { ... }; | 
|  | 1856 | * void swap(X&, X&); | 
|  | 1857 | * | 
|  | 1858 | * template<typename T> | 
|  | 1859 | * void reverse(T* first, T* last) { | 
|  | 1860 | *   while (first < last - 1) { | 
|  | 1861 | *     swap(*first, *--last); | 
|  | 1862 | *     ++first; | 
|  | 1863 | *   } | 
|  | 1864 | * } | 
|  | 1865 | * | 
|  | 1866 | * struct Y { }; | 
|  | 1867 | * void swap(Y&, Y&); | 
|  | 1868 | * \endcode | 
|  | 1869 | * | 
|  | 1870 | * Here, the identifier "swap" is associated with an overloaded declaration | 
|  | 1871 | * reference. In the template definition, "swap" refers to either of the two | 
|  | 1872 | * "swap" functions declared above, so both results will be available. At | 
|  | 1873 | * instantiation time, "swap" may also refer to other functions found via | 
|  | 1874 | * argument-dependent lookup (e.g., the "swap" function at the end of the | 
|  | 1875 | * example). | 
|  | 1876 | * | 
|  | 1877 | * The functions \c clang_getNumOverloadedDecls() and | 
|  | 1878 | * \c clang_getOverloadedDecl() can be used to retrieve the definitions | 
|  | 1879 | * referenced by this cursor. | 
|  | 1880 | */ | 
|  | 1881 | CXCursor_OverloadedDeclRef             = 49, | 
|  | 1882 |  | 
| Douglas Gregor | 3009383 | 2012-02-15 00:54:55 +0000 | [diff] [blame] | 1883 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1884 | * A reference to a variable that occurs in some non-expression | 
| Douglas Gregor | 3009383 | 2012-02-15 00:54:55 +0000 | [diff] [blame] | 1885 | * context, e.g., a C++ lambda capture list. | 
|  | 1886 | */ | 
|  | 1887 | CXCursor_VariableRef                   = 50, | 
|  | 1888 |  | 
|  | 1889 | CXCursor_LastRef                       = CXCursor_VariableRef, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1890 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1891 | /* Error conditions */ | 
|  | 1892 | CXCursor_FirstInvalid                  = 70, | 
|  | 1893 | CXCursor_InvalidFile                   = 70, | 
|  | 1894 | CXCursor_NoDeclFound                   = 71, | 
|  | 1895 | CXCursor_NotImplemented                = 72, | 
| Ted Kremenek | e184ac5 | 2010-03-19 20:39:03 +0000 | [diff] [blame] | 1896 | CXCursor_InvalidCode                   = 73, | 
|  | 1897 | CXCursor_LastInvalid                   = CXCursor_InvalidCode, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1898 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1899 | /* Expressions */ | 
|  | 1900 | CXCursor_FirstExpr                     = 100, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1901 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1902 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1903 | * An expression whose specific kind is not exposed via this | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1904 | * interface. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1905 | * | 
|  | 1906 | * Unexposed expressions have the same operations as any other kind | 
|  | 1907 | * of expression; one can extract their location information, | 
|  | 1908 | * spelling, children, etc. However, the specific kind of the | 
|  | 1909 | * expression is not reported. | 
|  | 1910 | */ | 
|  | 1911 | CXCursor_UnexposedExpr                 = 100, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1912 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1913 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1914 | * An expression that refers to some value declaration, such | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 1915 | * as a function, variable, or enumerator. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1916 | */ | 
|  | 1917 | CXCursor_DeclRefExpr                   = 101, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1918 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1919 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1920 | * An expression that refers to a member of a struct, union, | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1921 | * class, Objective-C class, etc. | 
|  | 1922 | */ | 
|  | 1923 | CXCursor_MemberRefExpr                 = 102, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1924 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1925 | /** An expression that calls a function. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1926 | CXCursor_CallExpr                      = 103, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1927 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1928 | /** An expression that sends a message to an Objective-C | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1929 | object or class. */ | 
|  | 1930 | CXCursor_ObjCMessageExpr               = 104, | 
| Ted Kremenek | 33b9a42 | 2010-04-11 21:47:37 +0000 | [diff] [blame] | 1931 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1932 | /** An expression that represents a block literal. */ | 
| Ted Kremenek | 33b9a42 | 2010-04-11 21:47:37 +0000 | [diff] [blame] | 1933 | CXCursor_BlockExpr                     = 105, | 
|  | 1934 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1935 | /** An integer literal. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1936 | */ | 
|  | 1937 | CXCursor_IntegerLiteral                = 106, | 
|  | 1938 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1939 | /** A floating point number literal. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1940 | */ | 
|  | 1941 | CXCursor_FloatingLiteral               = 107, | 
|  | 1942 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1943 | /** An imaginary number literal. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1944 | */ | 
|  | 1945 | CXCursor_ImaginaryLiteral              = 108, | 
|  | 1946 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1947 | /** A string literal. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1948 | */ | 
|  | 1949 | CXCursor_StringLiteral                 = 109, | 
|  | 1950 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1951 | /** A character literal. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1952 | */ | 
|  | 1953 | CXCursor_CharacterLiteral              = 110, | 
|  | 1954 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1955 | /** A parenthesized expression, e.g. "(1)". | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1956 | * | 
|  | 1957 | * This AST node is only formed if full location information is requested. | 
|  | 1958 | */ | 
|  | 1959 | CXCursor_ParenExpr                     = 111, | 
|  | 1960 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1961 | /** This represents the unary-expression's (except sizeof and | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1962 | * alignof). | 
|  | 1963 | */ | 
|  | 1964 | CXCursor_UnaryOperator                 = 112, | 
|  | 1965 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1966 | /** [C99 6.5.2.1] Array Subscripting. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1967 | */ | 
|  | 1968 | CXCursor_ArraySubscriptExpr            = 113, | 
|  | 1969 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1970 | /** A builtin binary operation expression such as "x + y" or | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1971 | * "x <= y". | 
|  | 1972 | */ | 
|  | 1973 | CXCursor_BinaryOperator                = 114, | 
|  | 1974 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1975 | /** Compound assignment such as "+=". | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1976 | */ | 
|  | 1977 | CXCursor_CompoundAssignOperator        = 115, | 
|  | 1978 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1979 | /** The ?: ternary operator. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1980 | */ | 
|  | 1981 | CXCursor_ConditionalOperator           = 116, | 
|  | 1982 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1983 | /** An explicit cast in C (C99 6.5.4) or a C-style cast in C++ | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1984 | * (C++ [expr.cast]), which uses the syntax (Type)expr. | 
|  | 1985 | * | 
|  | 1986 | * For example: (int)f. | 
|  | 1987 | */ | 
|  | 1988 | CXCursor_CStyleCastExpr                = 117, | 
|  | 1989 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1990 | /** [C99 6.5.2.5] | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1991 | */ | 
|  | 1992 | CXCursor_CompoundLiteralExpr           = 118, | 
|  | 1993 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1994 | /** Describes an C or C++ initializer list. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1995 | */ | 
|  | 1996 | CXCursor_InitListExpr                  = 119, | 
|  | 1997 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 1998 | /** The GNU address of label extension, representing &&label. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1999 | */ | 
|  | 2000 | CXCursor_AddrLabelExpr                 = 120, | 
|  | 2001 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2002 | /** This is the GNU Statement Expression extension: ({int X=4; X;}) | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2003 | */ | 
|  | 2004 | CXCursor_StmtExpr                      = 121, | 
|  | 2005 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2006 | /** Represents a C11 generic selection. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2007 | */ | 
|  | 2008 | CXCursor_GenericSelectionExpr          = 122, | 
|  | 2009 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2010 | /** Implements the GNU __null extension, which is a name for a null | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2011 | * pointer constant that has integral type (e.g., int or long) and is the same | 
|  | 2012 | * size and alignment as a pointer. | 
|  | 2013 | * | 
|  | 2014 | * The __null extension is typically only used by system headers, which define | 
|  | 2015 | * NULL as __null in C++ rather than using 0 (which is an integer that may not | 
|  | 2016 | * match the size of a pointer). | 
|  | 2017 | */ | 
|  | 2018 | CXCursor_GNUNullExpr                   = 123, | 
|  | 2019 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2020 | /** C++'s static_cast<> expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2021 | */ | 
|  | 2022 | CXCursor_CXXStaticCastExpr             = 124, | 
|  | 2023 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2024 | /** C++'s dynamic_cast<> expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2025 | */ | 
|  | 2026 | CXCursor_CXXDynamicCastExpr            = 125, | 
|  | 2027 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2028 | /** C++'s reinterpret_cast<> expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2029 | */ | 
|  | 2030 | CXCursor_CXXReinterpretCastExpr        = 126, | 
|  | 2031 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2032 | /** C++'s const_cast<> expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2033 | */ | 
|  | 2034 | CXCursor_CXXConstCastExpr              = 127, | 
|  | 2035 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2036 | /** Represents an explicit C++ type conversion that uses "functional" | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2037 | * notion (C++ [expr.type.conv]). | 
|  | 2038 | * | 
|  | 2039 | * Example: | 
|  | 2040 | * \code | 
|  | 2041 | *   x = int(0.5); | 
|  | 2042 | * \endcode | 
|  | 2043 | */ | 
|  | 2044 | CXCursor_CXXFunctionalCastExpr         = 128, | 
|  | 2045 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2046 | /** A C++ typeid expression (C++ [expr.typeid]). | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2047 | */ | 
|  | 2048 | CXCursor_CXXTypeidExpr                 = 129, | 
|  | 2049 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2050 | /** [C++ 2.13.5] C++ Boolean Literal. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2051 | */ | 
|  | 2052 | CXCursor_CXXBoolLiteralExpr            = 130, | 
|  | 2053 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2054 | /** [C++0x 2.14.7] C++ Pointer Literal. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2055 | */ | 
|  | 2056 | CXCursor_CXXNullPtrLiteralExpr         = 131, | 
|  | 2057 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2058 | /** Represents the "this" expression in C++ | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2059 | */ | 
|  | 2060 | CXCursor_CXXThisExpr                   = 132, | 
|  | 2061 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2062 | /** [C++ 15] C++ Throw Expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2063 | * | 
|  | 2064 | * This handles 'throw' and 'throw' assignment-expression. When | 
|  | 2065 | * assignment-expression isn't present, Op will be null. | 
|  | 2066 | */ | 
|  | 2067 | CXCursor_CXXThrowExpr                  = 133, | 
|  | 2068 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2069 | /** A new expression for memory allocation and constructor calls, e.g: | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2070 | * "new CXXNewExpr(foo)". | 
|  | 2071 | */ | 
|  | 2072 | CXCursor_CXXNewExpr                    = 134, | 
|  | 2073 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2074 | /** A delete expression for memory deallocation and destructor calls, | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2075 | * e.g. "delete[] pArray". | 
|  | 2076 | */ | 
|  | 2077 | CXCursor_CXXDeleteExpr                 = 135, | 
|  | 2078 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2079 | /** A unary expression. (noexcept, sizeof, or other traits) | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2080 | */ | 
|  | 2081 | CXCursor_UnaryExpr                     = 136, | 
|  | 2082 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2083 | /** An Objective-C string literal i.e. @"foo". | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2084 | */ | 
|  | 2085 | CXCursor_ObjCStringLiteral             = 137, | 
|  | 2086 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2087 | /** An Objective-C \@encode expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2088 | */ | 
|  | 2089 | CXCursor_ObjCEncodeExpr                = 138, | 
|  | 2090 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2091 | /** An Objective-C \@selector expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2092 | */ | 
|  | 2093 | CXCursor_ObjCSelectorExpr              = 139, | 
|  | 2094 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2095 | /** An Objective-C \@protocol expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2096 | */ | 
|  | 2097 | CXCursor_ObjCProtocolExpr              = 140, | 
|  | 2098 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2099 | /** An Objective-C "bridged" cast expression, which casts between | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2100 | * Objective-C pointers and C pointers, transferring ownership in the process. | 
|  | 2101 | * | 
|  | 2102 | * \code | 
|  | 2103 | *   NSString *str = (__bridge_transfer NSString *)CFCreateString(); | 
|  | 2104 | * \endcode | 
|  | 2105 | */ | 
|  | 2106 | CXCursor_ObjCBridgedCastExpr           = 141, | 
|  | 2107 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2108 | /** Represents a C++0x pack expansion that produces a sequence of | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2109 | * expressions. | 
|  | 2110 | * | 
|  | 2111 | * A pack expansion expression contains a pattern (which itself is an | 
|  | 2112 | * expression) followed by an ellipsis. For example: | 
|  | 2113 | * | 
|  | 2114 | * \code | 
|  | 2115 | * template<typename F, typename ...Types> | 
|  | 2116 | * void forward(F f, Types &&...args) { | 
|  | 2117 | *  f(static_cast<Types&&>(args)...); | 
|  | 2118 | * } | 
|  | 2119 | * \endcode | 
|  | 2120 | */ | 
|  | 2121 | CXCursor_PackExpansionExpr             = 142, | 
|  | 2122 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2123 | /** Represents an expression that computes the length of a parameter | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2124 | * pack. | 
|  | 2125 | * | 
|  | 2126 | * \code | 
|  | 2127 | * template<typename ...Types> | 
|  | 2128 | * struct count { | 
|  | 2129 | *   static const unsigned value = sizeof...(Types); | 
|  | 2130 | * }; | 
|  | 2131 | * \endcode | 
|  | 2132 | */ | 
|  | 2133 | CXCursor_SizeOfPackExpr                = 143, | 
|  | 2134 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2135 | /* Represents a C++ lambda expression that produces a local function | 
| Douglas Gregor | 3009383 | 2012-02-15 00:54:55 +0000 | [diff] [blame] | 2136 | * object. | 
|  | 2137 | * | 
|  | 2138 | * \code | 
|  | 2139 | * void abssort(float *x, unsigned N) { | 
|  | 2140 | *   std::sort(x, x + N, | 
|  | 2141 | *             [](float a, float b) { | 
|  | 2142 | *               return std::abs(a) < std::abs(b); | 
|  | 2143 | *             }); | 
|  | 2144 | * } | 
|  | 2145 | * \endcode | 
|  | 2146 | */ | 
|  | 2147 | CXCursor_LambdaExpr                    = 144, | 
|  | 2148 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2149 | /** Objective-c Boolean Literal. | 
| Ted Kremenek | 77006f6 | 2012-03-06 20:06:06 +0000 | [diff] [blame] | 2150 | */ | 
|  | 2151 | CXCursor_ObjCBoolLiteralExpr           = 145, | 
|  | 2152 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2153 | /** Represents the "self" expression in an Objective-C method. | 
| Argyrios Kyrtzidis | c2233be | 2013-04-23 17:57:17 +0000 | [diff] [blame] | 2154 | */ | 
|  | 2155 | CXCursor_ObjCSelfExpr                  = 146, | 
|  | 2156 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2157 | /** OpenMP 4.0 [2.4, Array Section]. | 
| Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 2158 | */ | 
|  | 2159 | CXCursor_OMPArraySectionExpr           = 147, | 
|  | 2160 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2161 | /** Represents an @available(...) check. | 
| Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 2162 | */ | 
|  | 2163 | CXCursor_ObjCAvailabilityCheckExpr     = 148, | 
|  | 2164 |  | 
|  | 2165 | CXCursor_LastExpr                      = CXCursor_ObjCAvailabilityCheckExpr, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2166 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2167 | /* Statements */ | 
|  | 2168 | CXCursor_FirstStmt                     = 200, | 
|  | 2169 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2170 | * A statement whose specific kind is not exposed via this | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2171 | * interface. | 
|  | 2172 | * | 
|  | 2173 | * Unexposed statements have the same operations as any other kind of | 
|  | 2174 | * statement; one can extract their location information, spelling, | 
|  | 2175 | * children, etc. However, the specific kind of the statement is not | 
|  | 2176 | * reported. | 
|  | 2177 | */ | 
|  | 2178 | CXCursor_UnexposedStmt                 = 200, | 
| Douglas Gregor | a93ab66 | 2010-09-10 00:22:18 +0000 | [diff] [blame] | 2179 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2180 | /** A labelled statement in a function. | 
| Douglas Gregor | a93ab66 | 2010-09-10 00:22:18 +0000 | [diff] [blame] | 2181 | * | 
|  | 2182 | * This cursor kind is used to describe the "start_over:" label statement in | 
|  | 2183 | * the following example: | 
|  | 2184 | * | 
|  | 2185 | * \code | 
|  | 2186 | *   start_over: | 
|  | 2187 | *     ++counter; | 
|  | 2188 | * \endcode | 
|  | 2189 | * | 
|  | 2190 | */ | 
|  | 2191 | CXCursor_LabelStmt                     = 201, | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2192 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2193 | /** A group of statements like { stmt stmt }. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2194 | * | 
|  | 2195 | * This cursor kind is used to describe compound statements, e.g. function | 
|  | 2196 | * bodies. | 
|  | 2197 | */ | 
|  | 2198 | CXCursor_CompoundStmt                  = 202, | 
|  | 2199 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2200 | /** A case statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2201 | */ | 
|  | 2202 | CXCursor_CaseStmt                      = 203, | 
|  | 2203 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2204 | /** A default statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2205 | */ | 
|  | 2206 | CXCursor_DefaultStmt                   = 204, | 
|  | 2207 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2208 | /** An if statement | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2209 | */ | 
|  | 2210 | CXCursor_IfStmt                        = 205, | 
|  | 2211 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2212 | /** A switch statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2213 | */ | 
|  | 2214 | CXCursor_SwitchStmt                    = 206, | 
|  | 2215 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2216 | /** A while statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2217 | */ | 
|  | 2218 | CXCursor_WhileStmt                     = 207, | 
|  | 2219 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2220 | /** A do statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2221 | */ | 
|  | 2222 | CXCursor_DoStmt                        = 208, | 
|  | 2223 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2224 | /** A for statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2225 | */ | 
|  | 2226 | CXCursor_ForStmt                       = 209, | 
|  | 2227 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2228 | /** A goto statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2229 | */ | 
|  | 2230 | CXCursor_GotoStmt                      = 210, | 
|  | 2231 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2232 | /** An indirect goto statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2233 | */ | 
|  | 2234 | CXCursor_IndirectGotoStmt              = 211, | 
|  | 2235 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2236 | /** A continue statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2237 | */ | 
|  | 2238 | CXCursor_ContinueStmt                  = 212, | 
|  | 2239 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2240 | /** A break statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2241 | */ | 
|  | 2242 | CXCursor_BreakStmt                     = 213, | 
|  | 2243 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2244 | /** A return statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2245 | */ | 
|  | 2246 | CXCursor_ReturnStmt                    = 214, | 
|  | 2247 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2248 | /** A GCC inline assembly statement extension. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2249 | */ | 
| Chad Rosier | de70e0e | 2012-08-25 00:11:56 +0000 | [diff] [blame] | 2250 | CXCursor_GCCAsmStmt                    = 215, | 
| Argyrios Kyrtzidis | 5eae073 | 2012-09-24 19:27:20 +0000 | [diff] [blame] | 2251 | CXCursor_AsmStmt                       = CXCursor_GCCAsmStmt, | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2252 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2253 | /** Objective-C's overall \@try-\@catch-\@finally statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2254 | */ | 
|  | 2255 | CXCursor_ObjCAtTryStmt                 = 216, | 
|  | 2256 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2257 | /** Objective-C's \@catch statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2258 | */ | 
|  | 2259 | CXCursor_ObjCAtCatchStmt               = 217, | 
|  | 2260 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2261 | /** Objective-C's \@finally statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2262 | */ | 
|  | 2263 | CXCursor_ObjCAtFinallyStmt             = 218, | 
|  | 2264 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2265 | /** Objective-C's \@throw statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2266 | */ | 
|  | 2267 | CXCursor_ObjCAtThrowStmt               = 219, | 
|  | 2268 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2269 | /** Objective-C's \@synchronized statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2270 | */ | 
|  | 2271 | CXCursor_ObjCAtSynchronizedStmt        = 220, | 
|  | 2272 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2273 | /** Objective-C's autorelease pool statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2274 | */ | 
|  | 2275 | CXCursor_ObjCAutoreleasePoolStmt       = 221, | 
|  | 2276 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2277 | /** Objective-C's collection statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2278 | */ | 
|  | 2279 | CXCursor_ObjCForCollectionStmt         = 222, | 
|  | 2280 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2281 | /** C++'s catch statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2282 | */ | 
|  | 2283 | CXCursor_CXXCatchStmt                  = 223, | 
|  | 2284 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2285 | /** C++'s try statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2286 | */ | 
|  | 2287 | CXCursor_CXXTryStmt                    = 224, | 
|  | 2288 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2289 | /** C++'s for (* : *) statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2290 | */ | 
|  | 2291 | CXCursor_CXXForRangeStmt               = 225, | 
|  | 2292 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2293 | /** Windows Structured Exception Handling's try statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2294 | */ | 
|  | 2295 | CXCursor_SEHTryStmt                    = 226, | 
|  | 2296 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2297 | /** Windows Structured Exception Handling's except statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2298 | */ | 
|  | 2299 | CXCursor_SEHExceptStmt                 = 227, | 
|  | 2300 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2301 | /** Windows Structured Exception Handling's finally statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2302 | */ | 
|  | 2303 | CXCursor_SEHFinallyStmt                = 228, | 
|  | 2304 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2305 | /** A MS inline assembly statement extension. | 
| Chad Rosier | 3250302 | 2012-06-11 20:47:18 +0000 | [diff] [blame] | 2306 | */ | 
|  | 2307 | CXCursor_MSAsmStmt                     = 229, | 
|  | 2308 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2309 | /** The null statement ";": C99 6.8.3p3. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2310 | * | 
|  | 2311 | * This cursor kind is used to describe the null statement. | 
|  | 2312 | */ | 
|  | 2313 | CXCursor_NullStmt                      = 230, | 
|  | 2314 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2315 | /** Adaptor class for mixing declarations with statements and | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2316 | * expressions. | 
|  | 2317 | */ | 
|  | 2318 | CXCursor_DeclStmt                      = 231, | 
|  | 2319 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2320 | /** OpenMP parallel directive. | 
| Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2321 | */ | 
|  | 2322 | CXCursor_OMPParallelDirective          = 232, | 
|  | 2323 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2324 | /** OpenMP SIMD directive. | 
| Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2325 | */ | 
|  | 2326 | CXCursor_OMPSimdDirective              = 233, | 
|  | 2327 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2328 | /** OpenMP for directive. | 
| Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 2329 | */ | 
|  | 2330 | CXCursor_OMPForDirective               = 234, | 
|  | 2331 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2332 | /** OpenMP sections directive. | 
| Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2333 | */ | 
|  | 2334 | CXCursor_OMPSectionsDirective          = 235, | 
|  | 2335 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2336 | /** OpenMP section directive. | 
| Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 2337 | */ | 
|  | 2338 | CXCursor_OMPSectionDirective           = 236, | 
|  | 2339 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2340 | /** OpenMP single directive. | 
| Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 2341 | */ | 
|  | 2342 | CXCursor_OMPSingleDirective            = 237, | 
|  | 2343 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2344 | /** OpenMP parallel for directive. | 
| Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 2345 | */ | 
|  | 2346 | CXCursor_OMPParallelForDirective       = 238, | 
|  | 2347 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2348 | /** OpenMP parallel sections directive. | 
| Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2349 | */ | 
|  | 2350 | CXCursor_OMPParallelSectionsDirective  = 239, | 
|  | 2351 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2352 | /** OpenMP task directive. | 
| Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2353 | */ | 
|  | 2354 | CXCursor_OMPTaskDirective              = 240, | 
|  | 2355 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2356 | /** OpenMP master directive. | 
| Alexander Musman | 80c2289 | 2014-07-17 08:54:58 +0000 | [diff] [blame] | 2357 | */ | 
|  | 2358 | CXCursor_OMPMasterDirective            = 241, | 
|  | 2359 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2360 | /** OpenMP critical directive. | 
| Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2361 | */ | 
|  | 2362 | CXCursor_OMPCriticalDirective          = 242, | 
|  | 2363 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2364 | /** OpenMP taskyield directive. | 
| Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 2365 | */ | 
| Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2366 | CXCursor_OMPTaskyieldDirective         = 243, | 
| Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 2367 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2368 | /** OpenMP barrier directive. | 
| Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 2369 | */ | 
| Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2370 | CXCursor_OMPBarrierDirective           = 244, | 
| Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 2371 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2372 | /** OpenMP taskwait directive. | 
| Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 2373 | */ | 
| Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2374 | CXCursor_OMPTaskwaitDirective          = 245, | 
| Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 2375 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2376 | /** OpenMP flush directive. | 
| Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2377 | */ | 
|  | 2378 | CXCursor_OMPFlushDirective             = 246, | 
| Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2379 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2380 | /** Windows Structured Exception Handling's leave statement. | 
| Reid Kleckner | ba76448 | 2014-07-24 18:22:15 +0000 | [diff] [blame] | 2381 | */ | 
|  | 2382 | CXCursor_SEHLeaveStmt                  = 247, | 
|  | 2383 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2384 | /** OpenMP ordered directive. | 
| Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 2385 | */ | 
| Reid Kleckner | ba76448 | 2014-07-24 18:22:15 +0000 | [diff] [blame] | 2386 | CXCursor_OMPOrderedDirective           = 248, | 
| Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2387 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2388 | /** OpenMP atomic directive. | 
| Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2389 | */ | 
| Reid Kleckner | ba76448 | 2014-07-24 18:22:15 +0000 | [diff] [blame] | 2390 | CXCursor_OMPAtomicDirective            = 249, | 
| Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2391 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2392 | /** OpenMP for SIMD directive. | 
| Alexander Musman | f82886e | 2014-09-18 05:12:34 +0000 | [diff] [blame] | 2393 | */ | 
|  | 2394 | CXCursor_OMPForSimdDirective           = 250, | 
|  | 2395 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2396 | /** OpenMP parallel for SIMD directive. | 
| Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 2397 | */ | 
|  | 2398 | CXCursor_OMPParallelForSimdDirective   = 251, | 
|  | 2399 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2400 | /** OpenMP target directive. | 
| Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 2401 | */ | 
| Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 2402 | CXCursor_OMPTargetDirective            = 252, | 
| Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 2403 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2404 | /** OpenMP teams directive. | 
| Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 2405 | */ | 
|  | 2406 | CXCursor_OMPTeamsDirective             = 253, | 
|  | 2407 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2408 | /** OpenMP taskgroup directive. | 
| Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2409 | */ | 
| Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2410 | CXCursor_OMPTaskgroupDirective         = 254, | 
| Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2411 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2412 | /** OpenMP cancellation point directive. | 
| Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 2413 | */ | 
| Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2414 | CXCursor_OMPCancellationPointDirective = 255, | 
| Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2415 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2416 | /** OpenMP cancel directive. | 
| Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2417 | */ | 
| Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2418 | CXCursor_OMPCancelDirective            = 256, | 
| Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2419 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2420 | /** OpenMP target data directive. | 
| Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2421 | */ | 
|  | 2422 | CXCursor_OMPTargetDataDirective        = 257, | 
|  | 2423 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2424 | /** OpenMP taskloop directive. | 
| Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 2425 | */ | 
|  | 2426 | CXCursor_OMPTaskLoopDirective          = 258, | 
|  | 2427 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2428 | /** OpenMP taskloop simd directive. | 
| Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 2429 | */ | 
|  | 2430 | CXCursor_OMPTaskLoopSimdDirective      = 259, | 
|  | 2431 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2432 | /** OpenMP distribute directive. | 
| Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 2433 | */ | 
|  | 2434 | CXCursor_OMPDistributeDirective        = 260, | 
|  | 2435 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2436 | /** OpenMP target enter data directive. | 
| Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 2437 | */ | 
|  | 2438 | CXCursor_OMPTargetEnterDataDirective   = 261, | 
|  | 2439 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2440 | /** OpenMP target exit data directive. | 
| Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 2441 | */ | 
|  | 2442 | CXCursor_OMPTargetExitDataDirective    = 262, | 
|  | 2443 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2444 | /** OpenMP target parallel directive. | 
| Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 2445 | */ | 
|  | 2446 | CXCursor_OMPTargetParallelDirective    = 263, | 
|  | 2447 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2448 | /** OpenMP target parallel for directive. | 
| Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 2449 | */ | 
|  | 2450 | CXCursor_OMPTargetParallelForDirective = 264, | 
|  | 2451 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2452 | /** OpenMP target update directive. | 
| Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2453 | */ | 
|  | 2454 | CXCursor_OMPTargetUpdateDirective      = 265, | 
|  | 2455 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2456 | /** OpenMP distribute parallel for directive. | 
| Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2457 | */ | 
|  | 2458 | CXCursor_OMPDistributeParallelForDirective = 266, | 
|  | 2459 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2460 | /** OpenMP distribute parallel for simd directive. | 
| Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 2461 | */ | 
|  | 2462 | CXCursor_OMPDistributeParallelForSimdDirective = 267, | 
|  | 2463 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2464 | /** OpenMP distribute simd directive. | 
| Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 2465 | */ | 
|  | 2466 | CXCursor_OMPDistributeSimdDirective = 268, | 
|  | 2467 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2468 | /** OpenMP target parallel for simd directive. | 
| Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 2469 | */ | 
|  | 2470 | CXCursor_OMPTargetParallelForSimdDirective = 269, | 
|  | 2471 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2472 | /** OpenMP target simd directive. | 
| Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 2473 | */ | 
|  | 2474 | CXCursor_OMPTargetSimdDirective = 270, | 
|  | 2475 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2476 | /** OpenMP teams distribute directive. | 
| Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 2477 | */ | 
|  | 2478 | CXCursor_OMPTeamsDistributeDirective = 271, | 
|  | 2479 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2480 | /** OpenMP teams distribute simd directive. | 
| Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 2481 | */ | 
|  | 2482 | CXCursor_OMPTeamsDistributeSimdDirective = 272, | 
|  | 2483 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2484 | /** OpenMP teams distribute parallel for simd directive. | 
| Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 2485 | */ | 
|  | 2486 | CXCursor_OMPTeamsDistributeParallelForSimdDirective = 273, | 
|  | 2487 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2488 | /** OpenMP teams distribute parallel for directive. | 
| Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 2489 | */ | 
|  | 2490 | CXCursor_OMPTeamsDistributeParallelForDirective = 274, | 
|  | 2491 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2492 | /** OpenMP target teams directive. | 
| Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 2493 | */ | 
|  | 2494 | CXCursor_OMPTargetTeamsDirective = 275, | 
|  | 2495 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2496 | /** OpenMP target teams distribute directive. | 
| Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 2497 | */ | 
|  | 2498 | CXCursor_OMPTargetTeamsDistributeDirective = 276, | 
|  | 2499 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2500 | /** OpenMP target teams distribute parallel for directive. | 
| Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 2501 | */ | 
|  | 2502 | CXCursor_OMPTargetTeamsDistributeParallelForDirective = 277, | 
|  | 2503 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2504 | /** OpenMP target teams distribute parallel for simd directive. | 
| Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 2505 | */ | 
|  | 2506 | CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective = 278, | 
|  | 2507 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2508 | /** OpenMP target teams distribute simd directive. | 
| Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 2509 | */ | 
|  | 2510 | CXCursor_OMPTargetTeamsDistributeSimdDirective = 279, | 
|  | 2511 |  | 
|  | 2512 | CXCursor_LastStmt = CXCursor_OMPTargetTeamsDistributeSimdDirective, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2513 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2514 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2515 | * Cursor that represents the translation unit itself. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2516 | * | 
|  | 2517 | * The translation unit cursor exists primarily to act as the root | 
|  | 2518 | * cursor for traversing the contents of a translation unit. | 
|  | 2519 | */ | 
| Ted Kremenek | bff3143 | 2010-02-18 03:09:07 +0000 | [diff] [blame] | 2520 | CXCursor_TranslationUnit               = 300, | 
|  | 2521 |  | 
| Bill Wendling | 4442605 | 2012-12-20 19:22:21 +0000 | [diff] [blame] | 2522 | /* Attributes */ | 
| Ted Kremenek | bff3143 | 2010-02-18 03:09:07 +0000 | [diff] [blame] | 2523 | CXCursor_FirstAttr                     = 400, | 
|  | 2524 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2525 | * An attribute whose specific kind is not exposed via this | 
| Ted Kremenek | bff3143 | 2010-02-18 03:09:07 +0000 | [diff] [blame] | 2526 | * interface. | 
|  | 2527 | */ | 
|  | 2528 | CXCursor_UnexposedAttr                 = 400, | 
|  | 2529 |  | 
|  | 2530 | CXCursor_IBActionAttr                  = 401, | 
|  | 2531 | CXCursor_IBOutletAttr                  = 402, | 
| Ted Kremenek | 26bde77 | 2010-05-19 17:38:06 +0000 | [diff] [blame] | 2532 | CXCursor_IBOutletCollectionAttr        = 403, | 
| Argyrios Kyrtzidis | 2cb4e3c | 2011-09-13 17:39:31 +0000 | [diff] [blame] | 2533 | CXCursor_CXXFinalAttr                  = 404, | 
|  | 2534 | CXCursor_CXXOverrideAttr               = 405, | 
| Erik Verbruggen | ca98f2a | 2011-10-13 09:41:32 +0000 | [diff] [blame] | 2535 | CXCursor_AnnotateAttr                  = 406, | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 2536 | CXCursor_AsmLabelAttr                  = 407, | 
| Argyrios Kyrtzidis | 16834f1 | 2013-09-25 00:14:38 +0000 | [diff] [blame] | 2537 | CXCursor_PackedAttr                    = 408, | 
| Joey Gouly | 8122838 | 2014-05-01 15:41:58 +0000 | [diff] [blame] | 2538 | CXCursor_PureAttr                      = 409, | 
|  | 2539 | CXCursor_ConstAttr                     = 410, | 
|  | 2540 | CXCursor_NoDuplicateAttr               = 411, | 
| Eli Bendersky | 2581e66 | 2014-05-28 19:29:58 +0000 | [diff] [blame] | 2541 | CXCursor_CUDAConstantAttr              = 412, | 
|  | 2542 | CXCursor_CUDADeviceAttr                = 413, | 
|  | 2543 | CXCursor_CUDAGlobalAttr                = 414, | 
|  | 2544 | CXCursor_CUDAHostAttr                  = 415, | 
| Eli Bendersky | 9b07147 | 2014-08-08 14:59:00 +0000 | [diff] [blame] | 2545 | CXCursor_CUDASharedAttr                = 416, | 
| Saleem Abdulrasool | 79c6971 | 2015-09-05 18:53:43 +0000 | [diff] [blame] | 2546 | CXCursor_VisibilityAttr                = 417, | 
| Saleem Abdulrasool | 8aa0b80 | 2015-12-10 18:45:18 +0000 | [diff] [blame] | 2547 | CXCursor_DLLExport                     = 418, | 
|  | 2548 | CXCursor_DLLImport                     = 419, | 
|  | 2549 | CXCursor_LastAttr                      = CXCursor_DLLImport, | 
| Eli Bendersky | 2581e66 | 2014-05-28 19:29:58 +0000 | [diff] [blame] | 2550 |  | 
| Douglas Gregor | 92a524f | 2010-03-18 00:42:48 +0000 | [diff] [blame] | 2551 | /* Preprocessing */ | 
|  | 2552 | CXCursor_PreprocessingDirective        = 500, | 
| Douglas Gregor | 06d6d32 | 2010-03-18 18:04:21 +0000 | [diff] [blame] | 2553 | CXCursor_MacroDefinition               = 501, | 
| Chandler Carruth | 9e4704a | 2011-07-14 08:41:15 +0000 | [diff] [blame] | 2554 | CXCursor_MacroExpansion                = 502, | 
|  | 2555 | CXCursor_MacroInstantiation            = CXCursor_MacroExpansion, | 
| Douglas Gregor | 796d76a | 2010-10-20 22:00:55 +0000 | [diff] [blame] | 2556 | CXCursor_InclusionDirective            = 503, | 
| Douglas Gregor | 92a524f | 2010-03-18 00:42:48 +0000 | [diff] [blame] | 2557 | CXCursor_FirstPreprocessing            = CXCursor_PreprocessingDirective, | 
| Argyrios Kyrtzidis | 50e5b1d | 2012-10-05 00:22:24 +0000 | [diff] [blame] | 2558 | CXCursor_LastPreprocessing             = CXCursor_InclusionDirective, | 
|  | 2559 |  | 
|  | 2560 | /* Extra Declarations */ | 
|  | 2561 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2562 | * A module import declaration. | 
| Argyrios Kyrtzidis | 50e5b1d | 2012-10-05 00:22:24 +0000 | [diff] [blame] | 2563 | */ | 
|  | 2564 | CXCursor_ModuleImportDecl              = 600, | 
| Sergey Kalinichev | 8f3b187 | 2015-11-15 13:48:32 +0000 | [diff] [blame] | 2565 | CXCursor_TypeAliasTemplateDecl         = 601, | 
| Olivier Goffart | 8197801 | 2016-06-09 16:15:55 +0000 | [diff] [blame] | 2566 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2567 | * A static_assert or _Static_assert node | 
| Olivier Goffart | 8197801 | 2016-06-09 16:15:55 +0000 | [diff] [blame] | 2568 | */ | 
|  | 2569 | CXCursor_StaticAssert                  = 602, | 
| Olivier Goffart | d211c64 | 2016-11-04 06:29:27 +0000 | [diff] [blame] | 2570 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2571 | * a friend declaration. | 
| Olivier Goffart | d211c64 | 2016-11-04 06:29:27 +0000 | [diff] [blame] | 2572 | */ | 
|  | 2573 | CXCursor_FriendDecl                    = 603, | 
| Argyrios Kyrtzidis | 50e5b1d | 2012-10-05 00:22:24 +0000 | [diff] [blame] | 2574 | CXCursor_FirstExtraDecl                = CXCursor_ModuleImportDecl, | 
| Olivier Goffart | d211c64 | 2016-11-04 06:29:27 +0000 | [diff] [blame] | 2575 | CXCursor_LastExtraDecl                 = CXCursor_FriendDecl, | 
| Francisco Lopes da Silva | 975a9f6 | 2015-01-21 16:24:11 +0000 | [diff] [blame] | 2576 |  | 
|  | 2577 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2578 | * A code completion overload candidate. | 
| Francisco Lopes da Silva | 975a9f6 | 2015-01-21 16:24:11 +0000 | [diff] [blame] | 2579 | */ | 
|  | 2580 | CXCursor_OverloadCandidate             = 700 | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2581 | }; | 
|  | 2582 |  | 
|  | 2583 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2584 | * A cursor representing some element in the abstract syntax tree for | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2585 | * a translation unit. | 
|  | 2586 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2587 | * The cursor abstraction unifies the different kinds of entities in a | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2588 | * program--declaration, statements, expressions, references to declarations, | 
|  | 2589 | * etc.--under a single "cursor" abstraction with a common set of operations. | 
|  | 2590 | * Common operation for a cursor include: getting the physical location in | 
|  | 2591 | * a source file where the cursor points, getting the name associated with a | 
|  | 2592 | * cursor, and retrieving cursors for any child nodes of a particular cursor. | 
|  | 2593 | * | 
|  | 2594 | * Cursors can be produced in two specific ways. | 
|  | 2595 | * clang_getTranslationUnitCursor() produces a cursor for a translation unit, | 
|  | 2596 | * from which one can use clang_visitChildren() to explore the rest of the | 
|  | 2597 | * translation unit. clang_getCursor() maps from a physical source location | 
|  | 2598 | * to the entity that resides at that location, allowing one to map from the | 
|  | 2599 | * source code into the AST. | 
|  | 2600 | */ | 
|  | 2601 | typedef struct { | 
|  | 2602 | enum CXCursorKind kind; | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 2603 | int xdata; | 
| Dmitri Gribenko | ba2f746 | 2013-01-11 21:01:49 +0000 | [diff] [blame] | 2604 | const void *data[3]; | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2605 | } CXCursor; | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2606 |  | 
|  | 2607 | /** | 
|  | 2608 | * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations | 
|  | 2609 | * | 
|  | 2610 | * @{ | 
|  | 2611 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2612 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2613 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2614 | * Retrieve the NULL cursor, which represents no entity. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2615 | */ | 
|  | 2616 | CINDEX_LINKAGE CXCursor clang_getNullCursor(void); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2617 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2618 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2619 | * Retrieve the cursor that represents the given translation unit. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2620 | * | 
|  | 2621 | * The translation unit cursor can be used to start traversing the | 
|  | 2622 | * various declarations within the given translation unit. | 
|  | 2623 | */ | 
|  | 2624 | CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit); | 
|  | 2625 |  | 
|  | 2626 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2627 | * Determine whether two cursors are equivalent. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2628 | */ | 
|  | 2629 | CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2630 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2631 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2632 | * Returns non-zero if \p cursor is null. | 
| Argyrios Kyrtzidis | d6e9fa5 | 2011-09-27 00:30:30 +0000 | [diff] [blame] | 2633 | */ | 
| Dmitri Gribenko | 8994e0c | 2012-09-13 13:11:20 +0000 | [diff] [blame] | 2634 | CINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor); | 
| Argyrios Kyrtzidis | d6e9fa5 | 2011-09-27 00:30:30 +0000 | [diff] [blame] | 2635 |  | 
|  | 2636 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2637 | * Compute a hash value for the given cursor. | 
| Douglas Gregor | 06a3f30 | 2010-11-20 00:09:34 +0000 | [diff] [blame] | 2638 | */ | 
|  | 2639 | CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor); | 
|  | 2640 |  | 
|  | 2641 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2642 | * Retrieve the kind of the given cursor. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2643 | */ | 
|  | 2644 | CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor); | 
|  | 2645 |  | 
|  | 2646 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2647 | * Determine whether the given cursor kind represents a declaration. | 
| Ivan Donchevskii | 65c766e | 2018-01-03 10:40:11 +0000 | [diff] [blame] | 2648 | */ | 
|  | 2649 | CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind); | 
|  | 2650 |  | 
|  | 2651 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2652 | * Determine whether the given declaration is invalid. | 
| Ivan Donchevskii | 08ff910 | 2018-01-04 10:59:50 +0000 | [diff] [blame] | 2653 | * | 
|  | 2654 | * A declaration is invalid if it could not be parsed successfully. | 
|  | 2655 | * | 
|  | 2656 | * \returns non-zero if the cursor represents a declaration and it is | 
|  | 2657 | * invalid, otherwise NULL. | 
|  | 2658 | */ | 
|  | 2659 | CINDEX_LINKAGE unsigned clang_isInvalidDeclaration(CXCursor); | 
|  | 2660 |  | 
|  | 2661 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2662 | * Determine whether the given cursor kind represents a simple | 
| Ivan Donchevskii | 65c766e | 2018-01-03 10:40:11 +0000 | [diff] [blame] | 2663 | * reference. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2664 | * | 
|  | 2665 | * Note that other kinds of cursors (such as expressions) can also refer to | 
|  | 2666 | * other cursors. Use clang_getCursorReferenced() to determine whether a | 
|  | 2667 | * particular cursor refers to another entity. | 
|  | 2668 | */ | 
|  | 2669 | CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind); | 
|  | 2670 |  | 
|  | 2671 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2672 | * Determine whether the given cursor kind represents an expression. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2673 | */ | 
|  | 2674 | CINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind); | 
|  | 2675 |  | 
|  | 2676 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2677 | * Determine whether the given cursor kind represents a statement. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2678 | */ | 
|  | 2679 | CINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind); | 
|  | 2680 |  | 
|  | 2681 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2682 | * Determine whether the given cursor kind represents an attribute. | 
| Douglas Gregor | a98034a | 2011-07-06 03:00:34 +0000 | [diff] [blame] | 2683 | */ | 
|  | 2684 | CINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind); | 
|  | 2685 |  | 
|  | 2686 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2687 | * Determine whether the given cursor has any attributes. | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 2688 | */ | 
|  | 2689 | CINDEX_LINKAGE unsigned clang_Cursor_hasAttrs(CXCursor C); | 
|  | 2690 |  | 
|  | 2691 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2692 | * Determine whether the given cursor kind represents an invalid | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2693 | * cursor. | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2694 | */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2695 | CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind); | 
|  | 2696 |  | 
|  | 2697 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2698 | * Determine whether the given cursor kind represents a translation | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2699 | * unit. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2700 | */ | 
|  | 2701 | CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2702 |  | 
| Ted Kremenek | ff9021b | 2010-03-08 21:17:29 +0000 | [diff] [blame] | 2703 | /*** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2704 | * Determine whether the given cursor represents a preprocessing | 
| Douglas Gregor | 92a524f | 2010-03-18 00:42:48 +0000 | [diff] [blame] | 2705 | * element, such as a preprocessor directive or macro instantiation. | 
|  | 2706 | */ | 
|  | 2707 | CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind); | 
|  | 2708 |  | 
|  | 2709 | /*** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2710 | * Determine whether the given cursor represents a currently | 
| Ted Kremenek | ff9021b | 2010-03-08 21:17:29 +0000 | [diff] [blame] | 2711 | *  unexposed piece of the AST (e.g., CXCursor_UnexposedStmt). | 
|  | 2712 | */ | 
|  | 2713 | CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind); | 
|  | 2714 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2715 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2716 | * Describe the linkage of the entity referred to by a cursor. | 
| Ted Kremenek | fb4961d | 2010-03-03 06:36:57 +0000 | [diff] [blame] | 2717 | */ | 
|  | 2718 | enum CXLinkageKind { | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2719 | /** This value indicates that no linkage information is available | 
| Ted Kremenek | fb4961d | 2010-03-03 06:36:57 +0000 | [diff] [blame] | 2720 | * for a provided CXCursor. */ | 
|  | 2721 | CXLinkage_Invalid, | 
|  | 2722 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2723 | * This is the linkage for variables, parameters, and so on that | 
| Ted Kremenek | fb4961d | 2010-03-03 06:36:57 +0000 | [diff] [blame] | 2724 | *  have automatic storage.  This covers normal (non-extern) local variables. | 
|  | 2725 | */ | 
|  | 2726 | CXLinkage_NoLinkage, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2727 | /** This is the linkage for static variables and static functions. */ | 
| Ted Kremenek | fb4961d | 2010-03-03 06:36:57 +0000 | [diff] [blame] | 2728 | CXLinkage_Internal, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2729 | /** This is the linkage for entities with external linkage that live | 
| Ted Kremenek | fb4961d | 2010-03-03 06:36:57 +0000 | [diff] [blame] | 2730 | * in C++ anonymous namespaces.*/ | 
|  | 2731 | CXLinkage_UniqueExternal, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2732 | /** This is the linkage for entities with true, external linkage. */ | 
| Ted Kremenek | fb4961d | 2010-03-03 06:36:57 +0000 | [diff] [blame] | 2733 | CXLinkage_External | 
|  | 2734 | }; | 
|  | 2735 |  | 
|  | 2736 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2737 | * Determine the linkage of the entity referred to by a given cursor. | 
| Ted Kremenek | fb4961d | 2010-03-03 06:36:57 +0000 | [diff] [blame] | 2738 | */ | 
|  | 2739 | CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor); | 
|  | 2740 |  | 
| Ehsan Akhgari | b743de7 | 2016-05-31 15:55:51 +0000 | [diff] [blame] | 2741 | enum CXVisibilityKind { | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2742 | /** This value indicates that no visibility information is available | 
| Ehsan Akhgari | b743de7 | 2016-05-31 15:55:51 +0000 | [diff] [blame] | 2743 | * for a provided CXCursor. */ | 
|  | 2744 | CXVisibility_Invalid, | 
|  | 2745 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2746 | /** Symbol not seen by the linker. */ | 
| Ehsan Akhgari | b743de7 | 2016-05-31 15:55:51 +0000 | [diff] [blame] | 2747 | CXVisibility_Hidden, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2748 | /** Symbol seen by the linker but resolves to a symbol inside this object. */ | 
| Ehsan Akhgari | b743de7 | 2016-05-31 15:55:51 +0000 | [diff] [blame] | 2749 | CXVisibility_Protected, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2750 | /** Symbol seen by the linker and acts like a normal symbol. */ | 
| Ehsan Akhgari | b743de7 | 2016-05-31 15:55:51 +0000 | [diff] [blame] | 2751 | CXVisibility_Default | 
|  | 2752 | }; | 
|  | 2753 |  | 
|  | 2754 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2755 | * Describe the visibility of the entity referred to by a cursor. | 
| Ehsan Akhgari | b743de7 | 2016-05-31 15:55:51 +0000 | [diff] [blame] | 2756 | * | 
|  | 2757 | * This returns the default visibility if not explicitly specified by | 
|  | 2758 | * a visibility attribute. The default visibility may be changed by | 
|  | 2759 | * commandline arguments. | 
|  | 2760 | * | 
|  | 2761 | * \param cursor The cursor to query. | 
|  | 2762 | * | 
|  | 2763 | * \returns The visibility of the cursor. | 
|  | 2764 | */ | 
|  | 2765 | CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor cursor); | 
|  | 2766 |  | 
| Ehsan Akhgari | 93697fa | 2015-11-23 19:56:46 +0000 | [diff] [blame] | 2767 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2768 | * Determine the availability of the entity that this cursor refers to, | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2769 | * taking the current target platform into account. | 
| Douglas Gregor | f757a12 | 2010-08-23 23:00:57 +0000 | [diff] [blame] | 2770 | * | 
|  | 2771 | * \param cursor The cursor to query. | 
|  | 2772 | * | 
|  | 2773 | * \returns The availability of the cursor. | 
|  | 2774 | */ | 
|  | 2775 | CINDEX_LINKAGE enum CXAvailabilityKind | 
|  | 2776 | clang_getCursorAvailability(CXCursor cursor); | 
|  | 2777 |  | 
|  | 2778 | /** | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2779 | * Describes the availability of a given entity on a particular platform, e.g., | 
|  | 2780 | * a particular class might only be available on Mac OS 10.7 or newer. | 
|  | 2781 | */ | 
|  | 2782 | typedef struct CXPlatformAvailability { | 
|  | 2783 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2784 | * A string that describes the platform for which this structure | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2785 | * provides availability information. | 
|  | 2786 | * | 
| Manman Ren | ccf25bb | 2016-06-28 20:55:30 +0000 | [diff] [blame] | 2787 | * Possible values are "ios" or "macos". | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2788 | */ | 
|  | 2789 | CXString Platform; | 
|  | 2790 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2791 | * The version number in which this entity was introduced. | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2792 | */ | 
|  | 2793 | CXVersion Introduced; | 
|  | 2794 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2795 | * The version number in which this entity was deprecated (but is | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2796 | * still available). | 
|  | 2797 | */ | 
|  | 2798 | CXVersion Deprecated; | 
|  | 2799 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2800 | * The version number in which this entity was obsoleted, and therefore | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2801 | * is no longer available. | 
|  | 2802 | */ | 
|  | 2803 | CXVersion Obsoleted; | 
|  | 2804 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2805 | * Whether the entity is unconditionally unavailable on this platform. | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2806 | */ | 
|  | 2807 | int Unavailable; | 
|  | 2808 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2809 | * An optional message to provide to a user of this API, e.g., to | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2810 | * suggest replacement APIs. | 
|  | 2811 | */ | 
|  | 2812 | CXString Message; | 
|  | 2813 | } CXPlatformAvailability; | 
|  | 2814 |  | 
|  | 2815 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2816 | * Determine the availability of the entity that this cursor refers to | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2817 | * on any platforms for which availability information is known. | 
|  | 2818 | * | 
|  | 2819 | * \param cursor The cursor to query. | 
|  | 2820 | * | 
|  | 2821 | * \param always_deprecated If non-NULL, will be set to indicate whether the | 
|  | 2822 | * entity is deprecated on all platforms. | 
|  | 2823 | * | 
|  | 2824 | * \param deprecated_message If non-NULL, will be set to the message text | 
|  | 2825 | * provided along with the unconditional deprecation of this entity. The client | 
|  | 2826 | * is responsible for deallocating this string. | 
|  | 2827 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 2828 | * \param always_unavailable If non-NULL, will be set to indicate whether the | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2829 | * entity is unavailable on all platforms. | 
|  | 2830 | * | 
|  | 2831 | * \param unavailable_message If non-NULL, will be set to the message text | 
|  | 2832 | * provided along with the unconditional unavailability of this entity. The | 
|  | 2833 | * client is responsible for deallocating this string. | 
|  | 2834 | * | 
|  | 2835 | * \param availability If non-NULL, an array of CXPlatformAvailability instances | 
|  | 2836 | * that will be populated with platform availability information, up to either | 
|  | 2837 | * the number of platforms for which availability information is available (as | 
|  | 2838 | * returned by this function) or \c availability_size, whichever is smaller. | 
|  | 2839 | * | 
|  | 2840 | * \param availability_size The number of elements available in the | 
|  | 2841 | * \c availability array. | 
|  | 2842 | * | 
|  | 2843 | * \returns The number of platforms (N) for which availability information is | 
|  | 2844 | * available (which is unrelated to \c availability_size). | 
|  | 2845 | * | 
|  | 2846 | * Note that the client is responsible for calling | 
|  | 2847 | * \c clang_disposeCXPlatformAvailability to free each of the | 
|  | 2848 | * platform-availability structures returned. There are | 
|  | 2849 | * \c min(N, availability_size) such structures. | 
|  | 2850 | */ | 
|  | 2851 | CINDEX_LINKAGE int | 
|  | 2852 | clang_getCursorPlatformAvailability(CXCursor cursor, | 
|  | 2853 | int *always_deprecated, | 
|  | 2854 | CXString *deprecated_message, | 
|  | 2855 | int *always_unavailable, | 
|  | 2856 | CXString *unavailable_message, | 
|  | 2857 | CXPlatformAvailability *availability, | 
|  | 2858 | int availability_size); | 
|  | 2859 |  | 
|  | 2860 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2861 | * Free the memory associated with a \c CXPlatformAvailability structure. | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2862 | */ | 
|  | 2863 | CINDEX_LINKAGE void | 
|  | 2864 | clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability); | 
|  | 2865 |  | 
|  | 2866 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2867 | * Describe the "language" of the entity referred to by a cursor. | 
| Ted Kremenek | 4ed2925 | 2010-04-12 21:22:16 +0000 | [diff] [blame] | 2868 | */ | 
| Reid Kleckner | 9e3bc72 | 2013-12-30 17:48:49 +0000 | [diff] [blame] | 2869 | enum CXLanguageKind { | 
| Ted Kremenek | ee45751 | 2010-04-14 20:58:32 +0000 | [diff] [blame] | 2870 | CXLanguage_Invalid = 0, | 
| Ted Kremenek | 4ed2925 | 2010-04-12 21:22:16 +0000 | [diff] [blame] | 2871 | CXLanguage_C, | 
|  | 2872 | CXLanguage_ObjC, | 
| Ted Kremenek | ee45751 | 2010-04-14 20:58:32 +0000 | [diff] [blame] | 2873 | CXLanguage_CPlusPlus | 
| Ted Kremenek | 4ed2925 | 2010-04-12 21:22:16 +0000 | [diff] [blame] | 2874 | }; | 
|  | 2875 |  | 
|  | 2876 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2877 | * Determine the "language" of the entity referred to by a given cursor. | 
| Ted Kremenek | 4ed2925 | 2010-04-12 21:22:16 +0000 | [diff] [blame] | 2878 | */ | 
|  | 2879 | CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor); | 
|  | 2880 |  | 
| Argyrios Kyrtzidis | d6e9fa5 | 2011-09-27 00:30:30 +0000 | [diff] [blame] | 2881 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2882 | * Describe the "thread-local storage (TLS) kind" of the declaration | 
| Saleem Abdulrasool | 50bc565 | 2017-09-13 02:15:09 +0000 | [diff] [blame] | 2883 | * referred to by a cursor. | 
|  | 2884 | */ | 
|  | 2885 | enum CXTLSKind { | 
|  | 2886 | CXTLS_None = 0, | 
|  | 2887 | CXTLS_Dynamic, | 
|  | 2888 | CXTLS_Static | 
|  | 2889 | }; | 
|  | 2890 |  | 
|  | 2891 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2892 | * Determine the "thread-local storage (TLS) kind" of the declaration | 
| Saleem Abdulrasool | 50bc565 | 2017-09-13 02:15:09 +0000 | [diff] [blame] | 2893 | * referred to by a cursor. | 
|  | 2894 | */ | 
|  | 2895 | CINDEX_LINKAGE enum CXTLSKind clang_getCursorTLSKind(CXCursor cursor); | 
|  | 2896 |  | 
|  | 2897 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2898 | * Returns the translation unit that a cursor originated from. | 
| Argyrios Kyrtzidis | d6e9fa5 | 2011-09-27 00:30:30 +0000 | [diff] [blame] | 2899 | */ | 
|  | 2900 | CINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor); | 
|  | 2901 |  | 
| Ted Kremenek | c0b9866 | 2013-04-24 07:17:12 +0000 | [diff] [blame] | 2902 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2903 | * A fast container representing a set of CXCursors. | 
| Ted Kremenek | c0b9866 | 2013-04-24 07:17:12 +0000 | [diff] [blame] | 2904 | */ | 
|  | 2905 | typedef struct CXCursorSetImpl *CXCursorSet; | 
|  | 2906 |  | 
|  | 2907 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2908 | * Creates an empty CXCursorSet. | 
| Ted Kremenek | c0b9866 | 2013-04-24 07:17:12 +0000 | [diff] [blame] | 2909 | */ | 
|  | 2910 | CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void); | 
|  | 2911 |  | 
|  | 2912 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2913 | * Disposes a CXCursorSet and releases its associated memory. | 
| Ted Kremenek | c0b9866 | 2013-04-24 07:17:12 +0000 | [diff] [blame] | 2914 | */ | 
|  | 2915 | CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset); | 
|  | 2916 |  | 
|  | 2917 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2918 | * Queries a CXCursorSet to see if it contains a specific CXCursor. | 
| Ted Kremenek | c0b9866 | 2013-04-24 07:17:12 +0000 | [diff] [blame] | 2919 | * | 
|  | 2920 | * \returns non-zero if the set contains the specified cursor. | 
|  | 2921 | */ | 
|  | 2922 | CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset, | 
|  | 2923 | CXCursor cursor); | 
|  | 2924 |  | 
|  | 2925 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2926 | * Inserts a CXCursor into a CXCursorSet. | 
| Ted Kremenek | c0b9866 | 2013-04-24 07:17:12 +0000 | [diff] [blame] | 2927 | * | 
|  | 2928 | * \returns zero if the CXCursor was already in the set, and non-zero otherwise. | 
|  | 2929 | */ | 
|  | 2930 | CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset, | 
|  | 2931 | CXCursor cursor); | 
|  | 2932 |  | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2933 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2934 | * Determine the semantic parent of the given cursor. | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2935 | * | 
|  | 2936 | * The semantic parent of a cursor is the cursor that semantically contains | 
|  | 2937 | * the given \p cursor. For many declarations, the lexical and semantic parents | 
|  | 2938 | * are equivalent (the lexical parent is returned by | 
|  | 2939 | * \c clang_getCursorLexicalParent()). They diverge when declarations or | 
|  | 2940 | * definitions are provided out-of-line. For example: | 
|  | 2941 | * | 
|  | 2942 | * \code | 
|  | 2943 | * class C { | 
|  | 2944 | *  void f(); | 
|  | 2945 | * }; | 
|  | 2946 | * | 
|  | 2947 | * void C::f() { } | 
|  | 2948 | * \endcode | 
|  | 2949 | * | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 2950 | * In the out-of-line definition of \c C::f, the semantic parent is | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2951 | * the class \c C, of which this function is a member. The lexical parent is | 
|  | 2952 | * the place where the declaration actually occurs in the source code; in this | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 2953 | * case, the definition occurs in the translation unit. In general, the | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2954 | * lexical parent for a given entity can change without affecting the semantics | 
|  | 2955 | * of the program, and the lexical parent of different declarations of the | 
|  | 2956 | * same entity may be different. Changing the semantic parent of a declaration, | 
|  | 2957 | * on the other hand, can have a major impact on semantics, and redeclarations | 
|  | 2958 | * of a particular entity should all have the same semantic context. | 
|  | 2959 | * | 
|  | 2960 | * In the example above, both declarations of \c C::f have \c C as their | 
|  | 2961 | * semantic context, while the lexical context of the first \c C::f is \c C | 
|  | 2962 | * and the lexical context of the second \c C::f is the translation unit. | 
| Douglas Gregor | 7ecd19e | 2010-12-21 07:55:45 +0000 | [diff] [blame] | 2963 | * | 
|  | 2964 | * For global declarations, the semantic parent is the translation unit. | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2965 | */ | 
|  | 2966 | CINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor); | 
|  | 2967 |  | 
|  | 2968 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 2969 | * Determine the lexical parent of the given cursor. | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2970 | * | 
|  | 2971 | * The lexical parent of a cursor is the cursor in which the given \p cursor | 
|  | 2972 | * was actually written. For many declarations, the lexical and semantic parents | 
|  | 2973 | * are equivalent (the semantic parent is returned by | 
|  | 2974 | * \c clang_getCursorSemanticParent()). They diverge when declarations or | 
|  | 2975 | * definitions are provided out-of-line. For example: | 
|  | 2976 | * | 
|  | 2977 | * \code | 
|  | 2978 | * class C { | 
|  | 2979 | *  void f(); | 
|  | 2980 | * }; | 
|  | 2981 | * | 
|  | 2982 | * void C::f() { } | 
|  | 2983 | * \endcode | 
|  | 2984 | * | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 2985 | * In the out-of-line definition of \c C::f, the semantic parent is | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2986 | * the class \c C, of which this function is a member. The lexical parent is | 
|  | 2987 | * the place where the declaration actually occurs in the source code; in this | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 2988 | * case, the definition occurs in the translation unit. In general, the | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2989 | * lexical parent for a given entity can change without affecting the semantics | 
|  | 2990 | * of the program, and the lexical parent of different declarations of the | 
|  | 2991 | * same entity may be different. Changing the semantic parent of a declaration, | 
|  | 2992 | * on the other hand, can have a major impact on semantics, and redeclarations | 
|  | 2993 | * of a particular entity should all have the same semantic context. | 
|  | 2994 | * | 
|  | 2995 | * In the example above, both declarations of \c C::f have \c C as their | 
|  | 2996 | * semantic context, while the lexical context of the first \c C::f is \c C | 
|  | 2997 | * and the lexical context of the second \c C::f is the translation unit. | 
| Douglas Gregor | 7ecd19e | 2010-12-21 07:55:45 +0000 | [diff] [blame] | 2998 | * | 
|  | 2999 | * For declarations written in the global scope, the lexical parent is | 
|  | 3000 | * the translation unit. | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 3001 | */ | 
|  | 3002 | CINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor); | 
| Douglas Gregor | 99a26af | 2010-10-01 20:25:15 +0000 | [diff] [blame] | 3003 |  | 
|  | 3004 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3005 | * Determine the set of methods that are overridden by the given | 
| Douglas Gregor | 99a26af | 2010-10-01 20:25:15 +0000 | [diff] [blame] | 3006 | * method. | 
|  | 3007 | * | 
|  | 3008 | * In both Objective-C and C++, a method (aka virtual member function, | 
|  | 3009 | * in C++) can override a virtual method in a base class. For | 
|  | 3010 | * Objective-C, a method is said to override any method in the class's | 
| Argyrios Kyrtzidis | bfb2425 | 2012-03-08 00:20:03 +0000 | [diff] [blame] | 3011 | * base class, its protocols, or its categories' protocols, that has the same | 
|  | 3012 | * selector and is of the same kind (class or instance). | 
|  | 3013 | * If no such method exists, the search continues to the class's superclass, | 
|  | 3014 | * its protocols, and its categories, and so on. A method from an Objective-C | 
|  | 3015 | * implementation is considered to override the same methods as its | 
|  | 3016 | * corresponding method in the interface. | 
| Douglas Gregor | 99a26af | 2010-10-01 20:25:15 +0000 | [diff] [blame] | 3017 | * | 
|  | 3018 | * For C++, a virtual member function overrides any virtual member | 
|  | 3019 | * function with the same signature that occurs in its base | 
|  | 3020 | * classes. With multiple inheritance, a virtual member function can | 
|  | 3021 | * override several virtual member functions coming from different | 
|  | 3022 | * base classes. | 
|  | 3023 | * | 
|  | 3024 | * In all cases, this function determines the immediate overridden | 
|  | 3025 | * method, rather than all of the overridden methods. For example, if | 
|  | 3026 | * a method is originally declared in a class A, then overridden in B | 
|  | 3027 | * (which in inherits from A) and also in C (which inherited from B), | 
|  | 3028 | * then the only overridden method returned from this function when | 
|  | 3029 | * invoked on C's method will be B's method. The client may then | 
|  | 3030 | * invoke this function again, given the previously-found overridden | 
|  | 3031 | * methods, to map out the complete method-override set. | 
|  | 3032 | * | 
|  | 3033 | * \param cursor A cursor representing an Objective-C or C++ | 
|  | 3034 | * method. This routine will compute the set of methods that this | 
|  | 3035 | * method overrides. | 
|  | 3036 | * | 
|  | 3037 | * \param overridden A pointer whose pointee will be replaced with a | 
|  | 3038 | * pointer to an array of cursors, representing the set of overridden | 
|  | 3039 | * methods. If there are no overridden methods, the pointee will be | 
|  | 3040 | * set to NULL. The pointee must be freed via a call to | 
|  | 3041 | * \c clang_disposeOverriddenCursors(). | 
|  | 3042 | * | 
|  | 3043 | * \param num_overridden A pointer to the number of overridden | 
|  | 3044 | * functions, will be set to the number of overridden functions in the | 
|  | 3045 | * array pointed to by \p overridden. | 
|  | 3046 | */ | 
|  | 3047 | CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor, | 
|  | 3048 | CXCursor **overridden, | 
|  | 3049 | unsigned *num_overridden); | 
|  | 3050 |  | 
|  | 3051 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3052 | * Free the set of overridden cursors returned by \c | 
| Douglas Gregor | 99a26af | 2010-10-01 20:25:15 +0000 | [diff] [blame] | 3053 | * clang_getOverriddenCursors(). | 
|  | 3054 | */ | 
|  | 3055 | CINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden); | 
|  | 3056 |  | 
| Ted Kremenek | 4ed2925 | 2010-04-12 21:22:16 +0000 | [diff] [blame] | 3057 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3058 | * Retrieve the file that is included by the given inclusion directive | 
| Douglas Gregor | 796d76a | 2010-10-20 22:00:55 +0000 | [diff] [blame] | 3059 | * cursor. | 
|  | 3060 | */ | 
|  | 3061 | CINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor); | 
|  | 3062 |  | 
|  | 3063 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3064 | * @} | 
|  | 3065 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3066 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3067 | /** | 
|  | 3068 | * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code | 
|  | 3069 | * | 
|  | 3070 | * Cursors represent a location within the Abstract Syntax Tree (AST). These | 
|  | 3071 | * routines help map between cursors and the physical locations where the | 
|  | 3072 | * described entities occur in the source code. The mapping is provided in | 
|  | 3073 | * both directions, so one can map from source code to the AST and back. | 
|  | 3074 | * | 
|  | 3075 | * @{ | 
| Steve Naroff | a1c7284 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 3076 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3077 |  | 
| Steve Naroff | 20bad0b | 2009-10-21 13:56:23 +0000 | [diff] [blame] | 3078 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3079 | * Map a source location to the cursor that describes the entity at that | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 3080 | * location in the source code. | 
|  | 3081 | * | 
|  | 3082 | * clang_getCursor() maps an arbitrary source location within a translation | 
|  | 3083 | * unit down to the most specific cursor that describes the entity at that | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3084 | * location. For example, given an expression \c x + y, invoking | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 3085 | * clang_getCursor() with a source location pointing to "x" will return the | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3086 | * cursor for "x"; similarly for "y". If the cursor points anywhere between | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 3087 | * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor() | 
|  | 3088 | * will return a cursor referring to the "+" expression. | 
|  | 3089 | * | 
|  | 3090 | * \returns a cursor representing the entity at the given source location, or | 
|  | 3091 | * a NULL cursor if no such entity can be found. | 
| Steve Naroff | 20bad0b | 2009-10-21 13:56:23 +0000 | [diff] [blame] | 3092 | */ | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 3093 | CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3094 |  | 
| Douglas Gregor | 66a5881 | 2010-01-18 22:46:11 +0000 | [diff] [blame] | 3095 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3096 | * Retrieve the physical location of the source constructor referenced | 
| Douglas Gregor | 66a5881 | 2010-01-18 22:46:11 +0000 | [diff] [blame] | 3097 | * by the given cursor. | 
|  | 3098 | * | 
|  | 3099 | * The location of a declaration is typically the location of the name of that | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3100 | * declaration, where the name of that declaration would occur if it is | 
|  | 3101 | * unnamed, or some keyword that introduces that particular declaration. | 
|  | 3102 | * The location of a reference is where that reference occurs within the | 
| Douglas Gregor | 66a5881 | 2010-01-18 22:46:11 +0000 | [diff] [blame] | 3103 | * source code. | 
|  | 3104 | */ | 
|  | 3105 | CINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor); | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3106 |  | 
| Douglas Gregor | 6b8232f | 2010-01-19 19:34:47 +0000 | [diff] [blame] | 3107 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3108 | * Retrieve the physical extent of the source construct referenced by | 
| Douglas Gregor | 33c34ac | 2010-01-19 00:34:46 +0000 | [diff] [blame] | 3109 | * the given cursor. | 
|  | 3110 | * | 
|  | 3111 | * The extent of a cursor starts with the file/line/column pointing at the | 
|  | 3112 | * first character within the source construct that the cursor refers to and | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 3113 | * ends with the last character within that source construct. For a | 
| Douglas Gregor | 33c34ac | 2010-01-19 00:34:46 +0000 | [diff] [blame] | 3114 | * declaration, the extent covers the declaration itself. For a reference, | 
|  | 3115 | * the extent covers the location of the reference (e.g., where the referenced | 
|  | 3116 | * entity was actually used). | 
|  | 3117 | */ | 
|  | 3118 | CINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor); | 
| Douglas Gregor | ad27e8b | 2010-01-19 01:20:04 +0000 | [diff] [blame] | 3119 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3120 | /** | 
|  | 3121 | * @} | 
|  | 3122 | */ | 
| Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 3123 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3124 | /** | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3125 | * \defgroup CINDEX_TYPES Type information for CXCursors | 
|  | 3126 | * | 
|  | 3127 | * @{ | 
|  | 3128 | */ | 
|  | 3129 |  | 
|  | 3130 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3131 | * Describes the kind of type | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3132 | */ | 
|  | 3133 | enum CXTypeKind { | 
|  | 3134 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3135 | * Represents an invalid type (e.g., where no type is available). | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3136 | */ | 
|  | 3137 | CXType_Invalid = 0, | 
|  | 3138 |  | 
|  | 3139 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3140 | * A type whose specific kind is not exposed via this | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3141 | * interface. | 
|  | 3142 | */ | 
|  | 3143 | CXType_Unexposed = 1, | 
|  | 3144 |  | 
|  | 3145 | /* Builtin types */ | 
|  | 3146 | CXType_Void = 2, | 
|  | 3147 | CXType_Bool = 3, | 
|  | 3148 | CXType_Char_U = 4, | 
|  | 3149 | CXType_UChar = 5, | 
|  | 3150 | CXType_Char16 = 6, | 
|  | 3151 | CXType_Char32 = 7, | 
|  | 3152 | CXType_UShort = 8, | 
|  | 3153 | CXType_UInt = 9, | 
|  | 3154 | CXType_ULong = 10, | 
|  | 3155 | CXType_ULongLong = 11, | 
|  | 3156 | CXType_UInt128 = 12, | 
|  | 3157 | CXType_Char_S = 13, | 
|  | 3158 | CXType_SChar = 14, | 
|  | 3159 | CXType_WChar = 15, | 
|  | 3160 | CXType_Short = 16, | 
|  | 3161 | CXType_Int = 17, | 
|  | 3162 | CXType_Long = 18, | 
|  | 3163 | CXType_LongLong = 19, | 
|  | 3164 | CXType_Int128 = 20, | 
|  | 3165 | CXType_Float = 21, | 
|  | 3166 | CXType_Double = 22, | 
|  | 3167 | CXType_LongDouble = 23, | 
|  | 3168 | CXType_NullPtr = 24, | 
|  | 3169 | CXType_Overload = 25, | 
|  | 3170 | CXType_Dependent = 26, | 
|  | 3171 | CXType_ObjCId = 27, | 
|  | 3172 | CXType_ObjCClass = 28, | 
|  | 3173 | CXType_ObjCSel = 29, | 
| Nemanja Ivanovic | bb1ea2d | 2016-05-09 08:52:33 +0000 | [diff] [blame] | 3174 | CXType_Float128 = 30, | 
| Joey Gouly | 6ea2185 | 2017-02-10 15:51:11 +0000 | [diff] [blame] | 3175 | CXType_Half = 31, | 
| Sjoerd Meijer | cc623ad | 2017-09-08 15:15:00 +0000 | [diff] [blame] | 3176 | CXType_Float16 = 32, | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3177 | CXType_FirstBuiltin = CXType_Void, | 
| Sjoerd Meijer | cc623ad | 2017-09-08 15:15:00 +0000 | [diff] [blame] | 3178 | CXType_LastBuiltin  = CXType_Float16, | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3179 |  | 
|  | 3180 | CXType_Complex = 100, | 
|  | 3181 | CXType_Pointer = 101, | 
|  | 3182 | CXType_BlockPointer = 102, | 
|  | 3183 | CXType_LValueReference = 103, | 
|  | 3184 | CXType_RValueReference = 104, | 
|  | 3185 | CXType_Record = 105, | 
|  | 3186 | CXType_Enum = 106, | 
|  | 3187 | CXType_Typedef = 107, | 
|  | 3188 | CXType_ObjCInterface = 108, | 
| Ted Kremenek | c150887 | 2010-06-21 20:15:39 +0000 | [diff] [blame] | 3189 | CXType_ObjCObjectPointer = 109, | 
|  | 3190 | CXType_FunctionNoProto = 110, | 
| Argyrios Kyrtzidis | 2b0cf60 | 2011-09-27 17:44:34 +0000 | [diff] [blame] | 3191 | CXType_FunctionProto = 111, | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3192 | CXType_ConstantArray = 112, | 
| Argyrios Kyrtzidis | 0661a71 | 2013-07-23 17:36:21 +0000 | [diff] [blame] | 3193 | CXType_Vector = 113, | 
|  | 3194 | CXType_IncompleteArray = 114, | 
|  | 3195 | CXType_VariableArray = 115, | 
| Argyrios Kyrtzidis | 7a4253b | 2013-10-03 16:19:23 +0000 | [diff] [blame] | 3196 | CXType_DependentSizedArray = 116, | 
| Sergey Kalinichev | c015120 | 2015-11-15 13:10:10 +0000 | [diff] [blame] | 3197 | CXType_MemberPointer = 117, | 
| Sergey Kalinichev | 69770ae | 2016-05-03 06:58:29 +0000 | [diff] [blame] | 3198 | CXType_Auto = 118, | 
|  | 3199 |  | 
|  | 3200 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3201 | * Represents a type that was referred to using an elaborated type keyword. | 
| Sergey Kalinichev | 69770ae | 2016-05-03 06:58:29 +0000 | [diff] [blame] | 3202 | * | 
|  | 3203 | * E.g., struct S, or via a qualified name, e.g., N::M::type, or both. | 
|  | 3204 | */ | 
| Sven van Haastregt | cc4f1e4 | 2017-05-23 10:36:43 +0000 | [diff] [blame] | 3205 | CXType_Elaborated = 119, | 
|  | 3206 |  | 
|  | 3207 | /* OpenCL PipeType. */ | 
|  | 3208 | CXType_Pipe = 120, | 
|  | 3209 |  | 
|  | 3210 | /* OpenCL builtin types. */ | 
|  | 3211 | CXType_OCLImage1dRO = 121, | 
|  | 3212 | CXType_OCLImage1dArrayRO = 122, | 
|  | 3213 | CXType_OCLImage1dBufferRO = 123, | 
|  | 3214 | CXType_OCLImage2dRO = 124, | 
|  | 3215 | CXType_OCLImage2dArrayRO = 125, | 
|  | 3216 | CXType_OCLImage2dDepthRO = 126, | 
|  | 3217 | CXType_OCLImage2dArrayDepthRO = 127, | 
|  | 3218 | CXType_OCLImage2dMSAARO = 128, | 
|  | 3219 | CXType_OCLImage2dArrayMSAARO = 129, | 
|  | 3220 | CXType_OCLImage2dMSAADepthRO = 130, | 
|  | 3221 | CXType_OCLImage2dArrayMSAADepthRO = 131, | 
|  | 3222 | CXType_OCLImage3dRO = 132, | 
|  | 3223 | CXType_OCLImage1dWO = 133, | 
|  | 3224 | CXType_OCLImage1dArrayWO = 134, | 
|  | 3225 | CXType_OCLImage1dBufferWO = 135, | 
|  | 3226 | CXType_OCLImage2dWO = 136, | 
|  | 3227 | CXType_OCLImage2dArrayWO = 137, | 
|  | 3228 | CXType_OCLImage2dDepthWO = 138, | 
|  | 3229 | CXType_OCLImage2dArrayDepthWO = 139, | 
|  | 3230 | CXType_OCLImage2dMSAAWO = 140, | 
|  | 3231 | CXType_OCLImage2dArrayMSAAWO = 141, | 
|  | 3232 | CXType_OCLImage2dMSAADepthWO = 142, | 
|  | 3233 | CXType_OCLImage2dArrayMSAADepthWO = 143, | 
|  | 3234 | CXType_OCLImage3dWO = 144, | 
|  | 3235 | CXType_OCLImage1dRW = 145, | 
|  | 3236 | CXType_OCLImage1dArrayRW = 146, | 
|  | 3237 | CXType_OCLImage1dBufferRW = 147, | 
|  | 3238 | CXType_OCLImage2dRW = 148, | 
|  | 3239 | CXType_OCLImage2dArrayRW = 149, | 
|  | 3240 | CXType_OCLImage2dDepthRW = 150, | 
|  | 3241 | CXType_OCLImage2dArrayDepthRW = 151, | 
|  | 3242 | CXType_OCLImage2dMSAARW = 152, | 
|  | 3243 | CXType_OCLImage2dArrayMSAARW = 153, | 
|  | 3244 | CXType_OCLImage2dMSAADepthRW = 154, | 
|  | 3245 | CXType_OCLImage2dArrayMSAADepthRW = 155, | 
|  | 3246 | CXType_OCLImage3dRW = 156, | 
|  | 3247 | CXType_OCLSampler = 157, | 
|  | 3248 | CXType_OCLEvent = 158, | 
|  | 3249 | CXType_OCLQueue = 159, | 
|  | 3250 | CXType_OCLReserveID = 160 | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3251 | }; | 
|  | 3252 |  | 
|  | 3253 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3254 | * Describes the calling convention of a function type | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3255 | */ | 
|  | 3256 | enum CXCallingConv { | 
|  | 3257 | CXCallingConv_Default = 0, | 
|  | 3258 | CXCallingConv_C = 1, | 
|  | 3259 | CXCallingConv_X86StdCall = 2, | 
|  | 3260 | CXCallingConv_X86FastCall = 3, | 
|  | 3261 | CXCallingConv_X86ThisCall = 4, | 
|  | 3262 | CXCallingConv_X86Pascal = 5, | 
|  | 3263 | CXCallingConv_AAPCS = 6, | 
|  | 3264 | CXCallingConv_AAPCS_VFP = 7, | 
| Erich Keane | 757d317 | 2016-11-02 18:29:35 +0000 | [diff] [blame] | 3265 | CXCallingConv_X86RegCall = 8, | 
| Guy Benyei | f0a014b | 2012-12-25 08:53:55 +0000 | [diff] [blame] | 3266 | CXCallingConv_IntelOclBicc = 9, | 
| Martin Storsjo | 022e782 | 2017-07-17 20:49:45 +0000 | [diff] [blame] | 3267 | CXCallingConv_Win64 = 10, | 
| Nikolai Bozhenov | ce25d41 | 2017-08-08 14:13:50 +0000 | [diff] [blame] | 3268 | /* Alias for compatibility with older versions of API. */ | 
|  | 3269 | CXCallingConv_X86_64Win64 = CXCallingConv_Win64, | 
| Charles Davis | b5a214e | 2013-08-30 04:39:01 +0000 | [diff] [blame] | 3270 | CXCallingConv_X86_64SysV = 11, | 
| Reid Kleckner | d7857f0 | 2014-10-24 17:42:17 +0000 | [diff] [blame] | 3271 | CXCallingConv_X86VectorCall = 12, | 
| John McCall | 477f2bb | 2016-03-03 06:39:32 +0000 | [diff] [blame] | 3272 | CXCallingConv_Swift = 13, | 
| Roman Levenstein | 35aa5ce | 2016-03-16 18:00:46 +0000 | [diff] [blame] | 3273 | CXCallingConv_PreserveMost = 14, | 
|  | 3274 | CXCallingConv_PreserveAll = 15, | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3275 |  | 
|  | 3276 | CXCallingConv_Invalid = 100, | 
|  | 3277 | CXCallingConv_Unexposed = 200 | 
|  | 3278 | }; | 
|  | 3279 |  | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3280 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3281 | * The type of an element in the abstract syntax tree. | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3282 | * | 
|  | 3283 | */ | 
|  | 3284 | typedef struct { | 
|  | 3285 | enum CXTypeKind kind; | 
|  | 3286 | void *data[2]; | 
|  | 3287 | } CXType; | 
|  | 3288 |  | 
|  | 3289 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3290 | * Retrieve the type of a CXCursor (if any). | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3291 | */ | 
|  | 3292 | CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C); | 
|  | 3293 |  | 
|  | 3294 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3295 | * Pretty-print the underlying type using the rules of the | 
| Dmitri Gribenko | 0035372 | 2013-02-15 21:15:49 +0000 | [diff] [blame] | 3296 | * language of the translation unit from which it came. | 
|  | 3297 | * | 
|  | 3298 | * If the type is invalid, an empty string is returned. | 
|  | 3299 | */ | 
|  | 3300 | CINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT); | 
|  | 3301 |  | 
|  | 3302 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3303 | * Retrieve the underlying type of a typedef declaration. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3304 | * | 
|  | 3305 | * If the cursor does not reference a typedef declaration, an invalid type is | 
|  | 3306 | * returned. | 
|  | 3307 | */ | 
|  | 3308 | CINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C); | 
|  | 3309 |  | 
|  | 3310 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3311 | * Retrieve the integer type of an enum declaration. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3312 | * | 
|  | 3313 | * If the cursor does not reference an enum declaration, an invalid type is | 
|  | 3314 | * returned. | 
|  | 3315 | */ | 
|  | 3316 | CINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C); | 
|  | 3317 |  | 
|  | 3318 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3319 | * Retrieve the integer value of an enum constant declaration as a signed | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3320 | *  long long. | 
|  | 3321 | * | 
|  | 3322 | * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned. | 
|  | 3323 | * Since this is also potentially a valid constant value, the kind of the cursor | 
|  | 3324 | * must be verified before calling this function. | 
|  | 3325 | */ | 
|  | 3326 | CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); | 
|  | 3327 |  | 
|  | 3328 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3329 | * Retrieve the integer value of an enum constant declaration as an unsigned | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3330 | *  long long. | 
|  | 3331 | * | 
|  | 3332 | * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned. | 
|  | 3333 | * Since this is also potentially a valid constant value, the kind of the cursor | 
|  | 3334 | * must be verified before calling this function. | 
|  | 3335 | */ | 
|  | 3336 | CINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C); | 
|  | 3337 |  | 
|  | 3338 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3339 | * Retrieve the bit width of a bit field declaration as an integer. | 
| Dmitri Gribenko | b506ba1 | 2012-12-04 15:13:46 +0000 | [diff] [blame] | 3340 | * | 
|  | 3341 | * If a cursor that is not a bit field declaration is passed in, -1 is returned. | 
|  | 3342 | */ | 
|  | 3343 | CINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C); | 
|  | 3344 |  | 
|  | 3345 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3346 | * Retrieve the number of non-variadic arguments associated with a given | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3347 | * cursor. | 
|  | 3348 | * | 
| Argyrios Kyrtzidis | b279297 | 2013-04-01 17:38:59 +0000 | [diff] [blame] | 3349 | * The number of arguments can be determined for calls as well as for | 
|  | 3350 | * declarations of functions or methods. For other cursors -1 is returned. | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3351 | */ | 
|  | 3352 | CINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C); | 
|  | 3353 |  | 
|  | 3354 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3355 | * Retrieve the argument cursor of a function or method. | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3356 | * | 
| Argyrios Kyrtzidis | b279297 | 2013-04-01 17:38:59 +0000 | [diff] [blame] | 3357 | * The argument cursor can be determined for calls as well as for declarations | 
|  | 3358 | * of functions or methods. For other cursors and for invalid indices, an | 
|  | 3359 | * invalid cursor is returned. | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3360 | */ | 
|  | 3361 | CINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i); | 
|  | 3362 |  | 
|  | 3363 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3364 | * Describes the kind of a template argument. | 
| Eli Bendersky | c27a0c4 | 2014-10-10 20:01:05 +0000 | [diff] [blame] | 3365 | * | 
|  | 3366 | * See the definition of llvm::clang::TemplateArgument::ArgKind for full | 
|  | 3367 | * element descriptions. | 
|  | 3368 | */ | 
|  | 3369 | enum CXTemplateArgumentKind { | 
|  | 3370 | CXTemplateArgumentKind_Null, | 
|  | 3371 | CXTemplateArgumentKind_Type, | 
|  | 3372 | CXTemplateArgumentKind_Declaration, | 
|  | 3373 | CXTemplateArgumentKind_NullPtr, | 
|  | 3374 | CXTemplateArgumentKind_Integral, | 
|  | 3375 | CXTemplateArgumentKind_Template, | 
|  | 3376 | CXTemplateArgumentKind_TemplateExpansion, | 
|  | 3377 | CXTemplateArgumentKind_Expression, | 
|  | 3378 | CXTemplateArgumentKind_Pack, | 
|  | 3379 | /* Indicates an error case, preventing the kind from being deduced. */ | 
|  | 3380 | CXTemplateArgumentKind_Invalid | 
|  | 3381 | }; | 
|  | 3382 |  | 
|  | 3383 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3384 | *Returns the number of template args of a function decl representing a | 
| Eli Bendersky | c27a0c4 | 2014-10-10 20:01:05 +0000 | [diff] [blame] | 3385 | * template specialization. | 
|  | 3386 | * | 
|  | 3387 | * If the argument cursor cannot be converted into a template function | 
|  | 3388 | * declaration, -1 is returned. | 
|  | 3389 | * | 
|  | 3390 | * For example, for the following declaration and specialization: | 
|  | 3391 | *   template <typename T, int kInt, bool kBool> | 
|  | 3392 | *   void foo() { ... } | 
|  | 3393 | * | 
|  | 3394 | *   template <> | 
|  | 3395 | *   void foo<float, -7, true>(); | 
|  | 3396 | * | 
|  | 3397 | * The value 3 would be returned from this call. | 
|  | 3398 | */ | 
|  | 3399 | CINDEX_LINKAGE int clang_Cursor_getNumTemplateArguments(CXCursor C); | 
|  | 3400 |  | 
|  | 3401 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3402 | * Retrieve the kind of the I'th template argument of the CXCursor C. | 
| Eli Bendersky | c27a0c4 | 2014-10-10 20:01:05 +0000 | [diff] [blame] | 3403 | * | 
|  | 3404 | * If the argument CXCursor does not represent a FunctionDecl, an invalid | 
|  | 3405 | * template argument kind is returned. | 
|  | 3406 | * | 
|  | 3407 | * For example, for the following declaration and specialization: | 
|  | 3408 | *   template <typename T, int kInt, bool kBool> | 
|  | 3409 | *   void foo() { ... } | 
|  | 3410 | * | 
|  | 3411 | *   template <> | 
|  | 3412 | *   void foo<float, -7, true>(); | 
|  | 3413 | * | 
|  | 3414 | * For I = 0, 1, and 2, Type, Integral, and Integral will be returned, | 
|  | 3415 | * respectively. | 
|  | 3416 | */ | 
|  | 3417 | CINDEX_LINKAGE enum CXTemplateArgumentKind clang_Cursor_getTemplateArgumentKind( | 
|  | 3418 | CXCursor C, unsigned I); | 
|  | 3419 |  | 
|  | 3420 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3421 | * Retrieve a CXType representing the type of a TemplateArgument of a | 
| Eli Bendersky | c27a0c4 | 2014-10-10 20:01:05 +0000 | [diff] [blame] | 3422 | *  function decl representing a template specialization. | 
|  | 3423 | * | 
|  | 3424 | * If the argument CXCursor does not represent a FunctionDecl whose I'th | 
|  | 3425 | * template argument has a kind of CXTemplateArgKind_Integral, an invalid type | 
|  | 3426 | * is returned. | 
|  | 3427 | * | 
|  | 3428 | * For example, for the following declaration and specialization: | 
|  | 3429 | *   template <typename T, int kInt, bool kBool> | 
|  | 3430 | *   void foo() { ... } | 
|  | 3431 | * | 
|  | 3432 | *   template <> | 
|  | 3433 | *   void foo<float, -7, true>(); | 
|  | 3434 | * | 
|  | 3435 | * If called with I = 0, "float", will be returned. | 
|  | 3436 | * Invalid types will be returned for I == 1 or 2. | 
|  | 3437 | */ | 
|  | 3438 | CINDEX_LINKAGE CXType clang_Cursor_getTemplateArgumentType(CXCursor C, | 
|  | 3439 | unsigned I); | 
|  | 3440 |  | 
|  | 3441 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3442 | * Retrieve the value of an Integral TemplateArgument (of a function | 
| Eli Bendersky | c27a0c4 | 2014-10-10 20:01:05 +0000 | [diff] [blame] | 3443 | *  decl representing a template specialization) as a signed long long. | 
|  | 3444 | * | 
|  | 3445 | * It is undefined to call this function on a CXCursor that does not represent a | 
|  | 3446 | * FunctionDecl or whose I'th template argument is not an integral value. | 
|  | 3447 | * | 
|  | 3448 | * For example, for the following declaration and specialization: | 
|  | 3449 | *   template <typename T, int kInt, bool kBool> | 
|  | 3450 | *   void foo() { ... } | 
|  | 3451 | * | 
|  | 3452 | *   template <> | 
|  | 3453 | *   void foo<float, -7, true>(); | 
|  | 3454 | * | 
|  | 3455 | * If called with I = 1 or 2, -7 or true will be returned, respectively. | 
|  | 3456 | * For I == 0, this function's behavior is undefined. | 
|  | 3457 | */ | 
|  | 3458 | CINDEX_LINKAGE long long clang_Cursor_getTemplateArgumentValue(CXCursor C, | 
|  | 3459 | unsigned I); | 
|  | 3460 |  | 
|  | 3461 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3462 | * Retrieve the value of an Integral TemplateArgument (of a function | 
| Eli Bendersky | c27a0c4 | 2014-10-10 20:01:05 +0000 | [diff] [blame] | 3463 | *  decl representing a template specialization) as an unsigned long long. | 
|  | 3464 | * | 
|  | 3465 | * It is undefined to call this function on a CXCursor that does not represent a | 
|  | 3466 | * FunctionDecl or whose I'th template argument is not an integral value. | 
|  | 3467 | * | 
|  | 3468 | * For example, for the following declaration and specialization: | 
|  | 3469 | *   template <typename T, int kInt, bool kBool> | 
|  | 3470 | *   void foo() { ... } | 
|  | 3471 | * | 
|  | 3472 | *   template <> | 
|  | 3473 | *   void foo<float, 2147483649, true>(); | 
|  | 3474 | * | 
|  | 3475 | * If called with I = 1 or 2, 2147483649 or true will be returned, respectively. | 
|  | 3476 | * For I == 0, this function's behavior is undefined. | 
|  | 3477 | */ | 
|  | 3478 | CINDEX_LINKAGE unsigned long long clang_Cursor_getTemplateArgumentUnsignedValue( | 
|  | 3479 | CXCursor C, unsigned I); | 
|  | 3480 |  | 
|  | 3481 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3482 | * Determine whether two CXTypes represent the same type. | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3483 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3484 | * \returns non-zero if the CXTypes represent the same type and | 
|  | 3485 | *          zero otherwise. | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3486 | */ | 
|  | 3487 | CINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B); | 
|  | 3488 |  | 
|  | 3489 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3490 | * Return the canonical type for a CXType. | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3491 | * | 
|  | 3492 | * Clang's type system explicitly models typedefs and all the ways | 
|  | 3493 | * a specific type can be represented.  The canonical type is the underlying | 
|  | 3494 | * type with all the "sugar" removed.  For example, if 'T' is a typedef | 
|  | 3495 | * for 'int', the canonical type for 'T' would be 'int'. | 
|  | 3496 | */ | 
|  | 3497 | CINDEX_LINKAGE CXType clang_getCanonicalType(CXType T); | 
|  | 3498 |  | 
|  | 3499 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3500 | * Determine whether a CXType has the "const" qualifier set, | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3501 | * without looking through typedefs that may have added "const" at a | 
|  | 3502 | * different level. | 
| Douglas Gregor | 56a6380 | 2011-01-27 16:27:11 +0000 | [diff] [blame] | 3503 | */ | 
|  | 3504 | CINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T); | 
|  | 3505 |  | 
|  | 3506 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3507 | * Determine whether a  CXCursor that is a macro, is | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 3508 | * function like. | 
|  | 3509 | */ | 
|  | 3510 | CINDEX_LINKAGE unsigned clang_Cursor_isMacroFunctionLike(CXCursor C); | 
|  | 3511 |  | 
|  | 3512 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3513 | * Determine whether a  CXCursor that is a macro, is a | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 3514 | * builtin one. | 
|  | 3515 | */ | 
|  | 3516 | CINDEX_LINKAGE unsigned clang_Cursor_isMacroBuiltin(CXCursor C); | 
|  | 3517 |  | 
|  | 3518 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3519 | * Determine whether a  CXCursor that is a function declaration, is an | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 3520 | * inline declaration. | 
|  | 3521 | */ | 
|  | 3522 | CINDEX_LINKAGE unsigned clang_Cursor_isFunctionInlined(CXCursor C); | 
|  | 3523 |  | 
|  | 3524 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3525 | * Determine whether a CXType has the "volatile" qualifier set, | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3526 | * without looking through typedefs that may have added "volatile" at | 
|  | 3527 | * a different level. | 
| Douglas Gregor | 56a6380 | 2011-01-27 16:27:11 +0000 | [diff] [blame] | 3528 | */ | 
|  | 3529 | CINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T); | 
|  | 3530 |  | 
|  | 3531 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3532 | * Determine whether a CXType has the "restrict" qualifier set, | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3533 | * without looking through typedefs that may have added "restrict" at a | 
|  | 3534 | * different level. | 
| Douglas Gregor | 56a6380 | 2011-01-27 16:27:11 +0000 | [diff] [blame] | 3535 | */ | 
|  | 3536 | CINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T); | 
|  | 3537 |  | 
|  | 3538 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3539 | * Returns the address space of the given type. | 
| Sven van Haastregt | e891042 | 2017-06-08 14:22:04 +0000 | [diff] [blame] | 3540 | */ | 
|  | 3541 | CINDEX_LINKAGE unsigned clang_getAddressSpace(CXType T); | 
|  | 3542 |  | 
|  | 3543 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3544 | * Returns the typedef name of the given type. | 
| Sven van Haastregt | e891042 | 2017-06-08 14:22:04 +0000 | [diff] [blame] | 3545 | */ | 
|  | 3546 | CINDEX_LINKAGE CXString clang_getTypedefName(CXType CT); | 
|  | 3547 |  | 
|  | 3548 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3549 | * For pointer types, returns the type of the pointee. | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3550 | */ | 
|  | 3551 | CINDEX_LINKAGE CXType clang_getPointeeType(CXType T); | 
|  | 3552 |  | 
|  | 3553 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3554 | * Return the cursor for the declaration of the given type. | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3555 | */ | 
|  | 3556 | CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T); | 
|  | 3557 |  | 
| David Chisnall | 50e4eba | 2010-12-30 14:05:53 +0000 | [diff] [blame] | 3558 | /** | 
|  | 3559 | * Returns the Objective-C type encoding for the specified declaration. | 
|  | 3560 | */ | 
|  | 3561 | CINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C); | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3562 |  | 
|  | 3563 | /** | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 3564 | * Returns the Objective-C type encoding for the specified CXType. | 
|  | 3565 | */ | 
|  | 3566 | CINDEX_LINKAGE CXString clang_Type_getObjCEncoding(CXType type); | 
|  | 3567 |  | 
|  | 3568 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3569 | * Retrieve the spelling of a given CXTypeKind. | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3570 | */ | 
|  | 3571 | CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K); | 
|  | 3572 |  | 
|  | 3573 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3574 | * Retrieve the calling convention associated with a function type. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3575 | * | 
|  | 3576 | * If a non-function type is passed in, CXCallingConv_Invalid is returned. | 
|  | 3577 | */ | 
|  | 3578 | CINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T); | 
|  | 3579 |  | 
|  | 3580 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3581 | * Retrieve the return type associated with a function type. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3582 | * | 
|  | 3583 | * If a non-function type is passed in, an invalid type is returned. | 
| Ted Kremenek | c150887 | 2010-06-21 20:15:39 +0000 | [diff] [blame] | 3584 | */ | 
|  | 3585 | CINDEX_LINKAGE CXType clang_getResultType(CXType T); | 
|  | 3586 |  | 
|  | 3587 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3588 | * Retrieve the exception specification type associated with a function type. | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 3589 | * | 
|  | 3590 | * If a non-function type is passed in, an error code of -1 is returned. | 
|  | 3591 | */ | 
|  | 3592 | CINDEX_LINKAGE int clang_getExceptionSpecificationType(CXType T); | 
|  | 3593 |  | 
|  | 3594 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3595 | * Retrieve the number of non-variadic parameters associated with a | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3596 | * function type. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3597 | * | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3598 | * If a non-function type is passed in, -1 is returned. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3599 | */ | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3600 | CINDEX_LINKAGE int clang_getNumArgTypes(CXType T); | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3601 |  | 
|  | 3602 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3603 | * Retrieve the type of a parameter of a function type. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3604 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3605 | * If a non-function type is passed in or the function does not have enough | 
|  | 3606 | * parameters, an invalid type is returned. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3607 | */ | 
|  | 3608 | CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); | 
|  | 3609 |  | 
|  | 3610 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3611 | * Return 1 if the CXType is a variadic function type, and 0 otherwise. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3612 | */ | 
|  | 3613 | CINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T); | 
|  | 3614 |  | 
|  | 3615 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3616 | * Retrieve the return type associated with a given cursor. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3617 | * | 
|  | 3618 | * This only returns a valid type if the cursor refers to a function or method. | 
| Ted Kremenek | c62ab8d | 2010-06-21 20:48:56 +0000 | [diff] [blame] | 3619 | */ | 
|  | 3620 | CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C); | 
|  | 3621 |  | 
|  | 3622 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3623 | * Retrieve the exception specification type associated with a given cursor. | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 3624 | * | 
|  | 3625 | * This only returns a valid result if the cursor refers to a function or method. | 
|  | 3626 | */ | 
|  | 3627 | CINDEX_LINKAGE int clang_getCursorExceptionSpecificationType(CXCursor C); | 
|  | 3628 |  | 
|  | 3629 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3630 | * Return 1 if the CXType is a POD (plain old data) type, and 0 | 
| Ted Kremenek | 0c7476a | 2010-07-30 00:14:11 +0000 | [diff] [blame] | 3631 | *  otherwise. | 
|  | 3632 | */ | 
|  | 3633 | CINDEX_LINKAGE unsigned clang_isPODType(CXType T); | 
|  | 3634 |  | 
|  | 3635 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3636 | * Return the element type of an array, complex, or vector type. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3637 | * | 
|  | 3638 | * If a type is passed in that is not an array, complex, or vector type, | 
|  | 3639 | * an invalid type is returned. | 
|  | 3640 | */ | 
|  | 3641 | CINDEX_LINKAGE CXType clang_getElementType(CXType T); | 
|  | 3642 |  | 
|  | 3643 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3644 | * Return the number of elements of an array or vector type. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3645 | * | 
|  | 3646 | * If a type is passed in that is not an array or vector type, | 
|  | 3647 | * -1 is returned. | 
|  | 3648 | */ | 
|  | 3649 | CINDEX_LINKAGE long long clang_getNumElements(CXType T); | 
|  | 3650 |  | 
|  | 3651 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3652 | * Return the element type of an array type. | 
| Argyrios Kyrtzidis | 2b0cf60 | 2011-09-27 17:44:34 +0000 | [diff] [blame] | 3653 | * | 
|  | 3654 | * If a non-array type is passed in, an invalid type is returned. | 
|  | 3655 | */ | 
|  | 3656 | CINDEX_LINKAGE CXType clang_getArrayElementType(CXType T); | 
|  | 3657 |  | 
|  | 3658 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3659 | * Return the array size of a constant array. | 
| Argyrios Kyrtzidis | 2b0cf60 | 2011-09-27 17:44:34 +0000 | [diff] [blame] | 3660 | * | 
|  | 3661 | * If a non-array type is passed in, -1 is returned. | 
|  | 3662 | */ | 
|  | 3663 | CINDEX_LINKAGE long long clang_getArraySize(CXType T); | 
|  | 3664 |  | 
|  | 3665 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3666 | * Retrieve the type named by the qualified-id. | 
| Sergey Kalinichev | 69770ae | 2016-05-03 06:58:29 +0000 | [diff] [blame] | 3667 | * | 
|  | 3668 | * If a non-elaborated type is passed in, an invalid type is returned. | 
|  | 3669 | */ | 
|  | 3670 | CINDEX_LINKAGE CXType clang_Type_getNamedType(CXType T); | 
|  | 3671 |  | 
|  | 3672 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3673 | * Determine if a typedef is 'transparent' tag. | 
| Argyrios Kyrtzidis | 3b25c91 | 2017-03-21 16:56:02 +0000 | [diff] [blame] | 3674 | * | 
|  | 3675 | * A typedef is considered 'transparent' if it shares a name and spelling | 
|  | 3676 | * location with its underlying tag type, as is the case with the NS_ENUM macro. | 
|  | 3677 | * | 
|  | 3678 | * \returns non-zero if transparent and zero otherwise. | 
|  | 3679 | */ | 
|  | 3680 | CINDEX_LINKAGE unsigned clang_Type_isTransparentTagTypedef(CXType T); | 
|  | 3681 |  | 
|  | 3682 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3683 | * List the possible error codes for \c clang_Type_getSizeOf, | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3684 | *   \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and | 
|  | 3685 | *   \c clang_Cursor_getOffsetOf. | 
|  | 3686 | * | 
|  | 3687 | * A value of this enumeration type can be returned if the target type is not | 
|  | 3688 | * a valid argument to sizeof, alignof or offsetof. | 
|  | 3689 | */ | 
|  | 3690 | enum CXTypeLayoutError { | 
|  | 3691 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3692 | * Type is of kind CXType_Invalid. | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3693 | */ | 
|  | 3694 | CXTypeLayoutError_Invalid = -1, | 
|  | 3695 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3696 | * The type is an incomplete Type. | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3697 | */ | 
|  | 3698 | CXTypeLayoutError_Incomplete = -2, | 
|  | 3699 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3700 | * The type is a dependent Type. | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3701 | */ | 
|  | 3702 | CXTypeLayoutError_Dependent = -3, | 
|  | 3703 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3704 | * The type is not a constant size type. | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3705 | */ | 
|  | 3706 | CXTypeLayoutError_NotConstantSize = -4, | 
|  | 3707 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3708 | * The Field name is not valid for this record. | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3709 | */ | 
|  | 3710 | CXTypeLayoutError_InvalidFieldName = -5 | 
|  | 3711 | }; | 
|  | 3712 |  | 
|  | 3713 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3714 | * Return the alignment of a type in bytes as per C++[expr.alignof] | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3715 | *   standard. | 
|  | 3716 | * | 
|  | 3717 | * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. | 
|  | 3718 | * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete | 
|  | 3719 | *   is returned. | 
|  | 3720 | * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is | 
|  | 3721 | *   returned. | 
|  | 3722 | * If the type declaration is not a constant size type, | 
|  | 3723 | *   CXTypeLayoutError_NotConstantSize is returned. | 
|  | 3724 | */ | 
|  | 3725 | CINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T); | 
|  | 3726 |  | 
|  | 3727 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3728 | * Return the class type of an member pointer type. | 
| Argyrios Kyrtzidis | 7a4253b | 2013-10-03 16:19:23 +0000 | [diff] [blame] | 3729 | * | 
|  | 3730 | * If a non-member-pointer type is passed in, an invalid type is returned. | 
|  | 3731 | */ | 
|  | 3732 | CINDEX_LINKAGE CXType clang_Type_getClassType(CXType T); | 
|  | 3733 |  | 
|  | 3734 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3735 | * Return the size of a type in bytes as per C++[expr.sizeof] standard. | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3736 | * | 
|  | 3737 | * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. | 
|  | 3738 | * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete | 
|  | 3739 | *   is returned. | 
|  | 3740 | * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is | 
|  | 3741 | *   returned. | 
|  | 3742 | */ | 
|  | 3743 | CINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T); | 
|  | 3744 |  | 
|  | 3745 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3746 | * Return the offset of a field named S in a record of type T in bits | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3747 | *   as it would be returned by __offsetof__ as per C++11[18.2p4] | 
|  | 3748 | * | 
|  | 3749 | * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid | 
|  | 3750 | *   is returned. | 
|  | 3751 | * If the field's type declaration is an incomplete type, | 
|  | 3752 | *   CXTypeLayoutError_Incomplete is returned. | 
|  | 3753 | * If the field's type declaration is a dependent type, | 
|  | 3754 | *   CXTypeLayoutError_Dependent is returned. | 
|  | 3755 | * If the field's name S is not found, | 
|  | 3756 | *   CXTypeLayoutError_InvalidFieldName is returned. | 
|  | 3757 | */ | 
|  | 3758 | CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S); | 
|  | 3759 |  | 
| Argyrios Kyrtzidis | 2bff516 | 2015-04-13 16:55:04 +0000 | [diff] [blame] | 3760 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3761 | * Return the offset of the field represented by the Cursor. | 
| Argyrios Kyrtzidis | 2bff516 | 2015-04-13 16:55:04 +0000 | [diff] [blame] | 3762 | * | 
|  | 3763 | * If the cursor is not a field declaration, -1 is returned. | 
|  | 3764 | * If the cursor semantic parent is not a record field declaration, | 
|  | 3765 | *   CXTypeLayoutError_Invalid is returned. | 
|  | 3766 | * If the field's type declaration is an incomplete type, | 
|  | 3767 | *   CXTypeLayoutError_Incomplete is returned. | 
|  | 3768 | * If the field's type declaration is a dependent type, | 
|  | 3769 | *   CXTypeLayoutError_Dependent is returned. | 
|  | 3770 | * If the field's name S is not found, | 
|  | 3771 | *   CXTypeLayoutError_InvalidFieldName is returned. | 
|  | 3772 | */ | 
|  | 3773 | CINDEX_LINKAGE long long clang_Cursor_getOffsetOfField(CXCursor C); | 
|  | 3774 |  | 
|  | 3775 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3776 | * Determine whether the given cursor represents an anonymous record | 
| Argyrios Kyrtzidis | 2bff516 | 2015-04-13 16:55:04 +0000 | [diff] [blame] | 3777 | * declaration. | 
|  | 3778 | */ | 
|  | 3779 | CINDEX_LINKAGE unsigned clang_Cursor_isAnonymous(CXCursor C); | 
|  | 3780 |  | 
| Argyrios Kyrtzidis | adff3ae | 2013-10-11 19:58:38 +0000 | [diff] [blame] | 3781 | enum CXRefQualifierKind { | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3782 | /** No ref-qualifier was provided. */ | 
| Argyrios Kyrtzidis | adff3ae | 2013-10-11 19:58:38 +0000 | [diff] [blame] | 3783 | CXRefQualifier_None = 0, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3784 | /** An lvalue ref-qualifier was provided (\c &). */ | 
| Argyrios Kyrtzidis | adff3ae | 2013-10-11 19:58:38 +0000 | [diff] [blame] | 3785 | CXRefQualifier_LValue, | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3786 | /** An rvalue ref-qualifier was provided (\c &&). */ | 
| Argyrios Kyrtzidis | adff3ae | 2013-10-11 19:58:38 +0000 | [diff] [blame] | 3787 | CXRefQualifier_RValue | 
|  | 3788 | }; | 
|  | 3789 |  | 
|  | 3790 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3791 | * Returns the number of template arguments for given template | 
| Argyrios Kyrtzidis | 35f5aab | 2016-11-15 20:51:46 +0000 | [diff] [blame] | 3792 | * specialization, or -1 if type \c T is not a template specialization. | 
| Dmitri Gribenko | 6ede6ab | 2014-02-27 16:05:05 +0000 | [diff] [blame] | 3793 | */ | 
|  | 3794 | CINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T); | 
|  | 3795 |  | 
|  | 3796 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3797 | * Returns the type template argument of a template class specialization | 
| Dmitri Gribenko | 6ede6ab | 2014-02-27 16:05:05 +0000 | [diff] [blame] | 3798 | * at given index. | 
|  | 3799 | * | 
|  | 3800 | * This function only returns template type arguments and does not handle | 
|  | 3801 | * template template arguments or variadic packs. | 
|  | 3802 | */ | 
|  | 3803 | CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T, unsigned i); | 
|  | 3804 |  | 
|  | 3805 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3806 | * Retrieve the ref-qualifier kind of a function or method. | 
| Argyrios Kyrtzidis | adff3ae | 2013-10-11 19:58:38 +0000 | [diff] [blame] | 3807 | * | 
|  | 3808 | * The ref-qualifier is returned for C++ functions or methods. For other types | 
|  | 3809 | * or non-C++ declarations, CXRefQualifier_None is returned. | 
|  | 3810 | */ | 
|  | 3811 | CINDEX_LINKAGE enum CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T); | 
|  | 3812 |  | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3813 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3814 | * Returns non-zero if the cursor specifies a Record member that is a | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3815 | *   bitfield. | 
|  | 3816 | */ | 
|  | 3817 | CINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C); | 
|  | 3818 |  | 
|  | 3819 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3820 | * Returns 1 if the base class specified by the cursor with kind | 
| Ted Kremenek | ae9e221 | 2010-08-27 21:34:58 +0000 | [diff] [blame] | 3821 | *   CX_CXXBaseSpecifier is virtual. | 
|  | 3822 | */ | 
|  | 3823 | CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor); | 
|  | 3824 |  | 
|  | 3825 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3826 | * Represents the C++ access control level to a base class for a | 
| Ted Kremenek | ae9e221 | 2010-08-27 21:34:58 +0000 | [diff] [blame] | 3827 | * cursor with kind CX_CXXBaseSpecifier. | 
|  | 3828 | */ | 
|  | 3829 | enum CX_CXXAccessSpecifier { | 
|  | 3830 | CX_CXXInvalidAccessSpecifier, | 
|  | 3831 | CX_CXXPublic, | 
|  | 3832 | CX_CXXProtected, | 
|  | 3833 | CX_CXXPrivate | 
|  | 3834 | }; | 
|  | 3835 |  | 
|  | 3836 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3837 | * Returns the access control level for the referenced object. | 
| Argyrios Kyrtzidis | f646408 | 2013-04-11 17:31:13 +0000 | [diff] [blame] | 3838 | * | 
| Argyrios Kyrtzidis | 1ab09cc | 2013-04-11 17:02:10 +0000 | [diff] [blame] | 3839 | * If the cursor refers to a C++ declaration, its access control level within its | 
|  | 3840 | * parent scope is returned. Otherwise, if the cursor refers to a base specifier or | 
|  | 3841 | * access specifier, the specifier itself is returned. | 
| Ted Kremenek | ae9e221 | 2010-08-27 21:34:58 +0000 | [diff] [blame] | 3842 | */ | 
|  | 3843 | CINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor); | 
|  | 3844 |  | 
|  | 3845 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3846 | * Represents the storage classes as declared in the source. CX_SC_Invalid | 
| Chad Rosier | db1cc7f | 2014-12-05 15:50:44 +0000 | [diff] [blame] | 3847 | * was added for the case that the passed cursor in not a declaration. | 
| Argyrios Kyrtzidis | 4e0854f | 2014-10-15 17:05:31 +0000 | [diff] [blame] | 3848 | */ | 
|  | 3849 | enum CX_StorageClass { | 
|  | 3850 | CX_SC_Invalid, | 
|  | 3851 | CX_SC_None, | 
|  | 3852 | CX_SC_Extern, | 
|  | 3853 | CX_SC_Static, | 
|  | 3854 | CX_SC_PrivateExtern, | 
|  | 3855 | CX_SC_OpenCLWorkGroupLocal, | 
|  | 3856 | CX_SC_Auto, | 
|  | 3857 | CX_SC_Register | 
|  | 3858 | }; | 
|  | 3859 |  | 
|  | 3860 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3861 | * Returns the storage class for a function or variable declaration. | 
| Argyrios Kyrtzidis | 4e0854f | 2014-10-15 17:05:31 +0000 | [diff] [blame] | 3862 | * | 
|  | 3863 | * If the passed in Cursor is not a function or variable declaration, | 
|  | 3864 | * CX_SC_Invalid is returned else the storage class. | 
|  | 3865 | */ | 
|  | 3866 | CINDEX_LINKAGE enum CX_StorageClass clang_Cursor_getStorageClass(CXCursor); | 
|  | 3867 |  | 
|  | 3868 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3869 | * Determine the number of overloaded declarations referenced by a | 
| Douglas Gregor | 16a2bdd | 2010-09-13 22:52:57 +0000 | [diff] [blame] | 3870 | * \c CXCursor_OverloadedDeclRef cursor. | 
|  | 3871 | * | 
|  | 3872 | * \param cursor The cursor whose overloaded declarations are being queried. | 
|  | 3873 | * | 
|  | 3874 | * \returns The number of overloaded declarations referenced by \c cursor. If it | 
|  | 3875 | * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0. | 
|  | 3876 | */ | 
|  | 3877 | CINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor); | 
|  | 3878 |  | 
|  | 3879 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3880 | * Retrieve a cursor for one of the overloaded declarations referenced | 
| Douglas Gregor | 16a2bdd | 2010-09-13 22:52:57 +0000 | [diff] [blame] | 3881 | * by a \c CXCursor_OverloadedDeclRef cursor. | 
|  | 3882 | * | 
|  | 3883 | * \param cursor The cursor whose overloaded declarations are being queried. | 
|  | 3884 | * | 
|  | 3885 | * \param index The zero-based index into the set of overloaded declarations in | 
|  | 3886 | * the cursor. | 
|  | 3887 | * | 
|  | 3888 | * \returns A cursor representing the declaration referenced by the given | 
|  | 3889 | * \c cursor at the specified \c index. If the cursor does not have an | 
|  | 3890 | * associated set of overloaded declarations, or if the index is out of bounds, | 
|  | 3891 | * returns \c clang_getNullCursor(); | 
|  | 3892 | */ | 
|  | 3893 | CINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor, | 
|  | 3894 | unsigned index); | 
|  | 3895 |  | 
|  | 3896 | /** | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3897 | * @} | 
|  | 3898 | */ | 
| Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 3899 |  | 
|  | 3900 | /** | 
| Ted Kremenek | 2c2c5f3 | 2010-08-27 21:34:51 +0000 | [diff] [blame] | 3901 | * \defgroup CINDEX_ATTRIBUTES Information for attributes | 
| Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 3902 | * | 
|  | 3903 | * @{ | 
|  | 3904 | */ | 
|  | 3905 |  | 
| Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 3906 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3907 | * For cursors representing an iboutletcollection attribute, | 
| Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 3908 | *  this function returns the collection element type. | 
|  | 3909 | * | 
|  | 3910 | */ | 
|  | 3911 | CINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor); | 
|  | 3912 |  | 
|  | 3913 | /** | 
|  | 3914 | * @} | 
|  | 3915 | */ | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3916 |  | 
|  | 3917 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3918 | * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors | 
|  | 3919 | * | 
|  | 3920 | * These routines provide the ability to traverse the abstract syntax tree | 
|  | 3921 | * using cursors. | 
|  | 3922 | * | 
|  | 3923 | * @{ | 
|  | 3924 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3925 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3926 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3927 | * Describes how the traversal of the children of a particular | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3928 | * cursor should proceed after visiting a particular child cursor. | 
|  | 3929 | * | 
|  | 3930 | * A value of this enumeration type should be returned by each | 
|  | 3931 | * \c CXCursorVisitor to indicate how clang_visitChildren() proceed. | 
|  | 3932 | */ | 
|  | 3933 | enum CXChildVisitResult { | 
|  | 3934 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3935 | * Terminates the cursor traversal. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3936 | */ | 
|  | 3937 | CXChildVisit_Break, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3938 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3939 | * Continues the cursor traversal with the next sibling of | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3940 | * the cursor just visited, without visiting its children. | 
|  | 3941 | */ | 
|  | 3942 | CXChildVisit_Continue, | 
|  | 3943 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3944 | * Recursively traverse the children of this cursor, using | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3945 | * the same visitor and client data. | 
|  | 3946 | */ | 
|  | 3947 | CXChildVisit_Recurse | 
|  | 3948 | }; | 
|  | 3949 |  | 
|  | 3950 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3951 | * Visitor invoked for each cursor found by a traversal. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3952 | * | 
|  | 3953 | * This visitor function will be invoked for each cursor found by | 
|  | 3954 | * clang_visitCursorChildren(). Its first argument is the cursor being | 
|  | 3955 | * visited, its second argument is the parent visitor for that cursor, | 
|  | 3956 | * and its third argument is the client data provided to | 
|  | 3957 | * clang_visitCursorChildren(). | 
|  | 3958 | * | 
|  | 3959 | * The visitor should return one of the \c CXChildVisitResult values | 
|  | 3960 | * to direct clang_visitCursorChildren(). | 
|  | 3961 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3962 | typedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor, | 
|  | 3963 | CXCursor parent, | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3964 | CXClientData client_data); | 
|  | 3965 |  | 
|  | 3966 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3967 | * Visit the children of a particular cursor. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3968 | * | 
|  | 3969 | * This function visits all the direct children of the given cursor, | 
|  | 3970 | * invoking the given \p visitor function with the cursors of each | 
|  | 3971 | * visited child. The traversal may be recursive, if the visitor returns | 
|  | 3972 | * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if | 
|  | 3973 | * the visitor returns \c CXChildVisit_Break. | 
|  | 3974 | * | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3975 | * \param parent the cursor whose child may be visited. All kinds of | 
| Daniel Dunbar | b9999fd | 2010-01-24 04:10:31 +0000 | [diff] [blame] | 3976 | * cursors can be visited, including invalid cursors (which, by | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3977 | * definition, have no children). | 
|  | 3978 | * | 
|  | 3979 | * \param visitor the visitor function that will be invoked for each | 
|  | 3980 | * child of \p parent. | 
|  | 3981 | * | 
|  | 3982 | * \param client_data pointer data supplied by the client, which will | 
|  | 3983 | * be passed to the visitor each time it is invoked. | 
|  | 3984 | * | 
|  | 3985 | * \returns a non-zero value if the traversal was terminated | 
|  | 3986 | * prematurely by the visitor returning \c CXChildVisit_Break. | 
|  | 3987 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3988 | CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent, | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3989 | CXCursorVisitor visitor, | 
|  | 3990 | CXClientData client_data); | 
| David Chisnall | b2aa0ef | 2010-11-03 14:12:26 +0000 | [diff] [blame] | 3991 | #ifdef __has_feature | 
|  | 3992 | #  if __has_feature(blocks) | 
|  | 3993 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 3994 | * Visitor invoked for each cursor found by a traversal. | 
| David Chisnall | b2aa0ef | 2010-11-03 14:12:26 +0000 | [diff] [blame] | 3995 | * | 
|  | 3996 | * This visitor block will be invoked for each cursor found by | 
|  | 3997 | * clang_visitChildrenWithBlock(). Its first argument is the cursor being | 
|  | 3998 | * visited, its second argument is the parent visitor for that cursor. | 
|  | 3999 | * | 
|  | 4000 | * The visitor should return one of the \c CXChildVisitResult values | 
|  | 4001 | * to direct clang_visitChildrenWithBlock(). | 
|  | 4002 | */ | 
|  | 4003 | typedef enum CXChildVisitResult | 
|  | 4004 | (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent); | 
|  | 4005 |  | 
|  | 4006 | /** | 
|  | 4007 | * Visits the children of a cursor using the specified block.  Behaves | 
|  | 4008 | * identically to clang_visitChildren() in all other respects. | 
|  | 4009 | */ | 
| Argyrios Kyrtzidis | a0a35d7 | 2016-02-07 18:21:28 +0000 | [diff] [blame] | 4010 | CINDEX_LINKAGE unsigned clang_visitChildrenWithBlock(CXCursor parent, | 
|  | 4011 | CXCursorVisitorBlock block); | 
| David Chisnall | b2aa0ef | 2010-11-03 14:12:26 +0000 | [diff] [blame] | 4012 | #  endif | 
|  | 4013 | #endif | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4014 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4015 | /** | 
|  | 4016 | * @} | 
|  | 4017 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4018 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4019 | /** | 
|  | 4020 | * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST | 
|  | 4021 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4022 | * These routines provide the ability to determine references within and | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4023 | * across translation units, by providing the names of the entities referenced | 
|  | 4024 | * by cursors, follow reference cursors to the declarations they reference, | 
|  | 4025 | * and associate declarations with their definitions. | 
|  | 4026 | * | 
|  | 4027 | * @{ | 
|  | 4028 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4029 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4030 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4031 | * Retrieve a Unified Symbol Resolution (USR) for the entity referenced | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4032 | * by the given cursor. | 
|  | 4033 | * | 
|  | 4034 | * A Unified Symbol Resolution (USR) is a string that identifies a particular | 
|  | 4035 | * entity (function, class, variable, etc.) within a program. USRs can be | 
|  | 4036 | * compared across translation units to determine, e.g., when references in | 
|  | 4037 | * one translation refer to an entity defined in another translation unit. | 
|  | 4038 | */ | 
|  | 4039 | CINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor); | 
|  | 4040 |  | 
|  | 4041 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4042 | * Construct a USR for a specified Objective-C class. | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4043 | */ | 
|  | 4044 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name); | 
|  | 4045 |  | 
|  | 4046 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4047 | * Construct a USR for a specified Objective-C category. | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4048 | */ | 
|  | 4049 | CINDEX_LINKAGE CXString | 
| Ted Kremenek | bc1a67b | 2010-03-15 17:38:58 +0000 | [diff] [blame] | 4050 | clang_constructUSR_ObjCCategory(const char *class_name, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4051 | const char *category_name); | 
|  | 4052 |  | 
|  | 4053 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4054 | * Construct a USR for a specified Objective-C protocol. | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4055 | */ | 
|  | 4056 | CINDEX_LINKAGE CXString | 
|  | 4057 | clang_constructUSR_ObjCProtocol(const char *protocol_name); | 
|  | 4058 |  | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4059 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4060 | * Construct a USR for a specified Objective-C instance variable and | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4061 | *   the USR for its containing class. | 
|  | 4062 | */ | 
|  | 4063 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name, | 
|  | 4064 | CXString classUSR); | 
|  | 4065 |  | 
|  | 4066 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4067 | * Construct a USR for a specified Objective-C method and | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4068 | *   the USR for its containing class. | 
|  | 4069 | */ | 
|  | 4070 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name, | 
|  | 4071 | unsigned isInstanceMethod, | 
|  | 4072 | CXString classUSR); | 
|  | 4073 |  | 
|  | 4074 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4075 | * Construct a USR for a specified Objective-C property and the USR | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4076 | *  for its containing class. | 
|  | 4077 | */ | 
|  | 4078 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property, | 
|  | 4079 | CXString classUSR); | 
|  | 4080 |  | 
|  | 4081 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4082 | * Retrieve a name for the entity referenced by this cursor. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4083 | */ | 
|  | 4084 | CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor); | 
|  | 4085 |  | 
| Douglas Gregor | 97c7571 | 2010-10-02 22:49:11 +0000 | [diff] [blame] | 4086 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4087 | * Retrieve a range for a piece that forms the cursors spelling name. | 
| Argyrios Kyrtzidis | 191a6a8 | 2012-03-30 20:58:35 +0000 | [diff] [blame] | 4088 | * Most of the times there is only one range for the complete spelling but for | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4089 | * Objective-C methods and Objective-C message expressions, there are multiple | 
|  | 4090 | * pieces for each selector identifier. | 
| Argyrios Kyrtzidis | 191a6a8 | 2012-03-30 20:58:35 +0000 | [diff] [blame] | 4091 | * | 
|  | 4092 | * \param pieceIndex the index of the spelling name piece. If this is greater | 
|  | 4093 | * than the actual number of pieces, it will return a NULL (invalid) range. | 
|  | 4094 | * | 
|  | 4095 | * \param options Reserved. | 
|  | 4096 | */ | 
|  | 4097 | CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor, | 
|  | 4098 | unsigned pieceIndex, | 
|  | 4099 | unsigned options); | 
|  | 4100 |  | 
|  | 4101 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4102 | * Opaque pointer representing a policy that controls pretty printing | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 4103 | * for \c clang_getCursorPrettyPrinted. | 
|  | 4104 | */ | 
|  | 4105 | typedef void *CXPrintingPolicy; | 
|  | 4106 |  | 
|  | 4107 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4108 | * Properties for the printing policy. | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 4109 | * | 
|  | 4110 | * See \c clang::PrintingPolicy for more information. | 
|  | 4111 | */ | 
|  | 4112 | enum CXPrintingPolicyProperty { | 
|  | 4113 | CXPrintingPolicy_Indentation, | 
|  | 4114 | CXPrintingPolicy_SuppressSpecifiers, | 
|  | 4115 | CXPrintingPolicy_SuppressTagKeyword, | 
|  | 4116 | CXPrintingPolicy_IncludeTagDefinition, | 
|  | 4117 | CXPrintingPolicy_SuppressScope, | 
|  | 4118 | CXPrintingPolicy_SuppressUnwrittenScope, | 
|  | 4119 | CXPrintingPolicy_SuppressInitializers, | 
|  | 4120 | CXPrintingPolicy_ConstantArraySizeAsWritten, | 
|  | 4121 | CXPrintingPolicy_AnonymousTagLocations, | 
|  | 4122 | CXPrintingPolicy_SuppressStrongLifetime, | 
|  | 4123 | CXPrintingPolicy_SuppressLifetimeQualifiers, | 
|  | 4124 | CXPrintingPolicy_SuppressTemplateArgsInCXXConstructors, | 
|  | 4125 | CXPrintingPolicy_Bool, | 
|  | 4126 | CXPrintingPolicy_Restrict, | 
|  | 4127 | CXPrintingPolicy_Alignof, | 
|  | 4128 | CXPrintingPolicy_UnderscoreAlignof, | 
|  | 4129 | CXPrintingPolicy_UseVoidForZeroParams, | 
|  | 4130 | CXPrintingPolicy_TerseOutput, | 
|  | 4131 | CXPrintingPolicy_PolishForDeclaration, | 
|  | 4132 | CXPrintingPolicy_Half, | 
|  | 4133 | CXPrintingPolicy_MSWChar, | 
|  | 4134 | CXPrintingPolicy_IncludeNewlines, | 
|  | 4135 | CXPrintingPolicy_MSVCFormatting, | 
|  | 4136 | CXPrintingPolicy_ConstantsAsWritten, | 
|  | 4137 | CXPrintingPolicy_SuppressImplicitBase, | 
|  | 4138 | CXPrintingPolicy_FullyQualifiedName, | 
|  | 4139 |  | 
|  | 4140 | CXPrintingPolicy_LastProperty = CXPrintingPolicy_FullyQualifiedName | 
|  | 4141 | }; | 
|  | 4142 |  | 
|  | 4143 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4144 | * Get a property value for the given printing policy. | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 4145 | */ | 
| Ivan Donchevskii | 4cab0fe | 2018-01-16 12:11:59 +0000 | [diff] [blame] | 4146 | CINDEX_LINKAGE unsigned | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 4147 | clang_PrintingPolicy_getProperty(CXPrintingPolicy Policy, | 
|  | 4148 | enum CXPrintingPolicyProperty Property); | 
|  | 4149 |  | 
|  | 4150 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4151 | * Set a property value for the given printing policy. | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 4152 | */ | 
| Ivan Donchevskii | 4cab0fe | 2018-01-16 12:11:59 +0000 | [diff] [blame] | 4153 | CINDEX_LINKAGE void clang_PrintingPolicy_setProperty(CXPrintingPolicy Policy, | 
|  | 4154 | enum CXPrintingPolicyProperty Property, | 
|  | 4155 | unsigned Value); | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 4156 |  | 
|  | 4157 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4158 | * Retrieve the default policy for the cursor. | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 4159 | * | 
|  | 4160 | * The policy should be released after use with \c | 
|  | 4161 | * clang_PrintingPolicy_dispose. | 
|  | 4162 | */ | 
|  | 4163 | CINDEX_LINKAGE CXPrintingPolicy clang_getCursorPrintingPolicy(CXCursor); | 
|  | 4164 |  | 
|  | 4165 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4166 | * Release a printing policy. | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 4167 | */ | 
|  | 4168 | CINDEX_LINKAGE void clang_PrintingPolicy_dispose(CXPrintingPolicy Policy); | 
|  | 4169 |  | 
|  | 4170 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4171 | * Pretty print declarations. | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 4172 | * | 
|  | 4173 | * \param Cursor The cursor representing a declaration. | 
|  | 4174 | * | 
|  | 4175 | * \param Policy The policy to control the entities being printed. If | 
|  | 4176 | * NULL, a default policy is used. | 
|  | 4177 | * | 
|  | 4178 | * \returns The pretty printed declaration or the empty string for | 
|  | 4179 | * other cursors. | 
|  | 4180 | */ | 
|  | 4181 | CINDEX_LINKAGE CXString clang_getCursorPrettyPrinted(CXCursor Cursor, | 
|  | 4182 | CXPrintingPolicy Policy); | 
|  | 4183 |  | 
|  | 4184 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4185 | * Retrieve the display name for the entity referenced by this cursor. | 
| Douglas Gregor | 97c7571 | 2010-10-02 22:49:11 +0000 | [diff] [blame] | 4186 | * | 
|  | 4187 | * The display name contains extra information that helps identify the cursor, | 
|  | 4188 | * such as the parameters of a function or template or the arguments of a | 
|  | 4189 | * class template specialization. | 
|  | 4190 | */ | 
|  | 4191 | CINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor); | 
|  | 4192 |  | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4193 | /** For a cursor that is a reference, retrieve a cursor representing the | 
| Douglas Gregor | ad27e8b | 2010-01-19 01:20:04 +0000 | [diff] [blame] | 4194 | * entity that it references. | 
|  | 4195 | * | 
|  | 4196 | * Reference cursors refer to other entities in the AST. For example, an | 
|  | 4197 | * Objective-C superclass reference cursor refers to an Objective-C class. | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4198 | * This function produces the cursor for the Objective-C class from the | 
| Douglas Gregor | ad27e8b | 2010-01-19 01:20:04 +0000 | [diff] [blame] | 4199 | * cursor for the superclass reference. If the input cursor is a declaration or | 
|  | 4200 | * definition, it returns that declaration or definition unchanged. | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4201 | * Otherwise, returns the NULL cursor. | 
| Douglas Gregor | ad27e8b | 2010-01-19 01:20:04 +0000 | [diff] [blame] | 4202 | */ | 
|  | 4203 | CINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor); | 
| Douglas Gregor | 6b8232f | 2010-01-19 19:34:47 +0000 | [diff] [blame] | 4204 |  | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4205 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4206 | *  For a cursor that is either a reference to or a declaration | 
| Douglas Gregor | 6b8232f | 2010-01-19 19:34:47 +0000 | [diff] [blame] | 4207 | *  of some entity, retrieve a cursor that describes the definition of | 
|  | 4208 | *  that entity. | 
|  | 4209 | * | 
|  | 4210 | *  Some entities can be declared multiple times within a translation | 
|  | 4211 | *  unit, but only one of those declarations can also be a | 
|  | 4212 | *  definition. For example, given: | 
|  | 4213 | * | 
|  | 4214 | *  \code | 
|  | 4215 | *  int f(int, int); | 
|  | 4216 | *  int g(int x, int y) { return f(x, y); } | 
|  | 4217 | *  int f(int a, int b) { return a + b; } | 
|  | 4218 | *  int f(int, int); | 
|  | 4219 | *  \endcode | 
|  | 4220 | * | 
|  | 4221 | *  there are three declarations of the function "f", but only the | 
|  | 4222 | *  second one is a definition. The clang_getCursorDefinition() | 
|  | 4223 | *  function will take any cursor pointing to a declaration of "f" | 
|  | 4224 | *  (the first or fourth lines of the example) or a cursor referenced | 
|  | 4225 | *  that uses "f" (the call to "f' inside "g") and will return a | 
|  | 4226 | *  declaration cursor pointing to the definition (the second "f" | 
|  | 4227 | *  declaration). | 
|  | 4228 | * | 
|  | 4229 | *  If given a cursor for which there is no corresponding definition, | 
|  | 4230 | *  e.g., because there is no definition of that entity within this | 
|  | 4231 | *  translation unit, returns a NULL cursor. | 
|  | 4232 | */ | 
|  | 4233 | CINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor); | 
|  | 4234 |  | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4235 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4236 | * Determine whether the declaration pointed to by this cursor | 
| Douglas Gregor | 6b8232f | 2010-01-19 19:34:47 +0000 | [diff] [blame] | 4237 | * is also a definition of that entity. | 
|  | 4238 | */ | 
|  | 4239 | CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor); | 
|  | 4240 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4241 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4242 | * Retrieve the canonical cursor corresponding to the given cursor. | 
| Douglas Gregor | fec4dc9 | 2010-11-19 23:44:15 +0000 | [diff] [blame] | 4243 | * | 
|  | 4244 | * In the C family of languages, many kinds of entities can be declared several | 
|  | 4245 | * times within a single translation unit. For example, a structure type can | 
|  | 4246 | * be forward-declared (possibly multiple times) and later defined: | 
|  | 4247 | * | 
|  | 4248 | * \code | 
|  | 4249 | * struct X; | 
|  | 4250 | * struct X; | 
|  | 4251 | * struct X { | 
|  | 4252 | *   int member; | 
|  | 4253 | * }; | 
|  | 4254 | * \endcode | 
|  | 4255 | * | 
|  | 4256 | * The declarations and the definition of \c X are represented by three | 
|  | 4257 | * different cursors, all of which are declarations of the same underlying | 
|  | 4258 | * entity. One of these cursor is considered the "canonical" cursor, which | 
|  | 4259 | * is effectively the representative for the underlying entity. One can | 
|  | 4260 | * determine if two cursors are declarations of the same underlying entity by | 
|  | 4261 | * comparing their canonical cursors. | 
|  | 4262 | * | 
|  | 4263 | * \returns The canonical cursor for the entity referred to by the given cursor. | 
|  | 4264 | */ | 
|  | 4265 | CINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor); | 
|  | 4266 |  | 
| Argyrios Kyrtzidis | 210f29f | 2012-03-30 22:15:48 +0000 | [diff] [blame] | 4267 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4268 | * If the cursor points to a selector identifier in an Objective-C | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4269 | * method or message expression, this returns the selector index. | 
| Argyrios Kyrtzidis | 210f29f | 2012-03-30 22:15:48 +0000 | [diff] [blame] | 4270 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 4271 | * After getting a cursor with #clang_getCursor, this can be called to | 
| Argyrios Kyrtzidis | 210f29f | 2012-03-30 22:15:48 +0000 | [diff] [blame] | 4272 | * determine if the location points to a selector identifier. | 
|  | 4273 | * | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4274 | * \returns The selector index if the cursor is an Objective-C method or message | 
| Argyrios Kyrtzidis | 210f29f | 2012-03-30 22:15:48 +0000 | [diff] [blame] | 4275 | * expression and the cursor is pointing to a selector identifier, or -1 | 
|  | 4276 | * otherwise. | 
|  | 4277 | */ | 
|  | 4278 | CINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor); | 
|  | 4279 |  | 
| Douglas Gregor | fec4dc9 | 2010-11-19 23:44:15 +0000 | [diff] [blame] | 4280 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4281 | * Given a cursor pointing to a C++ method call or an Objective-C | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4282 | * message, returns non-zero if the method/message is "dynamic", meaning: | 
| Argyrios Kyrtzidis | b6df6821 | 2012-07-02 23:54:36 +0000 | [diff] [blame] | 4283 | * | 
|  | 4284 | * For a C++ method: the call is virtual. | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4285 | * For an Objective-C message: the receiver is an object instance, not 'super' | 
|  | 4286 | * or a specific class. | 
| Argyrios Kyrtzidis | b6df6821 | 2012-07-02 23:54:36 +0000 | [diff] [blame] | 4287 | * | 
|  | 4288 | * If the method/message is "static" or the cursor does not point to a | 
|  | 4289 | * method/message, it will return zero. | 
|  | 4290 | */ | 
|  | 4291 | CINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C); | 
|  | 4292 |  | 
|  | 4293 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4294 | * Given a cursor pointing to an Objective-C message or property | 
| Argyrios Kyrtzidis | 2a68486 | 2017-04-27 17:23:04 +0000 | [diff] [blame] | 4295 | * reference, or C++ method call, returns the CXType of the receiver. | 
| Argyrios Kyrtzidis | b26a24c | 2012-11-01 02:01:34 +0000 | [diff] [blame] | 4296 | */ | 
|  | 4297 | CINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C); | 
|  | 4298 |  | 
|  | 4299 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4300 | * Property attributes for a \c CXCursor_ObjCPropertyDecl. | 
| Argyrios Kyrtzidis | 9adfd8a | 2013-04-18 22:15:49 +0000 | [diff] [blame] | 4301 | */ | 
|  | 4302 | typedef enum { | 
|  | 4303 | CXObjCPropertyAttr_noattr    = 0x00, | 
|  | 4304 | CXObjCPropertyAttr_readonly  = 0x01, | 
|  | 4305 | CXObjCPropertyAttr_getter    = 0x02, | 
|  | 4306 | CXObjCPropertyAttr_assign    = 0x04, | 
|  | 4307 | CXObjCPropertyAttr_readwrite = 0x08, | 
|  | 4308 | CXObjCPropertyAttr_retain    = 0x10, | 
|  | 4309 | CXObjCPropertyAttr_copy      = 0x20, | 
|  | 4310 | CXObjCPropertyAttr_nonatomic = 0x40, | 
|  | 4311 | CXObjCPropertyAttr_setter    = 0x80, | 
|  | 4312 | CXObjCPropertyAttr_atomic    = 0x100, | 
|  | 4313 | CXObjCPropertyAttr_weak      = 0x200, | 
|  | 4314 | CXObjCPropertyAttr_strong    = 0x400, | 
| Manman Ren | 04fd4d8 | 2016-05-31 23:22:04 +0000 | [diff] [blame] | 4315 | CXObjCPropertyAttr_unsafe_unretained = 0x800, | 
| Manman Ren | 400e4c3 | 2016-06-03 23:11:41 +0000 | [diff] [blame] | 4316 | CXObjCPropertyAttr_class = 0x1000 | 
| Argyrios Kyrtzidis | 9adfd8a | 2013-04-18 22:15:49 +0000 | [diff] [blame] | 4317 | } CXObjCPropertyAttrKind; | 
|  | 4318 |  | 
|  | 4319 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4320 | * Given a cursor that represents a property declaration, return the | 
| Argyrios Kyrtzidis | 9adfd8a | 2013-04-18 22:15:49 +0000 | [diff] [blame] | 4321 | * associated property attributes. The bits are formed from | 
|  | 4322 | * \c CXObjCPropertyAttrKind. | 
|  | 4323 | * | 
|  | 4324 | * \param reserved Reserved for future use, pass 0. | 
|  | 4325 | */ | 
|  | 4326 | CINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C, | 
|  | 4327 | unsigned reserved); | 
|  | 4328 |  | 
|  | 4329 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4330 | * 'Qualifiers' written next to the return and parameter types in | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4331 | * Objective-C method declarations. | 
| Argyrios Kyrtzidis | 9d9bc01 | 2013-04-18 23:29:12 +0000 | [diff] [blame] | 4332 | */ | 
|  | 4333 | typedef enum { | 
|  | 4334 | CXObjCDeclQualifier_None = 0x0, | 
|  | 4335 | CXObjCDeclQualifier_In = 0x1, | 
|  | 4336 | CXObjCDeclQualifier_Inout = 0x2, | 
|  | 4337 | CXObjCDeclQualifier_Out = 0x4, | 
|  | 4338 | CXObjCDeclQualifier_Bycopy = 0x8, | 
|  | 4339 | CXObjCDeclQualifier_Byref = 0x10, | 
|  | 4340 | CXObjCDeclQualifier_Oneway = 0x20 | 
|  | 4341 | } CXObjCDeclQualifierKind; | 
|  | 4342 |  | 
|  | 4343 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4344 | * Given a cursor that represents an Objective-C method or parameter | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4345 | * declaration, return the associated Objective-C qualifiers for the return | 
|  | 4346 | * type or the parameter respectively. The bits are formed from | 
|  | 4347 | * CXObjCDeclQualifierKind. | 
| Argyrios Kyrtzidis | 9d9bc01 | 2013-04-18 23:29:12 +0000 | [diff] [blame] | 4348 | */ | 
|  | 4349 | CINDEX_LINKAGE unsigned clang_Cursor_getObjCDeclQualifiers(CXCursor C); | 
|  | 4350 |  | 
|  | 4351 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4352 | * Given a cursor that represents an Objective-C method or property | 
| Alex Lorenz | 6c2898a | 2017-04-06 14:03:25 +0000 | [diff] [blame] | 4353 | * declaration, return non-zero if the declaration was affected by "\@optional". | 
|  | 4354 | * Returns zero if the cursor is not such a declaration or it is "\@required". | 
| Argyrios Kyrtzidis | 7b50fc5 | 2013-07-05 20:44:37 +0000 | [diff] [blame] | 4355 | */ | 
|  | 4356 | CINDEX_LINKAGE unsigned clang_Cursor_isObjCOptional(CXCursor C); | 
|  | 4357 |  | 
|  | 4358 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4359 | * Returns non-zero if the given cursor is a variadic function or method. | 
| Argyrios Kyrtzidis | 23814e4 | 2013-04-18 23:53:05 +0000 | [diff] [blame] | 4360 | */ | 
|  | 4361 | CINDEX_LINKAGE unsigned clang_Cursor_isVariadic(CXCursor C); | 
|  | 4362 |  | 
|  | 4363 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4364 | * Returns non-zero if the given cursor points to a symbol marked with | 
| Argyrios Kyrtzidis | 0381cc7 | 2017-05-10 15:10:36 +0000 | [diff] [blame] | 4365 | * external_source_symbol attribute. | 
|  | 4366 | * | 
|  | 4367 | * \param language If non-NULL, and the attribute is present, will be set to | 
|  | 4368 | * the 'language' string from the attribute. | 
|  | 4369 | * | 
|  | 4370 | * \param definedIn If non-NULL, and the attribute is present, will be set to | 
|  | 4371 | * the 'definedIn' string from the attribute. | 
|  | 4372 | * | 
|  | 4373 | * \param isGenerated If non-NULL, and the attribute is present, will be set to | 
| Argyrios Kyrtzidis | 8b337c0 | 2017-05-10 15:48:16 +0000 | [diff] [blame] | 4374 | * non-zero if the 'generated_declaration' is set in the attribute. | 
| Argyrios Kyrtzidis | 0381cc7 | 2017-05-10 15:10:36 +0000 | [diff] [blame] | 4375 | */ | 
|  | 4376 | CINDEX_LINKAGE unsigned clang_Cursor_isExternalSymbol(CXCursor C, | 
|  | 4377 | CXString *language, CXString *definedIn, | 
|  | 4378 | unsigned *isGenerated); | 
|  | 4379 |  | 
|  | 4380 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4381 | * Given a cursor that represents a declaration, return the associated | 
| Dmitri Gribenko | aab8383 | 2012-06-20 00:34:58 +0000 | [diff] [blame] | 4382 | * comment's source range.  The range may include multiple consecutive comments | 
|  | 4383 | * with whitespace in between. | 
|  | 4384 | */ | 
|  | 4385 | CINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C); | 
|  | 4386 |  | 
|  | 4387 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4388 | * Given a cursor that represents a declaration, return the associated | 
| Dmitri Gribenko | aab8383 | 2012-06-20 00:34:58 +0000 | [diff] [blame] | 4389 | * comment text, including comment markers. | 
|  | 4390 | */ | 
|  | 4391 | CINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C); | 
|  | 4392 |  | 
|  | 4393 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4394 | * Given a cursor that represents a documentable entity (e.g., | 
|  | 4395 | * declaration), return the associated \paragraph; otherwise return the | 
| Dmitri Gribenko | 5e4fe00 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 4396 | * first paragraph. | 
| Dmitri Gribenko | 5188c4b | 2012-06-26 20:39:18 +0000 | [diff] [blame] | 4397 | */ | 
|  | 4398 | CINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C); | 
|  | 4399 |  | 
|  | 4400 | /** | 
| Dmitri Gribenko | 5e4fe00 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 4401 | * @} | 
|  | 4402 | */ | 
|  | 4403 |  | 
| Eli Bendersky | 44a206f | 2014-07-31 18:04:56 +0000 | [diff] [blame] | 4404 | /** \defgroup CINDEX_MANGLE Name Mangling API Functions | 
|  | 4405 | * | 
|  | 4406 | * @{ | 
|  | 4407 | */ | 
|  | 4408 |  | 
|  | 4409 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4410 | * Retrieve the CXString representing the mangled name of the cursor. | 
| Eli Bendersky | 44a206f | 2014-07-31 18:04:56 +0000 | [diff] [blame] | 4411 | */ | 
|  | 4412 | CINDEX_LINKAGE CXString clang_Cursor_getMangling(CXCursor); | 
|  | 4413 |  | 
|  | 4414 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4415 | * Retrieve the CXStrings representing the mangled symbols of the C++ | 
| Saleem Abdulrasool | 6003443 | 2015-11-12 03:57:22 +0000 | [diff] [blame] | 4416 | * constructor or destructor at the cursor. | 
|  | 4417 | */ | 
|  | 4418 | CINDEX_LINKAGE CXStringSet *clang_Cursor_getCXXManglings(CXCursor); | 
|  | 4419 |  | 
|  | 4420 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4421 | * Retrieve the CXStrings representing the mangled symbols of the ObjC | 
| Dave Lee | 1a532c9 | 2017-09-22 16:58:57 +0000 | [diff] [blame] | 4422 | * class interface or implementation at the cursor. | 
|  | 4423 | */ | 
|  | 4424 | CINDEX_LINKAGE CXStringSet *clang_Cursor_getObjCManglings(CXCursor); | 
|  | 4425 |  | 
|  | 4426 | /** | 
| Eli Bendersky | 44a206f | 2014-07-31 18:04:56 +0000 | [diff] [blame] | 4427 | * @} | 
|  | 4428 | */ | 
|  | 4429 |  | 
| Dmitri Gribenko | 5e4fe00 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 4430 | /** | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4431 | * \defgroup CINDEX_MODULE Module introspection | 
|  | 4432 | * | 
|  | 4433 | * The functions in this group provide access to information about modules. | 
|  | 4434 | * | 
|  | 4435 | * @{ | 
|  | 4436 | */ | 
|  | 4437 |  | 
|  | 4438 | typedef void *CXModule; | 
|  | 4439 |  | 
|  | 4440 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4441 | * Given a CXCursor_ModuleImportDecl cursor, return the associated module. | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4442 | */ | 
|  | 4443 | CINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C); | 
|  | 4444 |  | 
|  | 4445 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4446 | * Given a CXFile header file, return the module that contains it, if one | 
| Argyrios Kyrtzidis | f6d49c3 | 2014-05-14 23:14:37 +0000 | [diff] [blame] | 4447 | * exists. | 
|  | 4448 | */ | 
|  | 4449 | CINDEX_LINKAGE CXModule clang_getModuleForFile(CXTranslationUnit, CXFile); | 
|  | 4450 |  | 
|  | 4451 | /** | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4452 | * \param Module a module object. | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4453 | * | 
| Argyrios Kyrtzidis | 12fdb9e | 2013-04-26 22:47:49 +0000 | [diff] [blame] | 4454 | * \returns the module file where the provided module object came from. | 
|  | 4455 | */ | 
|  | 4456 | CINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module); | 
|  | 4457 |  | 
|  | 4458 | /** | 
|  | 4459 | * \param Module a module object. | 
|  | 4460 | * | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4461 | * \returns the parent of a sub-module or NULL if the given module is top-level, | 
|  | 4462 | * e.g. for 'std.vector' it will return the 'std' module. | 
|  | 4463 | */ | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4464 | CINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module); | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4465 |  | 
|  | 4466 | /** | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4467 | * \param Module a module object. | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4468 | * | 
|  | 4469 | * \returns the name of the module, e.g. for the 'std.vector' sub-module it | 
|  | 4470 | * will return "vector". | 
|  | 4471 | */ | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4472 | CINDEX_LINKAGE CXString clang_Module_getName(CXModule Module); | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4473 |  | 
|  | 4474 | /** | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4475 | * \param Module a module object. | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4476 | * | 
|  | 4477 | * \returns the full name of the module, e.g. "std.vector". | 
|  | 4478 | */ | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4479 | CINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module); | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4480 |  | 
|  | 4481 | /** | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4482 | * \param Module a module object. | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4483 | * | 
| Argyrios Kyrtzidis | 884337f | 2014-05-15 04:44:25 +0000 | [diff] [blame] | 4484 | * \returns non-zero if the module is a system one. | 
|  | 4485 | */ | 
|  | 4486 | CINDEX_LINKAGE int clang_Module_isSystem(CXModule Module); | 
|  | 4487 |  | 
|  | 4488 | /** | 
|  | 4489 | * \param Module a module object. | 
|  | 4490 | * | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4491 | * \returns the number of top level headers associated with this module. | 
|  | 4492 | */ | 
| Argyrios Kyrtzidis | 3c5305c | 2013-03-13 21:13:43 +0000 | [diff] [blame] | 4493 | CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit, | 
|  | 4494 | CXModule Module); | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4495 |  | 
|  | 4496 | /** | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4497 | * \param Module a module object. | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4498 | * | 
|  | 4499 | * \param Index top level header index (zero-based). | 
|  | 4500 | * | 
|  | 4501 | * \returns the specified top level header associated with the module. | 
|  | 4502 | */ | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4503 | CINDEX_LINKAGE | 
| Argyrios Kyrtzidis | 3c5305c | 2013-03-13 21:13:43 +0000 | [diff] [blame] | 4504 | CXFile clang_Module_getTopLevelHeader(CXTranslationUnit, | 
|  | 4505 | CXModule Module, unsigned Index); | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4506 |  | 
|  | 4507 | /** | 
|  | 4508 | * @} | 
|  | 4509 | */ | 
|  | 4510 |  | 
|  | 4511 | /** | 
| Ted Kremenek | 9cfe9e6 | 2010-05-17 20:06:56 +0000 | [diff] [blame] | 4512 | * \defgroup CINDEX_CPP C++ AST introspection | 
|  | 4513 | * | 
|  | 4514 | * The routines in this group provide access information in the ASTs specific | 
|  | 4515 | * to C++ language features. | 
|  | 4516 | * | 
|  | 4517 | * @{ | 
|  | 4518 | */ | 
|  | 4519 |  | 
|  | 4520 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4521 | * Determine if a C++ constructor is a converting constructor. | 
| Jonathan Coe | 2956535 | 2016-04-27 12:48:25 +0000 | [diff] [blame] | 4522 | */ | 
|  | 4523 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isConvertingConstructor(CXCursor C); | 
|  | 4524 |  | 
|  | 4525 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4526 | * Determine if a C++ constructor is a copy constructor. | 
| Jonathan Coe | 2956535 | 2016-04-27 12:48:25 +0000 | [diff] [blame] | 4527 | */ | 
|  | 4528 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isCopyConstructor(CXCursor C); | 
|  | 4529 |  | 
|  | 4530 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4531 | * Determine if a C++ constructor is the default constructor. | 
| Jonathan Coe | 2956535 | 2016-04-27 12:48:25 +0000 | [diff] [blame] | 4532 | */ | 
|  | 4533 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isDefaultConstructor(CXCursor C); | 
|  | 4534 |  | 
|  | 4535 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4536 | * Determine if a C++ constructor is a move constructor. | 
| Jonathan Coe | 2956535 | 2016-04-27 12:48:25 +0000 | [diff] [blame] | 4537 | */ | 
|  | 4538 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isMoveConstructor(CXCursor C); | 
|  | 4539 |  | 
|  | 4540 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4541 | * Determine if a C++ field is declared 'mutable'. | 
| Saleem Abdulrasool | 6ea75db | 2015-10-27 15:50:22 +0000 | [diff] [blame] | 4542 | */ | 
|  | 4543 | CINDEX_LINKAGE unsigned clang_CXXField_isMutable(CXCursor C); | 
|  | 4544 |  | 
|  | 4545 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4546 | * Determine if a C++ method is declared '= default'. | 
| Jonathan Coe | 2956535 | 2016-04-27 12:48:25 +0000 | [diff] [blame] | 4547 | */ | 
|  | 4548 | CINDEX_LINKAGE unsigned clang_CXXMethod_isDefaulted(CXCursor C); | 
|  | 4549 |  | 
|  | 4550 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4551 | * Determine if a C++ member function or member function template is | 
| Dmitri Gribenko | 62770be | 2013-05-17 18:38:35 +0000 | [diff] [blame] | 4552 | * pure virtual. | 
|  | 4553 | */ | 
|  | 4554 | CINDEX_LINKAGE unsigned clang_CXXMethod_isPureVirtual(CXCursor C); | 
|  | 4555 |  | 
|  | 4556 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4557 | * Determine if a C++ member function or member function template is | 
| Douglas Gregor | f11309e | 2010-08-31 22:12:17 +0000 | [diff] [blame] | 4558 | * declared 'static'. | 
| Ted Kremenek | 9cfe9e6 | 2010-05-17 20:06:56 +0000 | [diff] [blame] | 4559 | */ | 
|  | 4560 | CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C); | 
|  | 4561 |  | 
|  | 4562 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4563 | * Determine if a C++ member function or member function template is | 
| Douglas Gregor | 9519d92 | 2011-05-12 15:17:24 +0000 | [diff] [blame] | 4564 | * explicitly declared 'virtual' or if it overrides a virtual method from | 
|  | 4565 | * one of the base classes. | 
|  | 4566 | */ | 
|  | 4567 | CINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C); | 
|  | 4568 |  | 
|  | 4569 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4570 | * Determine if a C++ record is abstract, i.e. whether a class or struct | 
| Alex Lorenz | 34ccadc | 2017-12-14 22:01:50 +0000 | [diff] [blame] | 4571 | * has a pure virtual member function. | 
|  | 4572 | */ | 
|  | 4573 | CINDEX_LINKAGE unsigned clang_CXXRecord_isAbstract(CXCursor C); | 
|  | 4574 |  | 
|  | 4575 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4576 | * Determine if an enum declaration refers to a scoped enum. | 
| Alex Lorenz | ff7f42e | 2017-07-12 11:35:11 +0000 | [diff] [blame] | 4577 | */ | 
|  | 4578 | CINDEX_LINKAGE unsigned clang_EnumDecl_isScoped(CXCursor C); | 
|  | 4579 |  | 
|  | 4580 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4581 | * Determine if a C++ member function or member function template is | 
| Dmitri Gribenko | e570ede | 2014-04-07 14:59:13 +0000 | [diff] [blame] | 4582 | * declared 'const'. | 
|  | 4583 | */ | 
|  | 4584 | CINDEX_LINKAGE unsigned clang_CXXMethod_isConst(CXCursor C); | 
|  | 4585 |  | 
|  | 4586 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4587 | * Given a cursor that represents a template, determine | 
| Douglas Gregor | f11309e | 2010-08-31 22:12:17 +0000 | [diff] [blame] | 4588 | * the cursor kind of the specializations would be generated by instantiating | 
|  | 4589 | * the template. | 
|  | 4590 | * | 
|  | 4591 | * This routine can be used to determine what flavor of function template, | 
|  | 4592 | * class template, or class template partial specialization is stored in the | 
|  | 4593 | * cursor. For example, it can describe whether a class template cursor is | 
|  | 4594 | * declared with "struct", "class" or "union". | 
|  | 4595 | * | 
|  | 4596 | * \param C The cursor to query. This cursor should represent a template | 
|  | 4597 | * declaration. | 
|  | 4598 | * | 
|  | 4599 | * \returns The cursor kind of the specializations that would be generated | 
|  | 4600 | * by instantiating the template \p C. If \p C is not a template, returns | 
|  | 4601 | * \c CXCursor_NoDeclFound. | 
|  | 4602 | */ | 
|  | 4603 | CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C); | 
|  | 4604 |  | 
|  | 4605 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4606 | * Given a cursor that may represent a specialization or instantiation | 
| Douglas Gregor | d3f48bd | 2010-09-02 00:07:54 +0000 | [diff] [blame] | 4607 | * of a template, retrieve the cursor that represents the template that it | 
|  | 4608 | * specializes or from which it was instantiated. | 
|  | 4609 | * | 
|  | 4610 | * This routine determines the template involved both for explicit | 
|  | 4611 | * specializations of templates and for implicit instantiations of the template, | 
|  | 4612 | * both of which are referred to as "specializations". For a class template | 
|  | 4613 | * specialization (e.g., \c std::vector<bool>), this routine will return | 
|  | 4614 | * either the primary template (\c std::vector) or, if the specialization was | 
|  | 4615 | * instantiated from a class template partial specialization, the class template | 
|  | 4616 | * partial specialization. For a class template partial specialization and a | 
|  | 4617 | * function template specialization (including instantiations), this | 
|  | 4618 | * this routine will return the specialized template. | 
|  | 4619 | * | 
|  | 4620 | * For members of a class template (e.g., member functions, member classes, or | 
|  | 4621 | * static data members), returns the specialized or instantiated member. | 
|  | 4622 | * Although not strictly "templates" in the C++ language, members of class | 
|  | 4623 | * templates have the same notions of specializations and instantiations that | 
|  | 4624 | * templates do, so this routine treats them similarly. | 
|  | 4625 | * | 
|  | 4626 | * \param C A cursor that may be a specialization of a template or a member | 
|  | 4627 | * of a template. | 
|  | 4628 | * | 
|  | 4629 | * \returns If the given cursor is a specialization or instantiation of a | 
|  | 4630 | * template or a member thereof, the template or member that it specializes or | 
|  | 4631 | * from which it was instantiated. Otherwise, returns a NULL cursor. | 
|  | 4632 | */ | 
|  | 4633 | CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C); | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4634 |  | 
|  | 4635 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4636 | * Given a cursor that references something else, return the source range | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4637 | * covering that reference. | 
|  | 4638 | * | 
|  | 4639 | * \param C A cursor pointing to a member reference, a declaration reference, or | 
|  | 4640 | * an operator call. | 
|  | 4641 | * \param NameFlags A bitset with three independent flags: | 
|  | 4642 | * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and | 
|  | 4643 | * CXNameRange_WantSinglePiece. | 
|  | 4644 | * \param PieceIndex For contiguous names or when passing the flag | 
|  | 4645 | * CXNameRange_WantSinglePiece, only one piece with index 0 is | 
|  | 4646 | * available. When the CXNameRange_WantSinglePiece flag is not passed for a | 
| Benjamin Kramer | 474261a | 2012-06-02 10:20:41 +0000 | [diff] [blame] | 4647 | * non-contiguous names, this index can be used to retrieve the individual | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4648 | * pieces of the name. See also CXNameRange_WantSinglePiece. | 
|  | 4649 | * | 
|  | 4650 | * \returns The piece of the name pointed to by the given cursor. If there is no | 
|  | 4651 | * name, or if the PieceIndex is out-of-range, a null-cursor will be returned. | 
|  | 4652 | */ | 
| Francois Pichet | ece689f | 2011-07-25 22:00:44 +0000 | [diff] [blame] | 4653 | CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C, | 
|  | 4654 | unsigned NameFlags, | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4655 | unsigned PieceIndex); | 
|  | 4656 |  | 
|  | 4657 | enum CXNameRefFlags { | 
|  | 4658 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4659 | * Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4660 | * range. | 
|  | 4661 | */ | 
|  | 4662 | CXNameRange_WantQualifier = 0x1, | 
|  | 4663 |  | 
|  | 4664 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4665 | * Include the explicit template arguments, e.g. \<int> in x.f<int>, | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 4666 | * in the range. | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4667 | */ | 
|  | 4668 | CXNameRange_WantTemplateArgs = 0x2, | 
|  | 4669 |  | 
|  | 4670 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4671 | * If the name is non-contiguous, return the full spanning range. | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4672 | * | 
|  | 4673 | * Non-contiguous names occur in Objective-C when a selector with two or more | 
|  | 4674 | * parameters is used, or in C++ when using an operator: | 
|  | 4675 | * \code | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4676 | * [object doSomething:here withValue:there]; // Objective-C | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4677 | * return some_vector[1]; // C++ | 
|  | 4678 | * \endcode | 
|  | 4679 | */ | 
|  | 4680 | CXNameRange_WantSinglePiece = 0x4 | 
|  | 4681 | }; | 
| Douglas Gregor | d3f48bd | 2010-09-02 00:07:54 +0000 | [diff] [blame] | 4682 |  | 
|  | 4683 | /** | 
| Ted Kremenek | 9cfe9e6 | 2010-05-17 20:06:56 +0000 | [diff] [blame] | 4684 | * @} | 
|  | 4685 | */ | 
|  | 4686 |  | 
|  | 4687 | /** | 
| Douglas Gregor | 6165611 | 2010-01-26 18:31:56 +0000 | [diff] [blame] | 4688 | * \defgroup CINDEX_LEX Token extraction and manipulation | 
|  | 4689 | * | 
|  | 4690 | * The routines in this group provide access to the tokens within a | 
|  | 4691 | * translation unit, along with a semantic mapping of those tokens to | 
|  | 4692 | * their corresponding cursors. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4693 | * | 
|  | 4694 | * @{ | 
|  | 4695 | */ | 
|  | 4696 |  | 
|  | 4697 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4698 | * Describes a kind of token. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4699 | */ | 
|  | 4700 | typedef enum CXTokenKind { | 
|  | 4701 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4702 | * A token that contains some kind of punctuation. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4703 | */ | 
|  | 4704 | CXToken_Punctuation, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4705 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4706 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4707 | * A language keyword. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4708 | */ | 
|  | 4709 | CXToken_Keyword, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4710 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4711 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4712 | * An identifier (that is not a keyword). | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4713 | */ | 
|  | 4714 | CXToken_Identifier, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4715 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4716 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4717 | * A numeric, string, or character literal. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4718 | */ | 
|  | 4719 | CXToken_Literal, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4720 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4721 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4722 | * A comment. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4723 | */ | 
|  | 4724 | CXToken_Comment | 
|  | 4725 | } CXTokenKind; | 
|  | 4726 |  | 
|  | 4727 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4728 | * Describes a single preprocessing token. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4729 | */ | 
|  | 4730 | typedef struct { | 
|  | 4731 | unsigned int_data[4]; | 
|  | 4732 | void *ptr_data; | 
|  | 4733 | } CXToken; | 
|  | 4734 |  | 
|  | 4735 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4736 | * Determine the kind of the given token. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4737 | */ | 
|  | 4738 | CINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4739 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4740 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4741 | * Determine the spelling of the given token. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4742 | * | 
|  | 4743 | * The spelling of a token is the textual representation of that token, e.g., | 
|  | 4744 | * the text of an identifier or keyword. | 
|  | 4745 | */ | 
|  | 4746 | CINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4747 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4748 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4749 | * Retrieve the source location of the given token. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4750 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4751 | CINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit, | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4752 | CXToken); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4753 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4754 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4755 | * Retrieve a source range that covers the given token. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4756 | */ | 
|  | 4757 | CINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken); | 
|  | 4758 |  | 
|  | 4759 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4760 | * Tokenize the source code described by the given range into raw | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4761 | * lexical tokens. | 
|  | 4762 | * | 
|  | 4763 | * \param TU the translation unit whose text is being tokenized. | 
|  | 4764 | * | 
|  | 4765 | * \param Range the source range in which text should be tokenized. All of the | 
|  | 4766 | * tokens produced by tokenization will fall within this source range, | 
|  | 4767 | * | 
|  | 4768 | * \param Tokens this pointer will be set to point to the array of tokens | 
|  | 4769 | * that occur within the given source range. The returned pointer must be | 
|  | 4770 | * freed with clang_disposeTokens() before the translation unit is destroyed. | 
|  | 4771 | * | 
|  | 4772 | * \param NumTokens will be set to the number of tokens in the \c *Tokens | 
|  | 4773 | * array. | 
|  | 4774 | * | 
|  | 4775 | */ | 
|  | 4776 | CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range, | 
|  | 4777 | CXToken **Tokens, unsigned *NumTokens); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4778 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4779 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4780 | * Annotate the given set of tokens by providing cursors for each token | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4781 | * that can be mapped to a specific entity within the abstract syntax tree. | 
|  | 4782 | * | 
| Douglas Gregor | 6165611 | 2010-01-26 18:31:56 +0000 | [diff] [blame] | 4783 | * This token-annotation routine is equivalent to invoking | 
|  | 4784 | * clang_getCursor() for the source locations of each of the | 
|  | 4785 | * tokens. The cursors provided are filtered, so that only those | 
|  | 4786 | * cursors that have a direct correspondence to the token are | 
|  | 4787 | * accepted. For example, given a function call \c f(x), | 
|  | 4788 | * clang_getCursor() would provide the following cursors: | 
|  | 4789 | * | 
|  | 4790 | *   * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'. | 
|  | 4791 | *   * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'. | 
|  | 4792 | *   * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'. | 
|  | 4793 | * | 
|  | 4794 | * Only the first and last of these cursors will occur within the | 
|  | 4795 | * annotate, since the tokens "f" and "x' directly refer to a function | 
|  | 4796 | * and a variable, respectively, but the parentheses are just a small | 
|  | 4797 | * part of the full syntax of the function call expression, which is | 
|  | 4798 | * not provided as an annotation. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4799 | * | 
|  | 4800 | * \param TU the translation unit that owns the given tokens. | 
|  | 4801 | * | 
|  | 4802 | * \param Tokens the set of tokens to annotate. | 
|  | 4803 | * | 
|  | 4804 | * \param NumTokens the number of tokens in \p Tokens. | 
|  | 4805 | * | 
|  | 4806 | * \param Cursors an array of \p NumTokens cursors, whose contents will be | 
|  | 4807 | * replaced with the cursors corresponding to each token. | 
|  | 4808 | */ | 
|  | 4809 | CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU, | 
|  | 4810 | CXToken *Tokens, unsigned NumTokens, | 
|  | 4811 | CXCursor *Cursors); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4812 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4813 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4814 | * Free the given set of tokens. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4815 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4816 | CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU, | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4817 | CXToken *Tokens, unsigned NumTokens); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4818 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4819 | /** | 
|  | 4820 | * @} | 
|  | 4821 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4822 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4823 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4824 | * \defgroup CINDEX_DEBUG Debugging facilities | 
|  | 4825 | * | 
|  | 4826 | * These routines are used for testing and debugging, only, and should not | 
|  | 4827 | * be relied upon. | 
|  | 4828 | * | 
|  | 4829 | * @{ | 
|  | 4830 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4831 |  | 
| Steve Naroff | 76b8f13 | 2009-09-23 17:52:52 +0000 | [diff] [blame] | 4832 | /* for debug/testing */ | 
| Ted Kremenek | 2900467 | 2010-02-17 00:41:32 +0000 | [diff] [blame] | 4833 | CINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4834 | CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor, | 
|  | 4835 | const char **startBuf, | 
| Steve Naroff | 76b8f13 | 2009-09-23 17:52:52 +0000 | [diff] [blame] | 4836 | const char **endBuf, | 
|  | 4837 | unsigned *startLine, | 
|  | 4838 | unsigned *startColumn, | 
|  | 4839 | unsigned *endLine, | 
|  | 4840 | unsigned *endColumn); | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 4841 | CINDEX_LINKAGE void clang_enableStackTraces(void); | 
| Daniel Dunbar | 2342065 | 2010-11-04 01:26:29 +0000 | [diff] [blame] | 4842 | CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data, | 
|  | 4843 | unsigned stack_size); | 
|  | 4844 |  | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4845 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4846 | * @} | 
|  | 4847 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4848 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4849 | /** | 
|  | 4850 | * \defgroup CINDEX_CODE_COMPLET Code completion | 
|  | 4851 | * | 
|  | 4852 | * Code completion involves taking an (incomplete) source file, along with | 
|  | 4853 | * knowledge of where the user is actively editing that file, and suggesting | 
|  | 4854 | * syntactically- and semantically-valid constructs that the user might want to | 
|  | 4855 | * use at that particular point in the source code. These data structures and | 
|  | 4856 | * routines provide support for code completion. | 
|  | 4857 | * | 
|  | 4858 | * @{ | 
|  | 4859 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4860 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4861 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4862 | * A semantic string that describes a code-completion result. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4863 | * | 
|  | 4864 | * A semantic string that describes the formatting of a code-completion | 
|  | 4865 | * result as a single "template" of text that should be inserted into the | 
|  | 4866 | * source buffer when a particular code-completion result is selected. | 
|  | 4867 | * Each semantic string is made up of some number of "chunks", each of which | 
|  | 4868 | * contains some text along with a description of what that text means, e.g., | 
|  | 4869 | * the name of the entity being referenced, whether the text chunk is part of | 
|  | 4870 | * the template, or whether it is a "placeholder" that the user should replace | 
|  | 4871 | * with actual code,of a specific kind. See \c CXCompletionChunkKind for a | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4872 | * description of the different kinds of chunks. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4873 | */ | 
|  | 4874 | typedef void *CXCompletionString; | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4875 |  | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4876 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4877 | * A single result of code completion. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4878 | */ | 
|  | 4879 | typedef struct { | 
|  | 4880 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4881 | * The kind of entity that this completion refers to. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4882 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4883 | * The cursor kind will be a macro, keyword, or a declaration (one of the | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4884 | * *Decl cursor kinds), describing the entity that the completion is | 
|  | 4885 | * referring to. | 
|  | 4886 | * | 
|  | 4887 | * \todo In the future, we would like to provide a full cursor, to allow | 
|  | 4888 | * the client to extract additional information from declaration. | 
|  | 4889 | */ | 
|  | 4890 | enum CXCursorKind CursorKind; | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4891 |  | 
|  | 4892 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4893 | * The code-completion string that describes how to insert this | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4894 | * code-completion result into the editing buffer. | 
|  | 4895 | */ | 
|  | 4896 | CXCompletionString CompletionString; | 
|  | 4897 | } CXCompletionResult; | 
|  | 4898 |  | 
|  | 4899 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4900 | * Describes a single piece of text within a code-completion string. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4901 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4902 | * Each "chunk" within a code-completion string (\c CXCompletionString) is | 
|  | 4903 | * either a piece of text with a specific "kind" that describes how that text | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4904 | * should be interpreted by the client or is another completion string. | 
|  | 4905 | */ | 
|  | 4906 | enum CXCompletionChunkKind { | 
|  | 4907 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4908 | * A code-completion string that describes "optional" text that | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4909 | * could be a part of the template (but is not required). | 
|  | 4910 | * | 
|  | 4911 | * The Optional chunk is the only kind of chunk that has a code-completion | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4912 | * string for its representation, which is accessible via | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4913 | * \c clang_getCompletionChunkCompletionString(). The code-completion string | 
|  | 4914 | * describes an additional part of the template that is completely optional. | 
|  | 4915 | * For example, optional chunks can be used to describe the placeholders for | 
|  | 4916 | * arguments that match up with defaulted function parameters, e.g. given: | 
|  | 4917 | * | 
|  | 4918 | * \code | 
|  | 4919 | * void f(int x, float y = 3.14, double z = 2.71828); | 
|  | 4920 | * \endcode | 
|  | 4921 | * | 
|  | 4922 | * The code-completion string for this function would contain: | 
|  | 4923 | *   - a TypedText chunk for "f". | 
|  | 4924 | *   - a LeftParen chunk for "(". | 
|  | 4925 | *   - a Placeholder chunk for "int x" | 
|  | 4926 | *   - an Optional chunk containing the remaining defaulted arguments, e.g., | 
|  | 4927 | *       - a Comma chunk for "," | 
| Daniel Dunbar | 4053fae | 2010-02-17 08:07:44 +0000 | [diff] [blame] | 4928 | *       - a Placeholder chunk for "float y" | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4929 | *       - an Optional chunk containing the last defaulted argument: | 
|  | 4930 | *           - a Comma chunk for "," | 
|  | 4931 | *           - a Placeholder chunk for "double z" | 
|  | 4932 | *   - a RightParen chunk for ")" | 
|  | 4933 | * | 
| Daniel Dunbar | 4053fae | 2010-02-17 08:07:44 +0000 | [diff] [blame] | 4934 | * There are many ways to handle Optional chunks. Two simple approaches are: | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4935 | *   - Completely ignore optional chunks, in which case the template for the | 
|  | 4936 | *     function "f" would only include the first parameter ("int x"). | 
|  | 4937 | *   - Fully expand all optional chunks, in which case the template for the | 
|  | 4938 | *     function "f" would have all of the parameters. | 
|  | 4939 | */ | 
|  | 4940 | CXCompletionChunk_Optional, | 
|  | 4941 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4942 | * Text that a user would be expected to type to get this | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4943 | * code-completion result. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4944 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4945 | * There will be exactly one "typed text" chunk in a semantic string, which | 
|  | 4946 | * will typically provide the spelling of a keyword or the name of a | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4947 | * declaration that could be used at the current code point. Clients are | 
|  | 4948 | * expected to filter the code-completion results based on the text in this | 
|  | 4949 | * chunk. | 
|  | 4950 | */ | 
|  | 4951 | CXCompletionChunk_TypedText, | 
|  | 4952 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4953 | * Text that should be inserted as part of a code-completion result. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4954 | * | 
|  | 4955 | * A "text" chunk represents text that is part of the template to be | 
|  | 4956 | * inserted into user code should this particular code-completion result | 
|  | 4957 | * be selected. | 
|  | 4958 | */ | 
|  | 4959 | CXCompletionChunk_Text, | 
|  | 4960 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4961 | * Placeholder text that should be replaced by the user. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4962 | * | 
|  | 4963 | * A "placeholder" chunk marks a place where the user should insert text | 
|  | 4964 | * into the code-completion template. For example, placeholders might mark | 
|  | 4965 | * the function parameters for a function declaration, to indicate that the | 
|  | 4966 | * user should provide arguments for each of those parameters. The actual | 
|  | 4967 | * text in a placeholder is a suggestion for the text to display before | 
|  | 4968 | * the user replaces the placeholder with real code. | 
|  | 4969 | */ | 
|  | 4970 | CXCompletionChunk_Placeholder, | 
|  | 4971 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4972 | * Informative text that should be displayed but never inserted as | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4973 | * part of the template. | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4974 | * | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4975 | * An "informative" chunk contains annotations that can be displayed to | 
|  | 4976 | * help the user decide whether a particular code-completion result is the | 
|  | 4977 | * right option, but which is not part of the actual template to be inserted | 
|  | 4978 | * by code completion. | 
|  | 4979 | */ | 
|  | 4980 | CXCompletionChunk_Informative, | 
|  | 4981 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 4982 | * Text that describes the current parameter when code-completion is | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4983 | * referring to function call, message send, or template specialization. | 
|  | 4984 | * | 
|  | 4985 | * A "current parameter" chunk occurs when code-completion is providing | 
|  | 4986 | * information about a parameter corresponding to the argument at the | 
|  | 4987 | * code-completion point. For example, given a function | 
|  | 4988 | * | 
|  | 4989 | * \code | 
|  | 4990 | * int add(int x, int y); | 
|  | 4991 | * \endcode | 
|  | 4992 | * | 
|  | 4993 | * and the source code \c add(, where the code-completion point is after the | 
|  | 4994 | * "(", the code-completion string will contain a "current parameter" chunk | 
|  | 4995 | * for "int x", indicating that the current argument will initialize that | 
|  | 4996 | * parameter. After typing further, to \c add(17, (where the code-completion | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4997 | * point is after the ","), the code-completion string will contain a | 
| Alexander Kornienko | 2a8c18d | 2018-04-06 15:14:32 +0000 | [diff] [blame] | 4998 | * "current parameter" chunk to "int y". | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4999 | */ | 
|  | 5000 | CXCompletionChunk_CurrentParameter, | 
|  | 5001 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5002 | * A left parenthesis ('('), used to initiate a function call or | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5003 | * signal the beginning of a function parameter list. | 
|  | 5004 | */ | 
|  | 5005 | CXCompletionChunk_LeftParen, | 
|  | 5006 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5007 | * A right parenthesis (')'), used to finish a function call or | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5008 | * signal the end of a function parameter list. | 
|  | 5009 | */ | 
|  | 5010 | CXCompletionChunk_RightParen, | 
|  | 5011 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5012 | * A left bracket ('['). | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5013 | */ | 
|  | 5014 | CXCompletionChunk_LeftBracket, | 
|  | 5015 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5016 | * A right bracket (']'). | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5017 | */ | 
|  | 5018 | CXCompletionChunk_RightBracket, | 
|  | 5019 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5020 | * A left brace ('{'). | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5021 | */ | 
|  | 5022 | CXCompletionChunk_LeftBrace, | 
|  | 5023 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5024 | * A right brace ('}'). | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5025 | */ | 
|  | 5026 | CXCompletionChunk_RightBrace, | 
|  | 5027 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5028 | * A left angle bracket ('<'). | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5029 | */ | 
|  | 5030 | CXCompletionChunk_LeftAngle, | 
|  | 5031 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5032 | * A right angle bracket ('>'). | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5033 | */ | 
|  | 5034 | CXCompletionChunk_RightAngle, | 
|  | 5035 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5036 | * A comma separator (','). | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5037 | */ | 
| Douglas Gregor | b3fa919 | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 5038 | CXCompletionChunk_Comma, | 
|  | 5039 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5040 | * Text that specifies the result type of a given result. | 
| Douglas Gregor | b3fa919 | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 5041 | * | 
|  | 5042 | * This special kind of informative chunk is not meant to be inserted into | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5043 | * the text buffer. Rather, it is meant to illustrate the type that an | 
| Douglas Gregor | b3fa919 | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 5044 | * expression using the given completion string would have. | 
|  | 5045 | */ | 
| Douglas Gregor | 504a6ae | 2010-01-10 23:08:15 +0000 | [diff] [blame] | 5046 | CXCompletionChunk_ResultType, | 
|  | 5047 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5048 | * A colon (':'). | 
| Douglas Gregor | 504a6ae | 2010-01-10 23:08:15 +0000 | [diff] [blame] | 5049 | */ | 
|  | 5050 | CXCompletionChunk_Colon, | 
|  | 5051 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5052 | * A semicolon (';'). | 
| Douglas Gregor | 504a6ae | 2010-01-10 23:08:15 +0000 | [diff] [blame] | 5053 | */ | 
|  | 5054 | CXCompletionChunk_SemiColon, | 
|  | 5055 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5056 | * An '=' sign. | 
| Douglas Gregor | 504a6ae | 2010-01-10 23:08:15 +0000 | [diff] [blame] | 5057 | */ | 
|  | 5058 | CXCompletionChunk_Equal, | 
|  | 5059 | /** | 
|  | 5060 | * Horizontal space (' '). | 
|  | 5061 | */ | 
|  | 5062 | CXCompletionChunk_HorizontalSpace, | 
|  | 5063 | /** | 
| Alex Lorenz | 6c2898a | 2017-04-06 14:03:25 +0000 | [diff] [blame] | 5064 | * Vertical space ('\\n'), after which it is generally a good idea to | 
| Douglas Gregor | 504a6ae | 2010-01-10 23:08:15 +0000 | [diff] [blame] | 5065 | * perform indentation. | 
|  | 5066 | */ | 
|  | 5067 | CXCompletionChunk_VerticalSpace | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5068 | }; | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5069 |  | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5070 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5071 | * Determine the kind of a particular chunk within a completion string. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5072 | * | 
|  | 5073 | * \param completion_string the completion string to query. | 
|  | 5074 | * | 
|  | 5075 | * \param chunk_number the 0-based index of the chunk in the completion string. | 
|  | 5076 | * | 
|  | 5077 | * \returns the kind of the chunk at the index \c chunk_number. | 
|  | 5078 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5079 | CINDEX_LINKAGE enum CXCompletionChunkKind | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5080 | clang_getCompletionChunkKind(CXCompletionString completion_string, | 
|  | 5081 | unsigned chunk_number); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5082 |  | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5083 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5084 | * Retrieve the text associated with a particular chunk within a | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5085 | * completion string. | 
|  | 5086 | * | 
|  | 5087 | * \param completion_string the completion string to query. | 
|  | 5088 | * | 
|  | 5089 | * \param chunk_number the 0-based index of the chunk in the completion string. | 
|  | 5090 | * | 
|  | 5091 | * \returns the text associated with the chunk at index \c chunk_number. | 
|  | 5092 | */ | 
| Ted Kremenek | f602f96 | 2010-02-17 01:42:24 +0000 | [diff] [blame] | 5093 | CINDEX_LINKAGE CXString | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5094 | clang_getCompletionChunkText(CXCompletionString completion_string, | 
|  | 5095 | unsigned chunk_number); | 
|  | 5096 |  | 
|  | 5097 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5098 | * Retrieve the completion string associated with a particular chunk | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5099 | * within a completion string. | 
|  | 5100 | * | 
|  | 5101 | * \param completion_string the completion string to query. | 
|  | 5102 | * | 
|  | 5103 | * \param chunk_number the 0-based index of the chunk in the completion string. | 
|  | 5104 | * | 
|  | 5105 | * \returns the completion string associated with the chunk at index | 
| Erik Verbruggen | 98ea7f6 | 2011-10-14 15:31:08 +0000 | [diff] [blame] | 5106 | * \c chunk_number. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5107 | */ | 
|  | 5108 | CINDEX_LINKAGE CXCompletionString | 
|  | 5109 | clang_getCompletionChunkCompletionString(CXCompletionString completion_string, | 
|  | 5110 | unsigned chunk_number); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5111 |  | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5112 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5113 | * Retrieve the number of chunks in the given code-completion string. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5114 | */ | 
|  | 5115 | CINDEX_LINKAGE unsigned | 
|  | 5116 | clang_getNumCompletionChunks(CXCompletionString completion_string); | 
|  | 5117 |  | 
|  | 5118 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5119 | * Determine the priority of this code completion. | 
| Douglas Gregor | a2db793 | 2010-05-26 22:00:08 +0000 | [diff] [blame] | 5120 | * | 
|  | 5121 | * The priority of a code completion indicates how likely it is that this | 
|  | 5122 | * particular completion is the completion that the user will select. The | 
|  | 5123 | * priority is selected by various internal heuristics. | 
|  | 5124 | * | 
|  | 5125 | * \param completion_string The completion string to query. | 
|  | 5126 | * | 
|  | 5127 | * \returns The priority of this completion string. Smaller values indicate | 
|  | 5128 | * higher-priority (more likely) completions. | 
|  | 5129 | */ | 
|  | 5130 | CINDEX_LINKAGE unsigned | 
|  | 5131 | clang_getCompletionPriority(CXCompletionString completion_string); | 
|  | 5132 |  | 
|  | 5133 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5134 | * Determine the availability of the entity that this code-completion | 
| Douglas Gregor | f757a12 | 2010-08-23 23:00:57 +0000 | [diff] [blame] | 5135 | * string refers to. | 
|  | 5136 | * | 
|  | 5137 | * \param completion_string The completion string to query. | 
|  | 5138 | * | 
|  | 5139 | * \returns The availability of the completion string. | 
|  | 5140 | */ | 
|  | 5141 | CINDEX_LINKAGE enum CXAvailabilityKind | 
|  | 5142 | clang_getCompletionAvailability(CXCompletionString completion_string); | 
|  | 5143 |  | 
|  | 5144 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5145 | * Retrieve the number of annotations associated with the given | 
| Erik Verbruggen | 98ea7f6 | 2011-10-14 15:31:08 +0000 | [diff] [blame] | 5146 | * completion string. | 
|  | 5147 | * | 
|  | 5148 | * \param completion_string the completion string to query. | 
|  | 5149 | * | 
|  | 5150 | * \returns the number of annotations associated with the given completion | 
|  | 5151 | * string. | 
|  | 5152 | */ | 
|  | 5153 | CINDEX_LINKAGE unsigned | 
|  | 5154 | clang_getCompletionNumAnnotations(CXCompletionString completion_string); | 
|  | 5155 |  | 
|  | 5156 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5157 | * Retrieve the annotation associated with the given completion string. | 
| Erik Verbruggen | 98ea7f6 | 2011-10-14 15:31:08 +0000 | [diff] [blame] | 5158 | * | 
|  | 5159 | * \param completion_string the completion string to query. | 
|  | 5160 | * | 
|  | 5161 | * \param annotation_number the 0-based index of the annotation of the | 
|  | 5162 | * completion string. | 
|  | 5163 | * | 
|  | 5164 | * \returns annotation string associated with the completion at index | 
|  | 5165 | * \c annotation_number, or a NULL string if that annotation is not available. | 
|  | 5166 | */ | 
|  | 5167 | CINDEX_LINKAGE CXString | 
|  | 5168 | clang_getCompletionAnnotation(CXCompletionString completion_string, | 
|  | 5169 | unsigned annotation_number); | 
|  | 5170 |  | 
|  | 5171 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5172 | * Retrieve the parent context of the given completion string. | 
| Douglas Gregor | 78254c8 | 2012-03-27 23:34:16 +0000 | [diff] [blame] | 5173 | * | 
|  | 5174 | * The parent context of a completion string is the semantic parent of | 
|  | 5175 | * the declaration (if any) that the code completion represents. For example, | 
|  | 5176 | * a code completion for an Objective-C method would have the method's class | 
|  | 5177 | * or protocol as its context. | 
|  | 5178 | * | 
|  | 5179 | * \param completion_string The code completion string whose parent is | 
|  | 5180 | * being queried. | 
|  | 5181 | * | 
| Argyrios Kyrtzidis | 9ae3956 | 2012-09-26 16:39:56 +0000 | [diff] [blame] | 5182 | * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL. | 
| Douglas Gregor | 78254c8 | 2012-03-27 23:34:16 +0000 | [diff] [blame] | 5183 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5184 | * \returns The name of the completion parent, e.g., "NSObject" if | 
| Douglas Gregor | 78254c8 | 2012-03-27 23:34:16 +0000 | [diff] [blame] | 5185 | * the completion string represents a method in the NSObject class. | 
|  | 5186 | */ | 
|  | 5187 | CINDEX_LINKAGE CXString | 
|  | 5188 | clang_getCompletionParent(CXCompletionString completion_string, | 
|  | 5189 | enum CXCursorKind *kind); | 
| Dmitri Gribenko | 3292d06 | 2012-07-02 17:35:10 +0000 | [diff] [blame] | 5190 |  | 
|  | 5191 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5192 | * Retrieve the brief documentation comment attached to the declaration | 
| Dmitri Gribenko | 3292d06 | 2012-07-02 17:35:10 +0000 | [diff] [blame] | 5193 | * that corresponds to the given completion string. | 
|  | 5194 | */ | 
|  | 5195 | CINDEX_LINKAGE CXString | 
|  | 5196 | clang_getCompletionBriefComment(CXCompletionString completion_string); | 
|  | 5197 |  | 
| Douglas Gregor | 78254c8 | 2012-03-27 23:34:16 +0000 | [diff] [blame] | 5198 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5199 | * Retrieve a completion string for an arbitrary declaration or macro | 
| Douglas Gregor | 3f35bb2 | 2011-08-04 20:04:59 +0000 | [diff] [blame] | 5200 | * definition cursor. | 
|  | 5201 | * | 
|  | 5202 | * \param cursor The cursor to query. | 
|  | 5203 | * | 
|  | 5204 | * \returns A non-context-sensitive completion string for declaration and macro | 
|  | 5205 | * definition cursors, or NULL for other kinds of cursors. | 
|  | 5206 | */ | 
|  | 5207 | CINDEX_LINKAGE CXCompletionString | 
|  | 5208 | clang_getCursorCompletionString(CXCursor cursor); | 
|  | 5209 |  | 
|  | 5210 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5211 | * Contains the results of code-completion. | 
| Douglas Gregor | f72b6ac | 2009-12-18 16:20:58 +0000 | [diff] [blame] | 5212 | * | 
|  | 5213 | * This data structure contains the results of code completion, as | 
| Douglas Gregor | 6a958028 | 2010-10-11 21:51:20 +0000 | [diff] [blame] | 5214 | * produced by \c clang_codeCompleteAt(). Its contents must be freed by | 
| Douglas Gregor | f72b6ac | 2009-12-18 16:20:58 +0000 | [diff] [blame] | 5215 | * \c clang_disposeCodeCompleteResults. | 
|  | 5216 | */ | 
|  | 5217 | typedef struct { | 
|  | 5218 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5219 | * The code-completion results. | 
| Douglas Gregor | f72b6ac | 2009-12-18 16:20:58 +0000 | [diff] [blame] | 5220 | */ | 
|  | 5221 | CXCompletionResult *Results; | 
|  | 5222 |  | 
|  | 5223 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5224 | * The number of code-completion results stored in the | 
| Douglas Gregor | f72b6ac | 2009-12-18 16:20:58 +0000 | [diff] [blame] | 5225 | * \c Results array. | 
|  | 5226 | */ | 
|  | 5227 | unsigned NumResults; | 
|  | 5228 | } CXCodeCompleteResults; | 
|  | 5229 |  | 
|  | 5230 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5231 | * Flags that can be passed to \c clang_codeCompleteAt() to | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5232 | * modify its behavior. | 
|  | 5233 | * | 
|  | 5234 | * The enumerators in this enumeration can be bitwise-OR'd together to | 
|  | 5235 | * provide multiple options to \c clang_codeCompleteAt(). | 
|  | 5236 | */ | 
|  | 5237 | enum CXCodeComplete_Flags { | 
|  | 5238 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5239 | * Whether to include macros within the set of code | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5240 | * completions returned. | 
|  | 5241 | */ | 
|  | 5242 | CXCodeComplete_IncludeMacros = 0x01, | 
|  | 5243 |  | 
|  | 5244 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5245 | * Whether to include code patterns for language constructs | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5246 | * within the set of code completions, e.g., for loops. | 
|  | 5247 | */ | 
| Dmitri Gribenko | 3292d06 | 2012-07-02 17:35:10 +0000 | [diff] [blame] | 5248 | CXCodeComplete_IncludeCodePatterns = 0x02, | 
|  | 5249 |  | 
|  | 5250 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5251 | * Whether to include brief documentation within the set of code | 
| Dmitri Gribenko | 3292d06 | 2012-07-02 17:35:10 +0000 | [diff] [blame] | 5252 | * completions returned. | 
|  | 5253 | */ | 
| Sam McCall | bb2cf63 | 2018-01-12 14:51:47 +0000 | [diff] [blame] | 5254 | CXCodeComplete_IncludeBriefComments = 0x04, | 
|  | 5255 |  | 
|  | 5256 | /** | 
| Sam McCall | abdcc61 | 2018-01-24 17:50:20 +0000 | [diff] [blame] | 5257 | * Whether to speed up completion by omitting top- or namespace-level entities | 
|  | 5258 | * defined in the preamble. There's no guarantee any particular entity is | 
|  | 5259 | * omitted. This may be useful if the headers are indexed externally. | 
| Sam McCall | bb2cf63 | 2018-01-12 14:51:47 +0000 | [diff] [blame] | 5260 | */ | 
|  | 5261 | CXCodeComplete_SkipPreamble = 0x08 | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5262 | }; | 
|  | 5263 |  | 
|  | 5264 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5265 | * Bits that represent the context under which completion is occurring. | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5266 | * | 
|  | 5267 | * The enumerators in this enumeration may be bitwise-OR'd together if multiple | 
|  | 5268 | * contexts are occurring simultaneously. | 
|  | 5269 | */ | 
|  | 5270 | enum CXCompletionContext { | 
|  | 5271 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5272 | * The context for completions is unexposed, as only Clang results | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5273 | * should be included. (This is equivalent to having no context bits set.) | 
|  | 5274 | */ | 
|  | 5275 | CXCompletionContext_Unexposed = 0, | 
|  | 5276 |  | 
|  | 5277 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5278 | * Completions for any possible type should be included in the results. | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5279 | */ | 
|  | 5280 | CXCompletionContext_AnyType = 1 << 0, | 
|  | 5281 |  | 
|  | 5282 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5283 | * Completions for any possible value (variables, function calls, etc.) | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5284 | * should be included in the results. | 
|  | 5285 | */ | 
|  | 5286 | CXCompletionContext_AnyValue = 1 << 1, | 
|  | 5287 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5288 | * Completions for values that resolve to an Objective-C object should | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5289 | * be included in the results. | 
|  | 5290 | */ | 
|  | 5291 | CXCompletionContext_ObjCObjectValue = 1 << 2, | 
|  | 5292 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5293 | * Completions for values that resolve to an Objective-C selector | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5294 | * should be included in the results. | 
|  | 5295 | */ | 
|  | 5296 | CXCompletionContext_ObjCSelectorValue = 1 << 3, | 
|  | 5297 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5298 | * Completions for values that resolve to a C++ class type should be | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5299 | * included in the results. | 
|  | 5300 | */ | 
|  | 5301 | CXCompletionContext_CXXClassTypeValue = 1 << 4, | 
|  | 5302 |  | 
|  | 5303 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5304 | * Completions for fields of the member being accessed using the dot | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5305 | * operator should be included in the results. | 
|  | 5306 | */ | 
|  | 5307 | CXCompletionContext_DotMemberAccess = 1 << 5, | 
|  | 5308 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5309 | * Completions for fields of the member being accessed using the arrow | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5310 | * operator should be included in the results. | 
|  | 5311 | */ | 
|  | 5312 | CXCompletionContext_ArrowMemberAccess = 1 << 6, | 
|  | 5313 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5314 | * Completions for properties of the Objective-C object being accessed | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5315 | * using the dot operator should be included in the results. | 
|  | 5316 | */ | 
|  | 5317 | CXCompletionContext_ObjCPropertyAccess = 1 << 7, | 
|  | 5318 |  | 
|  | 5319 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5320 | * Completions for enum tags should be included in the results. | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5321 | */ | 
|  | 5322 | CXCompletionContext_EnumTag = 1 << 8, | 
|  | 5323 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5324 | * Completions for union tags should be included in the results. | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5325 | */ | 
|  | 5326 | CXCompletionContext_UnionTag = 1 << 9, | 
|  | 5327 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5328 | * Completions for struct tags should be included in the results. | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5329 | */ | 
|  | 5330 | CXCompletionContext_StructTag = 1 << 10, | 
|  | 5331 |  | 
|  | 5332 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5333 | * Completions for C++ class names should be included in the results. | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5334 | */ | 
|  | 5335 | CXCompletionContext_ClassTag = 1 << 11, | 
|  | 5336 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5337 | * Completions for C++ namespaces and namespace aliases should be | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5338 | * included in the results. | 
|  | 5339 | */ | 
|  | 5340 | CXCompletionContext_Namespace = 1 << 12, | 
|  | 5341 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5342 | * Completions for C++ nested name specifiers should be included in | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5343 | * the results. | 
|  | 5344 | */ | 
|  | 5345 | CXCompletionContext_NestedNameSpecifier = 1 << 13, | 
|  | 5346 |  | 
|  | 5347 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5348 | * Completions for Objective-C interfaces (classes) should be included | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5349 | * in the results. | 
|  | 5350 | */ | 
|  | 5351 | CXCompletionContext_ObjCInterface = 1 << 14, | 
|  | 5352 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5353 | * Completions for Objective-C protocols should be included in | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5354 | * the results. | 
|  | 5355 | */ | 
|  | 5356 | CXCompletionContext_ObjCProtocol = 1 << 15, | 
|  | 5357 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5358 | * Completions for Objective-C categories should be included in | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5359 | * the results. | 
|  | 5360 | */ | 
|  | 5361 | CXCompletionContext_ObjCCategory = 1 << 16, | 
|  | 5362 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5363 | * Completions for Objective-C instance messages should be included | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5364 | * in the results. | 
|  | 5365 | */ | 
|  | 5366 | CXCompletionContext_ObjCInstanceMessage = 1 << 17, | 
|  | 5367 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5368 | * Completions for Objective-C class messages should be included in | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5369 | * the results. | 
|  | 5370 | */ | 
|  | 5371 | CXCompletionContext_ObjCClassMessage = 1 << 18, | 
|  | 5372 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5373 | * Completions for Objective-C selector names should be included in | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5374 | * the results. | 
|  | 5375 | */ | 
|  | 5376 | CXCompletionContext_ObjCSelectorName = 1 << 19, | 
|  | 5377 |  | 
|  | 5378 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5379 | * Completions for preprocessor macro names should be included in | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5380 | * the results. | 
|  | 5381 | */ | 
|  | 5382 | CXCompletionContext_MacroName = 1 << 20, | 
|  | 5383 |  | 
|  | 5384 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5385 | * Natural language completions should be included in the results. | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5386 | */ | 
|  | 5387 | CXCompletionContext_NaturalLanguage = 1 << 21, | 
|  | 5388 |  | 
|  | 5389 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5390 | * The current context is unknown, so set all contexts. | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5391 | */ | 
|  | 5392 | CXCompletionContext_Unknown = ((1 << 22) - 1) | 
|  | 5393 | }; | 
|  | 5394 |  | 
|  | 5395 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5396 | * Returns a default set of code-completion options that can be | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5397 | * passed to\c clang_codeCompleteAt(). | 
|  | 5398 | */ | 
|  | 5399 | CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void); | 
|  | 5400 |  | 
|  | 5401 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5402 | * Perform code completion at a given location in a translation unit. | 
| Douglas Gregor | 8e984da | 2010-08-04 16:47:14 +0000 | [diff] [blame] | 5403 | * | 
|  | 5404 | * This function performs code completion at a particular file, line, and | 
|  | 5405 | * column within source code, providing results that suggest potential | 
|  | 5406 | * code snippets based on the context of the completion. The basic model | 
|  | 5407 | * for code completion is that Clang will parse a complete source file, | 
|  | 5408 | * performing syntax checking up to the location where code-completion has | 
|  | 5409 | * been requested. At that point, a special code-completion token is passed | 
|  | 5410 | * to the parser, which recognizes this token and determines, based on the | 
|  | 5411 | * current location in the C/Objective-C/C++ grammar and the state of | 
|  | 5412 | * semantic analysis, what completions to provide. These completions are | 
|  | 5413 | * returned via a new \c CXCodeCompleteResults structure. | 
|  | 5414 | * | 
|  | 5415 | * Code completion itself is meant to be triggered by the client when the | 
|  | 5416 | * user types punctuation characters or whitespace, at which point the | 
|  | 5417 | * code-completion location will coincide with the cursor. For example, if \c p | 
|  | 5418 | * is a pointer, code-completion might be triggered after the "-" and then | 
| Alexander Kornienko | 2a8c18d | 2018-04-06 15:14:32 +0000 | [diff] [blame] | 5419 | * after the ">" in \c p->. When the code-completion location is after the ">", | 
| Douglas Gregor | 8e984da | 2010-08-04 16:47:14 +0000 | [diff] [blame] | 5420 | * the completion results will provide, e.g., the members of the struct that | 
|  | 5421 | * "p" points to. The client is responsible for placing the cursor at the | 
|  | 5422 | * beginning of the token currently being typed, then filtering the results | 
|  | 5423 | * based on the contents of the token. For example, when code-completing for | 
|  | 5424 | * the expression \c p->get, the client should provide the location just after | 
|  | 5425 | * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the | 
|  | 5426 | * client can filter the results based on the current token text ("get"), only | 
|  | 5427 | * showing those results that start with "get". The intent of this interface | 
|  | 5428 | * is to separate the relatively high-latency acquisition of code-completion | 
|  | 5429 | * results from the filtering of results on a per-character basis, which must | 
|  | 5430 | * have a lower latency. | 
|  | 5431 | * | 
|  | 5432 | * \param TU The translation unit in which code-completion should | 
|  | 5433 | * occur. The source files for this translation unit need not be | 
|  | 5434 | * completely up-to-date (and the contents of those source files may | 
|  | 5435 | * be overridden via \p unsaved_files). Cursors referring into the | 
|  | 5436 | * translation unit may be invalidated by this invocation. | 
|  | 5437 | * | 
|  | 5438 | * \param complete_filename The name of the source file where code | 
|  | 5439 | * completion should be performed. This filename may be any file | 
|  | 5440 | * included in the translation unit. | 
|  | 5441 | * | 
|  | 5442 | * \param complete_line The line at which code-completion should occur. | 
|  | 5443 | * | 
|  | 5444 | * \param complete_column The column at which code-completion should occur. | 
|  | 5445 | * Note that the column should point just after the syntactic construct that | 
|  | 5446 | * initiated code completion, and not in the middle of a lexical token. | 
|  | 5447 | * | 
| Vedant Kumar | cbfe7bb | 2016-03-23 23:51:36 +0000 | [diff] [blame] | 5448 | * \param unsaved_files the Files that have not yet been saved to disk | 
| Douglas Gregor | 8e984da | 2010-08-04 16:47:14 +0000 | [diff] [blame] | 5449 | * but may be required for parsing or code completion, including the | 
|  | 5450 | * contents of those files.  The contents and name of these files (as | 
|  | 5451 | * specified by CXUnsavedFile) are copied when necessary, so the | 
|  | 5452 | * client only needs to guarantee their validity until the call to | 
|  | 5453 | * this function returns. | 
|  | 5454 | * | 
|  | 5455 | * \param num_unsaved_files The number of unsaved file entries in \p | 
|  | 5456 | * unsaved_files. | 
|  | 5457 | * | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5458 | * \param options Extra options that control the behavior of code | 
|  | 5459 | * completion, expressed as a bitwise OR of the enumerators of the | 
|  | 5460 | * CXCodeComplete_Flags enumeration. The | 
|  | 5461 | * \c clang_defaultCodeCompleteOptions() function returns a default set | 
|  | 5462 | * of code-completion options. | 
|  | 5463 | * | 
| Douglas Gregor | 8e984da | 2010-08-04 16:47:14 +0000 | [diff] [blame] | 5464 | * \returns If successful, a new \c CXCodeCompleteResults structure | 
|  | 5465 | * containing code-completion results, which should eventually be | 
|  | 5466 | * freed with \c clang_disposeCodeCompleteResults(). If code | 
|  | 5467 | * completion fails, returns NULL. | 
|  | 5468 | */ | 
|  | 5469 | CINDEX_LINKAGE | 
|  | 5470 | CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU, | 
|  | 5471 | const char *complete_filename, | 
|  | 5472 | unsigned complete_line, | 
|  | 5473 | unsigned complete_column, | 
|  | 5474 | struct CXUnsavedFile *unsaved_files, | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5475 | unsigned num_unsaved_files, | 
|  | 5476 | unsigned options); | 
| Douglas Gregor | 8e984da | 2010-08-04 16:47:14 +0000 | [diff] [blame] | 5477 |  | 
|  | 5478 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5479 | * Sort the code-completion results in case-insensitive alphabetical | 
| Douglas Gregor | 49f67ce | 2010-08-26 13:48:20 +0000 | [diff] [blame] | 5480 | * order. | 
|  | 5481 | * | 
|  | 5482 | * \param Results The set of results to sort. | 
|  | 5483 | * \param NumResults The number of results in \p Results. | 
|  | 5484 | */ | 
|  | 5485 | CINDEX_LINKAGE | 
|  | 5486 | void clang_sortCodeCompletionResults(CXCompletionResult *Results, | 
|  | 5487 | unsigned NumResults); | 
|  | 5488 |  | 
|  | 5489 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5490 | * Free the given set of code-completion results. | 
| Douglas Gregor | f72b6ac | 2009-12-18 16:20:58 +0000 | [diff] [blame] | 5491 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5492 | CINDEX_LINKAGE | 
| Douglas Gregor | f72b6ac | 2009-12-18 16:20:58 +0000 | [diff] [blame] | 5493 | void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results); | 
| Douglas Gregor | f757a12 | 2010-08-23 23:00:57 +0000 | [diff] [blame] | 5494 |  | 
| Douglas Gregor | 52606ff | 2010-01-20 01:10:47 +0000 | [diff] [blame] | 5495 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5496 | * Determine the number of diagnostics produced prior to the | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 5497 | * location where code completion was performed. | 
|  | 5498 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 5499 | CINDEX_LINKAGE | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 5500 | unsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results); | 
|  | 5501 |  | 
|  | 5502 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5503 | * Retrieve a diagnostic associated with the given code completion. | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 5504 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5505 | * \param Results the code completion results to query. | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 5506 | * \param Index the zero-based diagnostic number to retrieve. | 
|  | 5507 | * | 
|  | 5508 | * \returns the requested diagnostic. This diagnostic must be freed | 
|  | 5509 | * via a call to \c clang_disposeDiagnostic(). | 
|  | 5510 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 5511 | CINDEX_LINKAGE | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 5512 | CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results, | 
|  | 5513 | unsigned Index); | 
|  | 5514 |  | 
|  | 5515 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5516 | * Determines what completions are appropriate for the context | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5517 | * the given code completion. | 
|  | 5518 | * | 
|  | 5519 | * \param Results the code completion results to query | 
|  | 5520 | * | 
|  | 5521 | * \returns the kinds of completions that are appropriate for use | 
|  | 5522 | * along with the given code completion results. | 
|  | 5523 | */ | 
|  | 5524 | CINDEX_LINKAGE | 
|  | 5525 | unsigned long long clang_codeCompleteGetContexts( | 
|  | 5526 | CXCodeCompleteResults *Results); | 
| Douglas Gregor | 63745d5 | 2011-07-21 01:05:26 +0000 | [diff] [blame] | 5527 |  | 
|  | 5528 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5529 | * Returns the cursor kind for the container for the current code | 
| Douglas Gregor | 63745d5 | 2011-07-21 01:05:26 +0000 | [diff] [blame] | 5530 | * completion context. The container is only guaranteed to be set for | 
|  | 5531 | * contexts where a container exists (i.e. member accesses or Objective-C | 
|  | 5532 | * message sends); if there is not a container, this function will return | 
|  | 5533 | * CXCursor_InvalidCode. | 
|  | 5534 | * | 
|  | 5535 | * \param Results the code completion results to query | 
|  | 5536 | * | 
|  | 5537 | * \param IsIncomplete on return, this value will be false if Clang has complete | 
|  | 5538 | * information about the container. If Clang does not have complete | 
|  | 5539 | * information, this value will be true. | 
|  | 5540 | * | 
|  | 5541 | * \returns the container kind, or CXCursor_InvalidCode if there is not a | 
|  | 5542 | * container | 
|  | 5543 | */ | 
|  | 5544 | CINDEX_LINKAGE | 
|  | 5545 | enum CXCursorKind clang_codeCompleteGetContainerKind( | 
|  | 5546 | CXCodeCompleteResults *Results, | 
|  | 5547 | unsigned *IsIncomplete); | 
|  | 5548 |  | 
|  | 5549 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5550 | * Returns the USR for the container for the current code completion | 
| Douglas Gregor | 63745d5 | 2011-07-21 01:05:26 +0000 | [diff] [blame] | 5551 | * context. If there is not a container for the current context, this | 
|  | 5552 | * function will return the empty string. | 
|  | 5553 | * | 
|  | 5554 | * \param Results the code completion results to query | 
|  | 5555 | * | 
|  | 5556 | * \returns the USR for the container | 
|  | 5557 | */ | 
|  | 5558 | CINDEX_LINKAGE | 
|  | 5559 | CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results); | 
| NAKAMURA Takumi | aa13f94 | 2015-12-09 07:52:46 +0000 | [diff] [blame] | 5560 |  | 
| Douglas Gregor | ea77740 | 2011-07-26 15:24:30 +0000 | [diff] [blame] | 5561 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5562 | * Returns the currently-entered selector for an Objective-C message | 
| Douglas Gregor | ea77740 | 2011-07-26 15:24:30 +0000 | [diff] [blame] | 5563 | * send, formatted like "initWithFoo:bar:". Only guaranteed to return a | 
|  | 5564 | * non-empty string for CXCompletionContext_ObjCInstanceMessage and | 
|  | 5565 | * CXCompletionContext_ObjCClassMessage. | 
|  | 5566 | * | 
|  | 5567 | * \param Results the code completion results to query | 
|  | 5568 | * | 
|  | 5569 | * \returns the selector (or partial selector) that has been entered thus far | 
|  | 5570 | * for an Objective-C message send. | 
|  | 5571 | */ | 
|  | 5572 | CINDEX_LINKAGE | 
|  | 5573 | CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results); | 
|  | 5574 |  | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5575 | /** | 
| Douglas Gregor | 52606ff | 2010-01-20 01:10:47 +0000 | [diff] [blame] | 5576 | * @} | 
|  | 5577 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5578 |  | 
| Ted Kremenek | c0f3f72 | 2010-01-22 22:44:15 +0000 | [diff] [blame] | 5579 | /** | 
|  | 5580 | * \defgroup CINDEX_MISC Miscellaneous utility functions | 
|  | 5581 | * | 
|  | 5582 | * @{ | 
|  | 5583 | */ | 
| Ted Kremenek | 3e315a2 | 2010-01-23 17:51:23 +0000 | [diff] [blame] | 5584 |  | 
|  | 5585 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5586 | * Return a version string, suitable for showing to a user, but not | 
| Ted Kremenek | 3e315a2 | 2010-01-23 17:51:23 +0000 | [diff] [blame] | 5587 | *        intended to be parsed (the format is not guaranteed to be stable). | 
|  | 5588 | */ | 
| NAKAMURA Takumi | eacd667 | 2013-01-10 02:12:38 +0000 | [diff] [blame] | 5589 | CINDEX_LINKAGE CXString clang_getClangVersion(void); | 
| Ted Kremenek | c0f3f72 | 2010-01-22 22:44:15 +0000 | [diff] [blame] | 5590 |  | 
| Ted Kremenek | 1ec7b33 | 2011-03-18 23:05:39 +0000 | [diff] [blame] | 5591 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5592 | * Enable/disable crash recovery. | 
| Ted Kremenek | 1ec7b33 | 2011-03-18 23:05:39 +0000 | [diff] [blame] | 5593 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5594 | * \param isEnabled Flag to indicate if crash recovery is enabled.  A non-zero | 
|  | 5595 | *        value enables crash recovery, while 0 disables it. | 
| Ted Kremenek | 1ec7b33 | 2011-03-18 23:05:39 +0000 | [diff] [blame] | 5596 | */ | 
|  | 5597 | CINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled); | 
|  | 5598 |  | 
| Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 5599 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5600 | * Visitor invoked for each file in a translation unit | 
| Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 5601 | *        (used with clang_getInclusions()). | 
|  | 5602 | * | 
|  | 5603 | * This visitor function will be invoked by clang_getInclusions() for each | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5604 | * file included (either at the top-level or by \#include directives) within | 
| Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 5605 | * a translation unit.  The first argument is the file being included, and | 
|  | 5606 | * the second and third arguments provide the inclusion stack.  The | 
|  | 5607 | * array is sorted in order of immediate inclusion.  For example, | 
|  | 5608 | * the first element refers to the location that included 'included_file'. | 
|  | 5609 | */ | 
|  | 5610 | typedef void (*CXInclusionVisitor)(CXFile included_file, | 
|  | 5611 | CXSourceLocation* inclusion_stack, | 
|  | 5612 | unsigned include_len, | 
|  | 5613 | CXClientData client_data); | 
|  | 5614 |  | 
|  | 5615 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5616 | * Visit the set of preprocessor inclusions in a translation unit. | 
| Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 5617 | *   The visitor function is called with the provided data for every included | 
|  | 5618 | *   file.  This does not include headers included by the PCH file (unless one | 
|  | 5619 | *   is inspecting the inclusions in the PCH file itself). | 
|  | 5620 | */ | 
|  | 5621 | CINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu, | 
|  | 5622 | CXInclusionVisitor visitor, | 
|  | 5623 | CXClientData client_data); | 
|  | 5624 |  | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5625 | typedef enum { | 
|  | 5626 | CXEval_Int = 1 , | 
|  | 5627 | CXEval_Float = 2, | 
|  | 5628 | CXEval_ObjCStrLiteral = 3, | 
|  | 5629 | CXEval_StrLiteral = 4, | 
|  | 5630 | CXEval_CFStr = 5, | 
|  | 5631 | CXEval_Other = 6, | 
|  | 5632 |  | 
|  | 5633 | CXEval_UnExposed = 0 | 
|  | 5634 |  | 
|  | 5635 | } CXEvalResultKind ; | 
|  | 5636 |  | 
|  | 5637 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5638 | * Evaluation result of a cursor | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5639 | */ | 
|  | 5640 | typedef void * CXEvalResult; | 
|  | 5641 |  | 
|  | 5642 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5643 | * If cursor is a statement declaration tries to evaluate the | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5644 | * statement and if its variable, tries to evaluate its initializer, | 
|  | 5645 | * into its corresponding type. | 
|  | 5646 | */ | 
|  | 5647 | CINDEX_LINKAGE CXEvalResult clang_Cursor_Evaluate(CXCursor C); | 
|  | 5648 |  | 
|  | 5649 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5650 | * Returns the kind of the evaluated result. | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5651 | */ | 
| Argyrios Kyrtzidis | a851d7e | 2016-01-16 03:01:20 +0000 | [diff] [blame] | 5652 | CINDEX_LINKAGE CXEvalResultKind clang_EvalResult_getKind(CXEvalResult E); | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5653 |  | 
|  | 5654 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5655 | * Returns the evaluation result as integer if the | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5656 | * kind is Int. | 
|  | 5657 | */ | 
| Argyrios Kyrtzidis | a851d7e | 2016-01-16 03:01:20 +0000 | [diff] [blame] | 5658 | CINDEX_LINKAGE int clang_EvalResult_getAsInt(CXEvalResult E); | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5659 |  | 
|  | 5660 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5661 | * Returns the evaluation result as a long long integer if the | 
| Argyrios Kyrtzidis | 5dda112 | 2016-12-01 23:41:27 +0000 | [diff] [blame] | 5662 | * kind is Int. This prevents overflows that may happen if the result is | 
|  | 5663 | * returned with clang_EvalResult_getAsInt. | 
|  | 5664 | */ | 
|  | 5665 | CINDEX_LINKAGE long long clang_EvalResult_getAsLongLong(CXEvalResult E); | 
|  | 5666 |  | 
|  | 5667 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5668 | * Returns a non-zero value if the kind is Int and the evaluation | 
| Argyrios Kyrtzidis | 5dda112 | 2016-12-01 23:41:27 +0000 | [diff] [blame] | 5669 | * result resulted in an unsigned integer. | 
|  | 5670 | */ | 
|  | 5671 | CINDEX_LINKAGE unsigned clang_EvalResult_isUnsignedInt(CXEvalResult E); | 
|  | 5672 |  | 
|  | 5673 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5674 | * Returns the evaluation result as an unsigned integer if | 
| Argyrios Kyrtzidis | 5dda112 | 2016-12-01 23:41:27 +0000 | [diff] [blame] | 5675 | * the kind is Int and clang_EvalResult_isUnsignedInt is non-zero. | 
|  | 5676 | */ | 
|  | 5677 | CINDEX_LINKAGE unsigned long long clang_EvalResult_getAsUnsigned(CXEvalResult E); | 
|  | 5678 |  | 
|  | 5679 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5680 | * Returns the evaluation result as double if the | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5681 | * kind is double. | 
|  | 5682 | */ | 
| Argyrios Kyrtzidis | a851d7e | 2016-01-16 03:01:20 +0000 | [diff] [blame] | 5683 | CINDEX_LINKAGE double clang_EvalResult_getAsDouble(CXEvalResult E); | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5684 |  | 
|  | 5685 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5686 | * Returns the evaluation result as a constant string if the | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5687 | * kind is other than Int or float. User must not free this pointer, | 
|  | 5688 | * instead call clang_EvalResult_dispose on the CXEvalResult returned | 
|  | 5689 | * by clang_Cursor_Evaluate. | 
|  | 5690 | */ | 
| Argyrios Kyrtzidis | a851d7e | 2016-01-16 03:01:20 +0000 | [diff] [blame] | 5691 | CINDEX_LINKAGE const char* clang_EvalResult_getAsStr(CXEvalResult E); | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5692 |  | 
|  | 5693 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5694 | * Disposes the created Eval memory. | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5695 | */ | 
| Argyrios Kyrtzidis | a851d7e | 2016-01-16 03:01:20 +0000 | [diff] [blame] | 5696 | CINDEX_LINKAGE void clang_EvalResult_dispose(CXEvalResult E); | 
| Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 5697 | /** | 
| Ted Kremenek | c0f3f72 | 2010-01-22 22:44:15 +0000 | [diff] [blame] | 5698 | * @} | 
|  | 5699 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5700 |  | 
| Argyrios Kyrtzidis | f89cc69 | 2011-07-11 20:15:00 +0000 | [diff] [blame] | 5701 | /** \defgroup CINDEX_REMAPPING Remapping functions | 
|  | 5702 | * | 
|  | 5703 | * @{ | 
|  | 5704 | */ | 
|  | 5705 |  | 
|  | 5706 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5707 | * A remapping of original source files and their translated files. | 
| Argyrios Kyrtzidis | f89cc69 | 2011-07-11 20:15:00 +0000 | [diff] [blame] | 5708 | */ | 
|  | 5709 | typedef void *CXRemapping; | 
|  | 5710 |  | 
|  | 5711 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5712 | * Retrieve a remapping. | 
| Argyrios Kyrtzidis | f89cc69 | 2011-07-11 20:15:00 +0000 | [diff] [blame] | 5713 | * | 
|  | 5714 | * \param path the path that contains metadata about remappings. | 
|  | 5715 | * | 
|  | 5716 | * \returns the requested remapping. This remapping must be freed | 
|  | 5717 | * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. | 
|  | 5718 | */ | 
|  | 5719 | CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path); | 
|  | 5720 |  | 
|  | 5721 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5722 | * Retrieve a remapping. | 
| Ted Kremenek | f7639e1 | 2012-03-06 20:06:33 +0000 | [diff] [blame] | 5723 | * | 
|  | 5724 | * \param filePaths pointer to an array of file paths containing remapping info. | 
|  | 5725 | * | 
|  | 5726 | * \param numFiles number of file paths. | 
|  | 5727 | * | 
|  | 5728 | * \returns the requested remapping. This remapping must be freed | 
|  | 5729 | * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. | 
|  | 5730 | */ | 
|  | 5731 | CINDEX_LINKAGE | 
|  | 5732 | CXRemapping clang_getRemappingsFromFileList(const char **filePaths, | 
|  | 5733 | unsigned numFiles); | 
|  | 5734 |  | 
|  | 5735 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5736 | * Determine the number of remappings. | 
| Argyrios Kyrtzidis | f89cc69 | 2011-07-11 20:15:00 +0000 | [diff] [blame] | 5737 | */ | 
|  | 5738 | CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping); | 
|  | 5739 |  | 
|  | 5740 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5741 | * Get the original and the associated filename from the remapping. | 
| Argyrios Kyrtzidis | f89cc69 | 2011-07-11 20:15:00 +0000 | [diff] [blame] | 5742 | * | 
|  | 5743 | * \param original If non-NULL, will be set to the original filename. | 
|  | 5744 | * | 
|  | 5745 | * \param transformed If non-NULL, will be set to the filename that the original | 
|  | 5746 | * is associated with. | 
|  | 5747 | */ | 
|  | 5748 | CINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index, | 
|  | 5749 | CXString *original, CXString *transformed); | 
|  | 5750 |  | 
|  | 5751 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5752 | * Dispose the remapping. | 
| Argyrios Kyrtzidis | f89cc69 | 2011-07-11 20:15:00 +0000 | [diff] [blame] | 5753 | */ | 
|  | 5754 | CINDEX_LINKAGE void clang_remap_dispose(CXRemapping); | 
|  | 5755 |  | 
|  | 5756 | /** | 
|  | 5757 | * @} | 
|  | 5758 | */ | 
|  | 5759 |  | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5760 | /** \defgroup CINDEX_HIGH Higher level API functions | 
|  | 5761 | * | 
|  | 5762 | * @{ | 
|  | 5763 | */ | 
|  | 5764 |  | 
|  | 5765 | enum CXVisitorResult { | 
|  | 5766 | CXVisit_Break, | 
|  | 5767 | CXVisit_Continue | 
|  | 5768 | }; | 
|  | 5769 |  | 
| Saleem Abdulrasool | ec988b7 | 2016-05-24 01:23:24 +0000 | [diff] [blame] | 5770 | typedef struct CXCursorAndRangeVisitor { | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5771 | void *context; | 
|  | 5772 | enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange); | 
|  | 5773 | } CXCursorAndRangeVisitor; | 
|  | 5774 |  | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5775 | typedef enum { | 
|  | 5776 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5777 | * Function returned successfully. | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5778 | */ | 
|  | 5779 | CXResult_Success = 0, | 
|  | 5780 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5781 | * One of the parameters was invalid for the function. | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5782 | */ | 
|  | 5783 | CXResult_Invalid = 1, | 
|  | 5784 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5785 | * The function was terminated by a callback (e.g. it returned | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5786 | * CXVisit_Break) | 
|  | 5787 | */ | 
|  | 5788 | CXResult_VisitBreak = 2 | 
|  | 5789 |  | 
|  | 5790 | } CXResult; | 
|  | 5791 |  | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5792 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5793 | * Find references of a declaration in a specific file. | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5794 | * | 
|  | 5795 | * \param cursor pointing to a declaration or a reference of one. | 
|  | 5796 | * | 
|  | 5797 | * \param file to search for references. | 
|  | 5798 | * | 
|  | 5799 | * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for | 
|  | 5800 | * each reference found. | 
|  | 5801 | * The CXSourceRange will point inside the file; if the reference is inside | 
|  | 5802 | * a macro (and not a macro argument) the CXSourceRange will be invalid. | 
| Argyrios Kyrtzidis | 951f61f | 2013-03-08 20:42:33 +0000 | [diff] [blame] | 5803 | * | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5804 | * \returns one of the CXResult enumerators. | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5805 | */ | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5806 | CINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file, | 
|  | 5807 | CXCursorAndRangeVisitor visitor); | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5808 |  | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5809 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5810 | * Find #import/#include directives in a specific file. | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5811 | * | 
|  | 5812 | * \param TU translation unit containing the file to query. | 
|  | 5813 | * | 
|  | 5814 | * \param file to search for #import/#include directives. | 
|  | 5815 | * | 
|  | 5816 | * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for | 
|  | 5817 | * each directive found. | 
| Argyrios Kyrtzidis | 951f61f | 2013-03-08 20:42:33 +0000 | [diff] [blame] | 5818 | * | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5819 | * \returns one of the CXResult enumerators. | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5820 | */ | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5821 | CINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU, | 
|  | 5822 | CXFile file, | 
|  | 5823 | CXCursorAndRangeVisitor visitor); | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5824 |  | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5825 | #ifdef __has_feature | 
|  | 5826 | #  if __has_feature(blocks) | 
|  | 5827 |  | 
|  | 5828 | typedef enum CXVisitorResult | 
|  | 5829 | (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange); | 
|  | 5830 |  | 
|  | 5831 | CINDEX_LINKAGE | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5832 | CXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile, | 
|  | 5833 | CXCursorAndRangeVisitorBlock); | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5834 |  | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5835 | CINDEX_LINKAGE | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5836 | CXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile, | 
|  | 5837 | CXCursorAndRangeVisitorBlock); | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5838 |  | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5839 | #  endif | 
|  | 5840 | #endif | 
|  | 5841 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5842 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5843 | * The client's data object that is associated with a CXFile. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5844 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5845 | typedef void *CXIdxClientFile; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5846 |  | 
|  | 5847 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5848 | * The client's data object that is associated with a semantic entity. | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 5849 | */ | 
|  | 5850 | typedef void *CXIdxClientEntity; | 
|  | 5851 |  | 
|  | 5852 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5853 | * The client's data object that is associated with a semantic container | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5854 | * of entities. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5855 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5856 | typedef void *CXIdxClientContainer; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5857 |  | 
|  | 5858 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5859 | * The client's data object that is associated with an AST file (PCH | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5860 | * or module). | 
|  | 5861 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5862 | typedef void *CXIdxClientASTFile; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5863 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5864 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5865 | * Source location passed to index callbacks. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5866 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5867 | typedef struct { | 
|  | 5868 | void *ptr_data[2]; | 
|  | 5869 | unsigned int_data; | 
|  | 5870 | } CXIdxLoc; | 
|  | 5871 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5872 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5873 | * Data for ppIncludedFile callback. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5874 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5875 | typedef struct { | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5876 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5877 | * Location of '#' in the \#include/\#import directive. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5878 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5879 | CXIdxLoc hashLoc; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5880 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5881 | * Filename as written in the \#include/\#import directive. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5882 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5883 | const char *filename; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5884 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5885 | * The actual file that the \#include/\#import directive resolved to. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5886 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5887 | CXFile file; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5888 | int isImport; | 
|  | 5889 | int isAngled; | 
| Argyrios Kyrtzidis | 5e2ec48 | 2012-10-18 00:17:05 +0000 | [diff] [blame] | 5890 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5891 | * Non-zero if the directive was automatically turned into a module | 
| Argyrios Kyrtzidis | 5e2ec48 | 2012-10-18 00:17:05 +0000 | [diff] [blame] | 5892 | * import. | 
|  | 5893 | */ | 
|  | 5894 | int isModuleImport; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5895 | } CXIdxIncludedFileInfo; | 
|  | 5896 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5897 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5898 | * Data for IndexerCallbacks#importedASTFile. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5899 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5900 | typedef struct { | 
| Argyrios Kyrtzidis | 472eda0 | 2012-10-02 16:10:38 +0000 | [diff] [blame] | 5901 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5902 | * Top level AST file containing the imported PCH, module or submodule. | 
| Argyrios Kyrtzidis | 472eda0 | 2012-10-02 16:10:38 +0000 | [diff] [blame] | 5903 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5904 | CXFile file; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5905 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5906 | * The imported module or NULL if the AST file is a PCH. | 
| Argyrios Kyrtzidis | dc78f3e | 2012-10-05 00:22:40 +0000 | [diff] [blame] | 5907 | */ | 
|  | 5908 | CXModule module; | 
|  | 5909 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5910 | * Location where the file is imported. Applicable only for modules. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5911 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5912 | CXIdxLoc loc; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5913 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5914 | * Non-zero if an inclusion directive was automatically turned into | 
| Argyrios Kyrtzidis | dc78f3e | 2012-10-05 00:22:40 +0000 | [diff] [blame] | 5915 | * a module import. Applicable only for modules. | 
| Argyrios Kyrtzidis | 472eda0 | 2012-10-02 16:10:38 +0000 | [diff] [blame] | 5916 | */ | 
| Argyrios Kyrtzidis | 184b144 | 2012-10-03 21:05:44 +0000 | [diff] [blame] | 5917 | int isImplicit; | 
| Argyrios Kyrtzidis | 472eda0 | 2012-10-02 16:10:38 +0000 | [diff] [blame] | 5918 |  | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5919 | } CXIdxImportedASTFileInfo; | 
|  | 5920 |  | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5921 | typedef enum { | 
|  | 5922 | CXIdxEntity_Unexposed     = 0, | 
|  | 5923 | CXIdxEntity_Typedef       = 1, | 
|  | 5924 | CXIdxEntity_Function      = 2, | 
|  | 5925 | CXIdxEntity_Variable      = 3, | 
|  | 5926 | CXIdxEntity_Field         = 4, | 
|  | 5927 | CXIdxEntity_EnumConstant  = 5, | 
|  | 5928 |  | 
|  | 5929 | CXIdxEntity_ObjCClass     = 6, | 
|  | 5930 | CXIdxEntity_ObjCProtocol  = 7, | 
|  | 5931 | CXIdxEntity_ObjCCategory  = 8, | 
|  | 5932 |  | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 5933 | CXIdxEntity_ObjCInstanceMethod = 9, | 
|  | 5934 | CXIdxEntity_ObjCClassMethod    = 10, | 
|  | 5935 | CXIdxEntity_ObjCProperty  = 11, | 
|  | 5936 | CXIdxEntity_ObjCIvar      = 12, | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5937 |  | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 5938 | CXIdxEntity_Enum          = 13, | 
|  | 5939 | CXIdxEntity_Struct        = 14, | 
|  | 5940 | CXIdxEntity_Union         = 15, | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 5941 |  | 
|  | 5942 | CXIdxEntity_CXXClass              = 16, | 
|  | 5943 | CXIdxEntity_CXXNamespace          = 17, | 
|  | 5944 | CXIdxEntity_CXXNamespaceAlias     = 18, | 
|  | 5945 | CXIdxEntity_CXXStaticVariable     = 19, | 
|  | 5946 | CXIdxEntity_CXXStaticMethod       = 20, | 
|  | 5947 | CXIdxEntity_CXXInstanceMethod     = 21, | 
| Joao Matos | e9a3ed4 | 2012-08-31 22:18:20 +0000 | [diff] [blame] | 5948 | CXIdxEntity_CXXConstructor        = 22, | 
|  | 5949 | CXIdxEntity_CXXDestructor         = 23, | 
|  | 5950 | CXIdxEntity_CXXConversionFunction = 24, | 
|  | 5951 | CXIdxEntity_CXXTypeAlias          = 25, | 
|  | 5952 | CXIdxEntity_CXXInterface          = 26 | 
|  | 5953 |  | 
|  | 5954 | } CXIdxEntityKind; | 
|  | 5955 |  | 
| Argyrios Kyrtzidis | 5200288 | 2011-12-07 20:44:12 +0000 | [diff] [blame] | 5956 | typedef enum { | 
|  | 5957 | CXIdxEntityLang_None = 0, | 
|  | 5958 | CXIdxEntityLang_C    = 1, | 
|  | 5959 | CXIdxEntityLang_ObjC = 2, | 
| Argyrios Kyrtzidis | b4b85f2 | 2017-04-24 14:52:00 +0000 | [diff] [blame] | 5960 | CXIdxEntityLang_CXX  = 3, | 
|  | 5961 | CXIdxEntityLang_Swift  = 4 | 
| Argyrios Kyrtzidis | 5200288 | 2011-12-07 20:44:12 +0000 | [diff] [blame] | 5962 | } CXIdxEntityLanguage; | 
|  | 5963 |  | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 5964 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 5965 | * Extra C++ template information for an entity. This can apply to: | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 5966 | * CXIdxEntity_Function | 
|  | 5967 | * CXIdxEntity_CXXClass | 
|  | 5968 | * CXIdxEntity_CXXStaticMethod | 
|  | 5969 | * CXIdxEntity_CXXInstanceMethod | 
|  | 5970 | * CXIdxEntity_CXXConstructor | 
|  | 5971 | * CXIdxEntity_CXXConversionFunction | 
|  | 5972 | * CXIdxEntity_CXXTypeAlias | 
|  | 5973 | */ | 
|  | 5974 | typedef enum { | 
|  | 5975 | CXIdxEntity_NonTemplate   = 0, | 
|  | 5976 | CXIdxEntity_Template      = 1, | 
|  | 5977 | CXIdxEntity_TemplatePartialSpecialization = 2, | 
|  | 5978 | CXIdxEntity_TemplateSpecialization = 3 | 
|  | 5979 | } CXIdxEntityCXXTemplateKind; | 
|  | 5980 |  | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 5981 | typedef enum { | 
|  | 5982 | CXIdxAttr_Unexposed     = 0, | 
|  | 5983 | CXIdxAttr_IBAction      = 1, | 
|  | 5984 | CXIdxAttr_IBOutlet      = 2, | 
|  | 5985 | CXIdxAttr_IBOutletCollection = 3 | 
|  | 5986 | } CXIdxAttrKind; | 
|  | 5987 |  | 
|  | 5988 | typedef struct { | 
|  | 5989 | CXIdxAttrKind kind; | 
|  | 5990 | CXCursor cursor; | 
|  | 5991 | CXIdxLoc loc; | 
|  | 5992 | } CXIdxAttrInfo; | 
|  | 5993 |  | 
|  | 5994 | typedef struct { | 
| Argyrios Kyrtzidis | 4d873b7 | 2011-12-15 00:05:00 +0000 | [diff] [blame] | 5995 | CXIdxEntityKind kind; | 
|  | 5996 | CXIdxEntityCXXTemplateKind templateKind; | 
|  | 5997 | CXIdxEntityLanguage lang; | 
|  | 5998 | const char *name; | 
|  | 5999 | const char *USR; | 
|  | 6000 | CXCursor cursor; | 
|  | 6001 | const CXIdxAttrInfo *const *attributes; | 
|  | 6002 | unsigned numAttributes; | 
|  | 6003 | } CXIdxEntityInfo; | 
|  | 6004 |  | 
|  | 6005 | typedef struct { | 
|  | 6006 | CXCursor cursor; | 
|  | 6007 | } CXIdxContainerInfo; | 
|  | 6008 |  | 
|  | 6009 | typedef struct { | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6010 | const CXIdxAttrInfo *attrInfo; | 
|  | 6011 | const CXIdxEntityInfo *objcClass; | 
|  | 6012 | CXCursor classCursor; | 
|  | 6013 | CXIdxLoc classLoc; | 
|  | 6014 | } CXIdxIBOutletCollectionAttrInfo; | 
|  | 6015 |  | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6016 | typedef enum { | 
|  | 6017 | CXIdxDeclFlag_Skipped = 0x1 | 
|  | 6018 | } CXIdxDeclInfoFlags; | 
|  | 6019 |  | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6020 | typedef struct { | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6021 | const CXIdxEntityInfo *entityInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6022 | CXCursor cursor; | 
|  | 6023 | CXIdxLoc loc; | 
| Argyrios Kyrtzidis | 663c8ec | 2011-12-07 20:44:19 +0000 | [diff] [blame] | 6024 | const CXIdxContainerInfo *semanticContainer; | 
|  | 6025 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6026 | * Generally same as #semanticContainer but can be different in | 
| Argyrios Kyrtzidis | 663c8ec | 2011-12-07 20:44:19 +0000 | [diff] [blame] | 6027 | * cases like out-of-line C++ member functions. | 
|  | 6028 | */ | 
|  | 6029 | const CXIdxContainerInfo *lexicalContainer; | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6030 | int isRedeclaration; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6031 | int isDefinition; | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6032 | int isContainer; | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6033 | const CXIdxContainerInfo *declAsContainer; | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6034 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6035 | * Whether the declaration exists in code or was created implicitly | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 6036 | * by the compiler, e.g. implicit Objective-C methods for properties. | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6037 | */ | 
|  | 6038 | int isImplicit; | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6039 | const CXIdxAttrInfo *const *attributes; | 
|  | 6040 | unsigned numAttributes; | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6041 |  | 
|  | 6042 | unsigned flags; | 
|  | 6043 |  | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6044 | } CXIdxDeclInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6045 |  | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6046 | typedef enum { | 
|  | 6047 | CXIdxObjCContainer_ForwardRef = 0, | 
|  | 6048 | CXIdxObjCContainer_Interface = 1, | 
|  | 6049 | CXIdxObjCContainer_Implementation = 2 | 
|  | 6050 | } CXIdxObjCContainerKind; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6051 |  | 
|  | 6052 | typedef struct { | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6053 | const CXIdxDeclInfo *declInfo; | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6054 | CXIdxObjCContainerKind kind; | 
|  | 6055 | } CXIdxObjCContainerDeclInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6056 |  | 
|  | 6057 | typedef struct { | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6058 | const CXIdxEntityInfo *base; | 
|  | 6059 | CXCursor cursor; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6060 | CXIdxLoc loc; | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6061 | } CXIdxBaseClassInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6062 |  | 
|  | 6063 | typedef struct { | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6064 | const CXIdxEntityInfo *protocol; | 
|  | 6065 | CXCursor cursor; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6066 | CXIdxLoc loc; | 
|  | 6067 | } CXIdxObjCProtocolRefInfo; | 
|  | 6068 |  | 
|  | 6069 | typedef struct { | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6070 | const CXIdxObjCProtocolRefInfo *const *protocols; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6071 | unsigned numProtocols; | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6072 | } CXIdxObjCProtocolRefListInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6073 |  | 
|  | 6074 | typedef struct { | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6075 | const CXIdxObjCContainerDeclInfo *containerInfo; | 
|  | 6076 | const CXIdxBaseClassInfo *superInfo; | 
|  | 6077 | const CXIdxObjCProtocolRefListInfo *protocols; | 
|  | 6078 | } CXIdxObjCInterfaceDeclInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6079 |  | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6080 | typedef struct { | 
| Argyrios Kyrtzidis | 9b9f7a9 | 2011-12-13 18:47:45 +0000 | [diff] [blame] | 6081 | const CXIdxObjCContainerDeclInfo *containerInfo; | 
|  | 6082 | const CXIdxEntityInfo *objcClass; | 
|  | 6083 | CXCursor classCursor; | 
|  | 6084 | CXIdxLoc classLoc; | 
|  | 6085 | const CXIdxObjCProtocolRefListInfo *protocols; | 
|  | 6086 | } CXIdxObjCCategoryDeclInfo; | 
|  | 6087 |  | 
|  | 6088 | typedef struct { | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6089 | const CXIdxDeclInfo *declInfo; | 
| Argyrios Kyrtzidis | 93db292 | 2012-02-28 17:50:33 +0000 | [diff] [blame] | 6090 | const CXIdxEntityInfo *getter; | 
|  | 6091 | const CXIdxEntityInfo *setter; | 
|  | 6092 | } CXIdxObjCPropertyDeclInfo; | 
|  | 6093 |  | 
|  | 6094 | typedef struct { | 
|  | 6095 | const CXIdxDeclInfo *declInfo; | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6096 | const CXIdxBaseClassInfo *const *bases; | 
|  | 6097 | unsigned numBases; | 
|  | 6098 | } CXIdxCXXClassDeclInfo; | 
|  | 6099 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6100 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6101 | * Data for IndexerCallbacks#indexEntityReference. | 
| Fangrui Song | 31b9719 | 2018-02-12 17:42:09 +0000 | [diff] [blame] | 6102 | * | 
|  | 6103 | * This may be deprecated in a future version as this duplicates | 
|  | 6104 | * the \c CXSymbolRole_Implicit bit in \c CXSymbolRole. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6105 | */ | 
| Argyrios Kyrtzidis | 0c7735e5 | 2011-10-18 15:50:50 +0000 | [diff] [blame] | 6106 | typedef enum { | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6107 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6108 | * The entity is referenced directly in user's code. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6109 | */ | 
| Argyrios Kyrtzidis | 0c7735e5 | 2011-10-18 15:50:50 +0000 | [diff] [blame] | 6110 | CXIdxEntityRef_Direct = 1, | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6111 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6112 | * An implicit reference, e.g. a reference of an Objective-C method | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 6113 | * via the dot syntax. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6114 | */ | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6115 | CXIdxEntityRef_Implicit = 2 | 
| Argyrios Kyrtzidis | 0c7735e5 | 2011-10-18 15:50:50 +0000 | [diff] [blame] | 6116 | } CXIdxEntityRefKind; | 
|  | 6117 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6118 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6119 | * Roles that are attributed to symbol occurrences. | 
| Fangrui Song | 31b9719 | 2018-02-12 17:42:09 +0000 | [diff] [blame] | 6120 | * | 
|  | 6121 | * Internal: this currently mirrors low 9 bits of clang::index::SymbolRole with | 
|  | 6122 | * higher bits zeroed. These high bits may be exposed in the future. | 
|  | 6123 | */ | 
|  | 6124 | typedef enum { | 
|  | 6125 | CXSymbolRole_None = 0, | 
|  | 6126 | CXSymbolRole_Declaration = 1 << 0, | 
|  | 6127 | CXSymbolRole_Definition = 1 << 1, | 
|  | 6128 | CXSymbolRole_Reference = 1 << 2, | 
|  | 6129 | CXSymbolRole_Read = 1 << 3, | 
|  | 6130 | CXSymbolRole_Write = 1 << 4, | 
|  | 6131 | CXSymbolRole_Call = 1 << 5, | 
|  | 6132 | CXSymbolRole_Dynamic = 1 << 6, | 
|  | 6133 | CXSymbolRole_AddressOf = 1 << 7, | 
|  | 6134 | CXSymbolRole_Implicit = 1 << 8 | 
|  | 6135 | } CXSymbolRole; | 
|  | 6136 |  | 
|  | 6137 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6138 | * Data for IndexerCallbacks#indexEntityReference. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6139 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6140 | typedef struct { | 
| Argyrios Kyrtzidis | 663c8ec | 2011-12-07 20:44:19 +0000 | [diff] [blame] | 6141 | CXIdxEntityRefKind kind; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6142 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6143 | * Reference cursor. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6144 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6145 | CXCursor cursor; | 
|  | 6146 | CXIdxLoc loc; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6147 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6148 | * The entity that gets referenced. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6149 | */ | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6150 | const CXIdxEntityInfo *referencedEntity; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6151 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6152 | * Immediate "parent" of the reference. For example: | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6153 | * | 
|  | 6154 | * \code | 
|  | 6155 | * Foo *var; | 
|  | 6156 | * \endcode | 
|  | 6157 | * | 
|  | 6158 | * The parent of reference of type 'Foo' is the variable 'var'. | 
| Argyrios Kyrtzidis | 25cb0ff | 2011-12-13 18:47:41 +0000 | [diff] [blame] | 6159 | * For references inside statement bodies of functions/methods, | 
|  | 6160 | * the parentEntity will be the function/method. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6161 | */ | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6162 | const CXIdxEntityInfo *parentEntity; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6163 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6164 | * Lexical container context of the reference. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6165 | */ | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6166 | const CXIdxContainerInfo *container; | 
| Fangrui Song | 31b9719 | 2018-02-12 17:42:09 +0000 | [diff] [blame] | 6167 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6168 | * Sets of symbol roles of the reference. | 
| Fangrui Song | 31b9719 | 2018-02-12 17:42:09 +0000 | [diff] [blame] | 6169 | */ | 
|  | 6170 | CXSymbolRole role; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6171 | } CXIdxEntityRefInfo; | 
|  | 6172 |  | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6173 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6174 | * A group of callbacks used by #clang_indexSourceFile and | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6175 | * #clang_indexTranslationUnit. | 
|  | 6176 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6177 | typedef struct { | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6178 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6179 | * Called periodically to check whether indexing should be aborted. | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6180 | * Should return 0 to continue, and non-zero to abort. | 
|  | 6181 | */ | 
|  | 6182 | int (*abortQuery)(CXClientData client_data, void *reserved); | 
|  | 6183 |  | 
|  | 6184 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6185 | * Called at the end of indexing; passes the complete diagnostic set. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6186 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6187 | void (*diagnostic)(CXClientData client_data, | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6188 | CXDiagnosticSet, void *reserved); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6189 |  | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6190 | CXIdxClientFile (*enteredMainFile)(CXClientData client_data, | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6191 | CXFile mainFile, void *reserved); | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6192 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6193 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6194 | * Called when a file gets \#included/\#imported. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6195 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6196 | CXIdxClientFile (*ppIncludedFile)(CXClientData client_data, | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6197 | const CXIdxIncludedFileInfo *); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6198 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6199 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6200 | * Called when a AST file (PCH or module) gets imported. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6201 | * | 
|  | 6202 | * AST files will not get indexed (there will not be callbacks to index all | 
|  | 6203 | * the entities in an AST file). The recommended action is that, if the AST | 
| Argyrios Kyrtzidis | 472eda0 | 2012-10-02 16:10:38 +0000 | [diff] [blame] | 6204 | * file is not already indexed, to initiate a new indexing job specific to | 
|  | 6205 | * the AST file. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6206 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6207 | CXIdxClientASTFile (*importedASTFile)(CXClientData client_data, | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6208 | const CXIdxImportedASTFileInfo *); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6209 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6210 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6211 | * Called at the beginning of indexing a translation unit. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6212 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6213 | CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data, | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6214 | void *reserved); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6215 |  | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6216 | void (*indexDeclaration)(CXClientData client_data, | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6217 | const CXIdxDeclInfo *); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6218 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6219 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6220 | * Called to index a reference of an entity. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6221 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6222 | void (*indexEntityReference)(CXClientData client_data, | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6223 | const CXIdxEntityRefInfo *); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6224 |  | 
|  | 6225 | } IndexerCallbacks; | 
|  | 6226 |  | 
| NAKAMURA Takumi | aacef7e | 2011-11-11 02:51:09 +0000 | [diff] [blame] | 6227 | CINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind); | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6228 | CINDEX_LINKAGE const CXIdxObjCContainerDeclInfo * | 
|  | 6229 | clang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *); | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6230 |  | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6231 | CINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo * | 
|  | 6232 | clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *); | 
|  | 6233 |  | 
| NAKAMURA Takumi | aacef7e | 2011-11-11 02:51:09 +0000 | [diff] [blame] | 6234 | CINDEX_LINKAGE | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6235 | const CXIdxObjCCategoryDeclInfo * | 
|  | 6236 | clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *); | 
|  | 6237 |  | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6238 | CINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo * | 
|  | 6239 | clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *); | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6240 |  | 
| Argyrios Kyrtzidis | 93db292 | 2012-02-28 17:50:33 +0000 | [diff] [blame] | 6241 | CINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo * | 
|  | 6242 | clang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *); | 
|  | 6243 |  | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6244 | CINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo * | 
|  | 6245 | clang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *); | 
|  | 6246 |  | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6247 | CINDEX_LINKAGE const CXIdxCXXClassDeclInfo * | 
|  | 6248 | clang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *); | 
|  | 6249 |  | 
|  | 6250 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6251 | * For retrieving a custom CXIdxClientContainer attached to a | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6252 | * container. | 
|  | 6253 | */ | 
|  | 6254 | CINDEX_LINKAGE CXIdxClientContainer | 
|  | 6255 | clang_index_getClientContainer(const CXIdxContainerInfo *); | 
|  | 6256 |  | 
|  | 6257 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6258 | * For setting a custom CXIdxClientContainer attached to a | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6259 | * container. | 
|  | 6260 | */ | 
|  | 6261 | CINDEX_LINKAGE void | 
|  | 6262 | clang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer); | 
|  | 6263 |  | 
|  | 6264 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6265 | * For retrieving a custom CXIdxClientEntity attached to an entity. | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6266 | */ | 
|  | 6267 | CINDEX_LINKAGE CXIdxClientEntity | 
|  | 6268 | clang_index_getClientEntity(const CXIdxEntityInfo *); | 
|  | 6269 |  | 
|  | 6270 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6271 | * For setting a custom CXIdxClientEntity attached to an entity. | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6272 | */ | 
|  | 6273 | CINDEX_LINKAGE void | 
|  | 6274 | clang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity); | 
|  | 6275 |  | 
|  | 6276 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6277 | * An indexing action/session, to be applied to one or multiple | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6278 | * translation units. | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6279 | */ | 
|  | 6280 | typedef void *CXIndexAction; | 
|  | 6281 |  | 
|  | 6282 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6283 | * An indexing action/session, to be applied to one or multiple | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6284 | * translation units. | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6285 | * | 
|  | 6286 | * \param CIdx The index object with which the index action will be associated. | 
|  | 6287 | */ | 
|  | 6288 | CINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx); | 
|  | 6289 |  | 
|  | 6290 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6291 | * Destroy the given index action. | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6292 | * | 
|  | 6293 | * The index action must not be destroyed until all of the translation units | 
|  | 6294 | * created within that index action have been destroyed. | 
|  | 6295 | */ | 
|  | 6296 | CINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction); | 
|  | 6297 |  | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6298 | typedef enum { | 
|  | 6299 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6300 | * Used to indicate that no special indexing options are needed. | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6301 | */ | 
|  | 6302 | CXIndexOpt_None = 0x0, | 
|  | 6303 |  | 
|  | 6304 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6305 | * Used to indicate that IndexerCallbacks#indexEntityReference should | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6306 | * be invoked for only one reference of an entity per source file that does | 
|  | 6307 | * not also include a declaration/definition of the entity. | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6308 | */ | 
| Argyrios Kyrtzidis | fb7d145 | 2012-01-14 00:11:49 +0000 | [diff] [blame] | 6309 | CXIndexOpt_SuppressRedundantRefs = 0x1, | 
|  | 6310 |  | 
|  | 6311 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6312 | * Function-local symbols should be indexed. If this is not set | 
| Argyrios Kyrtzidis | fb7d145 | 2012-01-14 00:11:49 +0000 | [diff] [blame] | 6313 | * function-local symbols will be ignored. | 
|  | 6314 | */ | 
| Argyrios Kyrtzidis | 7e74795 | 2012-02-14 22:23:11 +0000 | [diff] [blame] | 6315 | CXIndexOpt_IndexFunctionLocalSymbols = 0x2, | 
|  | 6316 |  | 
|  | 6317 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6318 | * Implicit function/class template instantiations should be indexed. | 
| Argyrios Kyrtzidis | 7e74795 | 2012-02-14 22:23:11 +0000 | [diff] [blame] | 6319 | * If this is not set, implicit instantiations will be ignored. | 
|  | 6320 | */ | 
| Argyrios Kyrtzidis | 6c9ed7d | 2012-03-27 21:38:03 +0000 | [diff] [blame] | 6321 | CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4, | 
|  | 6322 |  | 
|  | 6323 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6324 | * Suppress all compiler warnings when parsing for indexing. | 
| Argyrios Kyrtzidis | 6c9ed7d | 2012-03-27 21:38:03 +0000 | [diff] [blame] | 6325 | */ | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6326 | CXIndexOpt_SuppressWarnings = 0x8, | 
|  | 6327 |  | 
|  | 6328 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6329 | * Skip a function/method body that was already parsed during an | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 6330 | * indexing session associated with a \c CXIndexAction object. | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6331 | * Bodies in system headers are always skipped. | 
|  | 6332 | */ | 
|  | 6333 | CXIndexOpt_SkipParsedBodiesInSession = 0x10 | 
|  | 6334 |  | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6335 | } CXIndexOptFlags; | 
|  | 6336 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6337 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6338 | * Index the given source file and the translation unit corresponding | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6339 | * to that file via callbacks implemented through #IndexerCallbacks. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6340 | * | 
|  | 6341 | * \param client_data pointer data supplied by the client, which will | 
|  | 6342 | * be passed to the invoked callbacks. | 
|  | 6343 | * | 
|  | 6344 | * \param index_callbacks Pointer to indexing callbacks that the client | 
|  | 6345 | * implements. | 
|  | 6346 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6347 | * \param index_callbacks_size Size of #IndexerCallbacks structure that gets | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6348 | * passed in index_callbacks. | 
|  | 6349 | * | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6350 | * \param index_options A bitmask of options that affects how indexing is | 
|  | 6351 | * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6352 | * | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 6353 | * \param[out] out_TU pointer to store a \c CXTranslationUnit that can be | 
|  | 6354 | * reused after indexing is finished. Set to \c NULL if you do not require it. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6355 | * | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 6356 | * \returns 0 on success or if there were errors from which the compiler could | 
| Eric Christopher | 2c4555a | 2015-06-19 01:52:53 +0000 | [diff] [blame] | 6357 | * recover.  If there is a failure from which there is no recovery, returns | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 6358 | * a non-zero \c CXErrorCode. | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6359 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6360 | * The rest of the parameters are the same as #clang_parseTranslationUnit. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6361 | */ | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6362 | CINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction, | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6363 | CXClientData client_data, | 
|  | 6364 | IndexerCallbacks *index_callbacks, | 
|  | 6365 | unsigned index_callbacks_size, | 
|  | 6366 | unsigned index_options, | 
|  | 6367 | const char *source_filename, | 
|  | 6368 | const char * const *command_line_args, | 
|  | 6369 | int num_command_line_args, | 
|  | 6370 | struct CXUnsavedFile *unsaved_files, | 
|  | 6371 | unsigned num_unsaved_files, | 
|  | 6372 | CXTranslationUnit *out_TU, | 
|  | 6373 | unsigned TU_options); | 
|  | 6374 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6375 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6376 | * Same as clang_indexSourceFile but requires a full command line | 
| Benjamin Kramer | c02670e | 2015-11-18 16:14:27 +0000 | [diff] [blame] | 6377 | * for \c command_line_args including argv[0]. This is useful if the standard | 
|  | 6378 | * library paths are relative to the binary. | 
|  | 6379 | */ | 
|  | 6380 | CINDEX_LINKAGE int clang_indexSourceFileFullArgv( | 
|  | 6381 | CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks, | 
|  | 6382 | unsigned index_callbacks_size, unsigned index_options, | 
|  | 6383 | const char *source_filename, const char *const *command_line_args, | 
|  | 6384 | int num_command_line_args, struct CXUnsavedFile *unsaved_files, | 
|  | 6385 | unsigned num_unsaved_files, CXTranslationUnit *out_TU, unsigned TU_options); | 
|  | 6386 |  | 
|  | 6387 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6388 | * Index the given translation unit via callbacks implemented through | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6389 | * #IndexerCallbacks. | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6390 | * | 
|  | 6391 | * The order of callback invocations is not guaranteed to be the same as | 
|  | 6392 | * when indexing a source file. The high level order will be: | 
|  | 6393 | * | 
|  | 6394 | *   -Preprocessor callbacks invocations | 
|  | 6395 | *   -Declaration/reference callbacks invocations | 
|  | 6396 | *   -Diagnostic callback invocations | 
|  | 6397 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6398 | * The parameters are the same as #clang_indexSourceFile. | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6399 | * | 
| Eric Christopher | 2c4555a | 2015-06-19 01:52:53 +0000 | [diff] [blame] | 6400 | * \returns If there is a failure from which there is no recovery, returns | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6401 | * non-zero, otherwise returns 0. | 
|  | 6402 | */ | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6403 | CINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction, | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6404 | CXClientData client_data, | 
|  | 6405 | IndexerCallbacks *index_callbacks, | 
|  | 6406 | unsigned index_callbacks_size, | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6407 | unsigned index_options, | 
|  | 6408 | CXTranslationUnit); | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6409 |  | 
|  | 6410 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6411 | * Retrieve the CXIdxFile, file, line, column, and offset represented by | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6412 | * the given CXIdxLoc. | 
|  | 6413 | * | 
|  | 6414 | * If the location refers into a macro expansion, retrieves the | 
|  | 6415 | * location of the macro expansion and if it refers into a macro argument | 
|  | 6416 | * retrieves the location of the argument. | 
|  | 6417 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6418 | CINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc, | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6419 | CXIdxClientFile *indexFile, | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6420 | CXFile *file, | 
|  | 6421 | unsigned *line, | 
|  | 6422 | unsigned *column, | 
|  | 6423 | unsigned *offset); | 
|  | 6424 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6425 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6426 | * Retrieve the CXSourceLocation represented by the given CXIdxLoc. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6427 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6428 | CINDEX_LINKAGE | 
|  | 6429 | CXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc); | 
|  | 6430 |  | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 6431 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6432 | * Visitor invoked for each field found by a traversal. | 
| Argyrios Kyrtzidis | 2bff516 | 2015-04-13 16:55:04 +0000 | [diff] [blame] | 6433 | * | 
|  | 6434 | * This visitor function will be invoked for each field found by | 
|  | 6435 | * \c clang_Type_visitFields. Its first argument is the cursor being | 
|  | 6436 | * visited, its second argument is the client data provided to | 
|  | 6437 | * \c clang_Type_visitFields. | 
|  | 6438 | * | 
|  | 6439 | * The visitor should return one of the \c CXVisitorResult values | 
|  | 6440 | * to direct \c clang_Type_visitFields. | 
|  | 6441 | */ | 
|  | 6442 | typedef enum CXVisitorResult (*CXFieldVisitor)(CXCursor C, | 
|  | 6443 | CXClientData client_data); | 
|  | 6444 |  | 
|  | 6445 | /** | 
| Adrian Prantl | 9fc8faf | 2018-05-09 01:00:01 +0000 | [diff] [blame^] | 6446 | * Visit the fields of a particular type. | 
| Argyrios Kyrtzidis | 2bff516 | 2015-04-13 16:55:04 +0000 | [diff] [blame] | 6447 | * | 
|  | 6448 | * This function visits all the direct fields of the given cursor, | 
|  | 6449 | * invoking the given \p visitor function with the cursors of each | 
|  | 6450 | * visited field. The traversal may be ended prematurely, if | 
|  | 6451 | * the visitor returns \c CXFieldVisit_Break. | 
|  | 6452 | * | 
|  | 6453 | * \param T the record type whose field may be visited. | 
|  | 6454 | * | 
|  | 6455 | * \param visitor the visitor function that will be invoked for each | 
|  | 6456 | * field of \p T. | 
|  | 6457 | * | 
|  | 6458 | * \param client_data pointer data supplied by the client, which will | 
|  | 6459 | * be passed to the visitor each time it is invoked. | 
|  | 6460 | * | 
|  | 6461 | * \returns a non-zero value if the traversal was terminated | 
|  | 6462 | * prematurely by the visitor returning \c CXFieldVisit_Break. | 
|  | 6463 | */ | 
|  | 6464 | CINDEX_LINKAGE unsigned clang_Type_visitFields(CXType T, | 
|  | 6465 | CXFieldVisitor visitor, | 
|  | 6466 | CXClientData client_data); | 
|  | 6467 |  | 
| Argyrios Kyrtzidis | 2bff516 | 2015-04-13 16:55:04 +0000 | [diff] [blame] | 6468 | /** | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 6469 | * @} | 
|  | 6470 | */ | 
|  | 6471 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 6472 | /** | 
|  | 6473 | * @} | 
|  | 6474 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 6475 |  | 
| Ted Kremenek | b60d87c | 2009-08-26 22:36:44 +0000 | [diff] [blame] | 6476 | #ifdef __cplusplus | 
|  | 6477 | } | 
|  | 6478 | #endif | 
|  | 6479 | #endif |