| 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 | /** | 
|  | 27 | * \brief The version constants for the libclang API. | 
|  | 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 | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 35 | #define CINDEX_VERSION_MINOR 47 | 
| 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 | /** | 
|  | 78 | * \brief An "index" that consists of a set of translation units that would | 
|  | 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 | /** | 
| Emilio Cobos Alvarez | 485ad42 | 2017-04-28 15:56:39 +0000 | [diff] [blame] | 84 | * \brief An opaque type representing target information for a given translation | 
|  | 85 | * unit. | 
|  | 86 | */ | 
|  | 87 | typedef struct CXTargetInfoImpl *CXTargetInfo; | 
|  | 88 |  | 
|  | 89 | /** | 
| Douglas Gregor | 802f12f | 2010-01-20 22:28:27 +0000 | [diff] [blame] | 90 | * \brief A single translation unit, which resides in an index. | 
|  | 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 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 95 | * \brief Opaque pointer representing client data that will be passed through | 
|  | 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 | /** | 
|  | 101 | * \brief Provides the contents of a file that has not yet been saved to disk. | 
|  | 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 | /** | 
|  | 109 | * \brief 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 | /** | 
| Douglas Gregor | 89a56c5 | 2010-02-27 01:32:48 +0000 | [diff] [blame] | 116 | * \brief 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 | /** | 
| Douglas Gregor | 89a56c5 | 2010-02-27 01:32:48 +0000 | [diff] [blame] | 121 | * \brief 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 | /** | 
|  | 127 | * \brief Describes the availability of a particular entity, which indicates | 
|  | 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 | /** | 
|  | 133 | * \brief The entity is available. | 
|  | 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 | /** | 
|  | 137 | * \brief The entity is available, but has been deprecated (and its use is | 
|  | 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 | /** | 
|  | 142 | * \brief The entity is not available; any use of it will be an error. | 
|  | 143 | */ | 
| Erik Verbruggen | 2e657ff | 2011-10-06 07:27:49 +0000 | [diff] [blame] | 144 | CXAvailability_NotAvailable, | 
|  | 145 | /** | 
|  | 146 | * \brief The entity is available, but not accessible; any use of it will be | 
|  | 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 | /** | 
|  | 153 | * \brief Describes a version number of the form major.minor.subminor. | 
|  | 154 | */ | 
|  | 155 | typedef struct CXVersion { | 
|  | 156 | /** | 
|  | 157 | * \brief The major version number, e.g., the '10' in '10.7.3'. A negative | 
|  | 158 | * value indicates that there is no version number at all. | 
|  | 159 | */ | 
|  | 160 | int Major; | 
|  | 161 | /** | 
|  | 162 | * \brief The minor version number, e.g., the '7' in '10.7.3'. This value | 
|  | 163 | * will be negative if no minor version number was provided, e.g., for | 
|  | 164 | * version '10'. | 
|  | 165 | */ | 
|  | 166 | int Minor; | 
|  | 167 | /** | 
|  | 168 | * \brief The subminor version number, e.g., the '3' in '10.7.3'. This value | 
|  | 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 | /** | 
|  | 176 | * \brief Describes the exception specification of a cursor. | 
|  | 177 | * | 
|  | 178 | * A negative value indicates that the cursor is not a function declaration. | 
|  | 179 | */ | 
|  | 180 | enum CXCursor_ExceptionSpecificationKind { | 
|  | 181 |  | 
|  | 182 | /** | 
|  | 183 | * \brief The cursor has no exception specification. | 
|  | 184 | */ | 
|  | 185 | CXCursor_ExceptionSpecificationKind_None, | 
|  | 186 |  | 
|  | 187 | /** | 
|  | 188 | * \brief The cursor has exception specification throw() | 
|  | 189 | */ | 
|  | 190 | CXCursor_ExceptionSpecificationKind_DynamicNone, | 
|  | 191 |  | 
|  | 192 | /** | 
|  | 193 | * \brief The cursor has exception specification throw(T1, T2) | 
|  | 194 | */ | 
|  | 195 | CXCursor_ExceptionSpecificationKind_Dynamic, | 
|  | 196 |  | 
|  | 197 | /** | 
|  | 198 | * \brief The cursor has exception specification throw(...). | 
|  | 199 | */ | 
|  | 200 | CXCursor_ExceptionSpecificationKind_MSAny, | 
|  | 201 |  | 
|  | 202 | /** | 
|  | 203 | * \brief The cursor has exception specification basic noexcept. | 
|  | 204 | */ | 
|  | 205 | CXCursor_ExceptionSpecificationKind_BasicNoexcept, | 
|  | 206 |  | 
|  | 207 | /** | 
|  | 208 | * \brief The cursor has exception specification computed noexcept. | 
|  | 209 | */ | 
|  | 210 | CXCursor_ExceptionSpecificationKind_ComputedNoexcept, | 
|  | 211 |  | 
|  | 212 | /** | 
|  | 213 | * \brief The exception specification has not yet been evaluated. | 
|  | 214 | */ | 
|  | 215 | CXCursor_ExceptionSpecificationKind_Unevaluated, | 
|  | 216 |  | 
|  | 217 | /** | 
|  | 218 | * \brief The exception specification has not yet been instantiated. | 
|  | 219 | */ | 
|  | 220 | CXCursor_ExceptionSpecificationKind_Uninstantiated, | 
|  | 221 |  | 
|  | 222 | /** | 
|  | 223 | * \brief The exception specification has not been parsed yet. | 
|  | 224 | */ | 
|  | 225 | CXCursor_ExceptionSpecificationKind_Unparsed | 
|  | 226 | }; | 
|  | 227 |  | 
| Douglas Gregor | 802f12f | 2010-01-20 22:28:27 +0000 | [diff] [blame] | 228 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 229 | * \brief Provides a shared context for creating translation units. | 
|  | 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 | /** | 
|  | 272 | * \brief Destroy the given index. | 
|  | 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 | /** | 
|  | 281 | * \brief Used to indicate that no special CXIndex options are needed. | 
|  | 282 | */ | 
|  | 283 | CXGlobalOpt_None = 0x0, | 
|  | 284 |  | 
|  | 285 | /** | 
|  | 286 | * \brief Used to indicate that threads that libclang creates for indexing | 
|  | 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 | /** | 
|  | 295 | * \brief Used to indicate that threads that libclang creates for editing | 
|  | 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 | /** | 
|  | 304 | * \brief Used to indicate that all threads that libclang creates should use | 
|  | 305 | * background priority. | 
|  | 306 | */ | 
|  | 307 | CXGlobalOpt_ThreadBackgroundPriorityForAll = | 
|  | 308 | CXGlobalOpt_ThreadBackgroundPriorityForIndexing | | 
|  | 309 | CXGlobalOpt_ThreadBackgroundPriorityForEditing | 
|  | 310 |  | 
|  | 311 | } CXGlobalOptFlags; | 
|  | 312 |  | 
|  | 313 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 314 | * \brief 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 | /** | 
|  | 329 | * \brief Gets the general options associated with a CXIndex. | 
|  | 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 | /** | 
| Alex Lorenz | 0861579 | 2017-12-04 21:56:36 +0000 | [diff] [blame] | 337 | * \brief Sets the invocation emission path option in a CXIndex. | 
|  | 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 | /** | 
|  | 353 | * \brief A particular source file that is part of a translation unit. | 
|  | 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 | /** | 
|  | 358 | * \brief 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 | /** | 
|  | 363 | * \brief Retrieve the last modification time of the given file. | 
|  | 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 | /** | 
| Argyrios Kyrtzidis | ac08b26 | 2013-01-26 04:52:52 +0000 | [diff] [blame] | 368 | * \brief Uniquely identifies a CXFile, that refers to the same underlying file, | 
|  | 369 | * across an indexing session. | 
|  | 370 | */ | 
|  | 371 | typedef struct { | 
|  | 372 | unsigned long long data[3]; | 
|  | 373 | } CXFileUniqueID; | 
|  | 374 |  | 
|  | 375 | /** | 
|  | 376 | * \brief Retrieve the unique ID for the given \c file. | 
|  | 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 | /** | 
| Douglas Gregor | 37aa493 | 2011-05-04 00:14:37 +0000 | [diff] [blame] | 386 | * \brief Determine whether the given header is guarded against | 
|  | 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 | /** | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 394 | * \brief Retrieve a file handle within the given translation unit. | 
|  | 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 | /** | 
| Erik Verbruggen | 3afa3ce | 2017-12-06 09:02:52 +0000 | [diff] [blame] | 407 | * \brief Retrieve the buffer associated with the given file. | 
|  | 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 | /** | 
| Argyrios Kyrtzidis | ac3997e | 2014-08-16 00:26:19 +0000 | [diff] [blame] | 422 | * \brief Returns non-zero if the \c file1 and \c file2 point to the same file, | 
|  | 423 | * or they are both NULL. | 
|  | 424 | */ | 
|  | 425 | CINDEX_LINKAGE int clang_File_isEqual(CXFile file1, CXFile file2); | 
|  | 426 |  | 
|  | 427 | /** | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 428 | * @} | 
|  | 429 | */ | 
|  | 430 |  | 
|  | 431 | /** | 
|  | 432 | * \defgroup CINDEX_LOCATIONS Physical source locations | 
|  | 433 | * | 
|  | 434 | * Clang represents physical source locations in its abstract syntax tree in | 
|  | 435 | * great detail, with file, line, and column information for the majority of | 
|  | 436 | * the tokens parsed in the source code. These data types and functions are | 
|  | 437 | * used to represent source location information, either for a particular | 
|  | 438 | * point in the program or for a range of points in the program, and extract | 
|  | 439 | * specific location information from those data types. | 
|  | 440 | * | 
|  | 441 | * @{ | 
|  | 442 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 443 |  | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 444 | /** | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 445 | * \brief Identifies a specific source location within a translation | 
|  | 446 | * unit. | 
|  | 447 | * | 
| Chandler Carruth | 4aa01ef | 2011-08-31 16:53:37 +0000 | [diff] [blame] | 448 | * Use clang_getExpansionLocation() or clang_getSpellingLocation() | 
| Douglas Gregor | 229bebd | 2010-11-09 06:24:54 +0000 | [diff] [blame] | 449 | * to map a source location to a particular file, line, and column. | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 450 | */ | 
|  | 451 | typedef struct { | 
| Argyrios Kyrtzidis | 49d9d029 | 2013-01-11 22:29:47 +0000 | [diff] [blame] | 452 | const void *ptr_data[2]; | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 453 | unsigned int_data; | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 454 | } CXSourceLocation; | 
| Ted Kremenek | a44d99c | 2010-01-05 23:18:49 +0000 | [diff] [blame] | 455 |  | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 456 | /** | 
| Daniel Dunbar | 02968e5 | 2010-02-14 10:02:57 +0000 | [diff] [blame] | 457 | * \brief Identifies a half-open character range in the source code. | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 458 | * | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 459 | * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the | 
|  | 460 | * starting and end locations from a source range, respectively. | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 461 | */ | 
|  | 462 | typedef struct { | 
| Argyrios Kyrtzidis | 49d9d029 | 2013-01-11 22:29:47 +0000 | [diff] [blame] | 463 | const void *ptr_data[2]; | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 464 | unsigned begin_int_data; | 
|  | 465 | unsigned end_int_data; | 
| Douglas Gregor | 49c4baf | 2010-01-18 22:13:09 +0000 | [diff] [blame] | 466 | } CXSourceRange; | 
| Ted Kremenek | a44d99c | 2010-01-05 23:18:49 +0000 | [diff] [blame] | 467 |  | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 468 | /** | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 469 | * \brief Retrieve a NULL (invalid) source location. | 
|  | 470 | */ | 
| NAKAMURA Takumi | eacd667 | 2013-01-10 02:12:38 +0000 | [diff] [blame] | 471 | CINDEX_LINKAGE CXSourceLocation clang_getNullLocation(void); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 472 |  | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 473 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 474 | * \brief Determine whether two source locations, which must refer into | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 475 | * 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] | 476 | * code. | 
|  | 477 | * | 
|  | 478 | * \returns non-zero if the source locations refer to the same location, zero | 
|  | 479 | * if they refer to different locations. | 
|  | 480 | */ | 
|  | 481 | CINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1, | 
|  | 482 | CXSourceLocation loc2); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 483 |  | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 484 | /** | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 485 | * \brief Retrieves the source location associated with a given file/line/column | 
|  | 486 | * in a particular translation unit. | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 487 | */ | 
|  | 488 | CINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu, | 
|  | 489 | CXFile file, | 
|  | 490 | unsigned line, | 
|  | 491 | unsigned column); | 
| David Chisnall | 2e16ac5 | 2010-10-15 17:07:39 +0000 | [diff] [blame] | 492 | /** | 
|  | 493 | * \brief Retrieves the source location associated with a given character offset | 
|  | 494 | * in a particular translation unit. | 
|  | 495 | */ | 
|  | 496 | CINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu, | 
|  | 497 | CXFile file, | 
|  | 498 | unsigned offset); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 499 |  | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 500 | /** | 
| Argyrios Kyrtzidis | 25f7af1 | 2013-04-12 17:06:51 +0000 | [diff] [blame] | 501 | * \brief Returns non-zero if the given source location is in a system header. | 
|  | 502 | */ | 
|  | 503 | CINDEX_LINKAGE int clang_Location_isInSystemHeader(CXSourceLocation location); | 
|  | 504 |  | 
|  | 505 | /** | 
| Stefanus Du Toit | db51c63 | 2013-08-08 17:48:14 +0000 | [diff] [blame] | 506 | * \brief Returns non-zero if the given source location is in the main file of | 
|  | 507 | * the corresponding translation unit. | 
|  | 508 | */ | 
|  | 509 | CINDEX_LINKAGE int clang_Location_isFromMainFile(CXSourceLocation location); | 
|  | 510 |  | 
|  | 511 | /** | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 512 | * \brief Retrieve a NULL (invalid) source range. | 
|  | 513 | */ | 
| NAKAMURA Takumi | eacd667 | 2013-01-10 02:12:38 +0000 | [diff] [blame] | 514 | CINDEX_LINKAGE CXSourceRange clang_getNullRange(void); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 515 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 516 | /** | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 517 | * \brief Retrieve a source range given the beginning and ending source | 
|  | 518 | * locations. | 
|  | 519 | */ | 
|  | 520 | CINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin, | 
|  | 521 | CXSourceLocation end); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 522 |  | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 523 | /** | 
| Douglas Gregor | 757e38b | 2011-07-23 19:35:14 +0000 | [diff] [blame] | 524 | * \brief Determine whether two ranges are equivalent. | 
|  | 525 | * | 
|  | 526 | * \returns non-zero if the ranges are the same, zero if they differ. | 
|  | 527 | */ | 
|  | 528 | CINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1, | 
|  | 529 | CXSourceRange range2); | 
|  | 530 |  | 
|  | 531 | /** | 
| Dmitri Gribenko | 8994e0c | 2012-09-13 13:11:20 +0000 | [diff] [blame] | 532 | * \brief Returns non-zero if \p range is null. | 
| Argyrios Kyrtzidis | e7e4291 | 2011-09-28 18:14:21 +0000 | [diff] [blame] | 533 | */ | 
| Erik Verbruggen | d610b0f | 2011-10-06 12:11:57 +0000 | [diff] [blame] | 534 | CINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range); | 
| Argyrios Kyrtzidis | e7e4291 | 2011-09-28 18:14:21 +0000 | [diff] [blame] | 535 |  | 
|  | 536 | /** | 
| Douglas Gregor | 9bd6db5 | 2010-01-26 19:19:08 +0000 | [diff] [blame] | 537 | * \brief Retrieve the file, line, column, and offset represented by | 
|  | 538 | * the given source location. | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 539 | * | 
| Chandler Carruth | 4aa01ef | 2011-08-31 16:53:37 +0000 | [diff] [blame] | 540 | * If the location refers into a macro expansion, retrieves the | 
|  | 541 | * location of the macro expansion. | 
| Douglas Gregor | 229bebd | 2010-11-09 06:24:54 +0000 | [diff] [blame] | 542 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 543 | * \param location the location within a source file that will be decomposed | 
|  | 544 | * into its parts. | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 545 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 546 | * \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] | 547 | * source location points. | 
|  | 548 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 549 | * \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] | 550 | * source location points. | 
|  | 551 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 552 | * \param column [out] if non-NULL, will be set to the column to which the given | 
|  | 553 | * source location points. | 
| Douglas Gregor | 9bd6db5 | 2010-01-26 19:19:08 +0000 | [diff] [blame] | 554 | * | 
|  | 555 | * \param offset [out] if non-NULL, will be set to the offset into the | 
|  | 556 | * buffer to which the given source location points. | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 557 | */ | 
| Chandler Carruth | 4aa01ef | 2011-08-31 16:53:37 +0000 | [diff] [blame] | 558 | CINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location, | 
|  | 559 | CXFile *file, | 
|  | 560 | unsigned *line, | 
|  | 561 | unsigned *column, | 
|  | 562 | unsigned *offset); | 
|  | 563 |  | 
|  | 564 | /** | 
| Vassil Vassilev | 4b8e29d | 2017-04-06 10:05:46 +0000 | [diff] [blame] | 565 | * \brief Retrieve the file, line and column represented by the given source | 
|  | 566 | * location, as specified in a # line directive. | 
| Argyrios Kyrtzidis | 91672b3 | 2011-09-13 21:49:08 +0000 | [diff] [blame] | 567 | * | 
|  | 568 | * Example: given the following source code in a file somefile.c | 
|  | 569 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 570 | * \code | 
| Argyrios Kyrtzidis | 91672b3 | 2011-09-13 21:49:08 +0000 | [diff] [blame] | 571 | * #123 "dummy.c" 1 | 
|  | 572 | * | 
|  | 573 | * static int func(void) | 
|  | 574 | * { | 
|  | 575 | *     return 0; | 
|  | 576 | * } | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 577 | * \endcode | 
| Argyrios Kyrtzidis | 91672b3 | 2011-09-13 21:49:08 +0000 | [diff] [blame] | 578 | * | 
|  | 579 | * the location information returned by this function would be | 
|  | 580 | * | 
|  | 581 | * File: dummy.c Line: 124 Column: 12 | 
|  | 582 | * | 
|  | 583 | * whereas clang_getExpansionLocation would have returned | 
|  | 584 | * | 
|  | 585 | * File: somefile.c Line: 3 Column: 12 | 
|  | 586 | * | 
|  | 587 | * \param location the location within a source file that will be decomposed | 
|  | 588 | * into its parts. | 
|  | 589 | * | 
|  | 590 | * \param filename [out] if non-NULL, will be set to the filename of the | 
|  | 591 | * source location. Note that filenames returned will be for "virtual" files, | 
|  | 592 | * which don't necessarily exist on the machine running clang - e.g. when | 
|  | 593 | * parsing preprocessed output obtained from a different environment. If | 
|  | 594 | * a non-NULL value is passed in, remember to dispose of the returned value | 
|  | 595 | * using \c clang_disposeString() once you've finished with it. For an invalid | 
|  | 596 | * source location, an empty string is returned. | 
|  | 597 | * | 
|  | 598 | * \param line [out] if non-NULL, will be set to the line number of the | 
|  | 599 | * source location. For an invalid source location, zero is returned. | 
|  | 600 | * | 
|  | 601 | * \param column [out] if non-NULL, will be set to the column number of the | 
|  | 602 | * source location. For an invalid source location, zero is returned. | 
|  | 603 | */ | 
|  | 604 | CINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location, | 
|  | 605 | CXString *filename, | 
|  | 606 | unsigned *line, | 
|  | 607 | unsigned *column); | 
|  | 608 |  | 
|  | 609 | /** | 
| Chandler Carruth | 4aa01ef | 2011-08-31 16:53:37 +0000 | [diff] [blame] | 610 | * \brief Legacy API to retrieve the file, line, column, and offset represented | 
|  | 611 | * by the given source location. | 
|  | 612 | * | 
|  | 613 | * This interface has been replaced by the newer interface | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 614 | * #clang_getExpansionLocation(). See that interface's documentation for | 
| Chandler Carruth | 4aa01ef | 2011-08-31 16:53:37 +0000 | [diff] [blame] | 615 | * details. | 
|  | 616 | */ | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 617 | CINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location, | 
|  | 618 | CXFile *file, | 
|  | 619 | unsigned *line, | 
| Douglas Gregor | 9bd6db5 | 2010-01-26 19:19:08 +0000 | [diff] [blame] | 620 | unsigned *column, | 
|  | 621 | unsigned *offset); | 
| Douglas Gregor | 47751d6 | 2010-01-26 03:07:15 +0000 | [diff] [blame] | 622 |  | 
|  | 623 | /** | 
| Douglas Gregor | 229bebd | 2010-11-09 06:24:54 +0000 | [diff] [blame] | 624 | * \brief Retrieve the file, line, column, and offset represented by | 
|  | 625 | * the given source location. | 
|  | 626 | * | 
|  | 627 | * If the location refers into a macro instantiation, return where the | 
|  | 628 | * location was originally spelled in the source file. | 
|  | 629 | * | 
|  | 630 | * \param location the location within a source file that will be decomposed | 
|  | 631 | * into its parts. | 
|  | 632 | * | 
|  | 633 | * \param file [out] if non-NULL, will be set to the file to which the given | 
|  | 634 | * source location points. | 
|  | 635 | * | 
|  | 636 | * \param line [out] if non-NULL, will be set to the line to which the given | 
|  | 637 | * source location points. | 
|  | 638 | * | 
|  | 639 | * \param column [out] if non-NULL, will be set to the column to which the given | 
|  | 640 | * source location points. | 
|  | 641 | * | 
|  | 642 | * \param offset [out] if non-NULL, will be set to the offset into the | 
|  | 643 | * buffer to which the given source location points. | 
|  | 644 | */ | 
|  | 645 | CINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location, | 
|  | 646 | CXFile *file, | 
|  | 647 | unsigned *line, | 
|  | 648 | unsigned *column, | 
|  | 649 | unsigned *offset); | 
|  | 650 |  | 
|  | 651 | /** | 
| Argyrios Kyrtzidis | 56be716 | 2013-01-04 18:30:13 +0000 | [diff] [blame] | 652 | * \brief Retrieve the file, line, column, and offset represented by | 
|  | 653 | * the given source location. | 
|  | 654 | * | 
|  | 655 | * If the location refers into a macro expansion, return where the macro was | 
|  | 656 | * expanded or where the macro argument was written, if the location points at | 
|  | 657 | * a macro argument. | 
|  | 658 | * | 
|  | 659 | * \param location the location within a source file that will be decomposed | 
|  | 660 | * into its parts. | 
|  | 661 | * | 
|  | 662 | * \param file [out] if non-NULL, will be set to the file to which the given | 
|  | 663 | * source location points. | 
|  | 664 | * | 
|  | 665 | * \param line [out] if non-NULL, will be set to the line to which the given | 
|  | 666 | * source location points. | 
|  | 667 | * | 
|  | 668 | * \param column [out] if non-NULL, will be set to the column to which the given | 
|  | 669 | * source location points. | 
|  | 670 | * | 
|  | 671 | * \param offset [out] if non-NULL, will be set to the offset into the | 
|  | 672 | * buffer to which the given source location points. | 
|  | 673 | */ | 
|  | 674 | CINDEX_LINKAGE void clang_getFileLocation(CXSourceLocation location, | 
|  | 675 | CXFile *file, | 
|  | 676 | unsigned *line, | 
|  | 677 | unsigned *column, | 
|  | 678 | unsigned *offset); | 
|  | 679 |  | 
|  | 680 | /** | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 681 | * \brief Retrieve a source location representing the first character within a | 
|  | 682 | * source range. | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 683 | */ | 
|  | 684 | CINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range); | 
|  | 685 |  | 
|  | 686 | /** | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 687 | * \brief Retrieve a source location representing the last character within a | 
|  | 688 | * source range. | 
| Douglas Gregor | 4f46e78 | 2010-01-19 21:36:55 +0000 | [diff] [blame] | 689 | */ | 
|  | 690 | CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range); | 
|  | 691 |  | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 692 | /** | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 693 | * \brief Identifies an array of ranges. | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 694 | */ | 
|  | 695 | typedef struct { | 
|  | 696 | /** \brief The number of ranges in the \c ranges array. */ | 
|  | 697 | unsigned count; | 
|  | 698 | /** | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 699 | * \brief An array of \c CXSourceRanges. | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 700 | */ | 
|  | 701 | CXSourceRange *ranges; | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 702 | } CXSourceRangeList; | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 703 |  | 
|  | 704 | /** | 
|  | 705 | * \brief Retrieve all ranges that were skipped by the preprocessor. | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 706 | * | 
|  | 707 | * The preprocessor will skip lines when they are surrounded by an | 
|  | 708 | * if/ifdef/ifndef directive whose condition does not evaluate to true. | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 709 | */ | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 710 | CINDEX_LINKAGE CXSourceRangeList *clang_getSkippedRanges(CXTranslationUnit tu, | 
|  | 711 | CXFile file); | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 712 |  | 
|  | 713 | /** | 
| Cameron Desrochers | d809128 | 2016-08-18 15:43:55 +0000 | [diff] [blame] | 714 | * \brief Retrieve all ranges from all files that were skipped by the | 
|  | 715 | * preprocessor. | 
|  | 716 | * | 
|  | 717 | * The preprocessor will skip lines when they are surrounded by an | 
|  | 718 | * if/ifdef/ifndef directive whose condition does not evaluate to true. | 
|  | 719 | */ | 
|  | 720 | CINDEX_LINKAGE CXSourceRangeList *clang_getAllSkippedRanges(CXTranslationUnit tu); | 
|  | 721 |  | 
|  | 722 | /** | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 723 | * \brief Destroy the given \c CXSourceRangeList. | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 724 | */ | 
| Argyrios Kyrtzidis | 0e282ef | 2013-12-06 18:55:45 +0000 | [diff] [blame] | 725 | CINDEX_LINKAGE void clang_disposeSourceRangeList(CXSourceRangeList *ranges); | 
| Argyrios Kyrtzidis | 9ef5775 | 2013-12-05 08:19:32 +0000 | [diff] [blame] | 726 |  | 
|  | 727 | /** | 
| Douglas Gregor | c8e390c | 2010-01-20 22:45:41 +0000 | [diff] [blame] | 728 | * @} | 
|  | 729 | */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 730 |  | 
|  | 731 | /** | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 732 | * \defgroup CINDEX_DIAG Diagnostic reporting | 
|  | 733 | * | 
|  | 734 | * @{ | 
|  | 735 | */ | 
|  | 736 |  | 
|  | 737 | /** | 
|  | 738 | * \brief Describes the severity of a particular diagnostic. | 
|  | 739 | */ | 
|  | 740 | enum CXDiagnosticSeverity { | 
|  | 741 | /** | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 742 | * \brief A diagnostic that has been suppressed, e.g., by a command-line | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 743 | * option. | 
|  | 744 | */ | 
|  | 745 | CXDiagnostic_Ignored = 0, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 746 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 747 | /** | 
|  | 748 | * \brief This diagnostic is a note that should be attached to the | 
|  | 749 | * previous (non-note) diagnostic. | 
|  | 750 | */ | 
|  | 751 | CXDiagnostic_Note    = 1, | 
|  | 752 |  | 
|  | 753 | /** | 
|  | 754 | * \brief This diagnostic indicates suspicious code that may not be | 
|  | 755 | * wrong. | 
|  | 756 | */ | 
|  | 757 | CXDiagnostic_Warning = 2, | 
|  | 758 |  | 
|  | 759 | /** | 
|  | 760 | * \brief This diagnostic indicates that the code is ill-formed. | 
|  | 761 | */ | 
|  | 762 | CXDiagnostic_Error   = 3, | 
|  | 763 |  | 
|  | 764 | /** | 
|  | 765 | * \brief This diagnostic indicates that the code is ill-formed such | 
|  | 766 | * that future parser recovery is unlikely to produce useful | 
|  | 767 | * results. | 
|  | 768 | */ | 
|  | 769 | CXDiagnostic_Fatal   = 4 | 
|  | 770 | }; | 
|  | 771 |  | 
|  | 772 | /** | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 773 | * \brief A single diagnostic, containing the diagnostic's severity, | 
|  | 774 | * location, text, source ranges, and fix-it hints. | 
|  | 775 | */ | 
|  | 776 | typedef void *CXDiagnostic; | 
|  | 777 |  | 
|  | 778 | /** | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 779 | * \brief A group of CXDiagnostics. | 
|  | 780 | */ | 
|  | 781 | typedef void *CXDiagnosticSet; | 
|  | 782 |  | 
|  | 783 | /** | 
|  | 784 | * \brief Determine the number of diagnostics in a CXDiagnosticSet. | 
|  | 785 | */ | 
|  | 786 | CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags); | 
|  | 787 |  | 
|  | 788 | /** | 
|  | 789 | * \brief Retrieve a diagnostic associated with the given CXDiagnosticSet. | 
|  | 790 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 791 | * \param Diags the CXDiagnosticSet to query. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 792 | * \param Index the zero-based diagnostic number to retrieve. | 
|  | 793 | * | 
|  | 794 | * \returns the requested diagnostic. This diagnostic must be freed | 
|  | 795 | * via a call to \c clang_disposeDiagnostic(). | 
|  | 796 | */ | 
|  | 797 | CINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags, | 
|  | 798 | unsigned Index); | 
|  | 799 |  | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 800 | /** | 
|  | 801 | * \brief Describes the kind of error that occurred (if any) in a call to | 
|  | 802 | * \c clang_loadDiagnostics. | 
|  | 803 | */ | 
|  | 804 | enum CXLoadDiag_Error { | 
|  | 805 | /** | 
|  | 806 | * \brief Indicates that no error occurred. | 
|  | 807 | */ | 
|  | 808 | CXLoadDiag_None = 0, | 
|  | 809 |  | 
|  | 810 | /** | 
|  | 811 | * \brief Indicates that an unknown error occurred while attempting to | 
|  | 812 | * deserialize diagnostics. | 
|  | 813 | */ | 
|  | 814 | CXLoadDiag_Unknown = 1, | 
|  | 815 |  | 
|  | 816 | /** | 
|  | 817 | * \brief Indicates that the file containing the serialized diagnostics | 
|  | 818 | * could not be opened. | 
|  | 819 | */ | 
|  | 820 | CXLoadDiag_CannotLoad = 2, | 
|  | 821 |  | 
|  | 822 | /** | 
|  | 823 | * \brief Indicates that the serialized diagnostics file is invalid or | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 824 | * corrupt. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 825 | */ | 
|  | 826 | CXLoadDiag_InvalidFile = 3 | 
|  | 827 | }; | 
|  | 828 |  | 
|  | 829 | /** | 
|  | 830 | * \brief Deserialize a set of diagnostics from a Clang diagnostics bitcode | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 831 | * file. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 832 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 833 | * \param file The name of the file to deserialize. | 
|  | 834 | * \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] | 835 | *        deserializing the diagnostics. | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 836 | * \param errorString A pointer to a CXString for recording the error string | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 837 | *        if the file was not successfully loaded. | 
|  | 838 | * | 
|  | 839 | * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise.  These | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 840 | * diagnostics should be released using clang_disposeDiagnosticSet(). | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 841 | */ | 
|  | 842 | CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file, | 
|  | 843 | enum CXLoadDiag_Error *error, | 
|  | 844 | CXString *errorString); | 
|  | 845 |  | 
|  | 846 | /** | 
|  | 847 | * \brief Release a CXDiagnosticSet and all of its contained diagnostics. | 
|  | 848 | */ | 
|  | 849 | CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags); | 
|  | 850 |  | 
|  | 851 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 852 | * \brief Retrieve the child diagnostics of a CXDiagnostic. | 
|  | 853 | * | 
|  | 854 | * This CXDiagnosticSet does not need to be released by | 
| Sylvestre Ledru | d29d97c | 2013-11-17 09:46:45 +0000 | [diff] [blame] | 855 | * clang_disposeDiagnosticSet. | 
| Ted Kremenek | d010ba4 | 2011-11-10 08:43:12 +0000 | [diff] [blame] | 856 | */ | 
|  | 857 | CINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D); | 
|  | 858 |  | 
|  | 859 | /** | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 860 | * \brief Determine the number of diagnostics produced for the given | 
|  | 861 | * translation unit. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 862 | */ | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 863 | CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit); | 
|  | 864 |  | 
|  | 865 | /** | 
|  | 866 | * \brief Retrieve a diagnostic associated with the given translation unit. | 
|  | 867 | * | 
|  | 868 | * \param Unit the translation unit to query. | 
|  | 869 | * \param Index the zero-based diagnostic number to retrieve. | 
|  | 870 | * | 
|  | 871 | * \returns the requested diagnostic. This diagnostic must be freed | 
|  | 872 | * via a call to \c clang_disposeDiagnostic(). | 
|  | 873 | */ | 
|  | 874 | CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, | 
|  | 875 | unsigned Index); | 
|  | 876 |  | 
|  | 877 | /** | 
| Ted Kremenek | b4a8b05 | 2011-12-09 22:28:32 +0000 | [diff] [blame] | 878 | * \brief Retrieve the complete set of diagnostics associated with a | 
|  | 879 | *        translation unit. | 
|  | 880 | * | 
|  | 881 | * \param Unit the translation unit to query. | 
|  | 882 | */ | 
|  | 883 | CINDEX_LINKAGE CXDiagnosticSet | 
|  | 884 | clang_getDiagnosticSetFromTU(CXTranslationUnit Unit); | 
|  | 885 |  | 
|  | 886 | /** | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 887 | * \brief Destroy a diagnostic. | 
|  | 888 | */ | 
|  | 889 | CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic); | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 890 |  | 
|  | 891 | /** | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 892 | * \brief Options to control the display of diagnostics. | 
|  | 893 | * | 
|  | 894 | * 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] | 895 | * behavior of \c clang_formatDiagnostic(). | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 896 | */ | 
|  | 897 | enum CXDiagnosticDisplayOptions { | 
|  | 898 | /** | 
|  | 899 | * \brief Display the source-location information where the | 
|  | 900 | * diagnostic was located. | 
|  | 901 | * | 
|  | 902 | * When set, diagnostics will be prefixed by the file, line, and | 
|  | 903 | * (optionally) column to which the diagnostic refers. For example, | 
|  | 904 | * | 
|  | 905 | * \code | 
|  | 906 | * test.c:28: warning: extra tokens at end of #endif directive | 
|  | 907 | * \endcode | 
|  | 908 | * | 
|  | 909 | * This option corresponds to the clang flag \c -fshow-source-location. | 
|  | 910 | */ | 
|  | 911 | CXDiagnostic_DisplaySourceLocation = 0x01, | 
|  | 912 |  | 
|  | 913 | /** | 
|  | 914 | * \brief If displaying the source-location information of the | 
|  | 915 | * diagnostic, also include the column number. | 
|  | 916 | * | 
|  | 917 | * This option corresponds to the clang flag \c -fshow-column. | 
|  | 918 | */ | 
|  | 919 | CXDiagnostic_DisplayColumn = 0x02, | 
|  | 920 |  | 
|  | 921 | /** | 
|  | 922 | * \brief If displaying the source-location information of the | 
|  | 923 | * diagnostic, also include information about source ranges in a | 
|  | 924 | * machine-parsable format. | 
|  | 925 | * | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 926 | * This option corresponds to the clang flag | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 927 | * \c -fdiagnostics-print-source-range-info. | 
|  | 928 | */ | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 929 | CXDiagnostic_DisplaySourceRanges = 0x04, | 
|  | 930 |  | 
|  | 931 | /** | 
|  | 932 | * \brief Display the option name associated with this diagnostic, if any. | 
|  | 933 | * | 
|  | 934 | * The option name displayed (e.g., -Wconversion) will be placed in brackets | 
|  | 935 | * after the diagnostic text. This option corresponds to the clang flag | 
|  | 936 | * \c -fdiagnostics-show-option. | 
|  | 937 | */ | 
|  | 938 | CXDiagnostic_DisplayOption = 0x08, | 
|  | 939 |  | 
|  | 940 | /** | 
|  | 941 | * \brief Display the category number associated with this diagnostic, if any. | 
|  | 942 | * | 
|  | 943 | * The category number is displayed within brackets after the diagnostic text. | 
|  | 944 | * This option corresponds to the clang flag | 
|  | 945 | * \c -fdiagnostics-show-category=id. | 
|  | 946 | */ | 
|  | 947 | CXDiagnostic_DisplayCategoryId = 0x10, | 
|  | 948 |  | 
|  | 949 | /** | 
|  | 950 | * \brief Display the category name associated with this diagnostic, if any. | 
|  | 951 | * | 
|  | 952 | * The category name is displayed within brackets after the diagnostic text. | 
|  | 953 | * This option corresponds to the clang flag | 
|  | 954 | * \c -fdiagnostics-show-category=name. | 
|  | 955 | */ | 
|  | 956 | CXDiagnostic_DisplayCategoryName = 0x20 | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 957 | }; | 
|  | 958 |  | 
|  | 959 | /** | 
| Douglas Gregor | d770f73 | 2010-02-22 23:17:23 +0000 | [diff] [blame] | 960 | * \brief Format the given diagnostic in a manner that is suitable for display. | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 961 | * | 
| Douglas Gregor | d770f73 | 2010-02-22 23:17:23 +0000 | [diff] [blame] | 962 | * This routine will format the given diagnostic to a string, rendering | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 963 | * the diagnostic according to the various options given. The | 
|  | 964 | * \c clang_defaultDiagnosticDisplayOptions() function returns the set of | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 965 | * options that most closely mimics the behavior of the clang compiler. | 
|  | 966 | * | 
|  | 967 | * \param Diagnostic The diagnostic to print. | 
|  | 968 | * | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 969 | * \param Options A set of options that control the diagnostic display, | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 970 | * created by combining \c CXDiagnosticDisplayOptions values. | 
| Douglas Gregor | d770f73 | 2010-02-22 23:17:23 +0000 | [diff] [blame] | 971 | * | 
|  | 972 | * \returns A new string containing for formatted diagnostic. | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 973 | */ | 
| Douglas Gregor | d770f73 | 2010-02-22 23:17:23 +0000 | [diff] [blame] | 974 | CINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, | 
|  | 975 | unsigned Options); | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 976 |  | 
|  | 977 | /** | 
|  | 978 | * \brief Retrieve the set of display options most similar to the | 
|  | 979 | * default behavior of the clang compiler. | 
|  | 980 | * | 
|  | 981 | * \returns A set of display options suitable for use with \c | 
| Sylvestre Ledru | d29d97c | 2013-11-17 09:46:45 +0000 | [diff] [blame] | 982 | * clang_formatDiagnostic(). | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 983 | */ | 
|  | 984 | CINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void); | 
|  | 985 |  | 
|  | 986 | /** | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 987 | * \brief Determine the severity of the given diagnostic. | 
|  | 988 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 989 | CINDEX_LINKAGE enum CXDiagnosticSeverity | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 990 | clang_getDiagnosticSeverity(CXDiagnostic); | 
|  | 991 |  | 
|  | 992 | /** | 
|  | 993 | * \brief Retrieve the source location of the given diagnostic. | 
|  | 994 | * | 
|  | 995 | * This location is where Clang would print the caret ('^') when | 
|  | 996 | * displaying the diagnostic on the command line. | 
|  | 997 | */ | 
|  | 998 | CINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic); | 
|  | 999 |  | 
|  | 1000 | /** | 
|  | 1001 | * \brief Retrieve the text of the given diagnostic. | 
|  | 1002 | */ | 
|  | 1003 | CINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic); | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1004 |  | 
|  | 1005 | /** | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 1006 | * \brief Retrieve the name of the command-line option that enabled this | 
|  | 1007 | * diagnostic. | 
|  | 1008 | * | 
|  | 1009 | * \param Diag The diagnostic to be queried. | 
|  | 1010 | * | 
|  | 1011 | * \param Disable If non-NULL, will be set to the option that disables this | 
|  | 1012 | * diagnostic (if any). | 
|  | 1013 | * | 
|  | 1014 | * \returns A string that contains the command-line option used to enable this | 
|  | 1015 | * warning, such as "-Wconversion" or "-pedantic". | 
|  | 1016 | */ | 
|  | 1017 | CINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag, | 
|  | 1018 | CXString *Disable); | 
|  | 1019 |  | 
|  | 1020 | /** | 
|  | 1021 | * \brief Retrieve the category number for this diagnostic. | 
|  | 1022 | * | 
|  | 1023 | * Diagnostics can be categorized into groups along with other, related | 
|  | 1024 | * diagnostics (e.g., diagnostics under the same warning flag). This routine | 
|  | 1025 | * retrieves the category number for the given diagnostic. | 
|  | 1026 | * | 
|  | 1027 | * \returns The number of the category that contains this diagnostic, or zero | 
|  | 1028 | * if this diagnostic is uncategorized. | 
|  | 1029 | */ | 
|  | 1030 | CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic); | 
|  | 1031 |  | 
|  | 1032 | /** | 
| Ted Kremenek | 26a6d49 | 2012-04-12 00:03:31 +0000 | [diff] [blame] | 1033 | * \brief Retrieve the name of a particular diagnostic category.  This | 
|  | 1034 | *  is now deprecated.  Use clang_getDiagnosticCategoryText() | 
|  | 1035 | *  instead. | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 1036 | * | 
|  | 1037 | * \param Category A diagnostic category number, as returned by | 
|  | 1038 | * \c clang_getDiagnosticCategory(). | 
|  | 1039 | * | 
|  | 1040 | * \returns The name of the given diagnostic category. | 
|  | 1041 | */ | 
| Ted Kremenek | 26a6d49 | 2012-04-12 00:03:31 +0000 | [diff] [blame] | 1042 | CINDEX_DEPRECATED CINDEX_LINKAGE | 
|  | 1043 | CXString clang_getDiagnosticCategoryName(unsigned Category); | 
|  | 1044 |  | 
|  | 1045 | /** | 
|  | 1046 | * \brief Retrieve the diagnostic category text for a given diagnostic. | 
|  | 1047 | * | 
| Ted Kremenek | 26a6d49 | 2012-04-12 00:03:31 +0000 | [diff] [blame] | 1048 | * \returns The text of the given diagnostic category. | 
|  | 1049 | */ | 
|  | 1050 | CINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic); | 
| Douglas Gregor | a750e8e | 2010-11-19 16:18:16 +0000 | [diff] [blame] | 1051 |  | 
|  | 1052 | /** | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1053 | * \brief Determine the number of source ranges associated with the given | 
|  | 1054 | * diagnostic. | 
|  | 1055 | */ | 
|  | 1056 | CINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1057 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1058 | /** | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1059 | * \brief Retrieve a source range associated with the diagnostic. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1060 | * | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1061 | * A diagnostic's source ranges highlight important elements in the source | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1062 | * code. On the command line, Clang displays source ranges by | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1063 | * underlining them with '~' characters. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1064 | * | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1065 | * \param Diagnostic the diagnostic whose range is being extracted. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1066 | * | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1067 | * \param Range the zero-based index specifying which range to | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1068 | * | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1069 | * \returns the requested source range. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1070 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1071 | CINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic, | 
| Douglas Gregor | 4b8fd6d | 2010-02-08 23:11:56 +0000 | [diff] [blame] | 1072 | unsigned Range); | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1073 |  | 
|  | 1074 | /** | 
|  | 1075 | * \brief Determine the number of fix-it hints associated with the | 
|  | 1076 | * given diagnostic. | 
|  | 1077 | */ | 
|  | 1078 | CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic); | 
|  | 1079 |  | 
|  | 1080 | /** | 
| Douglas Gregor | 836ec94 | 2010-02-19 18:16:06 +0000 | [diff] [blame] | 1081 | * \brief Retrieve the replacement information for a given fix-it. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1082 | * | 
| Douglas Gregor | 836ec94 | 2010-02-19 18:16:06 +0000 | [diff] [blame] | 1083 | * Fix-its are described in terms of a source range whose contents | 
|  | 1084 | * should be replaced by a string. This approach generalizes over | 
|  | 1085 | * three kinds of operations: removal of source code (the range covers | 
|  | 1086 | * the code to be removed and the replacement string is empty), | 
|  | 1087 | * replacement of source code (the range covers the code to be | 
|  | 1088 | * replaced and the replacement string provides the new code), and | 
|  | 1089 | * insertion (both the start and end of the range point at the | 
|  | 1090 | * insertion location, and the replacement string provides the text to | 
|  | 1091 | * insert). | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1092 | * | 
| Douglas Gregor | 836ec94 | 2010-02-19 18:16:06 +0000 | [diff] [blame] | 1093 | * \param Diagnostic The diagnostic whose fix-its are being queried. | 
|  | 1094 | * | 
|  | 1095 | * \param FixIt The zero-based index of the fix-it. | 
|  | 1096 | * | 
|  | 1097 | * \param ReplacementRange The source range whose contents will be | 
|  | 1098 | * replaced with the returned replacement string. Note that source | 
|  | 1099 | * ranges are half-open ranges [a, b), so the source code should be | 
|  | 1100 | * replaced from a and up to (but not including) b. | 
|  | 1101 | * | 
|  | 1102 | * \returns A string containing text that should be replace the source | 
|  | 1103 | * code indicated by the \c ReplacementRange. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1104 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1105 | CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic, | 
| Douglas Gregor | 836ec94 | 2010-02-19 18:16:06 +0000 | [diff] [blame] | 1106 | unsigned FixIt, | 
|  | 1107 | CXSourceRange *ReplacementRange); | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1108 |  | 
|  | 1109 | /** | 
|  | 1110 | * @} | 
|  | 1111 | */ | 
|  | 1112 |  | 
|  | 1113 | /** | 
|  | 1114 | * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation | 
|  | 1115 | * | 
|  | 1116 | * The routines in this group provide the ability to create and destroy | 
|  | 1117 | * translation units from files, either by parsing the contents of the files or | 
|  | 1118 | * by reading in a serialized representation of a translation unit. | 
|  | 1119 | * | 
|  | 1120 | * @{ | 
|  | 1121 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1122 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1123 | /** | 
|  | 1124 | * \brief Get the original translation unit source file name. | 
|  | 1125 | */ | 
|  | 1126 | CINDEX_LINKAGE CXString | 
|  | 1127 | clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit); | 
|  | 1128 |  | 
|  | 1129 | /** | 
|  | 1130 | * \brief Return the CXTranslationUnit for a given source file and the provided | 
|  | 1131 | * command line arguments one would pass to the compiler. | 
|  | 1132 | * | 
|  | 1133 | * Note: The 'source_filename' argument is optional.  If the caller provides a | 
|  | 1134 | * NULL pointer, the name of the source file is expected to reside in the | 
|  | 1135 | * specified command line arguments. | 
|  | 1136 | * | 
|  | 1137 | * Note: When encountered in 'clang_command_line_args', the following options | 
|  | 1138 | * are ignored: | 
|  | 1139 | * | 
|  | 1140 | *   '-c' | 
|  | 1141 | *   '-emit-ast' | 
|  | 1142 | *   '-fsyntax-only' | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 1143 | *   '-o \<output file>'  (both '-o' and '\<output file>' are ignored) | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1144 | * | 
| Ted Kremenek | bd497244 | 2010-11-08 04:28:51 +0000 | [diff] [blame] | 1145 | * \param CIdx The index object with which the translation unit will be | 
|  | 1146 | * associated. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1147 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 1148 | * \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] | 1149 | * source file is included in \p clang_command_line_args. | 
|  | 1150 | * | 
|  | 1151 | * \param num_clang_command_line_args The number of command-line arguments in | 
|  | 1152 | * \p clang_command_line_args. | 
|  | 1153 | * | 
|  | 1154 | * \param clang_command_line_args The command-line arguments that would be | 
|  | 1155 | * passed to the \c clang executable if it were being invoked out-of-process. | 
|  | 1156 | * These command-line options will be parsed and will affect how the translation | 
|  | 1157 | * unit is parsed. Note that the following options are ignored: '-c', | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 1158 | * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1159 | * | 
|  | 1160 | * \param num_unsaved_files the number of unsaved file entries in \p | 
|  | 1161 | * unsaved_files. | 
|  | 1162 | * | 
|  | 1163 | * \param unsaved_files the files that have not yet been saved to disk | 
|  | 1164 | * but may be required for code completion, including the contents of | 
| Ted Kremenek | de24a94 | 2010-04-12 18:47:26 +0000 | [diff] [blame] | 1165 | * those files.  The contents and name of these files (as specified by | 
|  | 1166 | * CXUnsavedFile) are copied when necessary, so the client only needs to | 
|  | 1167 | * guarantee their validity until the call to this function returns. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1168 | */ | 
|  | 1169 | CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile( | 
|  | 1170 | CXIndex CIdx, | 
|  | 1171 | const char *source_filename, | 
|  | 1172 | int num_clang_command_line_args, | 
| Douglas Gregor | 57879fa | 2010-09-01 16:43:19 +0000 | [diff] [blame] | 1173 | const char * const *clang_command_line_args, | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1174 | unsigned num_unsaved_files, | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 1175 | struct CXUnsavedFile *unsaved_files); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1176 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1177 | /** | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1178 | * \brief Same as \c clang_createTranslationUnit2, but returns | 
|  | 1179 | * the \c CXTranslationUnit instead of an error code.  In case of an error this | 
|  | 1180 | * routine returns a \c NULL \c CXTranslationUnit, without further detailed | 
|  | 1181 | * error codes. | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1182 | */ | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1183 | CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit( | 
|  | 1184 | CXIndex CIdx, | 
|  | 1185 | const char *ast_filename); | 
|  | 1186 |  | 
|  | 1187 | /** | 
|  | 1188 | * \brief Create a translation unit from an AST file (\c -emit-ast). | 
|  | 1189 | * | 
|  | 1190 | * \param[out] out_TU A non-NULL pointer to store the created | 
|  | 1191 | * \c CXTranslationUnit. | 
|  | 1192 | * | 
|  | 1193 | * \returns Zero on success, otherwise returns an error code. | 
|  | 1194 | */ | 
|  | 1195 | CINDEX_LINKAGE enum CXErrorCode clang_createTranslationUnit2( | 
|  | 1196 | CXIndex CIdx, | 
|  | 1197 | const char *ast_filename, | 
|  | 1198 | CXTranslationUnit *out_TU); | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1199 |  | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1200 | /** | 
|  | 1201 | * \brief Flags that control the creation of translation units. | 
|  | 1202 | * | 
|  | 1203 | * The enumerators in this enumeration type are meant to be bitwise | 
|  | 1204 | * ORed together to specify which options should be used when | 
|  | 1205 | * constructing the translation unit. | 
|  | 1206 | */ | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1207 | enum CXTranslationUnit_Flags { | 
|  | 1208 | /** | 
|  | 1209 | * \brief Used to indicate that no special translation-unit options are | 
|  | 1210 | * needed. | 
|  | 1211 | */ | 
|  | 1212 | CXTranslationUnit_None = 0x0, | 
|  | 1213 |  | 
|  | 1214 | /** | 
|  | 1215 | * \brief Used to indicate that the parser should construct a "detailed" | 
|  | 1216 | * preprocessing record, including all macro definitions and instantiations. | 
|  | 1217 | * | 
|  | 1218 | * Constructing a detailed preprocessing record requires more memory | 
|  | 1219 | * and time to parse, since the information contained in the record | 
|  | 1220 | * is usually not retained. However, it can be useful for | 
|  | 1221 | * applications that require more detailed information about the | 
|  | 1222 | * behavior of the preprocessor. | 
|  | 1223 | */ | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1224 | CXTranslationUnit_DetailedPreprocessingRecord = 0x01, | 
|  | 1225 |  | 
|  | 1226 | /** | 
| Douglas Gregor | 4a47bca | 2010-08-09 22:28:58 +0000 | [diff] [blame] | 1227 | * \brief Used to indicate that the translation unit is incomplete. | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1228 | * | 
| Douglas Gregor | 4a47bca | 2010-08-09 22:28:58 +0000 | [diff] [blame] | 1229 | * When a translation unit is considered "incomplete", semantic | 
|  | 1230 | * analysis that is typically performed at the end of the | 
|  | 1231 | * translation unit will be suppressed. For example, this suppresses | 
|  | 1232 | * the completion of tentative declarations in C and of | 
|  | 1233 | * instantiation of implicitly-instantiation function templates in | 
|  | 1234 | * C++. This option is typically used when parsing a header with the | 
|  | 1235 | * intent of producing a precompiled header. | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1236 | */ | 
| Douglas Gregor | 4a47bca | 2010-08-09 22:28:58 +0000 | [diff] [blame] | 1237 | CXTranslationUnit_Incomplete = 0x02, | 
| Douglas Gregor | be2d8c6 | 2010-07-23 00:33:23 +0000 | [diff] [blame] | 1238 |  | 
|  | 1239 | /** | 
|  | 1240 | * \brief Used to indicate that the translation unit should be built with an | 
|  | 1241 | * implicit precompiled header for the preamble. | 
|  | 1242 | * | 
|  | 1243 | * An implicit precompiled header is used as an optimization when a | 
|  | 1244 | * particular translation unit is likely to be reparsed many times | 
|  | 1245 | * when the sources aren't changing that often. In this case, an | 
|  | 1246 | * implicit precompiled header will be built containing all of the | 
|  | 1247 | * initial includes at the top of the main file (what we refer to as | 
|  | 1248 | * the "preamble" of the file). In subsequent parses, if the | 
|  | 1249 | * preamble or the files in it have not changed, \c | 
|  | 1250 | * clang_reparseTranslationUnit() will re-use the implicit | 
|  | 1251 | * precompiled header to improve parsing performance. | 
|  | 1252 | */ | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1253 | CXTranslationUnit_PrecompiledPreamble = 0x04, | 
|  | 1254 |  | 
|  | 1255 | /** | 
|  | 1256 | * \brief Used to indicate that the translation unit should cache some | 
|  | 1257 | * code-completion results with each reparse of the source file. | 
|  | 1258 | * | 
|  | 1259 | * Caching of code-completion results is a performance optimization that | 
|  | 1260 | * introduces some overhead to reparsing but improves the performance of | 
|  | 1261 | * code-completion operations. | 
|  | 1262 | */ | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1263 | CXTranslationUnit_CacheCompletionResults = 0x08, | 
| Argyrios Kyrtzidis | 0db720f | 2012-10-11 16:05:00 +0000 | [diff] [blame] | 1264 |  | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1265 | /** | 
| Argyrios Kyrtzidis | 0db720f | 2012-10-11 16:05:00 +0000 | [diff] [blame] | 1266 | * \brief Used to indicate that the translation unit will be serialized with | 
|  | 1267 | * \c clang_saveTranslationUnit. | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1268 | * | 
| Argyrios Kyrtzidis | 0db720f | 2012-10-11 16:05:00 +0000 | [diff] [blame] | 1269 | * This option is typically used when parsing a header with the intent of | 
|  | 1270 | * producing a precompiled header. | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1271 | */ | 
| Argyrios Kyrtzidis | 0db720f | 2012-10-11 16:05:00 +0000 | [diff] [blame] | 1272 | CXTranslationUnit_ForSerialization = 0x10, | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1273 |  | 
|  | 1274 | /** | 
| Douglas Gregor | 2ed0ee1 | 2011-08-25 22:54:01 +0000 | [diff] [blame] | 1275 | * \brief DEPRECATED: Enabled chained precompiled preambles in C++. | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1276 | * | 
|  | 1277 | * Note: this is a *temporary* option that is available only while | 
| Douglas Gregor | 2ed0ee1 | 2011-08-25 22:54:01 +0000 | [diff] [blame] | 1278 | * we are testing C++ precompiled preamble support. It is deprecated. | 
| Douglas Gregor | f5a1854 | 2010-10-27 17:24:53 +0000 | [diff] [blame] | 1279 | */ | 
| Erik Verbruggen | 6e92251 | 2012-04-12 10:11:59 +0000 | [diff] [blame] | 1280 | CXTranslationUnit_CXXChainedPCH = 0x20, | 
|  | 1281 |  | 
|  | 1282 | /** | 
|  | 1283 | * \brief Used to indicate that function/method bodies should be skipped while | 
|  | 1284 | * parsing. | 
|  | 1285 | * | 
|  | 1286 | * This option can be used to search for declarations/definitions while | 
|  | 1287 | * ignoring the usages. | 
|  | 1288 | */ | 
| Dmitri Gribenko | 3292d06 | 2012-07-02 17:35:10 +0000 | [diff] [blame] | 1289 | CXTranslationUnit_SkipFunctionBodies = 0x40, | 
|  | 1290 |  | 
|  | 1291 | /** | 
|  | 1292 | * \brief Used to indicate that brief documentation comments should be | 
|  | 1293 | * included into the set of code completions returned from this translation | 
|  | 1294 | * unit. | 
|  | 1295 | */ | 
| Benjamin Kramer | 5c248d8 | 2015-12-15 09:30:31 +0000 | [diff] [blame] | 1296 | CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80, | 
|  | 1297 |  | 
|  | 1298 | /** | 
|  | 1299 | * \brief Used to indicate that the precompiled preamble should be created on | 
|  | 1300 | * the first parse. Otherwise it will be created on the first reparse. This | 
|  | 1301 | * trades runtime on the first parse (serializing the preamble takes time) for | 
|  | 1302 | * reduced runtime on the second parse (can now reuse the preamble). | 
|  | 1303 | */ | 
| Manuel Klimek | 016c024 | 2016-03-01 10:56:19 +0000 | [diff] [blame] | 1304 | CXTranslationUnit_CreatePreambleOnFirstParse = 0x100, | 
|  | 1305 |  | 
|  | 1306 | /** | 
|  | 1307 | * \brief Do not stop processing when fatal errors are encountered. | 
|  | 1308 | * | 
|  | 1309 | * When fatal errors are encountered while parsing a translation unit, | 
|  | 1310 | * semantic analysis is typically stopped early when compiling code. A common | 
|  | 1311 | * source for fatal errors are unresolvable include files. For the | 
|  | 1312 | * purposes of an IDE, this is undesirable behavior and as much information | 
|  | 1313 | * as possible should be reported. Use this flag to enable this behavior. | 
|  | 1314 | */ | 
| Argyrios Kyrtzidis | 735e92c | 2017-06-09 01:20:48 +0000 | [diff] [blame] | 1315 | CXTranslationUnit_KeepGoing = 0x200, | 
|  | 1316 |  | 
|  | 1317 | /** | 
|  | 1318 | * \brief Sets the preprocessor in a mode for parsing a single file only. | 
|  | 1319 | */ | 
|  | 1320 | CXTranslationUnit_SingleFileParse = 0x400 | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1321 | }; | 
|  | 1322 |  | 
|  | 1323 | /** | 
| Douglas Gregor | 4a47bca | 2010-08-09 22:28:58 +0000 | [diff] [blame] | 1324 | * \brief Returns the set of flags that is suitable for parsing a translation | 
|  | 1325 | * unit that is being edited. | 
|  | 1326 | * | 
|  | 1327 | * The set of flags returned provide options for \c clang_parseTranslationUnit() | 
|  | 1328 | * to indicate that the translation unit is likely to be reparsed many times, | 
|  | 1329 | * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly | 
|  | 1330 | * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag | 
|  | 1331 | * set contains an unspecified set of optimizations (e.g., the precompiled | 
|  | 1332 | * preamble) geared toward improving the performance of these routines. The | 
|  | 1333 | * set of optimizations enabled may change from one version to the next. | 
|  | 1334 | */ | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1335 | CINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void); | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1336 |  | 
|  | 1337 | /** | 
|  | 1338 | * \brief Same as \c clang_parseTranslationUnit2, but returns | 
|  | 1339 | * the \c CXTranslationUnit instead of an error code.  In case of an error this | 
|  | 1340 | * routine returns a \c NULL \c CXTranslationUnit, without further detailed | 
|  | 1341 | * error codes. | 
|  | 1342 | */ | 
|  | 1343 | CINDEX_LINKAGE CXTranslationUnit | 
|  | 1344 | clang_parseTranslationUnit(CXIndex CIdx, | 
|  | 1345 | const char *source_filename, | 
|  | 1346 | const char *const *command_line_args, | 
|  | 1347 | int num_command_line_args, | 
|  | 1348 | struct CXUnsavedFile *unsaved_files, | 
|  | 1349 | unsigned num_unsaved_files, | 
|  | 1350 | unsigned options); | 
|  | 1351 |  | 
| Douglas Gregor | 4a47bca | 2010-08-09 22:28:58 +0000 | [diff] [blame] | 1352 | /** | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1353 | * \brief Parse the given source file and the translation unit corresponding | 
|  | 1354 | * to that file. | 
|  | 1355 | * | 
|  | 1356 | * This routine is the main entry point for the Clang C API, providing the | 
|  | 1357 | * ability to parse a source file into a translation unit that can then be | 
|  | 1358 | * queried by other functions in the API. This routine accepts a set of | 
|  | 1359 | * command-line arguments so that the compilation can be configured in the same | 
|  | 1360 | * way that the compiler is configured on the command line. | 
|  | 1361 | * | 
|  | 1362 | * \param CIdx The index object with which the translation unit will be | 
|  | 1363 | * associated. | 
|  | 1364 | * | 
|  | 1365 | * \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] | 1366 | * source file is included in \c command_line_args. | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1367 | * | 
|  | 1368 | * \param command_line_args The command-line arguments that would be | 
|  | 1369 | * passed to the \c clang executable if it were being invoked out-of-process. | 
|  | 1370 | * These command-line options will be parsed and will affect how the translation | 
|  | 1371 | * unit is parsed. Note that the following options are ignored: '-c', | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 1372 | * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1373 | * | 
|  | 1374 | * \param num_command_line_args The number of command-line arguments in | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1375 | * \c command_line_args. | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1376 | * | 
|  | 1377 | * \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] | 1378 | * but may be required for parsing, including the contents of | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1379 | * those files.  The contents and name of these files (as specified by | 
|  | 1380 | * CXUnsavedFile) are copied when necessary, so the client only needs to | 
|  | 1381 | * guarantee their validity until the call to this function returns. | 
|  | 1382 | * | 
|  | 1383 | * \param num_unsaved_files the number of unsaved file entries in \p | 
|  | 1384 | * unsaved_files. | 
|  | 1385 | * | 
|  | 1386 | * \param options A bitmask of options that affects how the translation unit | 
|  | 1387 | * is managed but not its compilation. This should be a bitwise OR of the | 
|  | 1388 | * CXTranslationUnit_XXX flags. | 
|  | 1389 | * | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1390 | * \param[out] out_TU A non-NULL pointer to store the created | 
|  | 1391 | * \c CXTranslationUnit, describing the parsed code and containing any | 
|  | 1392 | * diagnostics produced by the compiler. | 
|  | 1393 | * | 
|  | 1394 | * \returns Zero on success, otherwise returns an error code. | 
| Douglas Gregor | 99d2cf4 | 2010-07-21 18:52:53 +0000 | [diff] [blame] | 1395 | */ | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1396 | CINDEX_LINKAGE enum CXErrorCode | 
|  | 1397 | clang_parseTranslationUnit2(CXIndex CIdx, | 
|  | 1398 | const char *source_filename, | 
|  | 1399 | const char *const *command_line_args, | 
|  | 1400 | int num_command_line_args, | 
|  | 1401 | struct CXUnsavedFile *unsaved_files, | 
|  | 1402 | unsigned num_unsaved_files, | 
|  | 1403 | unsigned options, | 
|  | 1404 | CXTranslationUnit *out_TU); | 
|  | 1405 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1406 | /** | 
| Benjamin Kramer | c02670e | 2015-11-18 16:14:27 +0000 | [diff] [blame] | 1407 | * \brief Same as clang_parseTranslationUnit2 but requires a full command line | 
|  | 1408 | * for \c command_line_args including argv[0]. This is useful if the standard | 
|  | 1409 | * library paths are relative to the binary. | 
|  | 1410 | */ | 
|  | 1411 | CINDEX_LINKAGE enum CXErrorCode clang_parseTranslationUnit2FullArgv( | 
|  | 1412 | CXIndex CIdx, const char *source_filename, | 
|  | 1413 | const char *const *command_line_args, int num_command_line_args, | 
|  | 1414 | struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files, | 
|  | 1415 | unsigned options, CXTranslationUnit *out_TU); | 
|  | 1416 |  | 
|  | 1417 | /** | 
| Douglas Gregor | 6bb92ec | 2010-08-13 15:35:05 +0000 | [diff] [blame] | 1418 | * \brief Flags that control how translation units are saved. | 
|  | 1419 | * | 
|  | 1420 | * The enumerators in this enumeration type are meant to be bitwise | 
|  | 1421 | * ORed together to specify which options should be used when | 
|  | 1422 | * saving the translation unit. | 
|  | 1423 | */ | 
|  | 1424 | enum CXSaveTranslationUnit_Flags { | 
|  | 1425 | /** | 
|  | 1426 | * \brief Used to indicate that no special saving options are needed. | 
|  | 1427 | */ | 
|  | 1428 | CXSaveTranslationUnit_None = 0x0 | 
|  | 1429 | }; | 
|  | 1430 |  | 
|  | 1431 | /** | 
|  | 1432 | * \brief Returns the set of flags that is suitable for saving a translation | 
|  | 1433 | * unit. | 
|  | 1434 | * | 
|  | 1435 | * The set of flags returned provide options for | 
|  | 1436 | * \c clang_saveTranslationUnit() by default. The returned flag | 
|  | 1437 | * set contains an unspecified set of options that save translation units with | 
|  | 1438 | * the most commonly-requested data. | 
|  | 1439 | */ | 
|  | 1440 | CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU); | 
|  | 1441 |  | 
|  | 1442 | /** | 
| Douglas Gregor | 30c80fa | 2011-07-06 16:43:36 +0000 | [diff] [blame] | 1443 | * \brief Describes the kind of error that occurred (if any) in a call to | 
|  | 1444 | * \c clang_saveTranslationUnit(). | 
|  | 1445 | */ | 
|  | 1446 | enum CXSaveError { | 
|  | 1447 | /** | 
|  | 1448 | * \brief Indicates that no error occurred while saving a translation unit. | 
|  | 1449 | */ | 
|  | 1450 | CXSaveError_None = 0, | 
|  | 1451 |  | 
|  | 1452 | /** | 
|  | 1453 | * \brief Indicates that an unknown error occurred while attempting to save | 
|  | 1454 | * the file. | 
|  | 1455 | * | 
|  | 1456 | * This error typically indicates that file I/O failed when attempting to | 
|  | 1457 | * write the file. | 
|  | 1458 | */ | 
|  | 1459 | CXSaveError_Unknown = 1, | 
|  | 1460 |  | 
|  | 1461 | /** | 
|  | 1462 | * \brief Indicates that errors during translation prevented this attempt | 
|  | 1463 | * to save the translation unit. | 
|  | 1464 | * | 
|  | 1465 | * Errors that prevent the translation unit from being saved can be | 
|  | 1466 | * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic(). | 
|  | 1467 | */ | 
|  | 1468 | CXSaveError_TranslationErrors = 2, | 
|  | 1469 |  | 
|  | 1470 | /** | 
|  | 1471 | * \brief Indicates that the translation unit to be saved was somehow | 
|  | 1472 | * invalid (e.g., NULL). | 
|  | 1473 | */ | 
|  | 1474 | CXSaveError_InvalidTU = 3 | 
|  | 1475 | }; | 
|  | 1476 |  | 
|  | 1477 | /** | 
| Douglas Gregor | e938668 | 2010-08-13 05:36:37 +0000 | [diff] [blame] | 1478 | * \brief Saves a translation unit into a serialized representation of | 
|  | 1479 | * that translation unit on disk. | 
|  | 1480 | * | 
|  | 1481 | * Any translation unit that was parsed without error can be saved | 
|  | 1482 | * into a file. The translation unit can then be deserialized into a | 
|  | 1483 | * new \c CXTranslationUnit with \c clang_createTranslationUnit() or, | 
|  | 1484 | * if it is an incomplete translation unit that corresponds to a | 
|  | 1485 | * header, used as a precompiled header when parsing other translation | 
|  | 1486 | * units. | 
|  | 1487 | * | 
|  | 1488 | * \param TU The translation unit to save. | 
| Douglas Gregor | 6bb92ec | 2010-08-13 15:35:05 +0000 | [diff] [blame] | 1489 | * | 
| Douglas Gregor | e938668 | 2010-08-13 05:36:37 +0000 | [diff] [blame] | 1490 | * \param FileName The file to which the translation unit will be saved. | 
|  | 1491 | * | 
| Douglas Gregor | 6bb92ec | 2010-08-13 15:35:05 +0000 | [diff] [blame] | 1492 | * \param options A bitmask of options that affects how the translation unit | 
|  | 1493 | * is saved. This should be a bitwise OR of the | 
|  | 1494 | * CXSaveTranslationUnit_XXX flags. | 
|  | 1495 | * | 
| Douglas Gregor | 30c80fa | 2011-07-06 16:43:36 +0000 | [diff] [blame] | 1496 | * \returns A value that will match one of the enumerators of the CXSaveError | 
|  | 1497 | * enumeration. Zero (CXSaveError_None) indicates that the translation unit was | 
|  | 1498 | * saved successfully, while a non-zero value indicates that a problem occurred. | 
| Douglas Gregor | e938668 | 2010-08-13 05:36:37 +0000 | [diff] [blame] | 1499 | */ | 
|  | 1500 | CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, | 
| Douglas Gregor | 6bb92ec | 2010-08-13 15:35:05 +0000 | [diff] [blame] | 1501 | const char *FileName, | 
|  | 1502 | unsigned options); | 
| Douglas Gregor | e938668 | 2010-08-13 05:36:37 +0000 | [diff] [blame] | 1503 |  | 
|  | 1504 | /** | 
| Erik Verbruggen | 346066b | 2017-05-30 14:25:54 +0000 | [diff] [blame] | 1505 | * \brief Suspend a translation unit in order to free memory associated with it. | 
|  | 1506 | * | 
|  | 1507 | * A suspended translation unit uses significantly less memory but on the other | 
|  | 1508 | * side does not support any other calls than \c clang_reparseTranslationUnit | 
|  | 1509 | * to resume it or \c clang_disposeTranslationUnit to dispose it completely. | 
|  | 1510 | */ | 
|  | 1511 | CINDEX_LINKAGE unsigned clang_suspendTranslationUnit(CXTranslationUnit); | 
|  | 1512 |  | 
|  | 1513 | /** | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1514 | * \brief Destroy the specified CXTranslationUnit object. | 
|  | 1515 | */ | 
|  | 1516 | CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1517 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1518 | /** | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1519 | * \brief Flags that control the reparsing of translation units. | 
|  | 1520 | * | 
|  | 1521 | * The enumerators in this enumeration type are meant to be bitwise | 
|  | 1522 | * ORed together to specify which options should be used when | 
|  | 1523 | * reparsing the translation unit. | 
|  | 1524 | */ | 
|  | 1525 | enum CXReparse_Flags { | 
|  | 1526 | /** | 
|  | 1527 | * \brief Used to indicate that no special reparsing options are needed. | 
|  | 1528 | */ | 
|  | 1529 | CXReparse_None = 0x0 | 
|  | 1530 | }; | 
|  | 1531 |  | 
|  | 1532 | /** | 
|  | 1533 | * \brief Returns the set of flags that is suitable for reparsing a translation | 
|  | 1534 | * unit. | 
|  | 1535 | * | 
|  | 1536 | * The set of flags returned provide options for | 
|  | 1537 | * \c clang_reparseTranslationUnit() by default. The returned flag | 
|  | 1538 | * set contains an unspecified set of optimizations geared toward common uses | 
|  | 1539 | * of reparsing. The set of optimizations enabled may change from one version | 
|  | 1540 | * to the next. | 
|  | 1541 | */ | 
|  | 1542 | CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU); | 
|  | 1543 |  | 
|  | 1544 | /** | 
| Douglas Gregor | aa21cc4 | 2010-07-19 21:46:24 +0000 | [diff] [blame] | 1545 | * \brief Reparse the source files that produced this translation unit. | 
|  | 1546 | * | 
|  | 1547 | * This routine can be used to re-parse the source files that originally | 
|  | 1548 | * created the given translation unit, for example because those source files | 
|  | 1549 | * have changed (either on disk or as passed via \p unsaved_files). The | 
|  | 1550 | * source code will be reparsed with the same command-line options as it | 
|  | 1551 | * was originally parsed. | 
|  | 1552 | * | 
|  | 1553 | * Reparsing a translation unit invalidates all cursors and source locations | 
|  | 1554 | * that refer into that translation unit. This makes reparsing a translation | 
|  | 1555 | * unit semantically equivalent to destroying the translation unit and then | 
|  | 1556 | * creating a new translation unit with the same command-line arguments. | 
|  | 1557 | * However, it may be more efficient to reparse a translation | 
|  | 1558 | * unit using this routine. | 
|  | 1559 | * | 
|  | 1560 | * \param TU The translation unit whose contents will be re-parsed. The | 
|  | 1561 | * translation unit must originally have been built with | 
|  | 1562 | * \c clang_createTranslationUnitFromSourceFile(). | 
|  | 1563 | * | 
|  | 1564 | * \param num_unsaved_files The number of unsaved file entries in \p | 
|  | 1565 | * unsaved_files. | 
|  | 1566 | * | 
|  | 1567 | * \param unsaved_files The files that have not yet been saved to disk | 
|  | 1568 | * but may be required for parsing, including the contents of | 
|  | 1569 | * those files.  The contents and name of these files (as specified by | 
|  | 1570 | * CXUnsavedFile) are copied when necessary, so the client only needs to | 
|  | 1571 | * guarantee their validity until the call to this function returns. | 
|  | 1572 | * | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1573 | * \param options A bitset of options composed of the flags in CXReparse_Flags. | 
|  | 1574 | * The function \c clang_defaultReparseOptions() produces a default set of | 
|  | 1575 | * options recommended for most uses, based on the translation unit. | 
|  | 1576 | * | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1577 | * \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] | 1578 | * returned if reparsing was impossible, such that the translation unit is | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 1579 | * invalid. In such cases, the only valid call for \c TU is | 
|  | 1580 | * \c clang_disposeTranslationUnit(TU).  The error codes returned by this | 
|  | 1581 | * routine are described by the \c CXErrorCode enum. | 
| Douglas Gregor | aa21cc4 | 2010-07-19 21:46:24 +0000 | [diff] [blame] | 1582 | */ | 
|  | 1583 | CINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU, | 
|  | 1584 | unsigned num_unsaved_files, | 
| Douglas Gregor | de05118 | 2010-08-11 15:58:42 +0000 | [diff] [blame] | 1585 | struct CXUnsavedFile *unsaved_files, | 
|  | 1586 | unsigned options); | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1587 |  | 
|  | 1588 | /** | 
|  | 1589 | * \brief Categorizes how memory is being used by a translation unit. | 
|  | 1590 | */ | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1591 | enum CXTUResourceUsageKind { | 
|  | 1592 | CXTUResourceUsage_AST = 1, | 
|  | 1593 | CXTUResourceUsage_Identifiers = 2, | 
|  | 1594 | CXTUResourceUsage_Selectors = 3, | 
|  | 1595 | CXTUResourceUsage_GlobalCompletionResults = 4, | 
| Ted Kremenek | 21735e6 | 2011-04-28 04:10:31 +0000 | [diff] [blame] | 1596 | CXTUResourceUsage_SourceManagerContentCache = 5, | 
| Ted Kremenek | f5df0ce | 2011-04-28 04:53:38 +0000 | [diff] [blame] | 1597 | CXTUResourceUsage_AST_SideTables = 6, | 
| Ted Kremenek | 8d58790 | 2011-04-28 20:36:42 +0000 | [diff] [blame] | 1598 | CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7, | 
| Ted Kremenek | 5e1ed7b | 2011-04-28 23:46:20 +0000 | [diff] [blame] | 1599 | CXTUResourceUsage_SourceManager_Membuffer_MMap = 8, | 
|  | 1600 | CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9, | 
|  | 1601 | CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10, | 
| Ted Kremenek | 2160a0d | 2011-05-04 01:38:46 +0000 | [diff] [blame] | 1602 | CXTUResourceUsage_Preprocessor = 11, | 
|  | 1603 | CXTUResourceUsage_PreprocessingRecord = 12, | 
| Ted Kremenek | 120992a | 2011-07-26 23:46:06 +0000 | [diff] [blame] | 1604 | CXTUResourceUsage_SourceManager_DataStructures = 13, | 
| Ted Kremenek | fbcce6f | 2011-07-26 23:46:11 +0000 | [diff] [blame] | 1605 | CXTUResourceUsage_Preprocessor_HeaderSearch = 14, | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1606 | CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST, | 
|  | 1607 | CXTUResourceUsage_MEMORY_IN_BYTES_END = | 
| Ted Kremenek | fbcce6f | 2011-07-26 23:46:11 +0000 | [diff] [blame] | 1608 | CXTUResourceUsage_Preprocessor_HeaderSearch, | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1609 |  | 
|  | 1610 | CXTUResourceUsage_First = CXTUResourceUsage_AST, | 
| Ted Kremenek | fbcce6f | 2011-07-26 23:46:11 +0000 | [diff] [blame] | 1611 | CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1612 | }; | 
|  | 1613 |  | 
|  | 1614 | /** | 
|  | 1615 | * \brief Returns the human-readable null-terminated C string that represents | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1616 | *  the name of the memory category.  This string should never be freed. | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1617 | */ | 
|  | 1618 | CINDEX_LINKAGE | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1619 | const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind); | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1620 |  | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1621 | typedef struct CXTUResourceUsageEntry { | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1622 | /* \brief The memory usage category. */ | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1623 | enum CXTUResourceUsageKind kind; | 
|  | 1624 | /* \brief Amount of resources used. | 
|  | 1625 | The units will depend on the resource kind. */ | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1626 | unsigned long amount; | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1627 | } CXTUResourceUsageEntry; | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1628 |  | 
|  | 1629 | /** | 
|  | 1630 | * \brief The memory usage of a CXTranslationUnit, broken into categories. | 
|  | 1631 | */ | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1632 | typedef struct CXTUResourceUsage { | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1633 | /* \brief Private data member, used for queries. */ | 
|  | 1634 | void *data; | 
|  | 1635 |  | 
|  | 1636 | /* \brief The number of entries in the 'entries' array. */ | 
|  | 1637 | unsigned numEntries; | 
|  | 1638 |  | 
|  | 1639 | /* \brief An array of key-value pairs, representing the breakdown of memory | 
|  | 1640 | usage. */ | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1641 | CXTUResourceUsageEntry *entries; | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1642 |  | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1643 | } CXTUResourceUsage; | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1644 |  | 
|  | 1645 | /** | 
|  | 1646 | * \brief Return the memory usage of a translation unit.  This object | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1647 | *  should be released with clang_disposeCXTUResourceUsage(). | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1648 | */ | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1649 | CINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU); | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1650 |  | 
| Ted Kremenek | 2332412 | 2011-04-20 16:41:07 +0000 | [diff] [blame] | 1651 | CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage); | 
| Ted Kremenek | 83f642e | 2011-04-18 22:47:10 +0000 | [diff] [blame] | 1652 |  | 
| Douglas Gregor | aa21cc4 | 2010-07-19 21:46:24 +0000 | [diff] [blame] | 1653 | /** | 
| Emilio Cobos Alvarez | 485ad42 | 2017-04-28 15:56:39 +0000 | [diff] [blame] | 1654 | * \brief Get target information for this translation unit. | 
|  | 1655 | * | 
|  | 1656 | * The CXTargetInfo object cannot outlive the CXTranslationUnit object. | 
|  | 1657 | */ | 
|  | 1658 | CINDEX_LINKAGE CXTargetInfo | 
|  | 1659 | clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit); | 
|  | 1660 |  | 
|  | 1661 | /** | 
|  | 1662 | * \brief Destroy the CXTargetInfo object. | 
|  | 1663 | */ | 
|  | 1664 | CINDEX_LINKAGE void | 
|  | 1665 | clang_TargetInfo_dispose(CXTargetInfo Info); | 
|  | 1666 |  | 
|  | 1667 | /** | 
|  | 1668 | * \brief Get the normalized target triple as a string. | 
|  | 1669 | * | 
|  | 1670 | * Returns the empty string in case of any error. | 
|  | 1671 | */ | 
|  | 1672 | CINDEX_LINKAGE CXString | 
|  | 1673 | clang_TargetInfo_getTriple(CXTargetInfo Info); | 
|  | 1674 |  | 
|  | 1675 | /** | 
|  | 1676 | * \brief Get the pointer width of the target in bits. | 
|  | 1677 | * | 
|  | 1678 | * Returns -1 in case of error. | 
|  | 1679 | */ | 
|  | 1680 | CINDEX_LINKAGE int | 
|  | 1681 | clang_TargetInfo_getPointerWidth(CXTargetInfo Info); | 
|  | 1682 |  | 
|  | 1683 | /** | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1684 | * @} | 
|  | 1685 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 1686 |  | 
| Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 1687 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1688 | * \brief Describes the kind of entity that a cursor refers to. | 
|  | 1689 | */ | 
|  | 1690 | enum CXCursorKind { | 
|  | 1691 | /* Declarations */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1692 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1693 | * \brief A declaration whose specific kind is not exposed via this | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1694 | * interface. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1695 | * | 
|  | 1696 | * Unexposed declarations have the same operations as any other kind | 
|  | 1697 | * of declaration; one can extract their location information, | 
|  | 1698 | * spelling, find their definitions, etc. However, the specific kind | 
|  | 1699 | * of the declaration is not reported. | 
|  | 1700 | */ | 
|  | 1701 | CXCursor_UnexposedDecl                 = 1, | 
|  | 1702 | /** \brief A C or C++ struct. */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1703 | CXCursor_StructDecl                    = 2, | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1704 | /** \brief A C or C++ union. */ | 
|  | 1705 | CXCursor_UnionDecl                     = 3, | 
|  | 1706 | /** \brief A C++ class. */ | 
|  | 1707 | CXCursor_ClassDecl                     = 4, | 
|  | 1708 | /** \brief An enumeration. */ | 
|  | 1709 | CXCursor_EnumDecl                      = 5, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1710 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1711 | * \brief A field (in C) or non-static data member (in C++) in a | 
|  | 1712 | * struct, union, or C++ class. | 
|  | 1713 | */ | 
|  | 1714 | CXCursor_FieldDecl                     = 6, | 
|  | 1715 | /** \brief An enumerator constant. */ | 
|  | 1716 | CXCursor_EnumConstantDecl              = 7, | 
|  | 1717 | /** \brief A function. */ | 
|  | 1718 | CXCursor_FunctionDecl                  = 8, | 
|  | 1719 | /** \brief A variable. */ | 
|  | 1720 | CXCursor_VarDecl                       = 9, | 
|  | 1721 | /** \brief A function or method parameter. */ | 
|  | 1722 | CXCursor_ParmDecl                      = 10, | 
| James Dennett | 1355bd1 | 2012-06-11 06:19:40 +0000 | [diff] [blame] | 1723 | /** \brief An Objective-C \@interface. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1724 | CXCursor_ObjCInterfaceDecl             = 11, | 
| James Dennett | 1355bd1 | 2012-06-11 06:19:40 +0000 | [diff] [blame] | 1725 | /** \brief An Objective-C \@interface for a category. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1726 | CXCursor_ObjCCategoryDecl              = 12, | 
| James Dennett | 1355bd1 | 2012-06-11 06:19:40 +0000 | [diff] [blame] | 1727 | /** \brief An Objective-C \@protocol declaration. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1728 | CXCursor_ObjCProtocolDecl              = 13, | 
| James Dennett | 1355bd1 | 2012-06-11 06:19:40 +0000 | [diff] [blame] | 1729 | /** \brief An Objective-C \@property declaration. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1730 | CXCursor_ObjCPropertyDecl              = 14, | 
|  | 1731 | /** \brief An Objective-C instance variable. */ | 
|  | 1732 | CXCursor_ObjCIvarDecl                  = 15, | 
|  | 1733 | /** \brief An Objective-C instance method. */ | 
|  | 1734 | CXCursor_ObjCInstanceMethodDecl        = 16, | 
|  | 1735 | /** \brief An Objective-C class method. */ | 
|  | 1736 | CXCursor_ObjCClassMethodDecl           = 17, | 
| James Dennett | 1355bd1 | 2012-06-11 06:19:40 +0000 | [diff] [blame] | 1737 | /** \brief An Objective-C \@implementation. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1738 | CXCursor_ObjCImplementationDecl        = 18, | 
| James Dennett | 1355bd1 | 2012-06-11 06:19:40 +0000 | [diff] [blame] | 1739 | /** \brief An Objective-C \@implementation for a category. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1740 | CXCursor_ObjCCategoryImplDecl          = 19, | 
| Saleem Abdulrasool | 993b286 | 2015-08-12 03:21:44 +0000 | [diff] [blame] | 1741 | /** \brief A typedef. */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1742 | CXCursor_TypedefDecl                   = 20, | 
| Ted Kremenek | 225b8e3 | 2010-04-13 23:39:06 +0000 | [diff] [blame] | 1743 | /** \brief A C++ class method. */ | 
|  | 1744 | CXCursor_CXXMethod                     = 21, | 
| Ted Kremenek | bd67fb2 | 2010-05-06 23:38:21 +0000 | [diff] [blame] | 1745 | /** \brief A C++ namespace. */ | 
|  | 1746 | CXCursor_Namespace                     = 22, | 
| Ted Kremenek | b80cba5 | 2010-05-07 01:04:29 +0000 | [diff] [blame] | 1747 | /** \brief A linkage specification, e.g. 'extern "C"'. */ | 
|  | 1748 | CXCursor_LinkageSpec                   = 23, | 
| Douglas Gregor | 12bca22 | 2010-08-31 14:41:23 +0000 | [diff] [blame] | 1749 | /** \brief A C++ constructor. */ | 
|  | 1750 | CXCursor_Constructor                   = 24, | 
|  | 1751 | /** \brief A C++ destructor. */ | 
|  | 1752 | CXCursor_Destructor                    = 25, | 
|  | 1753 | /** \brief A C++ conversion function. */ | 
|  | 1754 | CXCursor_ConversionFunction            = 26, | 
| Douglas Gregor | 713602b | 2010-08-31 17:01:39 +0000 | [diff] [blame] | 1755 | /** \brief A C++ template type parameter. */ | 
|  | 1756 | CXCursor_TemplateTypeParameter         = 27, | 
|  | 1757 | /** \brief A C++ non-type template parameter. */ | 
|  | 1758 | CXCursor_NonTypeTemplateParameter      = 28, | 
|  | 1759 | /** \brief A C++ template template parameter. */ | 
|  | 1760 | CXCursor_TemplateTemplateParameter     = 29, | 
|  | 1761 | /** \brief A C++ function template. */ | 
|  | 1762 | CXCursor_FunctionTemplate              = 30, | 
| Douglas Gregor | 1fbaeb1 | 2010-08-31 19:02:00 +0000 | [diff] [blame] | 1763 | /** \brief A C++ class template. */ | 
|  | 1764 | CXCursor_ClassTemplate                 = 31, | 
| Douglas Gregor | f96abb2 | 2010-08-31 19:31:58 +0000 | [diff] [blame] | 1765 | /** \brief A C++ class template partial specialization. */ | 
|  | 1766 | CXCursor_ClassTemplatePartialSpecialization = 32, | 
| Douglas Gregor | a89314e | 2010-08-31 23:48:11 +0000 | [diff] [blame] | 1767 | /** \brief A C++ namespace alias declaration. */ | 
|  | 1768 | CXCursor_NamespaceAlias                = 33, | 
| Douglas Gregor | 01a43013 | 2010-09-01 03:07:18 +0000 | [diff] [blame] | 1769 | /** \brief A C++ using directive. */ | 
|  | 1770 | CXCursor_UsingDirective                = 34, | 
| Richard Smith | dda56e4 | 2011-04-15 14:24:37 +0000 | [diff] [blame] | 1771 | /** \brief A C++ using declaration. */ | 
| Douglas Gregor | a9aa29c | 2010-09-01 19:52:22 +0000 | [diff] [blame] | 1772 | CXCursor_UsingDeclaration              = 35, | 
| Richard Smith | dda56e4 | 2011-04-15 14:24:37 +0000 | [diff] [blame] | 1773 | /** \brief A C++ alias declaration */ | 
|  | 1774 | CXCursor_TypeAliasDecl                 = 36, | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 1775 | /** \brief An Objective-C \@synthesize definition. */ | 
| Douglas Gregor | 4cd6596 | 2011-06-03 23:08:58 +0000 | [diff] [blame] | 1776 | CXCursor_ObjCSynthesizeDecl            = 37, | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 1777 | /** \brief An Objective-C \@dynamic definition. */ | 
| Douglas Gregor | 4cd6596 | 2011-06-03 23:08:58 +0000 | [diff] [blame] | 1778 | CXCursor_ObjCDynamicDecl               = 38, | 
| Argyrios Kyrtzidis | 12afd70 | 2011-09-30 17:58:23 +0000 | [diff] [blame] | 1779 | /** \brief An access specifier. */ | 
|  | 1780 | CXCursor_CXXAccessSpecifier            = 39, | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1781 |  | 
| Ted Kremenek | 08de5c1 | 2010-05-19 21:51:10 +0000 | [diff] [blame] | 1782 | CXCursor_FirstDecl                     = CXCursor_UnexposedDecl, | 
| Argyrios Kyrtzidis | 12afd70 | 2011-09-30 17:58:23 +0000 | [diff] [blame] | 1783 | CXCursor_LastDecl                      = CXCursor_CXXAccessSpecifier, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1784 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1785 | /* References */ | 
|  | 1786 | CXCursor_FirstRef                      = 40, /* Decl references */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1787 | CXCursor_ObjCSuperClassRef             = 40, | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1788 | CXCursor_ObjCProtocolRef               = 41, | 
|  | 1789 | CXCursor_ObjCClassRef                  = 42, | 
|  | 1790 | /** | 
|  | 1791 | * \brief A reference to a type declaration. | 
|  | 1792 | * | 
|  | 1793 | * A type reference occurs anywhere where a type is named but not | 
|  | 1794 | * declared. For example, given: | 
|  | 1795 | * | 
|  | 1796 | * \code | 
|  | 1797 | * typedef unsigned size_type; | 
|  | 1798 | * size_type size; | 
|  | 1799 | * \endcode | 
|  | 1800 | * | 
|  | 1801 | * The typedef is a declaration of size_type (CXCursor_TypedefDecl), | 
|  | 1802 | * while the type of the variable "size" is referenced. The cursor | 
|  | 1803 | * referenced by the type of size is the typedef for size_type. | 
|  | 1804 | */ | 
|  | 1805 | CXCursor_TypeRef                       = 43, | 
| Ted Kremenek | ae9e221 | 2010-08-27 21:34:58 +0000 | [diff] [blame] | 1806 | CXCursor_CXXBaseSpecifier              = 44, | 
| Douglas Gregor | a23e8f7 | 2010-08-31 20:37:03 +0000 | [diff] [blame] | 1807 | /** | 
| Douglas Gregor | f3af311 | 2010-09-09 21:42:20 +0000 | [diff] [blame] | 1808 | * \brief A reference to a class template, function template, template | 
|  | 1809 | * template parameter, or class template partial specialization. | 
| Douglas Gregor | a23e8f7 | 2010-08-31 20:37:03 +0000 | [diff] [blame] | 1810 | */ | 
|  | 1811 | CXCursor_TemplateRef                   = 45, | 
| Douglas Gregor | a89314e | 2010-08-31 23:48:11 +0000 | [diff] [blame] | 1812 | /** | 
|  | 1813 | * \brief A reference to a namespace or namespace alias. | 
|  | 1814 | */ | 
|  | 1815 | CXCursor_NamespaceRef                  = 46, | 
| Douglas Gregor | f3af311 | 2010-09-09 21:42:20 +0000 | [diff] [blame] | 1816 | /** | 
| Douglas Gregor | a93ab66 | 2010-09-10 00:22:18 +0000 | [diff] [blame] | 1817 | * \brief A reference to a member of a struct, union, or class that occurs in | 
|  | 1818 | * some non-expression context, e.g., a designated initializer. | 
| Douglas Gregor | f3af311 | 2010-09-09 21:42:20 +0000 | [diff] [blame] | 1819 | */ | 
|  | 1820 | CXCursor_MemberRef                     = 47, | 
| Douglas Gregor | a93ab66 | 2010-09-10 00:22:18 +0000 | [diff] [blame] | 1821 | /** | 
|  | 1822 | * \brief A reference to a labeled statement. | 
|  | 1823 | * | 
|  | 1824 | * This cursor kind is used to describe the jump to "start_over" in the | 
|  | 1825 | * goto statement in the following example: | 
|  | 1826 | * | 
|  | 1827 | * \code | 
|  | 1828 | *   start_over: | 
|  | 1829 | *     ++counter; | 
|  | 1830 | * | 
|  | 1831 | *     goto start_over; | 
|  | 1832 | * \endcode | 
|  | 1833 | * | 
|  | 1834 | * A label reference cursor refers to a label statement. | 
|  | 1835 | */ | 
|  | 1836 | CXCursor_LabelRef                      = 48, | 
|  | 1837 |  | 
| Douglas Gregor | 16a2bdd | 2010-09-13 22:52:57 +0000 | [diff] [blame] | 1838 | /** | 
|  | 1839 | * \brief A reference to a set of overloaded functions or function templates | 
|  | 1840 | * that has not yet been resolved to a specific function or function template. | 
|  | 1841 | * | 
|  | 1842 | * An overloaded declaration reference cursor occurs in C++ templates where | 
|  | 1843 | * a dependent name refers to a function. For example: | 
|  | 1844 | * | 
|  | 1845 | * \code | 
|  | 1846 | * template<typename T> void swap(T&, T&); | 
|  | 1847 | * | 
|  | 1848 | * struct X { ... }; | 
|  | 1849 | * void swap(X&, X&); | 
|  | 1850 | * | 
|  | 1851 | * template<typename T> | 
|  | 1852 | * void reverse(T* first, T* last) { | 
|  | 1853 | *   while (first < last - 1) { | 
|  | 1854 | *     swap(*first, *--last); | 
|  | 1855 | *     ++first; | 
|  | 1856 | *   } | 
|  | 1857 | * } | 
|  | 1858 | * | 
|  | 1859 | * struct Y { }; | 
|  | 1860 | * void swap(Y&, Y&); | 
|  | 1861 | * \endcode | 
|  | 1862 | * | 
|  | 1863 | * Here, the identifier "swap" is associated with an overloaded declaration | 
|  | 1864 | * reference. In the template definition, "swap" refers to either of the two | 
|  | 1865 | * "swap" functions declared above, so both results will be available. At | 
|  | 1866 | * instantiation time, "swap" may also refer to other functions found via | 
|  | 1867 | * argument-dependent lookup (e.g., the "swap" function at the end of the | 
|  | 1868 | * example). | 
|  | 1869 | * | 
|  | 1870 | * The functions \c clang_getNumOverloadedDecls() and | 
|  | 1871 | * \c clang_getOverloadedDecl() can be used to retrieve the definitions | 
|  | 1872 | * referenced by this cursor. | 
|  | 1873 | */ | 
|  | 1874 | CXCursor_OverloadedDeclRef             = 49, | 
|  | 1875 |  | 
| Douglas Gregor | 3009383 | 2012-02-15 00:54:55 +0000 | [diff] [blame] | 1876 | /** | 
|  | 1877 | * \brief A reference to a variable that occurs in some non-expression | 
|  | 1878 | * context, e.g., a C++ lambda capture list. | 
|  | 1879 | */ | 
|  | 1880 | CXCursor_VariableRef                   = 50, | 
|  | 1881 |  | 
|  | 1882 | CXCursor_LastRef                       = CXCursor_VariableRef, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1883 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1884 | /* Error conditions */ | 
|  | 1885 | CXCursor_FirstInvalid                  = 70, | 
|  | 1886 | CXCursor_InvalidFile                   = 70, | 
|  | 1887 | CXCursor_NoDeclFound                   = 71, | 
|  | 1888 | CXCursor_NotImplemented                = 72, | 
| Ted Kremenek | e184ac5 | 2010-03-19 20:39:03 +0000 | [diff] [blame] | 1889 | CXCursor_InvalidCode                   = 73, | 
|  | 1890 | CXCursor_LastInvalid                   = CXCursor_InvalidCode, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1891 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1892 | /* Expressions */ | 
|  | 1893 | CXCursor_FirstExpr                     = 100, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1894 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1895 | /** | 
|  | 1896 | * \brief An expression whose specific kind is not exposed via this | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1897 | * interface. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1898 | * | 
|  | 1899 | * Unexposed expressions have the same operations as any other kind | 
|  | 1900 | * of expression; one can extract their location information, | 
|  | 1901 | * spelling, children, etc. However, the specific kind of the | 
|  | 1902 | * expression is not reported. | 
|  | 1903 | */ | 
|  | 1904 | CXCursor_UnexposedExpr                 = 100, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1905 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1906 | /** | 
|  | 1907 | * \brief An expression that refers to some value declaration, such | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 1908 | * as a function, variable, or enumerator. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1909 | */ | 
|  | 1910 | CXCursor_DeclRefExpr                   = 101, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1911 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1912 | /** | 
|  | 1913 | * \brief An expression that refers to a member of a struct, union, | 
|  | 1914 | * class, Objective-C class, etc. | 
|  | 1915 | */ | 
|  | 1916 | CXCursor_MemberRefExpr                 = 102, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1917 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1918 | /** \brief An expression that calls a function. */ | 
|  | 1919 | CXCursor_CallExpr                      = 103, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 1920 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 1921 | /** \brief An expression that sends a message to an Objective-C | 
|  | 1922 | object or class. */ | 
|  | 1923 | CXCursor_ObjCMessageExpr               = 104, | 
| Ted Kremenek | 33b9a42 | 2010-04-11 21:47:37 +0000 | [diff] [blame] | 1924 |  | 
|  | 1925 | /** \brief An expression that represents a block literal. */ | 
|  | 1926 | CXCursor_BlockExpr                     = 105, | 
|  | 1927 |  | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 1928 | /** \brief An integer literal. | 
|  | 1929 | */ | 
|  | 1930 | CXCursor_IntegerLiteral                = 106, | 
|  | 1931 |  | 
|  | 1932 | /** \brief A floating point number literal. | 
|  | 1933 | */ | 
|  | 1934 | CXCursor_FloatingLiteral               = 107, | 
|  | 1935 |  | 
|  | 1936 | /** \brief An imaginary number literal. | 
|  | 1937 | */ | 
|  | 1938 | CXCursor_ImaginaryLiteral              = 108, | 
|  | 1939 |  | 
|  | 1940 | /** \brief A string literal. | 
|  | 1941 | */ | 
|  | 1942 | CXCursor_StringLiteral                 = 109, | 
|  | 1943 |  | 
|  | 1944 | /** \brief A character literal. | 
|  | 1945 | */ | 
|  | 1946 | CXCursor_CharacterLiteral              = 110, | 
|  | 1947 |  | 
|  | 1948 | /** \brief A parenthesized expression, e.g. "(1)". | 
|  | 1949 | * | 
|  | 1950 | * This AST node is only formed if full location information is requested. | 
|  | 1951 | */ | 
|  | 1952 | CXCursor_ParenExpr                     = 111, | 
|  | 1953 |  | 
|  | 1954 | /** \brief This represents the unary-expression's (except sizeof and | 
|  | 1955 | * alignof). | 
|  | 1956 | */ | 
|  | 1957 | CXCursor_UnaryOperator                 = 112, | 
|  | 1958 |  | 
|  | 1959 | /** \brief [C99 6.5.2.1] Array Subscripting. | 
|  | 1960 | */ | 
|  | 1961 | CXCursor_ArraySubscriptExpr            = 113, | 
|  | 1962 |  | 
|  | 1963 | /** \brief A builtin binary operation expression such as "x + y" or | 
|  | 1964 | * "x <= y". | 
|  | 1965 | */ | 
|  | 1966 | CXCursor_BinaryOperator                = 114, | 
|  | 1967 |  | 
|  | 1968 | /** \brief Compound assignment such as "+=". | 
|  | 1969 | */ | 
|  | 1970 | CXCursor_CompoundAssignOperator        = 115, | 
|  | 1971 |  | 
|  | 1972 | /** \brief The ?: ternary operator. | 
|  | 1973 | */ | 
|  | 1974 | CXCursor_ConditionalOperator           = 116, | 
|  | 1975 |  | 
|  | 1976 | /** \brief An explicit cast in C (C99 6.5.4) or a C-style cast in C++ | 
|  | 1977 | * (C++ [expr.cast]), which uses the syntax (Type)expr. | 
|  | 1978 | * | 
|  | 1979 | * For example: (int)f. | 
|  | 1980 | */ | 
|  | 1981 | CXCursor_CStyleCastExpr                = 117, | 
|  | 1982 |  | 
|  | 1983 | /** \brief [C99 6.5.2.5] | 
|  | 1984 | */ | 
|  | 1985 | CXCursor_CompoundLiteralExpr           = 118, | 
|  | 1986 |  | 
|  | 1987 | /** \brief Describes an C or C++ initializer list. | 
|  | 1988 | */ | 
|  | 1989 | CXCursor_InitListExpr                  = 119, | 
|  | 1990 |  | 
|  | 1991 | /** \brief The GNU address of label extension, representing &&label. | 
|  | 1992 | */ | 
|  | 1993 | CXCursor_AddrLabelExpr                 = 120, | 
|  | 1994 |  | 
|  | 1995 | /** \brief This is the GNU Statement Expression extension: ({int X=4; X;}) | 
|  | 1996 | */ | 
|  | 1997 | CXCursor_StmtExpr                      = 121, | 
|  | 1998 |  | 
| Benjamin Kramer | e56f393 | 2011-12-23 17:00:35 +0000 | [diff] [blame] | 1999 | /** \brief Represents a C11 generic selection. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2000 | */ | 
|  | 2001 | CXCursor_GenericSelectionExpr          = 122, | 
|  | 2002 |  | 
|  | 2003 | /** \brief Implements the GNU __null extension, which is a name for a null | 
|  | 2004 | * pointer constant that has integral type (e.g., int or long) and is the same | 
|  | 2005 | * size and alignment as a pointer. | 
|  | 2006 | * | 
|  | 2007 | * The __null extension is typically only used by system headers, which define | 
|  | 2008 | * NULL as __null in C++ rather than using 0 (which is an integer that may not | 
|  | 2009 | * match the size of a pointer). | 
|  | 2010 | */ | 
|  | 2011 | CXCursor_GNUNullExpr                   = 123, | 
|  | 2012 |  | 
|  | 2013 | /** \brief C++'s static_cast<> expression. | 
|  | 2014 | */ | 
|  | 2015 | CXCursor_CXXStaticCastExpr             = 124, | 
|  | 2016 |  | 
|  | 2017 | /** \brief C++'s dynamic_cast<> expression. | 
|  | 2018 | */ | 
|  | 2019 | CXCursor_CXXDynamicCastExpr            = 125, | 
|  | 2020 |  | 
|  | 2021 | /** \brief C++'s reinterpret_cast<> expression. | 
|  | 2022 | */ | 
|  | 2023 | CXCursor_CXXReinterpretCastExpr        = 126, | 
|  | 2024 |  | 
|  | 2025 | /** \brief C++'s const_cast<> expression. | 
|  | 2026 | */ | 
|  | 2027 | CXCursor_CXXConstCastExpr              = 127, | 
|  | 2028 |  | 
|  | 2029 | /** \brief Represents an explicit C++ type conversion that uses "functional" | 
|  | 2030 | * notion (C++ [expr.type.conv]). | 
|  | 2031 | * | 
|  | 2032 | * Example: | 
|  | 2033 | * \code | 
|  | 2034 | *   x = int(0.5); | 
|  | 2035 | * \endcode | 
|  | 2036 | */ | 
|  | 2037 | CXCursor_CXXFunctionalCastExpr         = 128, | 
|  | 2038 |  | 
|  | 2039 | /** \brief A C++ typeid expression (C++ [expr.typeid]). | 
|  | 2040 | */ | 
|  | 2041 | CXCursor_CXXTypeidExpr                 = 129, | 
|  | 2042 |  | 
|  | 2043 | /** \brief [C++ 2.13.5] C++ Boolean Literal. | 
|  | 2044 | */ | 
|  | 2045 | CXCursor_CXXBoolLiteralExpr            = 130, | 
|  | 2046 |  | 
|  | 2047 | /** \brief [C++0x 2.14.7] C++ Pointer Literal. | 
|  | 2048 | */ | 
|  | 2049 | CXCursor_CXXNullPtrLiteralExpr         = 131, | 
|  | 2050 |  | 
|  | 2051 | /** \brief Represents the "this" expression in C++ | 
|  | 2052 | */ | 
|  | 2053 | CXCursor_CXXThisExpr                   = 132, | 
|  | 2054 |  | 
|  | 2055 | /** \brief [C++ 15] C++ Throw Expression. | 
|  | 2056 | * | 
|  | 2057 | * This handles 'throw' and 'throw' assignment-expression. When | 
|  | 2058 | * assignment-expression isn't present, Op will be null. | 
|  | 2059 | */ | 
|  | 2060 | CXCursor_CXXThrowExpr                  = 133, | 
|  | 2061 |  | 
|  | 2062 | /** \brief A new expression for memory allocation and constructor calls, e.g: | 
|  | 2063 | * "new CXXNewExpr(foo)". | 
|  | 2064 | */ | 
|  | 2065 | CXCursor_CXXNewExpr                    = 134, | 
|  | 2066 |  | 
|  | 2067 | /** \brief A delete expression for memory deallocation and destructor calls, | 
|  | 2068 | * e.g. "delete[] pArray". | 
|  | 2069 | */ | 
|  | 2070 | CXCursor_CXXDeleteExpr                 = 135, | 
|  | 2071 |  | 
| Olivier Goffart | 692d533 | 2016-06-09 16:16:06 +0000 | [diff] [blame] | 2072 | /** \brief A unary expression. (noexcept, sizeof, or other traits) | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2073 | */ | 
|  | 2074 | CXCursor_UnaryExpr                     = 136, | 
|  | 2075 |  | 
| Douglas Gregor | 910c37c | 2011-11-11 22:35:18 +0000 | [diff] [blame] | 2076 | /** \brief An Objective-C string literal i.e. @"foo". | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2077 | */ | 
|  | 2078 | CXCursor_ObjCStringLiteral             = 137, | 
|  | 2079 |  | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 2080 | /** \brief An Objective-C \@encode expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2081 | */ | 
|  | 2082 | CXCursor_ObjCEncodeExpr                = 138, | 
|  | 2083 |  | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 2084 | /** \brief An Objective-C \@selector expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2085 | */ | 
|  | 2086 | CXCursor_ObjCSelectorExpr              = 139, | 
|  | 2087 |  | 
| James Dennett | 1355bd1 | 2012-06-11 06:19:40 +0000 | [diff] [blame] | 2088 | /** \brief An Objective-C \@protocol expression. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2089 | */ | 
|  | 2090 | CXCursor_ObjCProtocolExpr              = 140, | 
|  | 2091 |  | 
|  | 2092 | /** \brief An Objective-C "bridged" cast expression, which casts between | 
|  | 2093 | * Objective-C pointers and C pointers, transferring ownership in the process. | 
|  | 2094 | * | 
|  | 2095 | * \code | 
|  | 2096 | *   NSString *str = (__bridge_transfer NSString *)CFCreateString(); | 
|  | 2097 | * \endcode | 
|  | 2098 | */ | 
|  | 2099 | CXCursor_ObjCBridgedCastExpr           = 141, | 
|  | 2100 |  | 
|  | 2101 | /** \brief Represents a C++0x pack expansion that produces a sequence of | 
|  | 2102 | * expressions. | 
|  | 2103 | * | 
|  | 2104 | * A pack expansion expression contains a pattern (which itself is an | 
|  | 2105 | * expression) followed by an ellipsis. For example: | 
|  | 2106 | * | 
|  | 2107 | * \code | 
|  | 2108 | * template<typename F, typename ...Types> | 
|  | 2109 | * void forward(F f, Types &&...args) { | 
|  | 2110 | *  f(static_cast<Types&&>(args)...); | 
|  | 2111 | * } | 
|  | 2112 | * \endcode | 
|  | 2113 | */ | 
|  | 2114 | CXCursor_PackExpansionExpr             = 142, | 
|  | 2115 |  | 
|  | 2116 | /** \brief Represents an expression that computes the length of a parameter | 
|  | 2117 | * pack. | 
|  | 2118 | * | 
|  | 2119 | * \code | 
|  | 2120 | * template<typename ...Types> | 
|  | 2121 | * struct count { | 
|  | 2122 | *   static const unsigned value = sizeof...(Types); | 
|  | 2123 | * }; | 
|  | 2124 | * \endcode | 
|  | 2125 | */ | 
|  | 2126 | CXCursor_SizeOfPackExpr                = 143, | 
|  | 2127 |  | 
| Douglas Gregor | 3009383 | 2012-02-15 00:54:55 +0000 | [diff] [blame] | 2128 | /* \brief Represents a C++ lambda expression that produces a local function | 
|  | 2129 | * object. | 
|  | 2130 | * | 
|  | 2131 | * \code | 
|  | 2132 | * void abssort(float *x, unsigned N) { | 
|  | 2133 | *   std::sort(x, x + N, | 
|  | 2134 | *             [](float a, float b) { | 
|  | 2135 | *               return std::abs(a) < std::abs(b); | 
|  | 2136 | *             }); | 
|  | 2137 | * } | 
|  | 2138 | * \endcode | 
|  | 2139 | */ | 
|  | 2140 | CXCursor_LambdaExpr                    = 144, | 
|  | 2141 |  | 
| Ted Kremenek | 77006f6 | 2012-03-06 20:06:06 +0000 | [diff] [blame] | 2142 | /** \brief Objective-c Boolean Literal. | 
|  | 2143 | */ | 
|  | 2144 | CXCursor_ObjCBoolLiteralExpr           = 145, | 
|  | 2145 |  | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 2146 | /** \brief Represents the "self" expression in an Objective-C method. | 
| Argyrios Kyrtzidis | c2233be | 2013-04-23 17:57:17 +0000 | [diff] [blame] | 2147 | */ | 
|  | 2148 | CXCursor_ObjCSelfExpr                  = 146, | 
|  | 2149 |  | 
| Alexey Bataev | 1a3320e | 2015-08-25 14:24:04 +0000 | [diff] [blame] | 2150 | /** \brief OpenMP 4.0 [2.4, Array Section]. | 
|  | 2151 | */ | 
|  | 2152 | CXCursor_OMPArraySectionExpr           = 147, | 
|  | 2153 |  | 
| Erik Pilkington | 29099de | 2016-07-16 00:35:23 +0000 | [diff] [blame] | 2154 | /** \brief Represents an @available(...) check. | 
|  | 2155 | */ | 
|  | 2156 | CXCursor_ObjCAvailabilityCheckExpr     = 148, | 
|  | 2157 |  | 
|  | 2158 | CXCursor_LastExpr                      = CXCursor_ObjCAvailabilityCheckExpr, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2159 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2160 | /* Statements */ | 
|  | 2161 | CXCursor_FirstStmt                     = 200, | 
|  | 2162 | /** | 
|  | 2163 | * \brief A statement whose specific kind is not exposed via this | 
|  | 2164 | * interface. | 
|  | 2165 | * | 
|  | 2166 | * Unexposed statements have the same operations as any other kind of | 
|  | 2167 | * statement; one can extract their location information, spelling, | 
|  | 2168 | * children, etc. However, the specific kind of the statement is not | 
|  | 2169 | * reported. | 
|  | 2170 | */ | 
|  | 2171 | CXCursor_UnexposedStmt                 = 200, | 
| Douglas Gregor | a93ab66 | 2010-09-10 00:22:18 +0000 | [diff] [blame] | 2172 |  | 
|  | 2173 | /** \brief A labelled statement in a function. | 
|  | 2174 | * | 
|  | 2175 | * This cursor kind is used to describe the "start_over:" label statement in | 
|  | 2176 | * the following example: | 
|  | 2177 | * | 
|  | 2178 | * \code | 
|  | 2179 | *   start_over: | 
|  | 2180 | *     ++counter; | 
|  | 2181 | * \endcode | 
|  | 2182 | * | 
|  | 2183 | */ | 
|  | 2184 | CXCursor_LabelStmt                     = 201, | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2185 |  | 
|  | 2186 | /** \brief A group of statements like { stmt stmt }. | 
|  | 2187 | * | 
|  | 2188 | * This cursor kind is used to describe compound statements, e.g. function | 
|  | 2189 | * bodies. | 
|  | 2190 | */ | 
|  | 2191 | CXCursor_CompoundStmt                  = 202, | 
|  | 2192 |  | 
| Benjamin Kramer | 2501f14 | 2013-10-20 11:47:15 +0000 | [diff] [blame] | 2193 | /** \brief A case statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2194 | */ | 
|  | 2195 | CXCursor_CaseStmt                      = 203, | 
|  | 2196 |  | 
|  | 2197 | /** \brief A default statement. | 
|  | 2198 | */ | 
|  | 2199 | CXCursor_DefaultStmt                   = 204, | 
|  | 2200 |  | 
|  | 2201 | /** \brief An if statement | 
|  | 2202 | */ | 
|  | 2203 | CXCursor_IfStmt                        = 205, | 
|  | 2204 |  | 
|  | 2205 | /** \brief A switch statement. | 
|  | 2206 | */ | 
|  | 2207 | CXCursor_SwitchStmt                    = 206, | 
|  | 2208 |  | 
|  | 2209 | /** \brief A while statement. | 
|  | 2210 | */ | 
|  | 2211 | CXCursor_WhileStmt                     = 207, | 
|  | 2212 |  | 
|  | 2213 | /** \brief A do statement. | 
|  | 2214 | */ | 
|  | 2215 | CXCursor_DoStmt                        = 208, | 
|  | 2216 |  | 
|  | 2217 | /** \brief A for statement. | 
|  | 2218 | */ | 
|  | 2219 | CXCursor_ForStmt                       = 209, | 
|  | 2220 |  | 
|  | 2221 | /** \brief A goto statement. | 
|  | 2222 | */ | 
|  | 2223 | CXCursor_GotoStmt                      = 210, | 
|  | 2224 |  | 
|  | 2225 | /** \brief An indirect goto statement. | 
|  | 2226 | */ | 
|  | 2227 | CXCursor_IndirectGotoStmt              = 211, | 
|  | 2228 |  | 
|  | 2229 | /** \brief A continue statement. | 
|  | 2230 | */ | 
|  | 2231 | CXCursor_ContinueStmt                  = 212, | 
|  | 2232 |  | 
|  | 2233 | /** \brief A break statement. | 
|  | 2234 | */ | 
|  | 2235 | CXCursor_BreakStmt                     = 213, | 
|  | 2236 |  | 
|  | 2237 | /** \brief A return statement. | 
|  | 2238 | */ | 
|  | 2239 | CXCursor_ReturnStmt                    = 214, | 
|  | 2240 |  | 
| Chad Rosier | de70e0e | 2012-08-25 00:11:56 +0000 | [diff] [blame] | 2241 | /** \brief A GCC inline assembly statement extension. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2242 | */ | 
| Chad Rosier | de70e0e | 2012-08-25 00:11:56 +0000 | [diff] [blame] | 2243 | CXCursor_GCCAsmStmt                    = 215, | 
| Argyrios Kyrtzidis | 5eae073 | 2012-09-24 19:27:20 +0000 | [diff] [blame] | 2244 | CXCursor_AsmStmt                       = CXCursor_GCCAsmStmt, | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2245 |  | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 2246 | /** \brief Objective-C's overall \@try-\@catch-\@finally statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2247 | */ | 
|  | 2248 | CXCursor_ObjCAtTryStmt                 = 216, | 
|  | 2249 |  | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 2250 | /** \brief Objective-C's \@catch statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2251 | */ | 
|  | 2252 | CXCursor_ObjCAtCatchStmt               = 217, | 
|  | 2253 |  | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 2254 | /** \brief Objective-C's \@finally statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2255 | */ | 
|  | 2256 | CXCursor_ObjCAtFinallyStmt             = 218, | 
|  | 2257 |  | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 2258 | /** \brief Objective-C's \@throw statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2259 | */ | 
|  | 2260 | CXCursor_ObjCAtThrowStmt               = 219, | 
|  | 2261 |  | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 2262 | /** \brief Objective-C's \@synchronized statement. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2263 | */ | 
|  | 2264 | CXCursor_ObjCAtSynchronizedStmt        = 220, | 
|  | 2265 |  | 
|  | 2266 | /** \brief Objective-C's autorelease pool statement. | 
|  | 2267 | */ | 
|  | 2268 | CXCursor_ObjCAutoreleasePoolStmt       = 221, | 
|  | 2269 |  | 
|  | 2270 | /** \brief Objective-C's collection statement. | 
|  | 2271 | */ | 
|  | 2272 | CXCursor_ObjCForCollectionStmt         = 222, | 
|  | 2273 |  | 
|  | 2274 | /** \brief C++'s catch statement. | 
|  | 2275 | */ | 
|  | 2276 | CXCursor_CXXCatchStmt                  = 223, | 
|  | 2277 |  | 
|  | 2278 | /** \brief C++'s try statement. | 
|  | 2279 | */ | 
|  | 2280 | CXCursor_CXXTryStmt                    = 224, | 
|  | 2281 |  | 
|  | 2282 | /** \brief C++'s for (* : *) statement. | 
|  | 2283 | */ | 
|  | 2284 | CXCursor_CXXForRangeStmt               = 225, | 
|  | 2285 |  | 
|  | 2286 | /** \brief Windows Structured Exception Handling's try statement. | 
|  | 2287 | */ | 
|  | 2288 | CXCursor_SEHTryStmt                    = 226, | 
|  | 2289 |  | 
|  | 2290 | /** \brief Windows Structured Exception Handling's except statement. | 
|  | 2291 | */ | 
|  | 2292 | CXCursor_SEHExceptStmt                 = 227, | 
|  | 2293 |  | 
|  | 2294 | /** \brief Windows Structured Exception Handling's finally statement. | 
|  | 2295 | */ | 
|  | 2296 | CXCursor_SEHFinallyStmt                = 228, | 
|  | 2297 |  | 
| Chad Rosier | 3250302 | 2012-06-11 20:47:18 +0000 | [diff] [blame] | 2298 | /** \brief A MS inline assembly statement extension. | 
|  | 2299 | */ | 
|  | 2300 | CXCursor_MSAsmStmt                     = 229, | 
|  | 2301 |  | 
| Chad Rosier | db1cc7f | 2014-12-05 15:50:44 +0000 | [diff] [blame] | 2302 | /** \brief The null statement ";": C99 6.8.3p3. | 
| Douglas Gregor | 4c362d5 | 2011-10-05 19:00:14 +0000 | [diff] [blame] | 2303 | * | 
|  | 2304 | * This cursor kind is used to describe the null statement. | 
|  | 2305 | */ | 
|  | 2306 | CXCursor_NullStmt                      = 230, | 
|  | 2307 |  | 
|  | 2308 | /** \brief Adaptor class for mixing declarations with statements and | 
|  | 2309 | * expressions. | 
|  | 2310 | */ | 
|  | 2311 | CXCursor_DeclStmt                      = 231, | 
|  | 2312 |  | 
| Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 2313 | /** \brief OpenMP parallel directive. | 
|  | 2314 | */ | 
|  | 2315 | CXCursor_OMPParallelDirective          = 232, | 
|  | 2316 |  | 
| Chad Rosier | db1cc7f | 2014-12-05 15:50:44 +0000 | [diff] [blame] | 2317 | /** \brief OpenMP SIMD directive. | 
| Alexey Bataev | 1b59ab5 | 2014-02-27 08:29:12 +0000 | [diff] [blame] | 2318 | */ | 
|  | 2319 | CXCursor_OMPSimdDirective              = 233, | 
|  | 2320 |  | 
| Alexey Bataev | f29276e | 2014-06-18 04:14:57 +0000 | [diff] [blame] | 2321 | /** \brief OpenMP for directive. | 
|  | 2322 | */ | 
|  | 2323 | CXCursor_OMPForDirective               = 234, | 
|  | 2324 |  | 
| Alexey Bataev | d3f8dd2 | 2014-06-25 11:44:49 +0000 | [diff] [blame] | 2325 | /** \brief OpenMP sections directive. | 
|  | 2326 | */ | 
|  | 2327 | CXCursor_OMPSectionsDirective          = 235, | 
|  | 2328 |  | 
| Alexey Bataev | 1e0498a | 2014-06-26 08:21:58 +0000 | [diff] [blame] | 2329 | /** \brief OpenMP section directive. | 
|  | 2330 | */ | 
|  | 2331 | CXCursor_OMPSectionDirective           = 236, | 
|  | 2332 |  | 
| Alexey Bataev | d1e40fb | 2014-06-26 12:05:45 +0000 | [diff] [blame] | 2333 | /** \brief OpenMP single directive. | 
|  | 2334 | */ | 
|  | 2335 | CXCursor_OMPSingleDirective            = 237, | 
|  | 2336 |  | 
| Alexey Bataev | 4acb859 | 2014-07-07 13:01:15 +0000 | [diff] [blame] | 2337 | /** \brief OpenMP parallel for directive. | 
|  | 2338 | */ | 
|  | 2339 | CXCursor_OMPParallelForDirective       = 238, | 
|  | 2340 |  | 
| Alexey Bataev | 84d0b3e | 2014-07-08 08:12:03 +0000 | [diff] [blame] | 2341 | /** \brief OpenMP parallel sections directive. | 
|  | 2342 | */ | 
|  | 2343 | CXCursor_OMPParallelSectionsDirective  = 239, | 
|  | 2344 |  | 
| Alexey Bataev | 9c2e8ee | 2014-07-11 11:25:16 +0000 | [diff] [blame] | 2345 | /** \brief OpenMP task directive. | 
|  | 2346 | */ | 
|  | 2347 | CXCursor_OMPTaskDirective              = 240, | 
|  | 2348 |  | 
| Alexander Musman | 80c2289 | 2014-07-17 08:54:58 +0000 | [diff] [blame] | 2349 | /** \brief OpenMP master directive. | 
|  | 2350 | */ | 
|  | 2351 | CXCursor_OMPMasterDirective            = 241, | 
|  | 2352 |  | 
| Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2353 | /** \brief OpenMP critical directive. | 
|  | 2354 | */ | 
|  | 2355 | CXCursor_OMPCriticalDirective          = 242, | 
|  | 2356 |  | 
| Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 2357 | /** \brief OpenMP taskyield directive. | 
|  | 2358 | */ | 
| Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2359 | CXCursor_OMPTaskyieldDirective         = 243, | 
| Alexey Bataev | 68446b7 | 2014-07-18 07:47:19 +0000 | [diff] [blame] | 2360 |  | 
| Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 2361 | /** \brief OpenMP barrier directive. | 
|  | 2362 | */ | 
| Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2363 | CXCursor_OMPBarrierDirective           = 244, | 
| Alexey Bataev | 4d1dfea | 2014-07-18 09:11:51 +0000 | [diff] [blame] | 2364 |  | 
| Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 2365 | /** \brief OpenMP taskwait directive. | 
|  | 2366 | */ | 
| Alexander Musman | d9ed09f | 2014-07-21 09:42:05 +0000 | [diff] [blame] | 2367 | CXCursor_OMPTaskwaitDirective          = 245, | 
| Alexey Bataev | 2df347a | 2014-07-18 10:17:07 +0000 | [diff] [blame] | 2368 |  | 
| Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2369 | /** \brief OpenMP flush directive. | 
|  | 2370 | */ | 
|  | 2371 | CXCursor_OMPFlushDirective             = 246, | 
| Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2372 |  | 
| Reid Kleckner | ba76448 | 2014-07-24 18:22:15 +0000 | [diff] [blame] | 2373 | /** \brief Windows Structured Exception Handling's leave statement. | 
|  | 2374 | */ | 
|  | 2375 | CXCursor_SEHLeaveStmt                  = 247, | 
|  | 2376 |  | 
| Alexey Bataev | 9fb6e64 | 2014-07-22 06:45:04 +0000 | [diff] [blame] | 2377 | /** \brief OpenMP ordered directive. | 
|  | 2378 | */ | 
| Reid Kleckner | ba76448 | 2014-07-24 18:22:15 +0000 | [diff] [blame] | 2379 | CXCursor_OMPOrderedDirective           = 248, | 
| Alexey Bataev | 6125da9 | 2014-07-21 11:26:11 +0000 | [diff] [blame] | 2380 |  | 
| Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2381 | /** \brief OpenMP atomic directive. | 
|  | 2382 | */ | 
| Reid Kleckner | ba76448 | 2014-07-24 18:22:15 +0000 | [diff] [blame] | 2383 | CXCursor_OMPAtomicDirective            = 249, | 
| Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 2384 |  | 
| Chad Rosier | db1cc7f | 2014-12-05 15:50:44 +0000 | [diff] [blame] | 2385 | /** \brief OpenMP for SIMD directive. | 
| Alexander Musman | f82886e | 2014-09-18 05:12:34 +0000 | [diff] [blame] | 2386 | */ | 
|  | 2387 | CXCursor_OMPForSimdDirective           = 250, | 
|  | 2388 |  | 
| Chad Rosier | db1cc7f | 2014-12-05 15:50:44 +0000 | [diff] [blame] | 2389 | /** \brief OpenMP parallel for SIMD directive. | 
| Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 2390 | */ | 
|  | 2391 | CXCursor_OMPParallelForSimdDirective   = 251, | 
|  | 2392 |  | 
| Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 2393 | /** \brief OpenMP target directive. | 
|  | 2394 | */ | 
| Alexander Musman | e4e893b | 2014-09-23 09:33:00 +0000 | [diff] [blame] | 2395 | CXCursor_OMPTargetDirective            = 252, | 
| Alexey Bataev | 0bd520b | 2014-09-19 08:19:49 +0000 | [diff] [blame] | 2396 |  | 
| Alexey Bataev | 13314bf | 2014-10-09 04:18:56 +0000 | [diff] [blame] | 2397 | /** \brief OpenMP teams directive. | 
|  | 2398 | */ | 
|  | 2399 | CXCursor_OMPTeamsDirective             = 253, | 
|  | 2400 |  | 
| Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 2401 | /** \brief OpenMP taskgroup directive. | 
| Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2402 | */ | 
| Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2403 | CXCursor_OMPTaskgroupDirective         = 254, | 
| Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2404 |  | 
| Alexey Bataev | 6d4ed05 | 2015-07-01 06:57:41 +0000 | [diff] [blame] | 2405 | /** \brief OpenMP cancellation point directive. | 
|  | 2406 | */ | 
| Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2407 | CXCursor_OMPCancellationPointDirective = 255, | 
| Alexey Bataev | c30dd2d | 2015-06-18 12:14:09 +0000 | [diff] [blame] | 2408 |  | 
| Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2409 | /** \brief OpenMP cancel directive. | 
|  | 2410 | */ | 
| Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2411 | CXCursor_OMPCancelDirective            = 256, | 
| Alexey Bataev | 8090987 | 2015-07-02 11:25:17 +0000 | [diff] [blame] | 2412 |  | 
| Michael Wong | 65f367f | 2015-07-21 13:44:28 +0000 | [diff] [blame] | 2413 | /** \brief OpenMP target data directive. | 
|  | 2414 | */ | 
|  | 2415 | CXCursor_OMPTargetDataDirective        = 257, | 
|  | 2416 |  | 
| Alexey Bataev | 49f6e78 | 2015-12-01 04:18:41 +0000 | [diff] [blame] | 2417 | /** \brief OpenMP taskloop directive. | 
|  | 2418 | */ | 
|  | 2419 | CXCursor_OMPTaskLoopDirective          = 258, | 
|  | 2420 |  | 
| Alexey Bataev | 0a6ed84 | 2015-12-03 09:40:15 +0000 | [diff] [blame] | 2421 | /** \brief OpenMP taskloop simd directive. | 
|  | 2422 | */ | 
|  | 2423 | CXCursor_OMPTaskLoopSimdDirective      = 259, | 
|  | 2424 |  | 
| Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2425 | /** \brief OpenMP distribute directive. | 
| Carlo Bertolli | 6200a3d | 2015-12-14 14:51:25 +0000 | [diff] [blame] | 2426 | */ | 
|  | 2427 | CXCursor_OMPDistributeDirective        = 260, | 
|  | 2428 |  | 
| Samuel Antao | df67fc4 | 2016-01-19 19:15:56 +0000 | [diff] [blame] | 2429 | /** \brief OpenMP target enter data directive. | 
|  | 2430 | */ | 
|  | 2431 | CXCursor_OMPTargetEnterDataDirective   = 261, | 
|  | 2432 |  | 
| Samuel Antao | 7259076 | 2016-01-19 20:04:50 +0000 | [diff] [blame] | 2433 | /** \brief OpenMP target exit data directive. | 
|  | 2434 | */ | 
|  | 2435 | CXCursor_OMPTargetExitDataDirective    = 262, | 
|  | 2436 |  | 
| Arpith Chacko Jacob | e955b3d | 2016-01-26 18:48:41 +0000 | [diff] [blame] | 2437 | /** \brief OpenMP target parallel directive. | 
|  | 2438 | */ | 
|  | 2439 | CXCursor_OMPTargetParallelDirective    = 263, | 
|  | 2440 |  | 
| Arpith Chacko Jacob | 05bebb5 | 2016-02-03 15:46:42 +0000 | [diff] [blame] | 2441 | /** \brief OpenMP target parallel for directive. | 
|  | 2442 | */ | 
|  | 2443 | CXCursor_OMPTargetParallelForDirective = 264, | 
|  | 2444 |  | 
| Samuel Antao | 686c70c | 2016-05-26 17:30:50 +0000 | [diff] [blame] | 2445 | /** \brief OpenMP target update directive. | 
|  | 2446 | */ | 
|  | 2447 | CXCursor_OMPTargetUpdateDirective      = 265, | 
|  | 2448 |  | 
| Carlo Bertolli | 9925f15 | 2016-06-27 14:55:37 +0000 | [diff] [blame] | 2449 | /** \brief OpenMP distribute parallel for directive. | 
|  | 2450 | */ | 
|  | 2451 | CXCursor_OMPDistributeParallelForDirective = 266, | 
|  | 2452 |  | 
| Kelvin Li | 4a39add | 2016-07-05 05:00:15 +0000 | [diff] [blame] | 2453 | /** \brief OpenMP distribute parallel for simd directive. | 
|  | 2454 | */ | 
|  | 2455 | CXCursor_OMPDistributeParallelForSimdDirective = 267, | 
|  | 2456 |  | 
| Kelvin Li | 787f3fc | 2016-07-06 04:45:38 +0000 | [diff] [blame] | 2457 | /** \brief OpenMP distribute simd directive. | 
|  | 2458 | */ | 
|  | 2459 | CXCursor_OMPDistributeSimdDirective = 268, | 
|  | 2460 |  | 
| Kelvin Li | a579b91 | 2016-07-14 02:54:56 +0000 | [diff] [blame] | 2461 | /** \brief OpenMP target parallel for simd directive. | 
|  | 2462 | */ | 
|  | 2463 | CXCursor_OMPTargetParallelForSimdDirective = 269, | 
|  | 2464 |  | 
| Kelvin Li | 986330c | 2016-07-20 22:57:10 +0000 | [diff] [blame] | 2465 | /** \brief OpenMP target simd directive. | 
|  | 2466 | */ | 
|  | 2467 | CXCursor_OMPTargetSimdDirective = 270, | 
|  | 2468 |  | 
| Kelvin Li | 0253287 | 2016-08-05 14:37:37 +0000 | [diff] [blame] | 2469 | /** \brief OpenMP teams distribute directive. | 
|  | 2470 | */ | 
|  | 2471 | CXCursor_OMPTeamsDistributeDirective = 271, | 
|  | 2472 |  | 
| Kelvin Li | 4e325f7 | 2016-10-25 12:50:55 +0000 | [diff] [blame] | 2473 | /** \brief OpenMP teams distribute simd directive. | 
|  | 2474 | */ | 
|  | 2475 | CXCursor_OMPTeamsDistributeSimdDirective = 272, | 
|  | 2476 |  | 
| Kelvin Li | 579e41c | 2016-11-30 23:51:03 +0000 | [diff] [blame] | 2477 | /** \brief OpenMP teams distribute parallel for simd directive. | 
|  | 2478 | */ | 
|  | 2479 | CXCursor_OMPTeamsDistributeParallelForSimdDirective = 273, | 
|  | 2480 |  | 
| Kelvin Li | 7ade93f | 2016-12-09 03:24:30 +0000 | [diff] [blame] | 2481 | /** \brief OpenMP teams distribute parallel for directive. | 
|  | 2482 | */ | 
|  | 2483 | CXCursor_OMPTeamsDistributeParallelForDirective = 274, | 
|  | 2484 |  | 
| Kelvin Li | bf594a5 | 2016-12-17 05:48:59 +0000 | [diff] [blame] | 2485 | /** \brief OpenMP target teams directive. | 
|  | 2486 | */ | 
|  | 2487 | CXCursor_OMPTargetTeamsDirective = 275, | 
|  | 2488 |  | 
| Kelvin Li | 83c451e | 2016-12-25 04:52:54 +0000 | [diff] [blame] | 2489 | /** \brief OpenMP target teams distribute directive. | 
|  | 2490 | */ | 
|  | 2491 | CXCursor_OMPTargetTeamsDistributeDirective = 276, | 
|  | 2492 |  | 
| Kelvin Li | 80e8f56 | 2016-12-29 22:16:30 +0000 | [diff] [blame] | 2493 | /** \brief OpenMP target teams distribute parallel for directive. | 
|  | 2494 | */ | 
|  | 2495 | CXCursor_OMPTargetTeamsDistributeParallelForDirective = 277, | 
|  | 2496 |  | 
| Kelvin Li | 1851df5 | 2017-01-03 05:23:48 +0000 | [diff] [blame] | 2497 | /** \brief OpenMP target teams distribute parallel for simd directive. | 
|  | 2498 | */ | 
|  | 2499 | CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective = 278, | 
|  | 2500 |  | 
| Kelvin Li | da68118 | 2017-01-10 18:08:18 +0000 | [diff] [blame] | 2501 | /** \brief OpenMP target teams distribute simd directive. | 
|  | 2502 | */ | 
|  | 2503 | CXCursor_OMPTargetTeamsDistributeSimdDirective = 279, | 
|  | 2504 |  | 
|  | 2505 | CXCursor_LastStmt = CXCursor_OMPTargetTeamsDistributeSimdDirective, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2506 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2507 | /** | 
|  | 2508 | * \brief Cursor that represents the translation unit itself. | 
|  | 2509 | * | 
|  | 2510 | * The translation unit cursor exists primarily to act as the root | 
|  | 2511 | * cursor for traversing the contents of a translation unit. | 
|  | 2512 | */ | 
| Ted Kremenek | bff3143 | 2010-02-18 03:09:07 +0000 | [diff] [blame] | 2513 | CXCursor_TranslationUnit               = 300, | 
|  | 2514 |  | 
| Bill Wendling | 4442605 | 2012-12-20 19:22:21 +0000 | [diff] [blame] | 2515 | /* Attributes */ | 
| Ted Kremenek | bff3143 | 2010-02-18 03:09:07 +0000 | [diff] [blame] | 2516 | CXCursor_FirstAttr                     = 400, | 
|  | 2517 | /** | 
|  | 2518 | * \brief An attribute whose specific kind is not exposed via this | 
|  | 2519 | * interface. | 
|  | 2520 | */ | 
|  | 2521 | CXCursor_UnexposedAttr                 = 400, | 
|  | 2522 |  | 
|  | 2523 | CXCursor_IBActionAttr                  = 401, | 
|  | 2524 | CXCursor_IBOutletAttr                  = 402, | 
| Ted Kremenek | 26bde77 | 2010-05-19 17:38:06 +0000 | [diff] [blame] | 2525 | CXCursor_IBOutletCollectionAttr        = 403, | 
| Argyrios Kyrtzidis | 2cb4e3c | 2011-09-13 17:39:31 +0000 | [diff] [blame] | 2526 | CXCursor_CXXFinalAttr                  = 404, | 
|  | 2527 | CXCursor_CXXOverrideAttr               = 405, | 
| Erik Verbruggen | ca98f2a | 2011-10-13 09:41:32 +0000 | [diff] [blame] | 2528 | CXCursor_AnnotateAttr                  = 406, | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 2529 | CXCursor_AsmLabelAttr                  = 407, | 
| Argyrios Kyrtzidis | 16834f1 | 2013-09-25 00:14:38 +0000 | [diff] [blame] | 2530 | CXCursor_PackedAttr                    = 408, | 
| Joey Gouly | 8122838 | 2014-05-01 15:41:58 +0000 | [diff] [blame] | 2531 | CXCursor_PureAttr                      = 409, | 
|  | 2532 | CXCursor_ConstAttr                     = 410, | 
|  | 2533 | CXCursor_NoDuplicateAttr               = 411, | 
| Eli Bendersky | 2581e66 | 2014-05-28 19:29:58 +0000 | [diff] [blame] | 2534 | CXCursor_CUDAConstantAttr              = 412, | 
|  | 2535 | CXCursor_CUDADeviceAttr                = 413, | 
|  | 2536 | CXCursor_CUDAGlobalAttr                = 414, | 
|  | 2537 | CXCursor_CUDAHostAttr                  = 415, | 
| Eli Bendersky | 9b07147 | 2014-08-08 14:59:00 +0000 | [diff] [blame] | 2538 | CXCursor_CUDASharedAttr                = 416, | 
| Saleem Abdulrasool | 79c6971 | 2015-09-05 18:53:43 +0000 | [diff] [blame] | 2539 | CXCursor_VisibilityAttr                = 417, | 
| Saleem Abdulrasool | 8aa0b80 | 2015-12-10 18:45:18 +0000 | [diff] [blame] | 2540 | CXCursor_DLLExport                     = 418, | 
|  | 2541 | CXCursor_DLLImport                     = 419, | 
|  | 2542 | CXCursor_LastAttr                      = CXCursor_DLLImport, | 
| Eli Bendersky | 2581e66 | 2014-05-28 19:29:58 +0000 | [diff] [blame] | 2543 |  | 
| Douglas Gregor | 92a524f | 2010-03-18 00:42:48 +0000 | [diff] [blame] | 2544 | /* Preprocessing */ | 
|  | 2545 | CXCursor_PreprocessingDirective        = 500, | 
| Douglas Gregor | 06d6d32 | 2010-03-18 18:04:21 +0000 | [diff] [blame] | 2546 | CXCursor_MacroDefinition               = 501, | 
| Chandler Carruth | 9e4704a | 2011-07-14 08:41:15 +0000 | [diff] [blame] | 2547 | CXCursor_MacroExpansion                = 502, | 
|  | 2548 | CXCursor_MacroInstantiation            = CXCursor_MacroExpansion, | 
| Douglas Gregor | 796d76a | 2010-10-20 22:00:55 +0000 | [diff] [blame] | 2549 | CXCursor_InclusionDirective            = 503, | 
| Douglas Gregor | 92a524f | 2010-03-18 00:42:48 +0000 | [diff] [blame] | 2550 | CXCursor_FirstPreprocessing            = CXCursor_PreprocessingDirective, | 
| Argyrios Kyrtzidis | 50e5b1d | 2012-10-05 00:22:24 +0000 | [diff] [blame] | 2551 | CXCursor_LastPreprocessing             = CXCursor_InclusionDirective, | 
|  | 2552 |  | 
|  | 2553 | /* Extra Declarations */ | 
|  | 2554 | /** | 
|  | 2555 | * \brief A module import declaration. | 
|  | 2556 | */ | 
|  | 2557 | CXCursor_ModuleImportDecl              = 600, | 
| Sergey Kalinichev | 8f3b187 | 2015-11-15 13:48:32 +0000 | [diff] [blame] | 2558 | CXCursor_TypeAliasTemplateDecl         = 601, | 
| Olivier Goffart | 8197801 | 2016-06-09 16:15:55 +0000 | [diff] [blame] | 2559 | /** | 
|  | 2560 | * \brief A static_assert or _Static_assert node | 
|  | 2561 | */ | 
|  | 2562 | CXCursor_StaticAssert                  = 602, | 
| Olivier Goffart | d211c64 | 2016-11-04 06:29:27 +0000 | [diff] [blame] | 2563 | /** | 
|  | 2564 | * \brief a friend declaration. | 
|  | 2565 | */ | 
|  | 2566 | CXCursor_FriendDecl                    = 603, | 
| Argyrios Kyrtzidis | 50e5b1d | 2012-10-05 00:22:24 +0000 | [diff] [blame] | 2567 | CXCursor_FirstExtraDecl                = CXCursor_ModuleImportDecl, | 
| Olivier Goffart | d211c64 | 2016-11-04 06:29:27 +0000 | [diff] [blame] | 2568 | CXCursor_LastExtraDecl                 = CXCursor_FriendDecl, | 
| Francisco Lopes da Silva | 975a9f6 | 2015-01-21 16:24:11 +0000 | [diff] [blame] | 2569 |  | 
|  | 2570 | /** | 
|  | 2571 | * \brief A code completion overload candidate. | 
|  | 2572 | */ | 
|  | 2573 | CXCursor_OverloadCandidate             = 700 | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2574 | }; | 
|  | 2575 |  | 
|  | 2576 | /** | 
|  | 2577 | * \brief A cursor representing some element in the abstract syntax tree for | 
|  | 2578 | * a translation unit. | 
|  | 2579 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2580 | * The cursor abstraction unifies the different kinds of entities in a | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2581 | * program--declaration, statements, expressions, references to declarations, | 
|  | 2582 | * etc.--under a single "cursor" abstraction with a common set of operations. | 
|  | 2583 | * Common operation for a cursor include: getting the physical location in | 
|  | 2584 | * a source file where the cursor points, getting the name associated with a | 
|  | 2585 | * cursor, and retrieving cursors for any child nodes of a particular cursor. | 
|  | 2586 | * | 
|  | 2587 | * Cursors can be produced in two specific ways. | 
|  | 2588 | * clang_getTranslationUnitCursor() produces a cursor for a translation unit, | 
|  | 2589 | * from which one can use clang_visitChildren() to explore the rest of the | 
|  | 2590 | * translation unit. clang_getCursor() maps from a physical source location | 
|  | 2591 | * to the entity that resides at that location, allowing one to map from the | 
|  | 2592 | * source code into the AST. | 
|  | 2593 | */ | 
|  | 2594 | typedef struct { | 
|  | 2595 | enum CXCursorKind kind; | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 2596 | int xdata; | 
| Dmitri Gribenko | ba2f746 | 2013-01-11 21:01:49 +0000 | [diff] [blame] | 2597 | const void *data[3]; | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2598 | } CXCursor; | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2599 |  | 
|  | 2600 | /** | 
|  | 2601 | * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations | 
|  | 2602 | * | 
|  | 2603 | * @{ | 
|  | 2604 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2605 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2606 | /** | 
|  | 2607 | * \brief Retrieve the NULL cursor, which represents no entity. | 
|  | 2608 | */ | 
|  | 2609 | CINDEX_LINKAGE CXCursor clang_getNullCursor(void); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2610 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2611 | /** | 
|  | 2612 | * \brief Retrieve the cursor that represents the given translation unit. | 
|  | 2613 | * | 
|  | 2614 | * The translation unit cursor can be used to start traversing the | 
|  | 2615 | * various declarations within the given translation unit. | 
|  | 2616 | */ | 
|  | 2617 | CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit); | 
|  | 2618 |  | 
|  | 2619 | /** | 
|  | 2620 | * \brief Determine whether two cursors are equivalent. | 
|  | 2621 | */ | 
|  | 2622 | CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2623 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2624 | /** | 
| Dmitri Gribenko | 8994e0c | 2012-09-13 13:11:20 +0000 | [diff] [blame] | 2625 | * \brief Returns non-zero if \p cursor is null. | 
| Argyrios Kyrtzidis | d6e9fa5 | 2011-09-27 00:30:30 +0000 | [diff] [blame] | 2626 | */ | 
| Dmitri Gribenko | 8994e0c | 2012-09-13 13:11:20 +0000 | [diff] [blame] | 2627 | CINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor); | 
| Argyrios Kyrtzidis | d6e9fa5 | 2011-09-27 00:30:30 +0000 | [diff] [blame] | 2628 |  | 
|  | 2629 | /** | 
| Douglas Gregor | 06a3f30 | 2010-11-20 00:09:34 +0000 | [diff] [blame] | 2630 | * \brief Compute a hash value for the given cursor. | 
|  | 2631 | */ | 
|  | 2632 | CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor); | 
|  | 2633 |  | 
|  | 2634 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2635 | * \brief Retrieve the kind of the given cursor. | 
|  | 2636 | */ | 
|  | 2637 | CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor); | 
|  | 2638 |  | 
|  | 2639 | /** | 
|  | 2640 | * \brief Determine whether the given cursor kind represents a declaration. | 
| Ivan Donchevskii | 65c766e | 2018-01-03 10:40:11 +0000 | [diff] [blame] | 2641 | */ | 
|  | 2642 | CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind); | 
|  | 2643 |  | 
|  | 2644 | /** | 
| Ivan Donchevskii | 08ff910 | 2018-01-04 10:59:50 +0000 | [diff] [blame] | 2645 | * \brief Determine whether the given declaration is invalid. | 
|  | 2646 | * | 
|  | 2647 | * A declaration is invalid if it could not be parsed successfully. | 
|  | 2648 | * | 
|  | 2649 | * \returns non-zero if the cursor represents a declaration and it is | 
|  | 2650 | * invalid, otherwise NULL. | 
|  | 2651 | */ | 
|  | 2652 | CINDEX_LINKAGE unsigned clang_isInvalidDeclaration(CXCursor); | 
|  | 2653 |  | 
|  | 2654 | /** | 
| Ivan Donchevskii | 65c766e | 2018-01-03 10:40:11 +0000 | [diff] [blame] | 2655 | * \brief Determine whether the given cursor kind represents a simple | 
|  | 2656 | * reference. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2657 | * | 
|  | 2658 | * Note that other kinds of cursors (such as expressions) can also refer to | 
|  | 2659 | * other cursors. Use clang_getCursorReferenced() to determine whether a | 
|  | 2660 | * particular cursor refers to another entity. | 
|  | 2661 | */ | 
|  | 2662 | CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind); | 
|  | 2663 |  | 
|  | 2664 | /** | 
|  | 2665 | * \brief Determine whether the given cursor kind represents an expression. | 
|  | 2666 | */ | 
|  | 2667 | CINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind); | 
|  | 2668 |  | 
|  | 2669 | /** | 
|  | 2670 | * \brief Determine whether the given cursor kind represents a statement. | 
|  | 2671 | */ | 
|  | 2672 | CINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind); | 
|  | 2673 |  | 
|  | 2674 | /** | 
| Douglas Gregor | a98034a | 2011-07-06 03:00:34 +0000 | [diff] [blame] | 2675 | * \brief Determine whether the given cursor kind represents an attribute. | 
|  | 2676 | */ | 
|  | 2677 | CINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind); | 
|  | 2678 |  | 
|  | 2679 | /** | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 2680 | * \brief Determine whether the given cursor has any attributes. | 
|  | 2681 | */ | 
|  | 2682 | CINDEX_LINKAGE unsigned clang_Cursor_hasAttrs(CXCursor C); | 
|  | 2683 |  | 
|  | 2684 | /** | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2685 | * \brief Determine whether the given cursor kind represents an invalid | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2686 | * cursor. | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2687 | */ | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2688 | CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind); | 
|  | 2689 |  | 
|  | 2690 | /** | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2691 | * \brief Determine whether the given cursor kind represents a translation | 
|  | 2692 | * unit. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2693 | */ | 
|  | 2694 | CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 2695 |  | 
| Ted Kremenek | ff9021b | 2010-03-08 21:17:29 +0000 | [diff] [blame] | 2696 | /*** | 
| Douglas Gregor | 92a524f | 2010-03-18 00:42:48 +0000 | [diff] [blame] | 2697 | * \brief Determine whether the given cursor represents a preprocessing | 
|  | 2698 | * element, such as a preprocessor directive or macro instantiation. | 
|  | 2699 | */ | 
|  | 2700 | CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind); | 
|  | 2701 |  | 
|  | 2702 | /*** | 
| Ted Kremenek | ff9021b | 2010-03-08 21:17:29 +0000 | [diff] [blame] | 2703 | * \brief Determine whether the given cursor represents a currently | 
|  | 2704 | *  unexposed piece of the AST (e.g., CXCursor_UnexposedStmt). | 
|  | 2705 | */ | 
|  | 2706 | CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind); | 
|  | 2707 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 2708 | /** | 
| Ted Kremenek | fb4961d | 2010-03-03 06:36:57 +0000 | [diff] [blame] | 2709 | * \brief Describe the linkage of the entity referred to by a cursor. | 
|  | 2710 | */ | 
|  | 2711 | enum CXLinkageKind { | 
|  | 2712 | /** \brief This value indicates that no linkage information is available | 
|  | 2713 | * for a provided CXCursor. */ | 
|  | 2714 | CXLinkage_Invalid, | 
|  | 2715 | /** | 
|  | 2716 | * \brief This is the linkage for variables, parameters, and so on that | 
|  | 2717 | *  have automatic storage.  This covers normal (non-extern) local variables. | 
|  | 2718 | */ | 
|  | 2719 | CXLinkage_NoLinkage, | 
|  | 2720 | /** \brief This is the linkage for static variables and static functions. */ | 
|  | 2721 | CXLinkage_Internal, | 
|  | 2722 | /** \brief This is the linkage for entities with external linkage that live | 
|  | 2723 | * in C++ anonymous namespaces.*/ | 
|  | 2724 | CXLinkage_UniqueExternal, | 
|  | 2725 | /** \brief This is the linkage for entities with true, external linkage. */ | 
|  | 2726 | CXLinkage_External | 
|  | 2727 | }; | 
|  | 2728 |  | 
|  | 2729 | /** | 
| Ted Kremenek | 4ed2925 | 2010-04-12 21:22:16 +0000 | [diff] [blame] | 2730 | * \brief Determine the linkage of the entity referred to by a given cursor. | 
| Ted Kremenek | fb4961d | 2010-03-03 06:36:57 +0000 | [diff] [blame] | 2731 | */ | 
|  | 2732 | CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor); | 
|  | 2733 |  | 
| Ehsan Akhgari | b743de7 | 2016-05-31 15:55:51 +0000 | [diff] [blame] | 2734 | enum CXVisibilityKind { | 
|  | 2735 | /** \brief This value indicates that no visibility information is available | 
|  | 2736 | * for a provided CXCursor. */ | 
|  | 2737 | CXVisibility_Invalid, | 
|  | 2738 |  | 
|  | 2739 | /** \brief Symbol not seen by the linker. */ | 
|  | 2740 | CXVisibility_Hidden, | 
|  | 2741 | /** \brief Symbol seen by the linker but resolves to a symbol inside this object. */ | 
|  | 2742 | CXVisibility_Protected, | 
|  | 2743 | /** \brief Symbol seen by the linker and acts like a normal symbol. */ | 
|  | 2744 | CXVisibility_Default | 
|  | 2745 | }; | 
|  | 2746 |  | 
|  | 2747 | /** | 
|  | 2748 | * \brief Describe the visibility of the entity referred to by a cursor. | 
|  | 2749 | * | 
|  | 2750 | * This returns the default visibility if not explicitly specified by | 
|  | 2751 | * a visibility attribute. The default visibility may be changed by | 
|  | 2752 | * commandline arguments. | 
|  | 2753 | * | 
|  | 2754 | * \param cursor The cursor to query. | 
|  | 2755 | * | 
|  | 2756 | * \returns The visibility of the cursor. | 
|  | 2757 | */ | 
|  | 2758 | CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor cursor); | 
|  | 2759 |  | 
| Ehsan Akhgari | 93697fa | 2015-11-23 19:56:46 +0000 | [diff] [blame] | 2760 | /** | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2761 | * \brief Determine the availability of the entity that this cursor refers to, | 
|  | 2762 | * taking the current target platform into account. | 
| Douglas Gregor | f757a12 | 2010-08-23 23:00:57 +0000 | [diff] [blame] | 2763 | * | 
|  | 2764 | * \param cursor The cursor to query. | 
|  | 2765 | * | 
|  | 2766 | * \returns The availability of the cursor. | 
|  | 2767 | */ | 
|  | 2768 | CINDEX_LINKAGE enum CXAvailabilityKind | 
|  | 2769 | clang_getCursorAvailability(CXCursor cursor); | 
|  | 2770 |  | 
|  | 2771 | /** | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2772 | * Describes the availability of a given entity on a particular platform, e.g., | 
|  | 2773 | * a particular class might only be available on Mac OS 10.7 or newer. | 
|  | 2774 | */ | 
|  | 2775 | typedef struct CXPlatformAvailability { | 
|  | 2776 | /** | 
|  | 2777 | * \brief A string that describes the platform for which this structure | 
|  | 2778 | * provides availability information. | 
|  | 2779 | * | 
| Manman Ren | ccf25bb | 2016-06-28 20:55:30 +0000 | [diff] [blame] | 2780 | * Possible values are "ios" or "macos". | 
| Douglas Gregor | d6225d3 | 2012-05-08 00:14:45 +0000 | [diff] [blame] | 2781 | */ | 
|  | 2782 | CXString Platform; | 
|  | 2783 | /** | 
|  | 2784 | * \brief The version number in which this entity was introduced. | 
|  | 2785 | */ | 
|  | 2786 | CXVersion Introduced; | 
|  | 2787 | /** | 
|  | 2788 | * \brief The version number in which this entity was deprecated (but is | 
|  | 2789 | * still available). | 
|  | 2790 | */ | 
|  | 2791 | CXVersion Deprecated; | 
|  | 2792 | /** | 
|  | 2793 | * \brief The version number in which this entity was obsoleted, and therefore | 
|  | 2794 | * is no longer available. | 
|  | 2795 | */ | 
|  | 2796 | CXVersion Obsoleted; | 
|  | 2797 | /** | 
|  | 2798 | * \brief Whether the entity is unconditionally unavailable on this platform. | 
|  | 2799 | */ | 
|  | 2800 | int Unavailable; | 
|  | 2801 | /** | 
|  | 2802 | * \brief An optional message to provide to a user of this API, e.g., to | 
|  | 2803 | * suggest replacement APIs. | 
|  | 2804 | */ | 
|  | 2805 | CXString Message; | 
|  | 2806 | } CXPlatformAvailability; | 
|  | 2807 |  | 
|  | 2808 | /** | 
|  | 2809 | * \brief Determine the availability of the entity that this cursor refers to | 
|  | 2810 | * on any platforms for which availability information is known. | 
|  | 2811 | * | 
|  | 2812 | * \param cursor The cursor to query. | 
|  | 2813 | * | 
|  | 2814 | * \param always_deprecated If non-NULL, will be set to indicate whether the | 
|  | 2815 | * entity is deprecated on all platforms. | 
|  | 2816 | * | 
|  | 2817 | * \param deprecated_message If non-NULL, will be set to the message text | 
|  | 2818 | * provided along with the unconditional deprecation of this entity. The client | 
|  | 2819 | * is responsible for deallocating this string. | 
|  | 2820 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 2821 | * \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] | 2822 | * entity is unavailable on all platforms. | 
|  | 2823 | * | 
|  | 2824 | * \param unavailable_message If non-NULL, will be set to the message text | 
|  | 2825 | * provided along with the unconditional unavailability of this entity. The | 
|  | 2826 | * client is responsible for deallocating this string. | 
|  | 2827 | * | 
|  | 2828 | * \param availability If non-NULL, an array of CXPlatformAvailability instances | 
|  | 2829 | * that will be populated with platform availability information, up to either | 
|  | 2830 | * the number of platforms for which availability information is available (as | 
|  | 2831 | * returned by this function) or \c availability_size, whichever is smaller. | 
|  | 2832 | * | 
|  | 2833 | * \param availability_size The number of elements available in the | 
|  | 2834 | * \c availability array. | 
|  | 2835 | * | 
|  | 2836 | * \returns The number of platforms (N) for which availability information is | 
|  | 2837 | * available (which is unrelated to \c availability_size). | 
|  | 2838 | * | 
|  | 2839 | * Note that the client is responsible for calling | 
|  | 2840 | * \c clang_disposeCXPlatformAvailability to free each of the | 
|  | 2841 | * platform-availability structures returned. There are | 
|  | 2842 | * \c min(N, availability_size) such structures. | 
|  | 2843 | */ | 
|  | 2844 | CINDEX_LINKAGE int | 
|  | 2845 | clang_getCursorPlatformAvailability(CXCursor cursor, | 
|  | 2846 | int *always_deprecated, | 
|  | 2847 | CXString *deprecated_message, | 
|  | 2848 | int *always_unavailable, | 
|  | 2849 | CXString *unavailable_message, | 
|  | 2850 | CXPlatformAvailability *availability, | 
|  | 2851 | int availability_size); | 
|  | 2852 |  | 
|  | 2853 | /** | 
|  | 2854 | * \brief Free the memory associated with a \c CXPlatformAvailability structure. | 
|  | 2855 | */ | 
|  | 2856 | CINDEX_LINKAGE void | 
|  | 2857 | clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability); | 
|  | 2858 |  | 
|  | 2859 | /** | 
| Ted Kremenek | 4ed2925 | 2010-04-12 21:22:16 +0000 | [diff] [blame] | 2860 | * \brief Describe the "language" of the entity referred to by a cursor. | 
|  | 2861 | */ | 
| Reid Kleckner | 9e3bc72 | 2013-12-30 17:48:49 +0000 | [diff] [blame] | 2862 | enum CXLanguageKind { | 
| Ted Kremenek | ee45751 | 2010-04-14 20:58:32 +0000 | [diff] [blame] | 2863 | CXLanguage_Invalid = 0, | 
| Ted Kremenek | 4ed2925 | 2010-04-12 21:22:16 +0000 | [diff] [blame] | 2864 | CXLanguage_C, | 
|  | 2865 | CXLanguage_ObjC, | 
| Ted Kremenek | ee45751 | 2010-04-14 20:58:32 +0000 | [diff] [blame] | 2866 | CXLanguage_CPlusPlus | 
| Ted Kremenek | 4ed2925 | 2010-04-12 21:22:16 +0000 | [diff] [blame] | 2867 | }; | 
|  | 2868 |  | 
|  | 2869 | /** | 
|  | 2870 | * \brief Determine the "language" of the entity referred to by a given cursor. | 
|  | 2871 | */ | 
|  | 2872 | CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor); | 
|  | 2873 |  | 
| Argyrios Kyrtzidis | d6e9fa5 | 2011-09-27 00:30:30 +0000 | [diff] [blame] | 2874 | /** | 
| Saleem Abdulrasool | 50bc565 | 2017-09-13 02:15:09 +0000 | [diff] [blame] | 2875 | * \brief Describe the "thread-local storage (TLS) kind" of the declaration | 
|  | 2876 | * referred to by a cursor. | 
|  | 2877 | */ | 
|  | 2878 | enum CXTLSKind { | 
|  | 2879 | CXTLS_None = 0, | 
|  | 2880 | CXTLS_Dynamic, | 
|  | 2881 | CXTLS_Static | 
|  | 2882 | }; | 
|  | 2883 |  | 
|  | 2884 | /** | 
|  | 2885 | * \brief Determine the "thread-local storage (TLS) kind" of the declaration | 
|  | 2886 | * referred to by a cursor. | 
|  | 2887 | */ | 
|  | 2888 | CINDEX_LINKAGE enum CXTLSKind clang_getCursorTLSKind(CXCursor cursor); | 
|  | 2889 |  | 
|  | 2890 | /** | 
| Argyrios Kyrtzidis | d6e9fa5 | 2011-09-27 00:30:30 +0000 | [diff] [blame] | 2891 | * \brief Returns the translation unit that a cursor originated from. | 
|  | 2892 | */ | 
|  | 2893 | CINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor); | 
|  | 2894 |  | 
| Ted Kremenek | c0b9866 | 2013-04-24 07:17:12 +0000 | [diff] [blame] | 2895 | /** | 
|  | 2896 | * \brief A fast container representing a set of CXCursors. | 
|  | 2897 | */ | 
|  | 2898 | typedef struct CXCursorSetImpl *CXCursorSet; | 
|  | 2899 |  | 
|  | 2900 | /** | 
|  | 2901 | * \brief Creates an empty CXCursorSet. | 
|  | 2902 | */ | 
|  | 2903 | CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void); | 
|  | 2904 |  | 
|  | 2905 | /** | 
|  | 2906 | * \brief Disposes a CXCursorSet and releases its associated memory. | 
|  | 2907 | */ | 
|  | 2908 | CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset); | 
|  | 2909 |  | 
|  | 2910 | /** | 
|  | 2911 | * \brief Queries a CXCursorSet to see if it contains a specific CXCursor. | 
|  | 2912 | * | 
|  | 2913 | * \returns non-zero if the set contains the specified cursor. | 
|  | 2914 | */ | 
|  | 2915 | CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset, | 
|  | 2916 | CXCursor cursor); | 
|  | 2917 |  | 
|  | 2918 | /** | 
|  | 2919 | * \brief Inserts a CXCursor into a CXCursorSet. | 
|  | 2920 | * | 
|  | 2921 | * \returns zero if the CXCursor was already in the set, and non-zero otherwise. | 
|  | 2922 | */ | 
|  | 2923 | CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset, | 
|  | 2924 | CXCursor cursor); | 
|  | 2925 |  | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2926 | /** | 
|  | 2927 | * \brief Determine the semantic parent of the given cursor. | 
|  | 2928 | * | 
|  | 2929 | * The semantic parent of a cursor is the cursor that semantically contains | 
|  | 2930 | * the given \p cursor. For many declarations, the lexical and semantic parents | 
|  | 2931 | * are equivalent (the lexical parent is returned by | 
|  | 2932 | * \c clang_getCursorLexicalParent()). They diverge when declarations or | 
|  | 2933 | * definitions are provided out-of-line. For example: | 
|  | 2934 | * | 
|  | 2935 | * \code | 
|  | 2936 | * class C { | 
|  | 2937 | *  void f(); | 
|  | 2938 | * }; | 
|  | 2939 | * | 
|  | 2940 | * void C::f() { } | 
|  | 2941 | * \endcode | 
|  | 2942 | * | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 2943 | * 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] | 2944 | * the class \c C, of which this function is a member. The lexical parent is | 
|  | 2945 | * 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] | 2946 | * case, the definition occurs in the translation unit. In general, the | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2947 | * lexical parent for a given entity can change without affecting the semantics | 
|  | 2948 | * of the program, and the lexical parent of different declarations of the | 
|  | 2949 | * same entity may be different. Changing the semantic parent of a declaration, | 
|  | 2950 | * on the other hand, can have a major impact on semantics, and redeclarations | 
|  | 2951 | * of a particular entity should all have the same semantic context. | 
|  | 2952 | * | 
|  | 2953 | * In the example above, both declarations of \c C::f have \c C as their | 
|  | 2954 | * semantic context, while the lexical context of the first \c C::f is \c C | 
|  | 2955 | * 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] | 2956 | * | 
|  | 2957 | * For global declarations, the semantic parent is the translation unit. | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2958 | */ | 
|  | 2959 | CINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor); | 
|  | 2960 |  | 
|  | 2961 | /** | 
|  | 2962 | * \brief Determine the lexical parent of the given cursor. | 
|  | 2963 | * | 
|  | 2964 | * The lexical parent of a cursor is the cursor in which the given \p cursor | 
|  | 2965 | * was actually written. For many declarations, the lexical and semantic parents | 
|  | 2966 | * are equivalent (the semantic parent is returned by | 
|  | 2967 | * \c clang_getCursorSemanticParent()). They diverge when declarations or | 
|  | 2968 | * definitions are provided out-of-line. For example: | 
|  | 2969 | * | 
|  | 2970 | * \code | 
|  | 2971 | * class C { | 
|  | 2972 | *  void f(); | 
|  | 2973 | * }; | 
|  | 2974 | * | 
|  | 2975 | * void C::f() { } | 
|  | 2976 | * \endcode | 
|  | 2977 | * | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 2978 | * 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] | 2979 | * the class \c C, of which this function is a member. The lexical parent is | 
|  | 2980 | * 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] | 2981 | * case, the definition occurs in the translation unit. In general, the | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2982 | * lexical parent for a given entity can change without affecting the semantics | 
|  | 2983 | * of the program, and the lexical parent of different declarations of the | 
|  | 2984 | * same entity may be different. Changing the semantic parent of a declaration, | 
|  | 2985 | * on the other hand, can have a major impact on semantics, and redeclarations | 
|  | 2986 | * of a particular entity should all have the same semantic context. | 
|  | 2987 | * | 
|  | 2988 | * In the example above, both declarations of \c C::f have \c C as their | 
|  | 2989 | * semantic context, while the lexical context of the first \c C::f is \c C | 
|  | 2990 | * 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] | 2991 | * | 
|  | 2992 | * For declarations written in the global scope, the lexical parent is | 
|  | 2993 | * the translation unit. | 
| Douglas Gregor | 0576ce7 | 2010-09-22 21:22:29 +0000 | [diff] [blame] | 2994 | */ | 
|  | 2995 | CINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor); | 
| Douglas Gregor | 99a26af | 2010-10-01 20:25:15 +0000 | [diff] [blame] | 2996 |  | 
|  | 2997 | /** | 
|  | 2998 | * \brief Determine the set of methods that are overridden by the given | 
|  | 2999 | * method. | 
|  | 3000 | * | 
|  | 3001 | * In both Objective-C and C++, a method (aka virtual member function, | 
|  | 3002 | * in C++) can override a virtual method in a base class. For | 
|  | 3003 | * 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] | 3004 | * base class, its protocols, or its categories' protocols, that has the same | 
|  | 3005 | * selector and is of the same kind (class or instance). | 
|  | 3006 | * If no such method exists, the search continues to the class's superclass, | 
|  | 3007 | * its protocols, and its categories, and so on. A method from an Objective-C | 
|  | 3008 | * implementation is considered to override the same methods as its | 
|  | 3009 | * corresponding method in the interface. | 
| Douglas Gregor | 99a26af | 2010-10-01 20:25:15 +0000 | [diff] [blame] | 3010 | * | 
|  | 3011 | * For C++, a virtual member function overrides any virtual member | 
|  | 3012 | * function with the same signature that occurs in its base | 
|  | 3013 | * classes. With multiple inheritance, a virtual member function can | 
|  | 3014 | * override several virtual member functions coming from different | 
|  | 3015 | * base classes. | 
|  | 3016 | * | 
|  | 3017 | * In all cases, this function determines the immediate overridden | 
|  | 3018 | * method, rather than all of the overridden methods. For example, if | 
|  | 3019 | * a method is originally declared in a class A, then overridden in B | 
|  | 3020 | * (which in inherits from A) and also in C (which inherited from B), | 
|  | 3021 | * then the only overridden method returned from this function when | 
|  | 3022 | * invoked on C's method will be B's method. The client may then | 
|  | 3023 | * invoke this function again, given the previously-found overridden | 
|  | 3024 | * methods, to map out the complete method-override set. | 
|  | 3025 | * | 
|  | 3026 | * \param cursor A cursor representing an Objective-C or C++ | 
|  | 3027 | * method. This routine will compute the set of methods that this | 
|  | 3028 | * method overrides. | 
|  | 3029 | * | 
|  | 3030 | * \param overridden A pointer whose pointee will be replaced with a | 
|  | 3031 | * pointer to an array of cursors, representing the set of overridden | 
|  | 3032 | * methods. If there are no overridden methods, the pointee will be | 
|  | 3033 | * set to NULL. The pointee must be freed via a call to | 
|  | 3034 | * \c clang_disposeOverriddenCursors(). | 
|  | 3035 | * | 
|  | 3036 | * \param num_overridden A pointer to the number of overridden | 
|  | 3037 | * functions, will be set to the number of overridden functions in the | 
|  | 3038 | * array pointed to by \p overridden. | 
|  | 3039 | */ | 
|  | 3040 | CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor, | 
|  | 3041 | CXCursor **overridden, | 
|  | 3042 | unsigned *num_overridden); | 
|  | 3043 |  | 
|  | 3044 | /** | 
|  | 3045 | * \brief Free the set of overridden cursors returned by \c | 
|  | 3046 | * clang_getOverriddenCursors(). | 
|  | 3047 | */ | 
|  | 3048 | CINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden); | 
|  | 3049 |  | 
| Ted Kremenek | 4ed2925 | 2010-04-12 21:22:16 +0000 | [diff] [blame] | 3050 | /** | 
| Douglas Gregor | 796d76a | 2010-10-20 22:00:55 +0000 | [diff] [blame] | 3051 | * \brief Retrieve the file that is included by the given inclusion directive | 
|  | 3052 | * cursor. | 
|  | 3053 | */ | 
|  | 3054 | CINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor); | 
|  | 3055 |  | 
|  | 3056 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3057 | * @} | 
|  | 3058 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3059 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3060 | /** | 
|  | 3061 | * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code | 
|  | 3062 | * | 
|  | 3063 | * Cursors represent a location within the Abstract Syntax Tree (AST). These | 
|  | 3064 | * routines help map between cursors and the physical locations where the | 
|  | 3065 | * described entities occur in the source code. The mapping is provided in | 
|  | 3066 | * both directions, so one can map from source code to the AST and back. | 
|  | 3067 | * | 
|  | 3068 | * @{ | 
| Steve Naroff | a1c7284 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 3069 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3070 |  | 
| Steve Naroff | 20bad0b | 2009-10-21 13:56:23 +0000 | [diff] [blame] | 3071 | /** | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 3072 | * \brief Map a source location to the cursor that describes the entity at that | 
|  | 3073 | * location in the source code. | 
|  | 3074 | * | 
|  | 3075 | * clang_getCursor() maps an arbitrary source location within a translation | 
|  | 3076 | * 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] | 3077 | * location. For example, given an expression \c x + y, invoking | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 3078 | * clang_getCursor() with a source location pointing to "x" will return the | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3079 | * cursor for "x"; similarly for "y". If the cursor points anywhere between | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 3080 | * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor() | 
|  | 3081 | * will return a cursor referring to the "+" expression. | 
|  | 3082 | * | 
|  | 3083 | * \returns a cursor representing the entity at the given source location, or | 
|  | 3084 | * a NULL cursor if no such entity can be found. | 
| Steve Naroff | 20bad0b | 2009-10-21 13:56:23 +0000 | [diff] [blame] | 3085 | */ | 
| Douglas Gregor | 816fd36 | 2010-01-22 21:44:22 +0000 | [diff] [blame] | 3086 | CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3087 |  | 
| Douglas Gregor | 66a5881 | 2010-01-18 22:46:11 +0000 | [diff] [blame] | 3088 | /** | 
|  | 3089 | * \brief Retrieve the physical location of the source constructor referenced | 
|  | 3090 | * by the given cursor. | 
|  | 3091 | * | 
|  | 3092 | * 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] | 3093 | * declaration, where the name of that declaration would occur if it is | 
|  | 3094 | * unnamed, or some keyword that introduces that particular declaration. | 
|  | 3095 | * The location of a reference is where that reference occurs within the | 
| Douglas Gregor | 66a5881 | 2010-01-18 22:46:11 +0000 | [diff] [blame] | 3096 | * source code. | 
|  | 3097 | */ | 
|  | 3098 | CINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor); | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3099 |  | 
| Douglas Gregor | 6b8232f | 2010-01-19 19:34:47 +0000 | [diff] [blame] | 3100 | /** | 
|  | 3101 | * \brief Retrieve the physical extent of the source construct referenced by | 
| Douglas Gregor | 33c34ac | 2010-01-19 00:34:46 +0000 | [diff] [blame] | 3102 | * the given cursor. | 
|  | 3103 | * | 
|  | 3104 | * The extent of a cursor starts with the file/line/column pointing at the | 
|  | 3105 | * first character within the source construct that the cursor refers to and | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 3106 | * ends with the last character within that source construct. For a | 
| Douglas Gregor | 33c34ac | 2010-01-19 00:34:46 +0000 | [diff] [blame] | 3107 | * declaration, the extent covers the declaration itself. For a reference, | 
|  | 3108 | * the extent covers the location of the reference (e.g., where the referenced | 
|  | 3109 | * entity was actually used). | 
|  | 3110 | */ | 
|  | 3111 | CINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor); | 
| Douglas Gregor | ad27e8b | 2010-01-19 01:20:04 +0000 | [diff] [blame] | 3112 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3113 | /** | 
|  | 3114 | * @} | 
|  | 3115 | */ | 
| Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 3116 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3117 | /** | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3118 | * \defgroup CINDEX_TYPES Type information for CXCursors | 
|  | 3119 | * | 
|  | 3120 | * @{ | 
|  | 3121 | */ | 
|  | 3122 |  | 
|  | 3123 | /** | 
|  | 3124 | * \brief Describes the kind of type | 
|  | 3125 | */ | 
|  | 3126 | enum CXTypeKind { | 
|  | 3127 | /** | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 3128 | * \brief Represents an invalid type (e.g., where no type is available). | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3129 | */ | 
|  | 3130 | CXType_Invalid = 0, | 
|  | 3131 |  | 
|  | 3132 | /** | 
|  | 3133 | * \brief A type whose specific kind is not exposed via this | 
|  | 3134 | * interface. | 
|  | 3135 | */ | 
|  | 3136 | CXType_Unexposed = 1, | 
|  | 3137 |  | 
|  | 3138 | /* Builtin types */ | 
|  | 3139 | CXType_Void = 2, | 
|  | 3140 | CXType_Bool = 3, | 
|  | 3141 | CXType_Char_U = 4, | 
|  | 3142 | CXType_UChar = 5, | 
|  | 3143 | CXType_Char16 = 6, | 
|  | 3144 | CXType_Char32 = 7, | 
|  | 3145 | CXType_UShort = 8, | 
|  | 3146 | CXType_UInt = 9, | 
|  | 3147 | CXType_ULong = 10, | 
|  | 3148 | CXType_ULongLong = 11, | 
|  | 3149 | CXType_UInt128 = 12, | 
|  | 3150 | CXType_Char_S = 13, | 
|  | 3151 | CXType_SChar = 14, | 
|  | 3152 | CXType_WChar = 15, | 
|  | 3153 | CXType_Short = 16, | 
|  | 3154 | CXType_Int = 17, | 
|  | 3155 | CXType_Long = 18, | 
|  | 3156 | CXType_LongLong = 19, | 
|  | 3157 | CXType_Int128 = 20, | 
|  | 3158 | CXType_Float = 21, | 
|  | 3159 | CXType_Double = 22, | 
|  | 3160 | CXType_LongDouble = 23, | 
|  | 3161 | CXType_NullPtr = 24, | 
|  | 3162 | CXType_Overload = 25, | 
|  | 3163 | CXType_Dependent = 26, | 
|  | 3164 | CXType_ObjCId = 27, | 
|  | 3165 | CXType_ObjCClass = 28, | 
|  | 3166 | CXType_ObjCSel = 29, | 
| Nemanja Ivanovic | bb1ea2d | 2016-05-09 08:52:33 +0000 | [diff] [blame] | 3167 | CXType_Float128 = 30, | 
| Joey Gouly | 6ea2185 | 2017-02-10 15:51:11 +0000 | [diff] [blame] | 3168 | CXType_Half = 31, | 
| Sjoerd Meijer | cc623ad | 2017-09-08 15:15:00 +0000 | [diff] [blame] | 3169 | CXType_Float16 = 32, | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3170 | CXType_FirstBuiltin = CXType_Void, | 
| Sjoerd Meijer | cc623ad | 2017-09-08 15:15:00 +0000 | [diff] [blame] | 3171 | CXType_LastBuiltin  = CXType_Float16, | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3172 |  | 
|  | 3173 | CXType_Complex = 100, | 
|  | 3174 | CXType_Pointer = 101, | 
|  | 3175 | CXType_BlockPointer = 102, | 
|  | 3176 | CXType_LValueReference = 103, | 
|  | 3177 | CXType_RValueReference = 104, | 
|  | 3178 | CXType_Record = 105, | 
|  | 3179 | CXType_Enum = 106, | 
|  | 3180 | CXType_Typedef = 107, | 
|  | 3181 | CXType_ObjCInterface = 108, | 
| Ted Kremenek | c150887 | 2010-06-21 20:15:39 +0000 | [diff] [blame] | 3182 | CXType_ObjCObjectPointer = 109, | 
|  | 3183 | CXType_FunctionNoProto = 110, | 
| Argyrios Kyrtzidis | 2b0cf60 | 2011-09-27 17:44:34 +0000 | [diff] [blame] | 3184 | CXType_FunctionProto = 111, | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3185 | CXType_ConstantArray = 112, | 
| Argyrios Kyrtzidis | 0661a71 | 2013-07-23 17:36:21 +0000 | [diff] [blame] | 3186 | CXType_Vector = 113, | 
|  | 3187 | CXType_IncompleteArray = 114, | 
|  | 3188 | CXType_VariableArray = 115, | 
| Argyrios Kyrtzidis | 7a4253b | 2013-10-03 16:19:23 +0000 | [diff] [blame] | 3189 | CXType_DependentSizedArray = 116, | 
| Sergey Kalinichev | c015120 | 2015-11-15 13:10:10 +0000 | [diff] [blame] | 3190 | CXType_MemberPointer = 117, | 
| Sergey Kalinichev | 69770ae | 2016-05-03 06:58:29 +0000 | [diff] [blame] | 3191 | CXType_Auto = 118, | 
|  | 3192 |  | 
|  | 3193 | /** | 
|  | 3194 | * \brief Represents a type that was referred to using an elaborated type keyword. | 
|  | 3195 | * | 
|  | 3196 | * E.g., struct S, or via a qualified name, e.g., N::M::type, or both. | 
|  | 3197 | */ | 
| Sven van Haastregt | cc4f1e4 | 2017-05-23 10:36:43 +0000 | [diff] [blame] | 3198 | CXType_Elaborated = 119, | 
|  | 3199 |  | 
|  | 3200 | /* OpenCL PipeType. */ | 
|  | 3201 | CXType_Pipe = 120, | 
|  | 3202 |  | 
|  | 3203 | /* OpenCL builtin types. */ | 
|  | 3204 | CXType_OCLImage1dRO = 121, | 
|  | 3205 | CXType_OCLImage1dArrayRO = 122, | 
|  | 3206 | CXType_OCLImage1dBufferRO = 123, | 
|  | 3207 | CXType_OCLImage2dRO = 124, | 
|  | 3208 | CXType_OCLImage2dArrayRO = 125, | 
|  | 3209 | CXType_OCLImage2dDepthRO = 126, | 
|  | 3210 | CXType_OCLImage2dArrayDepthRO = 127, | 
|  | 3211 | CXType_OCLImage2dMSAARO = 128, | 
|  | 3212 | CXType_OCLImage2dArrayMSAARO = 129, | 
|  | 3213 | CXType_OCLImage2dMSAADepthRO = 130, | 
|  | 3214 | CXType_OCLImage2dArrayMSAADepthRO = 131, | 
|  | 3215 | CXType_OCLImage3dRO = 132, | 
|  | 3216 | CXType_OCLImage1dWO = 133, | 
|  | 3217 | CXType_OCLImage1dArrayWO = 134, | 
|  | 3218 | CXType_OCLImage1dBufferWO = 135, | 
|  | 3219 | CXType_OCLImage2dWO = 136, | 
|  | 3220 | CXType_OCLImage2dArrayWO = 137, | 
|  | 3221 | CXType_OCLImage2dDepthWO = 138, | 
|  | 3222 | CXType_OCLImage2dArrayDepthWO = 139, | 
|  | 3223 | CXType_OCLImage2dMSAAWO = 140, | 
|  | 3224 | CXType_OCLImage2dArrayMSAAWO = 141, | 
|  | 3225 | CXType_OCLImage2dMSAADepthWO = 142, | 
|  | 3226 | CXType_OCLImage2dArrayMSAADepthWO = 143, | 
|  | 3227 | CXType_OCLImage3dWO = 144, | 
|  | 3228 | CXType_OCLImage1dRW = 145, | 
|  | 3229 | CXType_OCLImage1dArrayRW = 146, | 
|  | 3230 | CXType_OCLImage1dBufferRW = 147, | 
|  | 3231 | CXType_OCLImage2dRW = 148, | 
|  | 3232 | CXType_OCLImage2dArrayRW = 149, | 
|  | 3233 | CXType_OCLImage2dDepthRW = 150, | 
|  | 3234 | CXType_OCLImage2dArrayDepthRW = 151, | 
|  | 3235 | CXType_OCLImage2dMSAARW = 152, | 
|  | 3236 | CXType_OCLImage2dArrayMSAARW = 153, | 
|  | 3237 | CXType_OCLImage2dMSAADepthRW = 154, | 
|  | 3238 | CXType_OCLImage2dArrayMSAADepthRW = 155, | 
|  | 3239 | CXType_OCLImage3dRW = 156, | 
|  | 3240 | CXType_OCLSampler = 157, | 
|  | 3241 | CXType_OCLEvent = 158, | 
|  | 3242 | CXType_OCLQueue = 159, | 
|  | 3243 | CXType_OCLReserveID = 160 | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3244 | }; | 
|  | 3245 |  | 
|  | 3246 | /** | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3247 | * \brief Describes the calling convention of a function type | 
|  | 3248 | */ | 
|  | 3249 | enum CXCallingConv { | 
|  | 3250 | CXCallingConv_Default = 0, | 
|  | 3251 | CXCallingConv_C = 1, | 
|  | 3252 | CXCallingConv_X86StdCall = 2, | 
|  | 3253 | CXCallingConv_X86FastCall = 3, | 
|  | 3254 | CXCallingConv_X86ThisCall = 4, | 
|  | 3255 | CXCallingConv_X86Pascal = 5, | 
|  | 3256 | CXCallingConv_AAPCS = 6, | 
|  | 3257 | CXCallingConv_AAPCS_VFP = 7, | 
| Erich Keane | 757d317 | 2016-11-02 18:29:35 +0000 | [diff] [blame] | 3258 | CXCallingConv_X86RegCall = 8, | 
| Guy Benyei | f0a014b | 2012-12-25 08:53:55 +0000 | [diff] [blame] | 3259 | CXCallingConv_IntelOclBicc = 9, | 
| Martin Storsjo | 022e782 | 2017-07-17 20:49:45 +0000 | [diff] [blame] | 3260 | CXCallingConv_Win64 = 10, | 
| Nikolai Bozhenov | ce25d41 | 2017-08-08 14:13:50 +0000 | [diff] [blame] | 3261 | /* Alias for compatibility with older versions of API. */ | 
|  | 3262 | CXCallingConv_X86_64Win64 = CXCallingConv_Win64, | 
| Charles Davis | b5a214e | 2013-08-30 04:39:01 +0000 | [diff] [blame] | 3263 | CXCallingConv_X86_64SysV = 11, | 
| Reid Kleckner | d7857f0 | 2014-10-24 17:42:17 +0000 | [diff] [blame] | 3264 | CXCallingConv_X86VectorCall = 12, | 
| John McCall | 477f2bb | 2016-03-03 06:39:32 +0000 | [diff] [blame] | 3265 | CXCallingConv_Swift = 13, | 
| Roman Levenstein | 35aa5ce | 2016-03-16 18:00:46 +0000 | [diff] [blame] | 3266 | CXCallingConv_PreserveMost = 14, | 
|  | 3267 | CXCallingConv_PreserveAll = 15, | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3268 |  | 
|  | 3269 | CXCallingConv_Invalid = 100, | 
|  | 3270 | CXCallingConv_Unexposed = 200 | 
|  | 3271 | }; | 
|  | 3272 |  | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3273 | /** | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3274 | * \brief The type of an element in the abstract syntax tree. | 
|  | 3275 | * | 
|  | 3276 | */ | 
|  | 3277 | typedef struct { | 
|  | 3278 | enum CXTypeKind kind; | 
|  | 3279 | void *data[2]; | 
|  | 3280 | } CXType; | 
|  | 3281 |  | 
|  | 3282 | /** | 
|  | 3283 | * \brief Retrieve the type of a CXCursor (if any). | 
|  | 3284 | */ | 
|  | 3285 | CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C); | 
|  | 3286 |  | 
|  | 3287 | /** | 
| Dmitri Gribenko | 0035372 | 2013-02-15 21:15:49 +0000 | [diff] [blame] | 3288 | * \brief Pretty-print the underlying type using the rules of the | 
|  | 3289 | * language of the translation unit from which it came. | 
|  | 3290 | * | 
|  | 3291 | * If the type is invalid, an empty string is returned. | 
|  | 3292 | */ | 
|  | 3293 | CINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT); | 
|  | 3294 |  | 
|  | 3295 | /** | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3296 | * \brief Retrieve the underlying type of a typedef declaration. | 
|  | 3297 | * | 
|  | 3298 | * If the cursor does not reference a typedef declaration, an invalid type is | 
|  | 3299 | * returned. | 
|  | 3300 | */ | 
|  | 3301 | CINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C); | 
|  | 3302 |  | 
|  | 3303 | /** | 
|  | 3304 | * \brief Retrieve the integer type of an enum declaration. | 
|  | 3305 | * | 
|  | 3306 | * If the cursor does not reference an enum declaration, an invalid type is | 
|  | 3307 | * returned. | 
|  | 3308 | */ | 
|  | 3309 | CINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C); | 
|  | 3310 |  | 
|  | 3311 | /** | 
|  | 3312 | * \brief Retrieve the integer value of an enum constant declaration as a signed | 
|  | 3313 | *  long long. | 
|  | 3314 | * | 
|  | 3315 | * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned. | 
|  | 3316 | * Since this is also potentially a valid constant value, the kind of the cursor | 
|  | 3317 | * must be verified before calling this function. | 
|  | 3318 | */ | 
|  | 3319 | CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); | 
|  | 3320 |  | 
|  | 3321 | /** | 
|  | 3322 | * \brief Retrieve the integer value of an enum constant declaration as an unsigned | 
|  | 3323 | *  long long. | 
|  | 3324 | * | 
|  | 3325 | * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned. | 
|  | 3326 | * Since this is also potentially a valid constant value, the kind of the cursor | 
|  | 3327 | * must be verified before calling this function. | 
|  | 3328 | */ | 
|  | 3329 | CINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C); | 
|  | 3330 |  | 
|  | 3331 | /** | 
| Dmitri Gribenko | b506ba1 | 2012-12-04 15:13:46 +0000 | [diff] [blame] | 3332 | * \brief Retrieve the bit width of a bit field declaration as an integer. | 
|  | 3333 | * | 
|  | 3334 | * If a cursor that is not a bit field declaration is passed in, -1 is returned. | 
|  | 3335 | */ | 
|  | 3336 | CINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C); | 
|  | 3337 |  | 
|  | 3338 | /** | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3339 | * \brief Retrieve the number of non-variadic arguments associated with a given | 
|  | 3340 | * cursor. | 
|  | 3341 | * | 
| Argyrios Kyrtzidis | b279297 | 2013-04-01 17:38:59 +0000 | [diff] [blame] | 3342 | * The number of arguments can be determined for calls as well as for | 
|  | 3343 | * declarations of functions or methods. For other cursors -1 is returned. | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3344 | */ | 
|  | 3345 | CINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C); | 
|  | 3346 |  | 
|  | 3347 | /** | 
|  | 3348 | * \brief Retrieve the argument cursor of a function or method. | 
|  | 3349 | * | 
| Argyrios Kyrtzidis | b279297 | 2013-04-01 17:38:59 +0000 | [diff] [blame] | 3350 | * The argument cursor can be determined for calls as well as for declarations | 
|  | 3351 | * of functions or methods. For other cursors and for invalid indices, an | 
|  | 3352 | * invalid cursor is returned. | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3353 | */ | 
|  | 3354 | CINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i); | 
|  | 3355 |  | 
|  | 3356 | /** | 
| Eli Bendersky | c27a0c4 | 2014-10-10 20:01:05 +0000 | [diff] [blame] | 3357 | * \brief Describes the kind of a template argument. | 
|  | 3358 | * | 
|  | 3359 | * See the definition of llvm::clang::TemplateArgument::ArgKind for full | 
|  | 3360 | * element descriptions. | 
|  | 3361 | */ | 
|  | 3362 | enum CXTemplateArgumentKind { | 
|  | 3363 | CXTemplateArgumentKind_Null, | 
|  | 3364 | CXTemplateArgumentKind_Type, | 
|  | 3365 | CXTemplateArgumentKind_Declaration, | 
|  | 3366 | CXTemplateArgumentKind_NullPtr, | 
|  | 3367 | CXTemplateArgumentKind_Integral, | 
|  | 3368 | CXTemplateArgumentKind_Template, | 
|  | 3369 | CXTemplateArgumentKind_TemplateExpansion, | 
|  | 3370 | CXTemplateArgumentKind_Expression, | 
|  | 3371 | CXTemplateArgumentKind_Pack, | 
|  | 3372 | /* Indicates an error case, preventing the kind from being deduced. */ | 
|  | 3373 | CXTemplateArgumentKind_Invalid | 
|  | 3374 | }; | 
|  | 3375 |  | 
|  | 3376 | /** | 
|  | 3377 | *\brief Returns the number of template args of a function decl representing a | 
|  | 3378 | * template specialization. | 
|  | 3379 | * | 
|  | 3380 | * If the argument cursor cannot be converted into a template function | 
|  | 3381 | * declaration, -1 is returned. | 
|  | 3382 | * | 
|  | 3383 | * For example, for the following declaration and specialization: | 
|  | 3384 | *   template <typename T, int kInt, bool kBool> | 
|  | 3385 | *   void foo() { ... } | 
|  | 3386 | * | 
|  | 3387 | *   template <> | 
|  | 3388 | *   void foo<float, -7, true>(); | 
|  | 3389 | * | 
|  | 3390 | * The value 3 would be returned from this call. | 
|  | 3391 | */ | 
|  | 3392 | CINDEX_LINKAGE int clang_Cursor_getNumTemplateArguments(CXCursor C); | 
|  | 3393 |  | 
|  | 3394 | /** | 
|  | 3395 | * \brief Retrieve the kind of the I'th template argument of the CXCursor C. | 
|  | 3396 | * | 
|  | 3397 | * If the argument CXCursor does not represent a FunctionDecl, an invalid | 
|  | 3398 | * template argument kind is returned. | 
|  | 3399 | * | 
|  | 3400 | * For example, for the following declaration and specialization: | 
|  | 3401 | *   template <typename T, int kInt, bool kBool> | 
|  | 3402 | *   void foo() { ... } | 
|  | 3403 | * | 
|  | 3404 | *   template <> | 
|  | 3405 | *   void foo<float, -7, true>(); | 
|  | 3406 | * | 
|  | 3407 | * For I = 0, 1, and 2, Type, Integral, and Integral will be returned, | 
|  | 3408 | * respectively. | 
|  | 3409 | */ | 
|  | 3410 | CINDEX_LINKAGE enum CXTemplateArgumentKind clang_Cursor_getTemplateArgumentKind( | 
|  | 3411 | CXCursor C, unsigned I); | 
|  | 3412 |  | 
|  | 3413 | /** | 
|  | 3414 | * \brief Retrieve a CXType representing the type of a TemplateArgument of a | 
|  | 3415 | *  function decl representing a template specialization. | 
|  | 3416 | * | 
|  | 3417 | * If the argument CXCursor does not represent a FunctionDecl whose I'th | 
|  | 3418 | * template argument has a kind of CXTemplateArgKind_Integral, an invalid type | 
|  | 3419 | * is returned. | 
|  | 3420 | * | 
|  | 3421 | * For example, for the following declaration and specialization: | 
|  | 3422 | *   template <typename T, int kInt, bool kBool> | 
|  | 3423 | *   void foo() { ... } | 
|  | 3424 | * | 
|  | 3425 | *   template <> | 
|  | 3426 | *   void foo<float, -7, true>(); | 
|  | 3427 | * | 
|  | 3428 | * If called with I = 0, "float", will be returned. | 
|  | 3429 | * Invalid types will be returned for I == 1 or 2. | 
|  | 3430 | */ | 
|  | 3431 | CINDEX_LINKAGE CXType clang_Cursor_getTemplateArgumentType(CXCursor C, | 
|  | 3432 | unsigned I); | 
|  | 3433 |  | 
|  | 3434 | /** | 
|  | 3435 | * \brief Retrieve the value of an Integral TemplateArgument (of a function | 
|  | 3436 | *  decl representing a template specialization) as a signed long long. | 
|  | 3437 | * | 
|  | 3438 | * It is undefined to call this function on a CXCursor that does not represent a | 
|  | 3439 | * FunctionDecl or whose I'th template argument is not an integral value. | 
|  | 3440 | * | 
|  | 3441 | * For example, for the following declaration and specialization: | 
|  | 3442 | *   template <typename T, int kInt, bool kBool> | 
|  | 3443 | *   void foo() { ... } | 
|  | 3444 | * | 
|  | 3445 | *   template <> | 
|  | 3446 | *   void foo<float, -7, true>(); | 
|  | 3447 | * | 
|  | 3448 | * If called with I = 1 or 2, -7 or true will be returned, respectively. | 
|  | 3449 | * For I == 0, this function's behavior is undefined. | 
|  | 3450 | */ | 
|  | 3451 | CINDEX_LINKAGE long long clang_Cursor_getTemplateArgumentValue(CXCursor C, | 
|  | 3452 | unsigned I); | 
|  | 3453 |  | 
|  | 3454 | /** | 
|  | 3455 | * \brief Retrieve the value of an Integral TemplateArgument (of a function | 
|  | 3456 | *  decl representing a template specialization) as an unsigned long long. | 
|  | 3457 | * | 
|  | 3458 | * It is undefined to call this function on a CXCursor that does not represent a | 
|  | 3459 | * FunctionDecl or whose I'th template argument is not an integral value. | 
|  | 3460 | * | 
|  | 3461 | * For example, for the following declaration and specialization: | 
|  | 3462 | *   template <typename T, int kInt, bool kBool> | 
|  | 3463 | *   void foo() { ... } | 
|  | 3464 | * | 
|  | 3465 | *   template <> | 
|  | 3466 | *   void foo<float, 2147483649, true>(); | 
|  | 3467 | * | 
|  | 3468 | * If called with I = 1 or 2, 2147483649 or true will be returned, respectively. | 
|  | 3469 | * For I == 0, this function's behavior is undefined. | 
|  | 3470 | */ | 
|  | 3471 | CINDEX_LINKAGE unsigned long long clang_Cursor_getTemplateArgumentUnsignedValue( | 
|  | 3472 | CXCursor C, unsigned I); | 
|  | 3473 |  | 
|  | 3474 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3475 | * \brief Determine whether two CXTypes represent the same type. | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3476 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3477 | * \returns non-zero if the CXTypes represent the same type and | 
|  | 3478 | *          zero otherwise. | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3479 | */ | 
|  | 3480 | CINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B); | 
|  | 3481 |  | 
|  | 3482 | /** | 
|  | 3483 | * \brief Return the canonical type for a CXType. | 
|  | 3484 | * | 
|  | 3485 | * Clang's type system explicitly models typedefs and all the ways | 
|  | 3486 | * a specific type can be represented.  The canonical type is the underlying | 
|  | 3487 | * type with all the "sugar" removed.  For example, if 'T' is a typedef | 
|  | 3488 | * for 'int', the canonical type for 'T' would be 'int'. | 
|  | 3489 | */ | 
|  | 3490 | CINDEX_LINKAGE CXType clang_getCanonicalType(CXType T); | 
|  | 3491 |  | 
|  | 3492 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3493 | * \brief Determine whether a CXType has the "const" qualifier set, | 
|  | 3494 | * without looking through typedefs that may have added "const" at a | 
|  | 3495 | * different level. | 
| Douglas Gregor | 56a6380 | 2011-01-27 16:27:11 +0000 | [diff] [blame] | 3496 | */ | 
|  | 3497 | CINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T); | 
|  | 3498 |  | 
|  | 3499 | /** | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 3500 | * \brief Determine whether a  CXCursor that is a macro, is | 
|  | 3501 | * function like. | 
|  | 3502 | */ | 
|  | 3503 | CINDEX_LINKAGE unsigned clang_Cursor_isMacroFunctionLike(CXCursor C); | 
|  | 3504 |  | 
|  | 3505 | /** | 
|  | 3506 | * \brief Determine whether a  CXCursor that is a macro, is a | 
|  | 3507 | * builtin one. | 
|  | 3508 | */ | 
|  | 3509 | CINDEX_LINKAGE unsigned clang_Cursor_isMacroBuiltin(CXCursor C); | 
|  | 3510 |  | 
|  | 3511 | /** | 
|  | 3512 | * \brief Determine whether a  CXCursor that is a function declaration, is an | 
|  | 3513 | * inline declaration. | 
|  | 3514 | */ | 
|  | 3515 | CINDEX_LINKAGE unsigned clang_Cursor_isFunctionInlined(CXCursor C); | 
|  | 3516 |  | 
|  | 3517 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3518 | * \brief Determine whether a CXType has the "volatile" qualifier set, | 
|  | 3519 | * without looking through typedefs that may have added "volatile" at | 
|  | 3520 | * a different level. | 
| Douglas Gregor | 56a6380 | 2011-01-27 16:27:11 +0000 | [diff] [blame] | 3521 | */ | 
|  | 3522 | CINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T); | 
|  | 3523 |  | 
|  | 3524 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3525 | * \brief Determine whether a CXType has the "restrict" qualifier set, | 
|  | 3526 | * without looking through typedefs that may have added "restrict" at a | 
|  | 3527 | * different level. | 
| Douglas Gregor | 56a6380 | 2011-01-27 16:27:11 +0000 | [diff] [blame] | 3528 | */ | 
|  | 3529 | CINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T); | 
|  | 3530 |  | 
|  | 3531 | /** | 
| Sven van Haastregt | e891042 | 2017-06-08 14:22:04 +0000 | [diff] [blame] | 3532 | * \brief Returns the address space of the given type. | 
|  | 3533 | */ | 
|  | 3534 | CINDEX_LINKAGE unsigned clang_getAddressSpace(CXType T); | 
|  | 3535 |  | 
|  | 3536 | /** | 
|  | 3537 | * \brief Returns the typedef name of the given type. | 
|  | 3538 | */ | 
|  | 3539 | CINDEX_LINKAGE CXString clang_getTypedefName(CXType CT); | 
|  | 3540 |  | 
|  | 3541 | /** | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3542 | * \brief For pointer types, returns the type of the pointee. | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3543 | */ | 
|  | 3544 | CINDEX_LINKAGE CXType clang_getPointeeType(CXType T); | 
|  | 3545 |  | 
|  | 3546 | /** | 
|  | 3547 | * \brief Return the cursor for the declaration of the given type. | 
|  | 3548 | */ | 
|  | 3549 | CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T); | 
|  | 3550 |  | 
| David Chisnall | 50e4eba | 2010-12-30 14:05:53 +0000 | [diff] [blame] | 3551 | /** | 
|  | 3552 | * Returns the Objective-C type encoding for the specified declaration. | 
|  | 3553 | */ | 
|  | 3554 | CINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C); | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3555 |  | 
|  | 3556 | /** | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 3557 | * Returns the Objective-C type encoding for the specified CXType. | 
|  | 3558 | */ | 
|  | 3559 | CINDEX_LINKAGE CXString clang_Type_getObjCEncoding(CXType type); | 
|  | 3560 |  | 
|  | 3561 | /** | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3562 | * \brief Retrieve the spelling of a given CXTypeKind. | 
|  | 3563 | */ | 
|  | 3564 | CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K); | 
|  | 3565 |  | 
|  | 3566 | /** | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3567 | * \brief Retrieve the calling convention associated with a function type. | 
|  | 3568 | * | 
|  | 3569 | * If a non-function type is passed in, CXCallingConv_Invalid is returned. | 
|  | 3570 | */ | 
|  | 3571 | CINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T); | 
|  | 3572 |  | 
|  | 3573 | /** | 
| Alp Toker | 314cc81 | 2014-01-25 16:55:45 +0000 | [diff] [blame] | 3574 | * \brief Retrieve the return type 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, an invalid type is returned. | 
| Ted Kremenek | c150887 | 2010-06-21 20:15:39 +0000 | [diff] [blame] | 3577 | */ | 
|  | 3578 | CINDEX_LINKAGE CXType clang_getResultType(CXType T); | 
|  | 3579 |  | 
|  | 3580 | /** | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 3581 | * \brief Retrieve the exception specification type associated with a function type. | 
|  | 3582 | * | 
|  | 3583 | * If a non-function type is passed in, an error code of -1 is returned. | 
|  | 3584 | */ | 
|  | 3585 | CINDEX_LINKAGE int clang_getExceptionSpecificationType(CXType T); | 
|  | 3586 |  | 
|  | 3587 | /** | 
| Alp Toker | 601b22c | 2014-01-21 23:35:24 +0000 | [diff] [blame] | 3588 | * \brief Retrieve the number of non-variadic parameters associated with a | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3589 | * function type. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3590 | * | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3591 | * If a non-function type is passed in, -1 is returned. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3592 | */ | 
| Argyrios Kyrtzidis | 0c27e4b | 2012-04-11 19:32:19 +0000 | [diff] [blame] | 3593 | CINDEX_LINKAGE int clang_getNumArgTypes(CXType T); | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3594 |  | 
|  | 3595 | /** | 
| Alp Toker | 601b22c | 2014-01-21 23:35:24 +0000 | [diff] [blame] | 3596 | * \brief Retrieve the type of a parameter of a function type. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3597 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 3598 | * If a non-function type is passed in or the function does not have enough | 
|  | 3599 | * parameters, an invalid type is returned. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3600 | */ | 
|  | 3601 | CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); | 
|  | 3602 |  | 
|  | 3603 | /** | 
|  | 3604 | * \brief 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] | 3605 | */ | 
|  | 3606 | CINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T); | 
|  | 3607 |  | 
|  | 3608 | /** | 
| Alp Toker | 314cc81 | 2014-01-25 16:55:45 +0000 | [diff] [blame] | 3609 | * \brief Retrieve the return type associated with a given cursor. | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3610 | * | 
|  | 3611 | * 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] | 3612 | */ | 
|  | 3613 | CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C); | 
|  | 3614 |  | 
|  | 3615 | /** | 
| Jonathan Coe | 0a5b03b | 2017-06-27 22:54:56 +0000 | [diff] [blame] | 3616 | * \brief Retrieve the exception specification type associated with a given cursor. | 
|  | 3617 | * | 
|  | 3618 | * This only returns a valid result if the cursor refers to a function or method. | 
|  | 3619 | */ | 
|  | 3620 | CINDEX_LINKAGE int clang_getCursorExceptionSpecificationType(CXCursor C); | 
|  | 3621 |  | 
|  | 3622 | /** | 
| Ted Kremenek | 0c7476a | 2010-07-30 00:14:11 +0000 | [diff] [blame] | 3623 | * \brief Return 1 if the CXType is a POD (plain old data) type, and 0 | 
|  | 3624 | *  otherwise. | 
|  | 3625 | */ | 
|  | 3626 | CINDEX_LINKAGE unsigned clang_isPODType(CXType T); | 
|  | 3627 |  | 
|  | 3628 | /** | 
| Argyrios Kyrtzidis | 66f433a | 2011-12-06 22:05:01 +0000 | [diff] [blame] | 3629 | * \brief Return the element type of an array, complex, or vector type. | 
|  | 3630 | * | 
|  | 3631 | * If a type is passed in that is not an array, complex, or vector type, | 
|  | 3632 | * an invalid type is returned. | 
|  | 3633 | */ | 
|  | 3634 | CINDEX_LINKAGE CXType clang_getElementType(CXType T); | 
|  | 3635 |  | 
|  | 3636 | /** | 
|  | 3637 | * \brief Return the number of elements of an array or vector type. | 
|  | 3638 | * | 
|  | 3639 | * If a type is passed in that is not an array or vector type, | 
|  | 3640 | * -1 is returned. | 
|  | 3641 | */ | 
|  | 3642 | CINDEX_LINKAGE long long clang_getNumElements(CXType T); | 
|  | 3643 |  | 
|  | 3644 | /** | 
| Argyrios Kyrtzidis | 2b0cf60 | 2011-09-27 17:44:34 +0000 | [diff] [blame] | 3645 | * \brief Return the element type of an array type. | 
|  | 3646 | * | 
|  | 3647 | * If a non-array type is passed in, an invalid type is returned. | 
|  | 3648 | */ | 
|  | 3649 | CINDEX_LINKAGE CXType clang_getArrayElementType(CXType T); | 
|  | 3650 |  | 
|  | 3651 | /** | 
| Sylvestre Ledru | 830885c | 2012-07-23 08:59:39 +0000 | [diff] [blame] | 3652 | * \brief Return the array size of a constant array. | 
| Argyrios Kyrtzidis | 2b0cf60 | 2011-09-27 17:44:34 +0000 | [diff] [blame] | 3653 | * | 
|  | 3654 | * If a non-array type is passed in, -1 is returned. | 
|  | 3655 | */ | 
|  | 3656 | CINDEX_LINKAGE long long clang_getArraySize(CXType T); | 
|  | 3657 |  | 
|  | 3658 | /** | 
| Sergey Kalinichev | 69770ae | 2016-05-03 06:58:29 +0000 | [diff] [blame] | 3659 | * \brief Retrieve the type named by the qualified-id. | 
|  | 3660 | * | 
|  | 3661 | * If a non-elaborated type is passed in, an invalid type is returned. | 
|  | 3662 | */ | 
|  | 3663 | CINDEX_LINKAGE CXType clang_Type_getNamedType(CXType T); | 
|  | 3664 |  | 
|  | 3665 | /** | 
| Argyrios Kyrtzidis | 3b25c91 | 2017-03-21 16:56:02 +0000 | [diff] [blame] | 3666 | * \brief Determine if a typedef is 'transparent' tag. | 
|  | 3667 | * | 
|  | 3668 | * A typedef is considered 'transparent' if it shares a name and spelling | 
|  | 3669 | * location with its underlying tag type, as is the case with the NS_ENUM macro. | 
|  | 3670 | * | 
|  | 3671 | * \returns non-zero if transparent and zero otherwise. | 
|  | 3672 | */ | 
|  | 3673 | CINDEX_LINKAGE unsigned clang_Type_isTransparentTagTypedef(CXType T); | 
|  | 3674 |  | 
|  | 3675 | /** | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3676 | * \brief List the possible error codes for \c clang_Type_getSizeOf, | 
|  | 3677 | *   \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and | 
|  | 3678 | *   \c clang_Cursor_getOffsetOf. | 
|  | 3679 | * | 
|  | 3680 | * A value of this enumeration type can be returned if the target type is not | 
|  | 3681 | * a valid argument to sizeof, alignof or offsetof. | 
|  | 3682 | */ | 
|  | 3683 | enum CXTypeLayoutError { | 
|  | 3684 | /** | 
|  | 3685 | * \brief Type is of kind CXType_Invalid. | 
|  | 3686 | */ | 
|  | 3687 | CXTypeLayoutError_Invalid = -1, | 
|  | 3688 | /** | 
|  | 3689 | * \brief The type is an incomplete Type. | 
|  | 3690 | */ | 
|  | 3691 | CXTypeLayoutError_Incomplete = -2, | 
|  | 3692 | /** | 
|  | 3693 | * \brief The type is a dependent Type. | 
|  | 3694 | */ | 
|  | 3695 | CXTypeLayoutError_Dependent = -3, | 
|  | 3696 | /** | 
|  | 3697 | * \brief The type is not a constant size type. | 
|  | 3698 | */ | 
|  | 3699 | CXTypeLayoutError_NotConstantSize = -4, | 
|  | 3700 | /** | 
|  | 3701 | * \brief The Field name is not valid for this record. | 
|  | 3702 | */ | 
|  | 3703 | CXTypeLayoutError_InvalidFieldName = -5 | 
|  | 3704 | }; | 
|  | 3705 |  | 
|  | 3706 | /** | 
|  | 3707 | * \brief Return the alignment of a type in bytes as per C++[expr.alignof] | 
|  | 3708 | *   standard. | 
|  | 3709 | * | 
|  | 3710 | * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. | 
|  | 3711 | * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete | 
|  | 3712 | *   is returned. | 
|  | 3713 | * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is | 
|  | 3714 | *   returned. | 
|  | 3715 | * If the type declaration is not a constant size type, | 
|  | 3716 | *   CXTypeLayoutError_NotConstantSize is returned. | 
|  | 3717 | */ | 
|  | 3718 | CINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T); | 
|  | 3719 |  | 
|  | 3720 | /** | 
| Argyrios Kyrtzidis | 7a4253b | 2013-10-03 16:19:23 +0000 | [diff] [blame] | 3721 | * \brief Return the class type of an member pointer type. | 
|  | 3722 | * | 
|  | 3723 | * If a non-member-pointer type is passed in, an invalid type is returned. | 
|  | 3724 | */ | 
|  | 3725 | CINDEX_LINKAGE CXType clang_Type_getClassType(CXType T); | 
|  | 3726 |  | 
|  | 3727 | /** | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3728 | * \brief Return the size of a type in bytes as per C++[expr.sizeof] standard. | 
|  | 3729 | * | 
|  | 3730 | * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. | 
|  | 3731 | * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete | 
|  | 3732 | *   is returned. | 
|  | 3733 | * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is | 
|  | 3734 | *   returned. | 
|  | 3735 | */ | 
|  | 3736 | CINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T); | 
|  | 3737 |  | 
|  | 3738 | /** | 
|  | 3739 | * \brief Return the offset of a field named S in a record of type T in bits | 
|  | 3740 | *   as it would be returned by __offsetof__ as per C++11[18.2p4] | 
|  | 3741 | * | 
|  | 3742 | * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid | 
|  | 3743 | *   is returned. | 
|  | 3744 | * If the field's type declaration is an incomplete type, | 
|  | 3745 | *   CXTypeLayoutError_Incomplete is returned. | 
|  | 3746 | * If the field's type declaration is a dependent type, | 
|  | 3747 | *   CXTypeLayoutError_Dependent is returned. | 
|  | 3748 | * If the field's name S is not found, | 
|  | 3749 | *   CXTypeLayoutError_InvalidFieldName is returned. | 
|  | 3750 | */ | 
|  | 3751 | CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S); | 
|  | 3752 |  | 
| Argyrios Kyrtzidis | 2bff516 | 2015-04-13 16:55:04 +0000 | [diff] [blame] | 3753 | /** | 
|  | 3754 | * \brief Return the offset of the field represented by the Cursor. | 
|  | 3755 | * | 
|  | 3756 | * If the cursor is not a field declaration, -1 is returned. | 
|  | 3757 | * If the cursor semantic parent is not a record field declaration, | 
|  | 3758 | *   CXTypeLayoutError_Invalid is returned. | 
|  | 3759 | * If the field's type declaration is an incomplete type, | 
|  | 3760 | *   CXTypeLayoutError_Incomplete is returned. | 
|  | 3761 | * If the field's type declaration is a dependent type, | 
|  | 3762 | *   CXTypeLayoutError_Dependent is returned. | 
|  | 3763 | * If the field's name S is not found, | 
|  | 3764 | *   CXTypeLayoutError_InvalidFieldName is returned. | 
|  | 3765 | */ | 
|  | 3766 | CINDEX_LINKAGE long long clang_Cursor_getOffsetOfField(CXCursor C); | 
|  | 3767 |  | 
|  | 3768 | /** | 
|  | 3769 | * \brief Determine whether the given cursor represents an anonymous record | 
|  | 3770 | * declaration. | 
|  | 3771 | */ | 
|  | 3772 | CINDEX_LINKAGE unsigned clang_Cursor_isAnonymous(CXCursor C); | 
|  | 3773 |  | 
| Argyrios Kyrtzidis | adff3ae | 2013-10-11 19:58:38 +0000 | [diff] [blame] | 3774 | enum CXRefQualifierKind { | 
|  | 3775 | /** \brief No ref-qualifier was provided. */ | 
|  | 3776 | CXRefQualifier_None = 0, | 
|  | 3777 | /** \brief An lvalue ref-qualifier was provided (\c &). */ | 
|  | 3778 | CXRefQualifier_LValue, | 
|  | 3779 | /** \brief An rvalue ref-qualifier was provided (\c &&). */ | 
|  | 3780 | CXRefQualifier_RValue | 
|  | 3781 | }; | 
|  | 3782 |  | 
|  | 3783 | /** | 
| Argyrios Kyrtzidis | 35f5aab | 2016-11-15 20:51:46 +0000 | [diff] [blame] | 3784 | * \brief Returns the number of template arguments for given template | 
|  | 3785 | * specialization, or -1 if type \c T is not a template specialization. | 
| Dmitri Gribenko | 6ede6ab | 2014-02-27 16:05:05 +0000 | [diff] [blame] | 3786 | */ | 
|  | 3787 | CINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T); | 
|  | 3788 |  | 
|  | 3789 | /** | 
|  | 3790 | * \brief Returns the type template argument of a template class specialization | 
|  | 3791 | * at given index. | 
|  | 3792 | * | 
|  | 3793 | * This function only returns template type arguments and does not handle | 
|  | 3794 | * template template arguments or variadic packs. | 
|  | 3795 | */ | 
|  | 3796 | CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T, unsigned i); | 
|  | 3797 |  | 
|  | 3798 | /** | 
| Argyrios Kyrtzidis | adff3ae | 2013-10-11 19:58:38 +0000 | [diff] [blame] | 3799 | * \brief Retrieve the ref-qualifier kind of a function or method. | 
|  | 3800 | * | 
|  | 3801 | * The ref-qualifier is returned for C++ functions or methods. For other types | 
|  | 3802 | * or non-C++ declarations, CXRefQualifier_None is returned. | 
|  | 3803 | */ | 
|  | 3804 | CINDEX_LINKAGE enum CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T); | 
|  | 3805 |  | 
| Argyrios Kyrtzidis | e822f58 | 2013-04-11 01:20:11 +0000 | [diff] [blame] | 3806 | /** | 
|  | 3807 | * \brief Returns non-zero if the cursor specifies a Record member that is a | 
|  | 3808 | *   bitfield. | 
|  | 3809 | */ | 
|  | 3810 | CINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C); | 
|  | 3811 |  | 
|  | 3812 | /** | 
| Ted Kremenek | ae9e221 | 2010-08-27 21:34:58 +0000 | [diff] [blame] | 3813 | * \brief Returns 1 if the base class specified by the cursor with kind | 
|  | 3814 | *   CX_CXXBaseSpecifier is virtual. | 
|  | 3815 | */ | 
|  | 3816 | CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor); | 
|  | 3817 |  | 
|  | 3818 | /** | 
|  | 3819 | * \brief Represents the C++ access control level to a base class for a | 
|  | 3820 | * cursor with kind CX_CXXBaseSpecifier. | 
|  | 3821 | */ | 
|  | 3822 | enum CX_CXXAccessSpecifier { | 
|  | 3823 | CX_CXXInvalidAccessSpecifier, | 
|  | 3824 | CX_CXXPublic, | 
|  | 3825 | CX_CXXProtected, | 
|  | 3826 | CX_CXXPrivate | 
|  | 3827 | }; | 
|  | 3828 |  | 
|  | 3829 | /** | 
| Argyrios Kyrtzidis | 1ab09cc | 2013-04-11 17:02:10 +0000 | [diff] [blame] | 3830 | * \brief Returns the access control level for the referenced object. | 
| Argyrios Kyrtzidis | f646408 | 2013-04-11 17:31:13 +0000 | [diff] [blame] | 3831 | * | 
| Argyrios Kyrtzidis | 1ab09cc | 2013-04-11 17:02:10 +0000 | [diff] [blame] | 3832 | * If the cursor refers to a C++ declaration, its access control level within its | 
|  | 3833 | * parent scope is returned. Otherwise, if the cursor refers to a base specifier or | 
|  | 3834 | * access specifier, the specifier itself is returned. | 
| Ted Kremenek | ae9e221 | 2010-08-27 21:34:58 +0000 | [diff] [blame] | 3835 | */ | 
|  | 3836 | CINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor); | 
|  | 3837 |  | 
|  | 3838 | /** | 
| Argyrios Kyrtzidis | 4e0854f | 2014-10-15 17:05:31 +0000 | [diff] [blame] | 3839 | * \brief Represents the storage classes as declared in the source. CX_SC_Invalid | 
| Chad Rosier | db1cc7f | 2014-12-05 15:50:44 +0000 | [diff] [blame] | 3840 | * 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] | 3841 | */ | 
|  | 3842 | enum CX_StorageClass { | 
|  | 3843 | CX_SC_Invalid, | 
|  | 3844 | CX_SC_None, | 
|  | 3845 | CX_SC_Extern, | 
|  | 3846 | CX_SC_Static, | 
|  | 3847 | CX_SC_PrivateExtern, | 
|  | 3848 | CX_SC_OpenCLWorkGroupLocal, | 
|  | 3849 | CX_SC_Auto, | 
|  | 3850 | CX_SC_Register | 
|  | 3851 | }; | 
|  | 3852 |  | 
|  | 3853 | /** | 
|  | 3854 | * \brief Returns the storage class for a function or variable declaration. | 
|  | 3855 | * | 
|  | 3856 | * If the passed in Cursor is not a function or variable declaration, | 
|  | 3857 | * CX_SC_Invalid is returned else the storage class. | 
|  | 3858 | */ | 
|  | 3859 | CINDEX_LINKAGE enum CX_StorageClass clang_Cursor_getStorageClass(CXCursor); | 
|  | 3860 |  | 
|  | 3861 | /** | 
| Douglas Gregor | 16a2bdd | 2010-09-13 22:52:57 +0000 | [diff] [blame] | 3862 | * \brief Determine the number of overloaded declarations referenced by a | 
|  | 3863 | * \c CXCursor_OverloadedDeclRef cursor. | 
|  | 3864 | * | 
|  | 3865 | * \param cursor The cursor whose overloaded declarations are being queried. | 
|  | 3866 | * | 
|  | 3867 | * \returns The number of overloaded declarations referenced by \c cursor. If it | 
|  | 3868 | * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0. | 
|  | 3869 | */ | 
|  | 3870 | CINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor); | 
|  | 3871 |  | 
|  | 3872 | /** | 
|  | 3873 | * \brief Retrieve a cursor for one of the overloaded declarations referenced | 
|  | 3874 | * by a \c CXCursor_OverloadedDeclRef cursor. | 
|  | 3875 | * | 
|  | 3876 | * \param cursor The cursor whose overloaded declarations are being queried. | 
|  | 3877 | * | 
|  | 3878 | * \param index The zero-based index into the set of overloaded declarations in | 
|  | 3879 | * the cursor. | 
|  | 3880 | * | 
|  | 3881 | * \returns A cursor representing the declaration referenced by the given | 
|  | 3882 | * \c cursor at the specified \c index. If the cursor does not have an | 
|  | 3883 | * associated set of overloaded declarations, or if the index is out of bounds, | 
|  | 3884 | * returns \c clang_getNullCursor(); | 
|  | 3885 | */ | 
|  | 3886 | CINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor, | 
|  | 3887 | unsigned index); | 
|  | 3888 |  | 
|  | 3889 | /** | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3890 | * @} | 
|  | 3891 | */ | 
| Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 3892 |  | 
|  | 3893 | /** | 
| Ted Kremenek | 2c2c5f3 | 2010-08-27 21:34:51 +0000 | [diff] [blame] | 3894 | * \defgroup CINDEX_ATTRIBUTES Information for attributes | 
| Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 3895 | * | 
|  | 3896 | * @{ | 
|  | 3897 | */ | 
|  | 3898 |  | 
| Ted Kremenek | a594082 | 2010-08-26 01:42:22 +0000 | [diff] [blame] | 3899 | /** | 
|  | 3900 | * \brief For cursors representing an iboutletcollection attribute, | 
|  | 3901 | *  this function returns the collection element type. | 
|  | 3902 | * | 
|  | 3903 | */ | 
|  | 3904 | CINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor); | 
|  | 3905 |  | 
|  | 3906 | /** | 
|  | 3907 | * @} | 
|  | 3908 | */ | 
| Ted Kremenek | 6bca984 | 2010-05-14 21:29:26 +0000 | [diff] [blame] | 3909 |  | 
|  | 3910 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3911 | * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors | 
|  | 3912 | * | 
|  | 3913 | * These routines provide the ability to traverse the abstract syntax tree | 
|  | 3914 | * using cursors. | 
|  | 3915 | * | 
|  | 3916 | * @{ | 
|  | 3917 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3918 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3919 | /** | 
|  | 3920 | * \brief Describes how the traversal of the children of a particular | 
|  | 3921 | * cursor should proceed after visiting a particular child cursor. | 
|  | 3922 | * | 
|  | 3923 | * A value of this enumeration type should be returned by each | 
|  | 3924 | * \c CXCursorVisitor to indicate how clang_visitChildren() proceed. | 
|  | 3925 | */ | 
|  | 3926 | enum CXChildVisitResult { | 
|  | 3927 | /** | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3928 | * \brief Terminates the cursor traversal. | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3929 | */ | 
|  | 3930 | CXChildVisit_Break, | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3931 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3932 | * \brief Continues the cursor traversal with the next sibling of | 
|  | 3933 | * the cursor just visited, without visiting its children. | 
|  | 3934 | */ | 
|  | 3935 | CXChildVisit_Continue, | 
|  | 3936 | /** | 
|  | 3937 | * \brief Recursively traverse the children of this cursor, using | 
|  | 3938 | * the same visitor and client data. | 
|  | 3939 | */ | 
|  | 3940 | CXChildVisit_Recurse | 
|  | 3941 | }; | 
|  | 3942 |  | 
|  | 3943 | /** | 
|  | 3944 | * \brief Visitor invoked for each cursor found by a traversal. | 
|  | 3945 | * | 
|  | 3946 | * This visitor function will be invoked for each cursor found by | 
|  | 3947 | * clang_visitCursorChildren(). Its first argument is the cursor being | 
|  | 3948 | * visited, its second argument is the parent visitor for that cursor, | 
|  | 3949 | * and its third argument is the client data provided to | 
|  | 3950 | * clang_visitCursorChildren(). | 
|  | 3951 | * | 
|  | 3952 | * The visitor should return one of the \c CXChildVisitResult values | 
|  | 3953 | * to direct clang_visitCursorChildren(). | 
|  | 3954 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3955 | typedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor, | 
|  | 3956 | CXCursor parent, | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3957 | CXClientData client_data); | 
|  | 3958 |  | 
|  | 3959 | /** | 
|  | 3960 | * \brief Visit the children of a particular cursor. | 
|  | 3961 | * | 
|  | 3962 | * This function visits all the direct children of the given cursor, | 
|  | 3963 | * invoking the given \p visitor function with the cursors of each | 
|  | 3964 | * visited child. The traversal may be recursive, if the visitor returns | 
|  | 3965 | * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if | 
|  | 3966 | * the visitor returns \c CXChildVisit_Break. | 
|  | 3967 | * | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3968 | * \param parent the cursor whose child may be visited. All kinds of | 
| Daniel Dunbar | b9999fd | 2010-01-24 04:10:31 +0000 | [diff] [blame] | 3969 | * cursors can be visited, including invalid cursors (which, by | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3970 | * definition, have no children). | 
|  | 3971 | * | 
|  | 3972 | * \param visitor the visitor function that will be invoked for each | 
|  | 3973 | * child of \p parent. | 
|  | 3974 | * | 
|  | 3975 | * \param client_data pointer data supplied by the client, which will | 
|  | 3976 | * be passed to the visitor each time it is invoked. | 
|  | 3977 | * | 
|  | 3978 | * \returns a non-zero value if the traversal was terminated | 
|  | 3979 | * prematurely by the visitor returning \c CXChildVisit_Break. | 
|  | 3980 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 3981 | CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent, | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 3982 | CXCursorVisitor visitor, | 
|  | 3983 | CXClientData client_data); | 
| David Chisnall | b2aa0ef | 2010-11-03 14:12:26 +0000 | [diff] [blame] | 3984 | #ifdef __has_feature | 
|  | 3985 | #  if __has_feature(blocks) | 
|  | 3986 | /** | 
|  | 3987 | * \brief Visitor invoked for each cursor found by a traversal. | 
|  | 3988 | * | 
|  | 3989 | * This visitor block will be invoked for each cursor found by | 
|  | 3990 | * clang_visitChildrenWithBlock(). Its first argument is the cursor being | 
|  | 3991 | * visited, its second argument is the parent visitor for that cursor. | 
|  | 3992 | * | 
|  | 3993 | * The visitor should return one of the \c CXChildVisitResult values | 
|  | 3994 | * to direct clang_visitChildrenWithBlock(). | 
|  | 3995 | */ | 
|  | 3996 | typedef enum CXChildVisitResult | 
|  | 3997 | (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent); | 
|  | 3998 |  | 
|  | 3999 | /** | 
|  | 4000 | * Visits the children of a cursor using the specified block.  Behaves | 
|  | 4001 | * identically to clang_visitChildren() in all other respects. | 
|  | 4002 | */ | 
| Argyrios Kyrtzidis | a0a35d7 | 2016-02-07 18:21:28 +0000 | [diff] [blame] | 4003 | CINDEX_LINKAGE unsigned clang_visitChildrenWithBlock(CXCursor parent, | 
|  | 4004 | CXCursorVisitorBlock block); | 
| David Chisnall | b2aa0ef | 2010-11-03 14:12:26 +0000 | [diff] [blame] | 4005 | #  endif | 
|  | 4006 | #endif | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4007 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4008 | /** | 
|  | 4009 | * @} | 
|  | 4010 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4011 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4012 | /** | 
|  | 4013 | * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST | 
|  | 4014 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4015 | * These routines provide the ability to determine references within and | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4016 | * across translation units, by providing the names of the entities referenced | 
|  | 4017 | * by cursors, follow reference cursors to the declarations they reference, | 
|  | 4018 | * and associate declarations with their definitions. | 
|  | 4019 | * | 
|  | 4020 | * @{ | 
|  | 4021 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4022 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4023 | /** | 
|  | 4024 | * \brief Retrieve a Unified Symbol Resolution (USR) for the entity referenced | 
|  | 4025 | * by the given cursor. | 
|  | 4026 | * | 
|  | 4027 | * A Unified Symbol Resolution (USR) is a string that identifies a particular | 
|  | 4028 | * entity (function, class, variable, etc.) within a program. USRs can be | 
|  | 4029 | * compared across translation units to determine, e.g., when references in | 
|  | 4030 | * one translation refer to an entity defined in another translation unit. | 
|  | 4031 | */ | 
|  | 4032 | CINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor); | 
|  | 4033 |  | 
|  | 4034 | /** | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4035 | * \brief Construct a USR for a specified Objective-C class. | 
|  | 4036 | */ | 
|  | 4037 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name); | 
|  | 4038 |  | 
|  | 4039 | /** | 
|  | 4040 | * \brief Construct a USR for a specified Objective-C category. | 
|  | 4041 | */ | 
|  | 4042 | CINDEX_LINKAGE CXString | 
| Ted Kremenek | bc1a67b | 2010-03-15 17:38:58 +0000 | [diff] [blame] | 4043 | clang_constructUSR_ObjCCategory(const char *class_name, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4044 | const char *category_name); | 
|  | 4045 |  | 
|  | 4046 | /** | 
|  | 4047 | * \brief Construct a USR for a specified Objective-C protocol. | 
|  | 4048 | */ | 
|  | 4049 | CINDEX_LINKAGE CXString | 
|  | 4050 | clang_constructUSR_ObjCProtocol(const char *protocol_name); | 
|  | 4051 |  | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4052 | /** | 
|  | 4053 | * \brief Construct a USR for a specified Objective-C instance variable and | 
|  | 4054 | *   the USR for its containing class. | 
|  | 4055 | */ | 
|  | 4056 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name, | 
|  | 4057 | CXString classUSR); | 
|  | 4058 |  | 
|  | 4059 | /** | 
|  | 4060 | * \brief Construct a USR for a specified Objective-C method and | 
|  | 4061 | *   the USR for its containing class. | 
|  | 4062 | */ | 
|  | 4063 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name, | 
|  | 4064 | unsigned isInstanceMethod, | 
|  | 4065 | CXString classUSR); | 
|  | 4066 |  | 
|  | 4067 | /** | 
|  | 4068 | * \brief Construct a USR for a specified Objective-C property and the USR | 
|  | 4069 | *  for its containing class. | 
|  | 4070 | */ | 
|  | 4071 | CINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property, | 
|  | 4072 | CXString classUSR); | 
|  | 4073 |  | 
|  | 4074 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4075 | * \brief Retrieve a name for the entity referenced by this cursor. | 
|  | 4076 | */ | 
|  | 4077 | CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor); | 
|  | 4078 |  | 
| Douglas Gregor | 97c7571 | 2010-10-02 22:49:11 +0000 | [diff] [blame] | 4079 | /** | 
| Argyrios Kyrtzidis | 191a6a8 | 2012-03-30 20:58:35 +0000 | [diff] [blame] | 4080 | * \brief Retrieve a range for a piece that forms the cursors spelling name. | 
|  | 4081 | * 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] | 4082 | * Objective-C methods and Objective-C message expressions, there are multiple | 
|  | 4083 | * pieces for each selector identifier. | 
| Argyrios Kyrtzidis | 191a6a8 | 2012-03-30 20:58:35 +0000 | [diff] [blame] | 4084 | * | 
|  | 4085 | * \param pieceIndex the index of the spelling name piece. If this is greater | 
|  | 4086 | * than the actual number of pieces, it will return a NULL (invalid) range. | 
|  | 4087 | * | 
|  | 4088 | * \param options Reserved. | 
|  | 4089 | */ | 
|  | 4090 | CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor, | 
|  | 4091 | unsigned pieceIndex, | 
|  | 4092 | unsigned options); | 
|  | 4093 |  | 
|  | 4094 | /** | 
| Jonathan Coe | 45ef503 | 2018-01-16 10:19:56 +0000 | [diff] [blame] | 4095 | * \brief Opaque pointer representing a policy that controls pretty printing | 
|  | 4096 | * for \c clang_getCursorPrettyPrinted. | 
|  | 4097 | */ | 
|  | 4098 | typedef void *CXPrintingPolicy; | 
|  | 4099 |  | 
|  | 4100 | /** | 
|  | 4101 | * \brief Properties for the printing policy. | 
|  | 4102 | * | 
|  | 4103 | * See \c clang::PrintingPolicy for more information. | 
|  | 4104 | */ | 
|  | 4105 | enum CXPrintingPolicyProperty { | 
|  | 4106 | CXPrintingPolicy_Indentation, | 
|  | 4107 | CXPrintingPolicy_SuppressSpecifiers, | 
|  | 4108 | CXPrintingPolicy_SuppressTagKeyword, | 
|  | 4109 | CXPrintingPolicy_IncludeTagDefinition, | 
|  | 4110 | CXPrintingPolicy_SuppressScope, | 
|  | 4111 | CXPrintingPolicy_SuppressUnwrittenScope, | 
|  | 4112 | CXPrintingPolicy_SuppressInitializers, | 
|  | 4113 | CXPrintingPolicy_ConstantArraySizeAsWritten, | 
|  | 4114 | CXPrintingPolicy_AnonymousTagLocations, | 
|  | 4115 | CXPrintingPolicy_SuppressStrongLifetime, | 
|  | 4116 | CXPrintingPolicy_SuppressLifetimeQualifiers, | 
|  | 4117 | CXPrintingPolicy_SuppressTemplateArgsInCXXConstructors, | 
|  | 4118 | CXPrintingPolicy_Bool, | 
|  | 4119 | CXPrintingPolicy_Restrict, | 
|  | 4120 | CXPrintingPolicy_Alignof, | 
|  | 4121 | CXPrintingPolicy_UnderscoreAlignof, | 
|  | 4122 | CXPrintingPolicy_UseVoidForZeroParams, | 
|  | 4123 | CXPrintingPolicy_TerseOutput, | 
|  | 4124 | CXPrintingPolicy_PolishForDeclaration, | 
|  | 4125 | CXPrintingPolicy_Half, | 
|  | 4126 | CXPrintingPolicy_MSWChar, | 
|  | 4127 | CXPrintingPolicy_IncludeNewlines, | 
|  | 4128 | CXPrintingPolicy_MSVCFormatting, | 
|  | 4129 | CXPrintingPolicy_ConstantsAsWritten, | 
|  | 4130 | CXPrintingPolicy_SuppressImplicitBase, | 
|  | 4131 | CXPrintingPolicy_FullyQualifiedName, | 
|  | 4132 |  | 
|  | 4133 | CXPrintingPolicy_LastProperty = CXPrintingPolicy_FullyQualifiedName | 
|  | 4134 | }; | 
|  | 4135 |  | 
|  | 4136 | /** | 
|  | 4137 | * \brief Get a property value for the given printing policy. | 
|  | 4138 | */ | 
|  | 4139 | unsigned | 
|  | 4140 | clang_PrintingPolicy_getProperty(CXPrintingPolicy Policy, | 
|  | 4141 | enum CXPrintingPolicyProperty Property); | 
|  | 4142 |  | 
|  | 4143 | /** | 
|  | 4144 | * \brief Set a property value for the given printing policy. | 
|  | 4145 | */ | 
|  | 4146 | void clang_PrintingPolicy_setProperty(CXPrintingPolicy Policy, | 
|  | 4147 | enum CXPrintingPolicyProperty Property, | 
|  | 4148 | unsigned Value); | 
|  | 4149 |  | 
|  | 4150 | /** | 
|  | 4151 | * \brief Retrieve the default policy for the cursor. | 
|  | 4152 | * | 
|  | 4153 | * The policy should be released after use with \c | 
|  | 4154 | * clang_PrintingPolicy_dispose. | 
|  | 4155 | */ | 
|  | 4156 | CINDEX_LINKAGE CXPrintingPolicy clang_getCursorPrintingPolicy(CXCursor); | 
|  | 4157 |  | 
|  | 4158 | /** | 
|  | 4159 | * \brief Release a printing policy. | 
|  | 4160 | */ | 
|  | 4161 | CINDEX_LINKAGE void clang_PrintingPolicy_dispose(CXPrintingPolicy Policy); | 
|  | 4162 |  | 
|  | 4163 | /** | 
|  | 4164 | * \brief Pretty print declarations. | 
|  | 4165 | * | 
|  | 4166 | * \param Cursor The cursor representing a declaration. | 
|  | 4167 | * | 
|  | 4168 | * \param Policy The policy to control the entities being printed. If | 
|  | 4169 | * NULL, a default policy is used. | 
|  | 4170 | * | 
|  | 4171 | * \returns The pretty printed declaration or the empty string for | 
|  | 4172 | * other cursors. | 
|  | 4173 | */ | 
|  | 4174 | CINDEX_LINKAGE CXString clang_getCursorPrettyPrinted(CXCursor Cursor, | 
|  | 4175 | CXPrintingPolicy Policy); | 
|  | 4176 |  | 
|  | 4177 | /** | 
| Douglas Gregor | 97c7571 | 2010-10-02 22:49:11 +0000 | [diff] [blame] | 4178 | * \brief Retrieve the display name for the entity referenced by this cursor. | 
|  | 4179 | * | 
|  | 4180 | * The display name contains extra information that helps identify the cursor, | 
|  | 4181 | * such as the parameters of a function or template or the arguments of a | 
|  | 4182 | * class template specialization. | 
|  | 4183 | */ | 
|  | 4184 | CINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor); | 
|  | 4185 |  | 
| Douglas Gregor | ad27e8b | 2010-01-19 01:20:04 +0000 | [diff] [blame] | 4186 | /** \brief For a cursor that is a reference, retrieve a cursor representing the | 
|  | 4187 | * entity that it references. | 
|  | 4188 | * | 
|  | 4189 | * Reference cursors refer to other entities in the AST. For example, an | 
|  | 4190 | * Objective-C superclass reference cursor refers to an Objective-C class. | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4191 | * This function produces the cursor for the Objective-C class from the | 
| Douglas Gregor | ad27e8b | 2010-01-19 01:20:04 +0000 | [diff] [blame] | 4192 | * cursor for the superclass reference. If the input cursor is a declaration or | 
|  | 4193 | * definition, it returns that declaration or definition unchanged. | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4194 | * Otherwise, returns the NULL cursor. | 
| Douglas Gregor | ad27e8b | 2010-01-19 01:20:04 +0000 | [diff] [blame] | 4195 | */ | 
|  | 4196 | CINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor); | 
| Douglas Gregor | 6b8232f | 2010-01-19 19:34:47 +0000 | [diff] [blame] | 4197 |  | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4198 | /** | 
| Douglas Gregor | 6b8232f | 2010-01-19 19:34:47 +0000 | [diff] [blame] | 4199 | *  \brief For a cursor that is either a reference to or a declaration | 
|  | 4200 | *  of some entity, retrieve a cursor that describes the definition of | 
|  | 4201 | *  that entity. | 
|  | 4202 | * | 
|  | 4203 | *  Some entities can be declared multiple times within a translation | 
|  | 4204 | *  unit, but only one of those declarations can also be a | 
|  | 4205 | *  definition. For example, given: | 
|  | 4206 | * | 
|  | 4207 | *  \code | 
|  | 4208 | *  int f(int, int); | 
|  | 4209 | *  int g(int x, int y) { return f(x, y); } | 
|  | 4210 | *  int f(int a, int b) { return a + b; } | 
|  | 4211 | *  int f(int, int); | 
|  | 4212 | *  \endcode | 
|  | 4213 | * | 
|  | 4214 | *  there are three declarations of the function "f", but only the | 
|  | 4215 | *  second one is a definition. The clang_getCursorDefinition() | 
|  | 4216 | *  function will take any cursor pointing to a declaration of "f" | 
|  | 4217 | *  (the first or fourth lines of the example) or a cursor referenced | 
|  | 4218 | *  that uses "f" (the call to "f' inside "g") and will return a | 
|  | 4219 | *  declaration cursor pointing to the definition (the second "f" | 
|  | 4220 | *  declaration). | 
|  | 4221 | * | 
|  | 4222 | *  If given a cursor for which there is no corresponding definition, | 
|  | 4223 | *  e.g., because there is no definition of that entity within this | 
|  | 4224 | *  translation unit, returns a NULL cursor. | 
|  | 4225 | */ | 
|  | 4226 | CINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor); | 
|  | 4227 |  | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4228 | /** | 
| Douglas Gregor | 6b8232f | 2010-01-19 19:34:47 +0000 | [diff] [blame] | 4229 | * \brief Determine whether the declaration pointed to by this cursor | 
|  | 4230 | * is also a definition of that entity. | 
|  | 4231 | */ | 
|  | 4232 | CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor); | 
|  | 4233 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4234 | /** | 
| Douglas Gregor | fec4dc9 | 2010-11-19 23:44:15 +0000 | [diff] [blame] | 4235 | * \brief Retrieve the canonical cursor corresponding to the given cursor. | 
|  | 4236 | * | 
|  | 4237 | * In the C family of languages, many kinds of entities can be declared several | 
|  | 4238 | * times within a single translation unit. For example, a structure type can | 
|  | 4239 | * be forward-declared (possibly multiple times) and later defined: | 
|  | 4240 | * | 
|  | 4241 | * \code | 
|  | 4242 | * struct X; | 
|  | 4243 | * struct X; | 
|  | 4244 | * struct X { | 
|  | 4245 | *   int member; | 
|  | 4246 | * }; | 
|  | 4247 | * \endcode | 
|  | 4248 | * | 
|  | 4249 | * The declarations and the definition of \c X are represented by three | 
|  | 4250 | * different cursors, all of which are declarations of the same underlying | 
|  | 4251 | * entity. One of these cursor is considered the "canonical" cursor, which | 
|  | 4252 | * is effectively the representative for the underlying entity. One can | 
|  | 4253 | * determine if two cursors are declarations of the same underlying entity by | 
|  | 4254 | * comparing their canonical cursors. | 
|  | 4255 | * | 
|  | 4256 | * \returns The canonical cursor for the entity referred to by the given cursor. | 
|  | 4257 | */ | 
|  | 4258 | CINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor); | 
|  | 4259 |  | 
| Argyrios Kyrtzidis | 210f29f | 2012-03-30 22:15:48 +0000 | [diff] [blame] | 4260 | /** | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4261 | * \brief If the cursor points to a selector identifier in an Objective-C | 
|  | 4262 | * method or message expression, this returns the selector index. | 
| Argyrios Kyrtzidis | 210f29f | 2012-03-30 22:15:48 +0000 | [diff] [blame] | 4263 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 4264 | * After getting a cursor with #clang_getCursor, this can be called to | 
| Argyrios Kyrtzidis | 210f29f | 2012-03-30 22:15:48 +0000 | [diff] [blame] | 4265 | * determine if the location points to a selector identifier. | 
|  | 4266 | * | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4267 | * \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] | 4268 | * expression and the cursor is pointing to a selector identifier, or -1 | 
|  | 4269 | * otherwise. | 
|  | 4270 | */ | 
|  | 4271 | CINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor); | 
|  | 4272 |  | 
| Douglas Gregor | fec4dc9 | 2010-11-19 23:44:15 +0000 | [diff] [blame] | 4273 | /** | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4274 | * \brief Given a cursor pointing to a C++ method call or an Objective-C | 
|  | 4275 | * message, returns non-zero if the method/message is "dynamic", meaning: | 
| Argyrios Kyrtzidis | b6df6821 | 2012-07-02 23:54:36 +0000 | [diff] [blame] | 4276 | * | 
|  | 4277 | * For a C++ method: the call is virtual. | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4278 | * For an Objective-C message: the receiver is an object instance, not 'super' | 
|  | 4279 | * or a specific class. | 
| Argyrios Kyrtzidis | b6df6821 | 2012-07-02 23:54:36 +0000 | [diff] [blame] | 4280 | * | 
|  | 4281 | * If the method/message is "static" or the cursor does not point to a | 
|  | 4282 | * method/message, it will return zero. | 
|  | 4283 | */ | 
|  | 4284 | CINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C); | 
|  | 4285 |  | 
|  | 4286 | /** | 
| Argyrios Kyrtzidis | 2a68486 | 2017-04-27 17:23:04 +0000 | [diff] [blame] | 4287 | * \brief Given a cursor pointing to an Objective-C message or property | 
|  | 4288 | * reference, or C++ method call, returns the CXType of the receiver. | 
| Argyrios Kyrtzidis | b26a24c | 2012-11-01 02:01:34 +0000 | [diff] [blame] | 4289 | */ | 
|  | 4290 | CINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C); | 
|  | 4291 |  | 
|  | 4292 | /** | 
| Argyrios Kyrtzidis | 9adfd8a | 2013-04-18 22:15:49 +0000 | [diff] [blame] | 4293 | * \brief Property attributes for a \c CXCursor_ObjCPropertyDecl. | 
|  | 4294 | */ | 
|  | 4295 | typedef enum { | 
|  | 4296 | CXObjCPropertyAttr_noattr    = 0x00, | 
|  | 4297 | CXObjCPropertyAttr_readonly  = 0x01, | 
|  | 4298 | CXObjCPropertyAttr_getter    = 0x02, | 
|  | 4299 | CXObjCPropertyAttr_assign    = 0x04, | 
|  | 4300 | CXObjCPropertyAttr_readwrite = 0x08, | 
|  | 4301 | CXObjCPropertyAttr_retain    = 0x10, | 
|  | 4302 | CXObjCPropertyAttr_copy      = 0x20, | 
|  | 4303 | CXObjCPropertyAttr_nonatomic = 0x40, | 
|  | 4304 | CXObjCPropertyAttr_setter    = 0x80, | 
|  | 4305 | CXObjCPropertyAttr_atomic    = 0x100, | 
|  | 4306 | CXObjCPropertyAttr_weak      = 0x200, | 
|  | 4307 | CXObjCPropertyAttr_strong    = 0x400, | 
| Manman Ren | 04fd4d8 | 2016-05-31 23:22:04 +0000 | [diff] [blame] | 4308 | CXObjCPropertyAttr_unsafe_unretained = 0x800, | 
| Manman Ren | 400e4c3 | 2016-06-03 23:11:41 +0000 | [diff] [blame] | 4309 | CXObjCPropertyAttr_class = 0x1000 | 
| Argyrios Kyrtzidis | 9adfd8a | 2013-04-18 22:15:49 +0000 | [diff] [blame] | 4310 | } CXObjCPropertyAttrKind; | 
|  | 4311 |  | 
|  | 4312 | /** | 
|  | 4313 | * \brief Given a cursor that represents a property declaration, return the | 
|  | 4314 | * associated property attributes. The bits are formed from | 
|  | 4315 | * \c CXObjCPropertyAttrKind. | 
|  | 4316 | * | 
|  | 4317 | * \param reserved Reserved for future use, pass 0. | 
|  | 4318 | */ | 
|  | 4319 | CINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C, | 
|  | 4320 | unsigned reserved); | 
|  | 4321 |  | 
|  | 4322 | /** | 
| Argyrios Kyrtzidis | 9d9bc01 | 2013-04-18 23:29:12 +0000 | [diff] [blame] | 4323 | * \brief 'Qualifiers' written next to the return and parameter types in | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4324 | * Objective-C method declarations. | 
| Argyrios Kyrtzidis | 9d9bc01 | 2013-04-18 23:29:12 +0000 | [diff] [blame] | 4325 | */ | 
|  | 4326 | typedef enum { | 
|  | 4327 | CXObjCDeclQualifier_None = 0x0, | 
|  | 4328 | CXObjCDeclQualifier_In = 0x1, | 
|  | 4329 | CXObjCDeclQualifier_Inout = 0x2, | 
|  | 4330 | CXObjCDeclQualifier_Out = 0x4, | 
|  | 4331 | CXObjCDeclQualifier_Bycopy = 0x8, | 
|  | 4332 | CXObjCDeclQualifier_Byref = 0x10, | 
|  | 4333 | CXObjCDeclQualifier_Oneway = 0x20 | 
|  | 4334 | } CXObjCDeclQualifierKind; | 
|  | 4335 |  | 
|  | 4336 | /** | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4337 | * \brief Given a cursor that represents an Objective-C method or parameter | 
|  | 4338 | * declaration, return the associated Objective-C qualifiers for the return | 
|  | 4339 | * type or the parameter respectively. The bits are formed from | 
|  | 4340 | * CXObjCDeclQualifierKind. | 
| Argyrios Kyrtzidis | 9d9bc01 | 2013-04-18 23:29:12 +0000 | [diff] [blame] | 4341 | */ | 
|  | 4342 | CINDEX_LINKAGE unsigned clang_Cursor_getObjCDeclQualifiers(CXCursor C); | 
|  | 4343 |  | 
|  | 4344 | /** | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4345 | * \brief Given a cursor that represents an Objective-C method or property | 
| Alex Lorenz | 6c2898a | 2017-04-06 14:03:25 +0000 | [diff] [blame] | 4346 | * declaration, return non-zero if the declaration was affected by "\@optional". | 
|  | 4347 | * 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] | 4348 | */ | 
|  | 4349 | CINDEX_LINKAGE unsigned clang_Cursor_isObjCOptional(CXCursor C); | 
|  | 4350 |  | 
|  | 4351 | /** | 
| Argyrios Kyrtzidis | 23814e4 | 2013-04-18 23:53:05 +0000 | [diff] [blame] | 4352 | * \brief Returns non-zero if the given cursor is a variadic function or method. | 
|  | 4353 | */ | 
|  | 4354 | CINDEX_LINKAGE unsigned clang_Cursor_isVariadic(CXCursor C); | 
|  | 4355 |  | 
|  | 4356 | /** | 
| Argyrios Kyrtzidis | 0381cc7 | 2017-05-10 15:10:36 +0000 | [diff] [blame] | 4357 | * \brief Returns non-zero if the given cursor points to a symbol marked with | 
|  | 4358 | * external_source_symbol attribute. | 
|  | 4359 | * | 
|  | 4360 | * \param language If non-NULL, and the attribute is present, will be set to | 
|  | 4361 | * the 'language' string from the attribute. | 
|  | 4362 | * | 
|  | 4363 | * \param definedIn If non-NULL, and the attribute is present, will be set to | 
|  | 4364 | * the 'definedIn' string from the attribute. | 
|  | 4365 | * | 
|  | 4366 | * \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] | 4367 | * non-zero if the 'generated_declaration' is set in the attribute. | 
| Argyrios Kyrtzidis | 0381cc7 | 2017-05-10 15:10:36 +0000 | [diff] [blame] | 4368 | */ | 
|  | 4369 | CINDEX_LINKAGE unsigned clang_Cursor_isExternalSymbol(CXCursor C, | 
|  | 4370 | CXString *language, CXString *definedIn, | 
|  | 4371 | unsigned *isGenerated); | 
|  | 4372 |  | 
|  | 4373 | /** | 
| Dmitri Gribenko | aab8383 | 2012-06-20 00:34:58 +0000 | [diff] [blame] | 4374 | * \brief Given a cursor that represents a declaration, return the associated | 
|  | 4375 | * comment's source range.  The range may include multiple consecutive comments | 
|  | 4376 | * with whitespace in between. | 
|  | 4377 | */ | 
|  | 4378 | CINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C); | 
|  | 4379 |  | 
|  | 4380 | /** | 
|  | 4381 | * \brief Given a cursor that represents a declaration, return the associated | 
|  | 4382 | * comment text, including comment markers. | 
|  | 4383 | */ | 
|  | 4384 | CINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C); | 
|  | 4385 |  | 
|  | 4386 | /** | 
| Dmitri Gribenko | 5e4fe00 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 4387 | * \brief Given a cursor that represents a documentable entity (e.g., | 
|  | 4388 | * declaration), return the associated \\brief paragraph; otherwise return the | 
|  | 4389 | * first paragraph. | 
| Dmitri Gribenko | 5188c4b | 2012-06-26 20:39:18 +0000 | [diff] [blame] | 4390 | */ | 
|  | 4391 | CINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C); | 
|  | 4392 |  | 
|  | 4393 | /** | 
| Dmitri Gribenko | 5e4fe00 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 4394 | * @} | 
|  | 4395 | */ | 
|  | 4396 |  | 
| Eli Bendersky | 44a206f | 2014-07-31 18:04:56 +0000 | [diff] [blame] | 4397 | /** \defgroup CINDEX_MANGLE Name Mangling API Functions | 
|  | 4398 | * | 
|  | 4399 | * @{ | 
|  | 4400 | */ | 
|  | 4401 |  | 
|  | 4402 | /** | 
|  | 4403 | * \brief Retrieve the CXString representing the mangled name of the cursor. | 
|  | 4404 | */ | 
|  | 4405 | CINDEX_LINKAGE CXString clang_Cursor_getMangling(CXCursor); | 
|  | 4406 |  | 
|  | 4407 | /** | 
| Saleem Abdulrasool | 6003443 | 2015-11-12 03:57:22 +0000 | [diff] [blame] | 4408 | * \brief Retrieve the CXStrings representing the mangled symbols of the C++ | 
|  | 4409 | * constructor or destructor at the cursor. | 
|  | 4410 | */ | 
|  | 4411 | CINDEX_LINKAGE CXStringSet *clang_Cursor_getCXXManglings(CXCursor); | 
|  | 4412 |  | 
|  | 4413 | /** | 
| Dave Lee | 1a532c9 | 2017-09-22 16:58:57 +0000 | [diff] [blame] | 4414 | * \brief Retrieve the CXStrings representing the mangled symbols of the ObjC | 
|  | 4415 | * class interface or implementation at the cursor. | 
|  | 4416 | */ | 
|  | 4417 | CINDEX_LINKAGE CXStringSet *clang_Cursor_getObjCManglings(CXCursor); | 
|  | 4418 |  | 
|  | 4419 | /** | 
| Eli Bendersky | 44a206f | 2014-07-31 18:04:56 +0000 | [diff] [blame] | 4420 | * @} | 
|  | 4421 | */ | 
|  | 4422 |  | 
| Dmitri Gribenko | 5e4fe00 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 4423 | /** | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4424 | * \defgroup CINDEX_MODULE Module introspection | 
|  | 4425 | * | 
|  | 4426 | * The functions in this group provide access to information about modules. | 
|  | 4427 | * | 
|  | 4428 | * @{ | 
|  | 4429 | */ | 
|  | 4430 |  | 
|  | 4431 | typedef void *CXModule; | 
|  | 4432 |  | 
|  | 4433 | /** | 
|  | 4434 | * \brief Given a CXCursor_ModuleImportDecl cursor, return the associated module. | 
|  | 4435 | */ | 
|  | 4436 | CINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C); | 
|  | 4437 |  | 
|  | 4438 | /** | 
| Argyrios Kyrtzidis | f6d49c3 | 2014-05-14 23:14:37 +0000 | [diff] [blame] | 4439 | * \brief Given a CXFile header file, return the module that contains it, if one | 
|  | 4440 | * exists. | 
|  | 4441 | */ | 
|  | 4442 | CINDEX_LINKAGE CXModule clang_getModuleForFile(CXTranslationUnit, CXFile); | 
|  | 4443 |  | 
|  | 4444 | /** | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4445 | * \param Module a module object. | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4446 | * | 
| Argyrios Kyrtzidis | 12fdb9e | 2013-04-26 22:47:49 +0000 | [diff] [blame] | 4447 | * \returns the module file where the provided module object came from. | 
|  | 4448 | */ | 
|  | 4449 | CINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module); | 
|  | 4450 |  | 
|  | 4451 | /** | 
|  | 4452 | * \param Module a module object. | 
|  | 4453 | * | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4454 | * \returns the parent of a sub-module or NULL if the given module is top-level, | 
|  | 4455 | * e.g. for 'std.vector' it will return the 'std' module. | 
|  | 4456 | */ | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4457 | CINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module); | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4458 |  | 
|  | 4459 | /** | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4460 | * \param Module a module object. | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4461 | * | 
|  | 4462 | * \returns the name of the module, e.g. for the 'std.vector' sub-module it | 
|  | 4463 | * will return "vector". | 
|  | 4464 | */ | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4465 | CINDEX_LINKAGE CXString clang_Module_getName(CXModule Module); | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4466 |  | 
|  | 4467 | /** | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4468 | * \param Module a module object. | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4469 | * | 
|  | 4470 | * \returns the full name of the module, e.g. "std.vector". | 
|  | 4471 | */ | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4472 | CINDEX_LINKAGE CXString clang_Module_getFullName(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 | * | 
| Argyrios Kyrtzidis | 884337f | 2014-05-15 04:44:25 +0000 | [diff] [blame] | 4477 | * \returns non-zero if the module is a system one. | 
|  | 4478 | */ | 
|  | 4479 | CINDEX_LINKAGE int clang_Module_isSystem(CXModule Module); | 
|  | 4480 |  | 
|  | 4481 | /** | 
|  | 4482 | * \param Module a module object. | 
|  | 4483 | * | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4484 | * \returns the number of top level headers associated with this module. | 
|  | 4485 | */ | 
| Argyrios Kyrtzidis | 3c5305c | 2013-03-13 21:13:43 +0000 | [diff] [blame] | 4486 | CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit, | 
|  | 4487 | CXModule Module); | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4488 |  | 
|  | 4489 | /** | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4490 | * \param Module a module object. | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4491 | * | 
|  | 4492 | * \param Index top level header index (zero-based). | 
|  | 4493 | * | 
|  | 4494 | * \returns the specified top level header associated with the module. | 
|  | 4495 | */ | 
| Argyrios Kyrtzidis | ba30d92 | 2012-10-06 01:18:38 +0000 | [diff] [blame] | 4496 | CINDEX_LINKAGE | 
| Argyrios Kyrtzidis | 3c5305c | 2013-03-13 21:13:43 +0000 | [diff] [blame] | 4497 | CXFile clang_Module_getTopLevelHeader(CXTranslationUnit, | 
|  | 4498 | CXModule Module, unsigned Index); | 
| Argyrios Kyrtzidis | 2b9b5bb | 2012-10-05 00:22:37 +0000 | [diff] [blame] | 4499 |  | 
|  | 4500 | /** | 
|  | 4501 | * @} | 
|  | 4502 | */ | 
|  | 4503 |  | 
|  | 4504 | /** | 
| Ted Kremenek | 9cfe9e6 | 2010-05-17 20:06:56 +0000 | [diff] [blame] | 4505 | * \defgroup CINDEX_CPP C++ AST introspection | 
|  | 4506 | * | 
|  | 4507 | * The routines in this group provide access information in the ASTs specific | 
|  | 4508 | * to C++ language features. | 
|  | 4509 | * | 
|  | 4510 | * @{ | 
|  | 4511 | */ | 
|  | 4512 |  | 
|  | 4513 | /** | 
| Jonathan Coe | 2956535 | 2016-04-27 12:48:25 +0000 | [diff] [blame] | 4514 | * \brief Determine if a C++ constructor is a converting constructor. | 
|  | 4515 | */ | 
|  | 4516 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isConvertingConstructor(CXCursor C); | 
|  | 4517 |  | 
|  | 4518 | /** | 
|  | 4519 | * \brief Determine if a C++ constructor is a copy constructor. | 
|  | 4520 | */ | 
|  | 4521 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isCopyConstructor(CXCursor C); | 
|  | 4522 |  | 
|  | 4523 | /** | 
|  | 4524 | * \brief Determine if a C++ constructor is the default constructor. | 
|  | 4525 | */ | 
|  | 4526 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isDefaultConstructor(CXCursor C); | 
|  | 4527 |  | 
|  | 4528 | /** | 
|  | 4529 | * \brief Determine if a C++ constructor is a move constructor. | 
|  | 4530 | */ | 
|  | 4531 | CINDEX_LINKAGE unsigned clang_CXXConstructor_isMoveConstructor(CXCursor C); | 
|  | 4532 |  | 
|  | 4533 | /** | 
| Saleem Abdulrasool | 6ea75db | 2015-10-27 15:50:22 +0000 | [diff] [blame] | 4534 | * \brief Determine if a C++ field is declared 'mutable'. | 
|  | 4535 | */ | 
|  | 4536 | CINDEX_LINKAGE unsigned clang_CXXField_isMutable(CXCursor C); | 
|  | 4537 |  | 
|  | 4538 | /** | 
| Jonathan Coe | 2956535 | 2016-04-27 12:48:25 +0000 | [diff] [blame] | 4539 | * \brief Determine if a C++ method is declared '= default'. | 
|  | 4540 | */ | 
|  | 4541 | CINDEX_LINKAGE unsigned clang_CXXMethod_isDefaulted(CXCursor C); | 
|  | 4542 |  | 
|  | 4543 | /** | 
| Dmitri Gribenko | 62770be | 2013-05-17 18:38:35 +0000 | [diff] [blame] | 4544 | * \brief Determine if a C++ member function or member function template is | 
|  | 4545 | * pure virtual. | 
|  | 4546 | */ | 
|  | 4547 | CINDEX_LINKAGE unsigned clang_CXXMethod_isPureVirtual(CXCursor C); | 
|  | 4548 |  | 
|  | 4549 | /** | 
| Douglas Gregor | f11309e | 2010-08-31 22:12:17 +0000 | [diff] [blame] | 4550 | * \brief Determine if a C++ member function or member function template is | 
|  | 4551 | * declared 'static'. | 
| Ted Kremenek | 9cfe9e6 | 2010-05-17 20:06:56 +0000 | [diff] [blame] | 4552 | */ | 
|  | 4553 | CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C); | 
|  | 4554 |  | 
|  | 4555 | /** | 
| Douglas Gregor | 9519d92 | 2011-05-12 15:17:24 +0000 | [diff] [blame] | 4556 | * \brief Determine if a C++ member function or member function template is | 
|  | 4557 | * explicitly declared 'virtual' or if it overrides a virtual method from | 
|  | 4558 | * one of the base classes. | 
|  | 4559 | */ | 
|  | 4560 | CINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C); | 
|  | 4561 |  | 
|  | 4562 | /** | 
| Alex Lorenz | 34ccadc | 2017-12-14 22:01:50 +0000 | [diff] [blame] | 4563 | * \brief Determine if a C++ record is abstract, i.e. whether a class or struct | 
|  | 4564 | * has a pure virtual member function. | 
|  | 4565 | */ | 
|  | 4566 | CINDEX_LINKAGE unsigned clang_CXXRecord_isAbstract(CXCursor C); | 
|  | 4567 |  | 
|  | 4568 | /** | 
| Alex Lorenz | ff7f42e | 2017-07-12 11:35:11 +0000 | [diff] [blame] | 4569 | * \brief Determine if an enum declaration refers to a scoped enum. | 
|  | 4570 | */ | 
|  | 4571 | CINDEX_LINKAGE unsigned clang_EnumDecl_isScoped(CXCursor C); | 
|  | 4572 |  | 
|  | 4573 | /** | 
| Dmitri Gribenko | e570ede | 2014-04-07 14:59:13 +0000 | [diff] [blame] | 4574 | * \brief Determine if a C++ member function or member function template is | 
|  | 4575 | * declared 'const'. | 
|  | 4576 | */ | 
|  | 4577 | CINDEX_LINKAGE unsigned clang_CXXMethod_isConst(CXCursor C); | 
|  | 4578 |  | 
|  | 4579 | /** | 
| Douglas Gregor | f11309e | 2010-08-31 22:12:17 +0000 | [diff] [blame] | 4580 | * \brief Given a cursor that represents a template, determine | 
|  | 4581 | * the cursor kind of the specializations would be generated by instantiating | 
|  | 4582 | * the template. | 
|  | 4583 | * | 
|  | 4584 | * This routine can be used to determine what flavor of function template, | 
|  | 4585 | * class template, or class template partial specialization is stored in the | 
|  | 4586 | * cursor. For example, it can describe whether a class template cursor is | 
|  | 4587 | * declared with "struct", "class" or "union". | 
|  | 4588 | * | 
|  | 4589 | * \param C The cursor to query. This cursor should represent a template | 
|  | 4590 | * declaration. | 
|  | 4591 | * | 
|  | 4592 | * \returns The cursor kind of the specializations that would be generated | 
|  | 4593 | * by instantiating the template \p C. If \p C is not a template, returns | 
|  | 4594 | * \c CXCursor_NoDeclFound. | 
|  | 4595 | */ | 
|  | 4596 | CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C); | 
|  | 4597 |  | 
|  | 4598 | /** | 
| Douglas Gregor | d3f48bd | 2010-09-02 00:07:54 +0000 | [diff] [blame] | 4599 | * \brief Given a cursor that may represent a specialization or instantiation | 
|  | 4600 | * of a template, retrieve the cursor that represents the template that it | 
|  | 4601 | * specializes or from which it was instantiated. | 
|  | 4602 | * | 
|  | 4603 | * This routine determines the template involved both for explicit | 
|  | 4604 | * specializations of templates and for implicit instantiations of the template, | 
|  | 4605 | * both of which are referred to as "specializations". For a class template | 
|  | 4606 | * specialization (e.g., \c std::vector<bool>), this routine will return | 
|  | 4607 | * either the primary template (\c std::vector) or, if the specialization was | 
|  | 4608 | * instantiated from a class template partial specialization, the class template | 
|  | 4609 | * partial specialization. For a class template partial specialization and a | 
|  | 4610 | * function template specialization (including instantiations), this | 
|  | 4611 | * this routine will return the specialized template. | 
|  | 4612 | * | 
|  | 4613 | * For members of a class template (e.g., member functions, member classes, or | 
|  | 4614 | * static data members), returns the specialized or instantiated member. | 
|  | 4615 | * Although not strictly "templates" in the C++ language, members of class | 
|  | 4616 | * templates have the same notions of specializations and instantiations that | 
|  | 4617 | * templates do, so this routine treats them similarly. | 
|  | 4618 | * | 
|  | 4619 | * \param C A cursor that may be a specialization of a template or a member | 
|  | 4620 | * of a template. | 
|  | 4621 | * | 
|  | 4622 | * \returns If the given cursor is a specialization or instantiation of a | 
|  | 4623 | * template or a member thereof, the template or member that it specializes or | 
|  | 4624 | * from which it was instantiated. Otherwise, returns a NULL cursor. | 
|  | 4625 | */ | 
|  | 4626 | CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C); | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4627 |  | 
|  | 4628 | /** | 
|  | 4629 | * \brief Given a cursor that references something else, return the source range | 
|  | 4630 | * covering that reference. | 
|  | 4631 | * | 
|  | 4632 | * \param C A cursor pointing to a member reference, a declaration reference, or | 
|  | 4633 | * an operator call. | 
|  | 4634 | * \param NameFlags A bitset with three independent flags: | 
|  | 4635 | * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and | 
|  | 4636 | * CXNameRange_WantSinglePiece. | 
|  | 4637 | * \param PieceIndex For contiguous names or when passing the flag | 
|  | 4638 | * CXNameRange_WantSinglePiece, only one piece with index 0 is | 
|  | 4639 | * available. When the CXNameRange_WantSinglePiece flag is not passed for a | 
| Benjamin Kramer | 474261a | 2012-06-02 10:20:41 +0000 | [diff] [blame] | 4640 | * non-contiguous names, this index can be used to retrieve the individual | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4641 | * pieces of the name. See also CXNameRange_WantSinglePiece. | 
|  | 4642 | * | 
|  | 4643 | * \returns The piece of the name pointed to by the given cursor. If there is no | 
|  | 4644 | * name, or if the PieceIndex is out-of-range, a null-cursor will be returned. | 
|  | 4645 | */ | 
| Francois Pichet | ece689f | 2011-07-25 22:00:44 +0000 | [diff] [blame] | 4646 | CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C, | 
|  | 4647 | unsigned NameFlags, | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4648 | unsigned PieceIndex); | 
|  | 4649 |  | 
|  | 4650 | enum CXNameRefFlags { | 
|  | 4651 | /** | 
|  | 4652 | * \brief Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the | 
|  | 4653 | * range. | 
|  | 4654 | */ | 
|  | 4655 | CXNameRange_WantQualifier = 0x1, | 
|  | 4656 |  | 
|  | 4657 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 4658 | * \brief Include the explicit template arguments, e.g. \<int> in x.f<int>, | 
|  | 4659 | * in the range. | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4660 | */ | 
|  | 4661 | CXNameRange_WantTemplateArgs = 0x2, | 
|  | 4662 |  | 
|  | 4663 | /** | 
|  | 4664 | * \brief If the name is non-contiguous, return the full spanning range. | 
|  | 4665 | * | 
|  | 4666 | * Non-contiguous names occur in Objective-C when a selector with two or more | 
|  | 4667 | * parameters is used, or in C++ when using an operator: | 
|  | 4668 | * \code | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 4669 | * [object doSomething:here withValue:there]; // Objective-C | 
| Douglas Gregor | c1679ec | 2011-07-25 17:48:11 +0000 | [diff] [blame] | 4670 | * return some_vector[1]; // C++ | 
|  | 4671 | * \endcode | 
|  | 4672 | */ | 
|  | 4673 | CXNameRange_WantSinglePiece = 0x4 | 
|  | 4674 | }; | 
| Douglas Gregor | d3f48bd | 2010-09-02 00:07:54 +0000 | [diff] [blame] | 4675 |  | 
|  | 4676 | /** | 
| Ted Kremenek | 9cfe9e6 | 2010-05-17 20:06:56 +0000 | [diff] [blame] | 4677 | * @} | 
|  | 4678 | */ | 
|  | 4679 |  | 
|  | 4680 | /** | 
| Douglas Gregor | 6165611 | 2010-01-26 18:31:56 +0000 | [diff] [blame] | 4681 | * \defgroup CINDEX_LEX Token extraction and manipulation | 
|  | 4682 | * | 
|  | 4683 | * The routines in this group provide access to the tokens within a | 
|  | 4684 | * translation unit, along with a semantic mapping of those tokens to | 
|  | 4685 | * their corresponding cursors. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4686 | * | 
|  | 4687 | * @{ | 
|  | 4688 | */ | 
|  | 4689 |  | 
|  | 4690 | /** | 
|  | 4691 | * \brief Describes a kind of token. | 
|  | 4692 | */ | 
|  | 4693 | typedef enum CXTokenKind { | 
|  | 4694 | /** | 
|  | 4695 | * \brief A token that contains some kind of punctuation. | 
|  | 4696 | */ | 
|  | 4697 | CXToken_Punctuation, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4698 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4699 | /** | 
| Douglas Gregor | 6165611 | 2010-01-26 18:31:56 +0000 | [diff] [blame] | 4700 | * \brief A language keyword. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4701 | */ | 
|  | 4702 | CXToken_Keyword, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4703 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4704 | /** | 
|  | 4705 | * \brief An identifier (that is not a keyword). | 
|  | 4706 | */ | 
|  | 4707 | CXToken_Identifier, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4708 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4709 | /** | 
|  | 4710 | * \brief A numeric, string, or character literal. | 
|  | 4711 | */ | 
|  | 4712 | CXToken_Literal, | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4713 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4714 | /** | 
|  | 4715 | * \brief A comment. | 
|  | 4716 | */ | 
|  | 4717 | CXToken_Comment | 
|  | 4718 | } CXTokenKind; | 
|  | 4719 |  | 
|  | 4720 | /** | 
|  | 4721 | * \brief Describes a single preprocessing token. | 
|  | 4722 | */ | 
|  | 4723 | typedef struct { | 
|  | 4724 | unsigned int_data[4]; | 
|  | 4725 | void *ptr_data; | 
|  | 4726 | } CXToken; | 
|  | 4727 |  | 
|  | 4728 | /** | 
|  | 4729 | * \brief Determine the kind of the given token. | 
|  | 4730 | */ | 
|  | 4731 | CINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4732 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4733 | /** | 
|  | 4734 | * \brief Determine the spelling of the given token. | 
|  | 4735 | * | 
|  | 4736 | * The spelling of a token is the textual representation of that token, e.g., | 
|  | 4737 | * the text of an identifier or keyword. | 
|  | 4738 | */ | 
|  | 4739 | CINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4740 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4741 | /** | 
|  | 4742 | * \brief Retrieve the source location of the given token. | 
|  | 4743 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4744 | CINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit, | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4745 | CXToken); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4746 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4747 | /** | 
|  | 4748 | * \brief Retrieve a source range that covers the given token. | 
|  | 4749 | */ | 
|  | 4750 | CINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken); | 
|  | 4751 |  | 
|  | 4752 | /** | 
|  | 4753 | * \brief Tokenize the source code described by the given range into raw | 
|  | 4754 | * lexical tokens. | 
|  | 4755 | * | 
|  | 4756 | * \param TU the translation unit whose text is being tokenized. | 
|  | 4757 | * | 
|  | 4758 | * \param Range the source range in which text should be tokenized. All of the | 
|  | 4759 | * tokens produced by tokenization will fall within this source range, | 
|  | 4760 | * | 
|  | 4761 | * \param Tokens this pointer will be set to point to the array of tokens | 
|  | 4762 | * that occur within the given source range. The returned pointer must be | 
|  | 4763 | * freed with clang_disposeTokens() before the translation unit is destroyed. | 
|  | 4764 | * | 
|  | 4765 | * \param NumTokens will be set to the number of tokens in the \c *Tokens | 
|  | 4766 | * array. | 
|  | 4767 | * | 
|  | 4768 | */ | 
|  | 4769 | CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range, | 
|  | 4770 | CXToken **Tokens, unsigned *NumTokens); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4771 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4772 | /** | 
|  | 4773 | * \brief Annotate the given set of tokens by providing cursors for each token | 
|  | 4774 | * that can be mapped to a specific entity within the abstract syntax tree. | 
|  | 4775 | * | 
| Douglas Gregor | 6165611 | 2010-01-26 18:31:56 +0000 | [diff] [blame] | 4776 | * This token-annotation routine is equivalent to invoking | 
|  | 4777 | * clang_getCursor() for the source locations of each of the | 
|  | 4778 | * tokens. The cursors provided are filtered, so that only those | 
|  | 4779 | * cursors that have a direct correspondence to the token are | 
|  | 4780 | * accepted. For example, given a function call \c f(x), | 
|  | 4781 | * clang_getCursor() would provide the following cursors: | 
|  | 4782 | * | 
|  | 4783 | *   * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'. | 
|  | 4784 | *   * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'. | 
|  | 4785 | *   * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'. | 
|  | 4786 | * | 
|  | 4787 | * Only the first and last of these cursors will occur within the | 
|  | 4788 | * annotate, since the tokens "f" and "x' directly refer to a function | 
|  | 4789 | * and a variable, respectively, but the parentheses are just a small | 
|  | 4790 | * part of the full syntax of the function call expression, which is | 
|  | 4791 | * not provided as an annotation. | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4792 | * | 
|  | 4793 | * \param TU the translation unit that owns the given tokens. | 
|  | 4794 | * | 
|  | 4795 | * \param Tokens the set of tokens to annotate. | 
|  | 4796 | * | 
|  | 4797 | * \param NumTokens the number of tokens in \p Tokens. | 
|  | 4798 | * | 
|  | 4799 | * \param Cursors an array of \p NumTokens cursors, whose contents will be | 
|  | 4800 | * replaced with the cursors corresponding to each token. | 
|  | 4801 | */ | 
|  | 4802 | CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU, | 
|  | 4803 | CXToken *Tokens, unsigned NumTokens, | 
|  | 4804 | CXCursor *Cursors); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4805 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4806 | /** | 
|  | 4807 | * \brief Free the given set of tokens. | 
|  | 4808 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4809 | CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU, | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4810 | CXToken *Tokens, unsigned NumTokens); | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4811 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4812 | /** | 
|  | 4813 | * @} | 
|  | 4814 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 4815 |  | 
| Douglas Gregor | 27b4fa9 | 2010-01-26 17:06:03 +0000 | [diff] [blame] | 4816 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4817 | * \defgroup CINDEX_DEBUG Debugging facilities | 
|  | 4818 | * | 
|  | 4819 | * These routines are used for testing and debugging, only, and should not | 
|  | 4820 | * be relied upon. | 
|  | 4821 | * | 
|  | 4822 | * @{ | 
|  | 4823 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4824 |  | 
| Steve Naroff | 76b8f13 | 2009-09-23 17:52:52 +0000 | [diff] [blame] | 4825 | /* for debug/testing */ | 
| Ted Kremenek | 2900467 | 2010-02-17 00:41:32 +0000 | [diff] [blame] | 4826 | CINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4827 | CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor, | 
|  | 4828 | const char **startBuf, | 
| Steve Naroff | 76b8f13 | 2009-09-23 17:52:52 +0000 | [diff] [blame] | 4829 | const char **endBuf, | 
|  | 4830 | unsigned *startLine, | 
|  | 4831 | unsigned *startColumn, | 
|  | 4832 | unsigned *endLine, | 
|  | 4833 | unsigned *endColumn); | 
| Douglas Gregor | 1e21cc7 | 2010-02-18 23:07:20 +0000 | [diff] [blame] | 4834 | CINDEX_LINKAGE void clang_enableStackTraces(void); | 
| Daniel Dunbar | 2342065 | 2010-11-04 01:26:29 +0000 | [diff] [blame] | 4835 | CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data, | 
|  | 4836 | unsigned stack_size); | 
|  | 4837 |  | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4838 | /** | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4839 | * @} | 
|  | 4840 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4841 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4842 | /** | 
|  | 4843 | * \defgroup CINDEX_CODE_COMPLET Code completion | 
|  | 4844 | * | 
|  | 4845 | * Code completion involves taking an (incomplete) source file, along with | 
|  | 4846 | * knowledge of where the user is actively editing that file, and suggesting | 
|  | 4847 | * syntactically- and semantically-valid constructs that the user might want to | 
|  | 4848 | * use at that particular point in the source code. These data structures and | 
|  | 4849 | * routines provide support for code completion. | 
|  | 4850 | * | 
|  | 4851 | * @{ | 
|  | 4852 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4853 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 4854 | /** | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4855 | * \brief A semantic string that describes a code-completion result. | 
|  | 4856 | * | 
|  | 4857 | * A semantic string that describes the formatting of a code-completion | 
|  | 4858 | * result as a single "template" of text that should be inserted into the | 
|  | 4859 | * source buffer when a particular code-completion result is selected. | 
|  | 4860 | * Each semantic string is made up of some number of "chunks", each of which | 
|  | 4861 | * contains some text along with a description of what that text means, e.g., | 
|  | 4862 | * the name of the entity being referenced, whether the text chunk is part of | 
|  | 4863 | * the template, or whether it is a "placeholder" that the user should replace | 
|  | 4864 | * with actual code,of a specific kind. See \c CXCompletionChunkKind for a | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4865 | * description of the different kinds of chunks. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4866 | */ | 
|  | 4867 | typedef void *CXCompletionString; | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4868 |  | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4869 | /** | 
|  | 4870 | * \brief A single result of code completion. | 
|  | 4871 | */ | 
|  | 4872 | typedef struct { | 
|  | 4873 | /** | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4874 | * \brief The kind of entity that this completion refers to. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4875 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4876 | * 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] | 4877 | * *Decl cursor kinds), describing the entity that the completion is | 
|  | 4878 | * referring to. | 
|  | 4879 | * | 
|  | 4880 | * \todo In the future, we would like to provide a full cursor, to allow | 
|  | 4881 | * the client to extract additional information from declaration. | 
|  | 4882 | */ | 
|  | 4883 | enum CXCursorKind CursorKind; | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4884 |  | 
|  | 4885 | /** | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4886 | * \brief The code-completion string that describes how to insert this | 
|  | 4887 | * code-completion result into the editing buffer. | 
|  | 4888 | */ | 
|  | 4889 | CXCompletionString CompletionString; | 
|  | 4890 | } CXCompletionResult; | 
|  | 4891 |  | 
|  | 4892 | /** | 
|  | 4893 | * \brief Describes a single piece of text within a code-completion string. | 
|  | 4894 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4895 | * Each "chunk" within a code-completion string (\c CXCompletionString) is | 
|  | 4896 | * 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] | 4897 | * should be interpreted by the client or is another completion string. | 
|  | 4898 | */ | 
|  | 4899 | enum CXCompletionChunkKind { | 
|  | 4900 | /** | 
|  | 4901 | * \brief A code-completion string that describes "optional" text that | 
|  | 4902 | * could be a part of the template (but is not required). | 
|  | 4903 | * | 
|  | 4904 | * 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] | 4905 | * string for its representation, which is accessible via | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4906 | * \c clang_getCompletionChunkCompletionString(). The code-completion string | 
|  | 4907 | * describes an additional part of the template that is completely optional. | 
|  | 4908 | * For example, optional chunks can be used to describe the placeholders for | 
|  | 4909 | * arguments that match up with defaulted function parameters, e.g. given: | 
|  | 4910 | * | 
|  | 4911 | * \code | 
|  | 4912 | * void f(int x, float y = 3.14, double z = 2.71828); | 
|  | 4913 | * \endcode | 
|  | 4914 | * | 
|  | 4915 | * The code-completion string for this function would contain: | 
|  | 4916 | *   - a TypedText chunk for "f". | 
|  | 4917 | *   - a LeftParen chunk for "(". | 
|  | 4918 | *   - a Placeholder chunk for "int x" | 
|  | 4919 | *   - an Optional chunk containing the remaining defaulted arguments, e.g., | 
|  | 4920 | *       - a Comma chunk for "," | 
| Daniel Dunbar | 4053fae | 2010-02-17 08:07:44 +0000 | [diff] [blame] | 4921 | *       - a Placeholder chunk for "float y" | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4922 | *       - an Optional chunk containing the last defaulted argument: | 
|  | 4923 | *           - a Comma chunk for "," | 
|  | 4924 | *           - a Placeholder chunk for "double z" | 
|  | 4925 | *   - a RightParen chunk for ")" | 
|  | 4926 | * | 
| Daniel Dunbar | 4053fae | 2010-02-17 08:07:44 +0000 | [diff] [blame] | 4927 | * There are many ways to handle Optional chunks. Two simple approaches are: | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4928 | *   - Completely ignore optional chunks, in which case the template for the | 
|  | 4929 | *     function "f" would only include the first parameter ("int x"). | 
|  | 4930 | *   - Fully expand all optional chunks, in which case the template for the | 
|  | 4931 | *     function "f" would have all of the parameters. | 
|  | 4932 | */ | 
|  | 4933 | CXCompletionChunk_Optional, | 
|  | 4934 | /** | 
|  | 4935 | * \brief Text that a user would be expected to type to get this | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4936 | * code-completion result. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4937 | * | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4938 | * There will be exactly one "typed text" chunk in a semantic string, which | 
|  | 4939 | * 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] | 4940 | * declaration that could be used at the current code point. Clients are | 
|  | 4941 | * expected to filter the code-completion results based on the text in this | 
|  | 4942 | * chunk. | 
|  | 4943 | */ | 
|  | 4944 | CXCompletionChunk_TypedText, | 
|  | 4945 | /** | 
|  | 4946 | * \brief Text that should be inserted as part of a code-completion result. | 
|  | 4947 | * | 
|  | 4948 | * A "text" chunk represents text that is part of the template to be | 
|  | 4949 | * inserted into user code should this particular code-completion result | 
|  | 4950 | * be selected. | 
|  | 4951 | */ | 
|  | 4952 | CXCompletionChunk_Text, | 
|  | 4953 | /** | 
|  | 4954 | * \brief Placeholder text that should be replaced by the user. | 
|  | 4955 | * | 
|  | 4956 | * A "placeholder" chunk marks a place where the user should insert text | 
|  | 4957 | * into the code-completion template. For example, placeholders might mark | 
|  | 4958 | * the function parameters for a function declaration, to indicate that the | 
|  | 4959 | * user should provide arguments for each of those parameters. The actual | 
|  | 4960 | * text in a placeholder is a suggestion for the text to display before | 
|  | 4961 | * the user replaces the placeholder with real code. | 
|  | 4962 | */ | 
|  | 4963 | CXCompletionChunk_Placeholder, | 
|  | 4964 | /** | 
|  | 4965 | * \brief Informative text that should be displayed but never inserted as | 
|  | 4966 | * part of the template. | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4967 | * | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4968 | * An "informative" chunk contains annotations that can be displayed to | 
|  | 4969 | * help the user decide whether a particular code-completion result is the | 
|  | 4970 | * right option, but which is not part of the actual template to be inserted | 
|  | 4971 | * by code completion. | 
|  | 4972 | */ | 
|  | 4973 | CXCompletionChunk_Informative, | 
|  | 4974 | /** | 
|  | 4975 | * \brief Text that describes the current parameter when code-completion is | 
|  | 4976 | * referring to function call, message send, or template specialization. | 
|  | 4977 | * | 
|  | 4978 | * A "current parameter" chunk occurs when code-completion is providing | 
|  | 4979 | * information about a parameter corresponding to the argument at the | 
|  | 4980 | * code-completion point. For example, given a function | 
|  | 4981 | * | 
|  | 4982 | * \code | 
|  | 4983 | * int add(int x, int y); | 
|  | 4984 | * \endcode | 
|  | 4985 | * | 
|  | 4986 | * and the source code \c add(, where the code-completion point is after the | 
|  | 4987 | * "(", the code-completion string will contain a "current parameter" chunk | 
|  | 4988 | * for "int x", indicating that the current argument will initialize that | 
|  | 4989 | * parameter. After typing further, to \c add(17, (where the code-completion | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 4990 | * point is after the ","), the code-completion string will contain a | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 4991 | * "current paremeter" chunk to "int y". | 
|  | 4992 | */ | 
|  | 4993 | CXCompletionChunk_CurrentParameter, | 
|  | 4994 | /** | 
|  | 4995 | * \brief A left parenthesis ('('), used to initiate a function call or | 
|  | 4996 | * signal the beginning of a function parameter list. | 
|  | 4997 | */ | 
|  | 4998 | CXCompletionChunk_LeftParen, | 
|  | 4999 | /** | 
|  | 5000 | * \brief A right parenthesis (')'), used to finish a function call or | 
|  | 5001 | * signal the end of a function parameter list. | 
|  | 5002 | */ | 
|  | 5003 | CXCompletionChunk_RightParen, | 
|  | 5004 | /** | 
|  | 5005 | * \brief A left bracket ('['). | 
|  | 5006 | */ | 
|  | 5007 | CXCompletionChunk_LeftBracket, | 
|  | 5008 | /** | 
|  | 5009 | * \brief A right bracket (']'). | 
|  | 5010 | */ | 
|  | 5011 | CXCompletionChunk_RightBracket, | 
|  | 5012 | /** | 
|  | 5013 | * \brief A left brace ('{'). | 
|  | 5014 | */ | 
|  | 5015 | CXCompletionChunk_LeftBrace, | 
|  | 5016 | /** | 
|  | 5017 | * \brief A right brace ('}'). | 
|  | 5018 | */ | 
|  | 5019 | CXCompletionChunk_RightBrace, | 
|  | 5020 | /** | 
|  | 5021 | * \brief A left angle bracket ('<'). | 
|  | 5022 | */ | 
|  | 5023 | CXCompletionChunk_LeftAngle, | 
|  | 5024 | /** | 
|  | 5025 | * \brief A right angle bracket ('>'). | 
|  | 5026 | */ | 
|  | 5027 | CXCompletionChunk_RightAngle, | 
|  | 5028 | /** | 
|  | 5029 | * \brief A comma separator (','). | 
|  | 5030 | */ | 
| Douglas Gregor | b3fa919 | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 5031 | CXCompletionChunk_Comma, | 
|  | 5032 | /** | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5033 | * \brief Text that specifies the result type of a given result. | 
| Douglas Gregor | b3fa919 | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 5034 | * | 
|  | 5035 | * 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] | 5036 | * 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] | 5037 | * expression using the given completion string would have. | 
|  | 5038 | */ | 
| Douglas Gregor | 504a6ae | 2010-01-10 23:08:15 +0000 | [diff] [blame] | 5039 | CXCompletionChunk_ResultType, | 
|  | 5040 | /** | 
|  | 5041 | * \brief A colon (':'). | 
|  | 5042 | */ | 
|  | 5043 | CXCompletionChunk_Colon, | 
|  | 5044 | /** | 
|  | 5045 | * \brief A semicolon (';'). | 
|  | 5046 | */ | 
|  | 5047 | CXCompletionChunk_SemiColon, | 
|  | 5048 | /** | 
|  | 5049 | * \brief An '=' sign. | 
|  | 5050 | */ | 
|  | 5051 | CXCompletionChunk_Equal, | 
|  | 5052 | /** | 
|  | 5053 | * Horizontal space (' '). | 
|  | 5054 | */ | 
|  | 5055 | CXCompletionChunk_HorizontalSpace, | 
|  | 5056 | /** | 
| Alex Lorenz | 6c2898a | 2017-04-06 14:03:25 +0000 | [diff] [blame] | 5057 | * Vertical space ('\\n'), after which it is generally a good idea to | 
| Douglas Gregor | 504a6ae | 2010-01-10 23:08:15 +0000 | [diff] [blame] | 5058 | * perform indentation. | 
|  | 5059 | */ | 
|  | 5060 | CXCompletionChunk_VerticalSpace | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5061 | }; | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5062 |  | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5063 | /** | 
|  | 5064 | * \brief Determine the kind of a particular chunk within a completion string. | 
|  | 5065 | * | 
|  | 5066 | * \param completion_string the completion string to query. | 
|  | 5067 | * | 
|  | 5068 | * \param chunk_number the 0-based index of the chunk in the completion string. | 
|  | 5069 | * | 
|  | 5070 | * \returns the kind of the chunk at the index \c chunk_number. | 
|  | 5071 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5072 | CINDEX_LINKAGE enum CXCompletionChunkKind | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5073 | clang_getCompletionChunkKind(CXCompletionString completion_string, | 
|  | 5074 | unsigned chunk_number); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5075 |  | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5076 | /** | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5077 | * \brief Retrieve the text associated with a particular chunk within a | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5078 | * completion string. | 
|  | 5079 | * | 
|  | 5080 | * \param completion_string the completion string to query. | 
|  | 5081 | * | 
|  | 5082 | * \param chunk_number the 0-based index of the chunk in the completion string. | 
|  | 5083 | * | 
|  | 5084 | * \returns the text associated with the chunk at index \c chunk_number. | 
|  | 5085 | */ | 
| Ted Kremenek | f602f96 | 2010-02-17 01:42:24 +0000 | [diff] [blame] | 5086 | CINDEX_LINKAGE CXString | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5087 | clang_getCompletionChunkText(CXCompletionString completion_string, | 
|  | 5088 | unsigned chunk_number); | 
|  | 5089 |  | 
|  | 5090 | /** | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5091 | * \brief Retrieve the completion string associated with a particular chunk | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5092 | * within a completion string. | 
|  | 5093 | * | 
|  | 5094 | * \param completion_string the completion string to query. | 
|  | 5095 | * | 
|  | 5096 | * \param chunk_number the 0-based index of the chunk in the completion string. | 
|  | 5097 | * | 
|  | 5098 | * \returns the completion string associated with the chunk at index | 
| Erik Verbruggen | 98ea7f6 | 2011-10-14 15:31:08 +0000 | [diff] [blame] | 5099 | * \c chunk_number. | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5100 | */ | 
|  | 5101 | CINDEX_LINKAGE CXCompletionString | 
|  | 5102 | clang_getCompletionChunkCompletionString(CXCompletionString completion_string, | 
|  | 5103 | unsigned chunk_number); | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5104 |  | 
| Douglas Gregor | 9eb7701 | 2009-11-07 00:00:49 +0000 | [diff] [blame] | 5105 | /** | 
|  | 5106 | * \brief Retrieve the number of chunks in the given code-completion string. | 
|  | 5107 | */ | 
|  | 5108 | CINDEX_LINKAGE unsigned | 
|  | 5109 | clang_getNumCompletionChunks(CXCompletionString completion_string); | 
|  | 5110 |  | 
|  | 5111 | /** | 
| Douglas Gregor | a2db793 | 2010-05-26 22:00:08 +0000 | [diff] [blame] | 5112 | * \brief Determine the priority of this code completion. | 
|  | 5113 | * | 
|  | 5114 | * The priority of a code completion indicates how likely it is that this | 
|  | 5115 | * particular completion is the completion that the user will select. The | 
|  | 5116 | * priority is selected by various internal heuristics. | 
|  | 5117 | * | 
|  | 5118 | * \param completion_string The completion string to query. | 
|  | 5119 | * | 
|  | 5120 | * \returns The priority of this completion string. Smaller values indicate | 
|  | 5121 | * higher-priority (more likely) completions. | 
|  | 5122 | */ | 
|  | 5123 | CINDEX_LINKAGE unsigned | 
|  | 5124 | clang_getCompletionPriority(CXCompletionString completion_string); | 
|  | 5125 |  | 
|  | 5126 | /** | 
| Douglas Gregor | f757a12 | 2010-08-23 23:00:57 +0000 | [diff] [blame] | 5127 | * \brief Determine the availability of the entity that this code-completion | 
|  | 5128 | * string refers to. | 
|  | 5129 | * | 
|  | 5130 | * \param completion_string The completion string to query. | 
|  | 5131 | * | 
|  | 5132 | * \returns The availability of the completion string. | 
|  | 5133 | */ | 
|  | 5134 | CINDEX_LINKAGE enum CXAvailabilityKind | 
|  | 5135 | clang_getCompletionAvailability(CXCompletionString completion_string); | 
|  | 5136 |  | 
|  | 5137 | /** | 
| Erik Verbruggen | 98ea7f6 | 2011-10-14 15:31:08 +0000 | [diff] [blame] | 5138 | * \brief Retrieve the number of annotations associated with the given | 
|  | 5139 | * completion string. | 
|  | 5140 | * | 
|  | 5141 | * \param completion_string the completion string to query. | 
|  | 5142 | * | 
|  | 5143 | * \returns the number of annotations associated with the given completion | 
|  | 5144 | * string. | 
|  | 5145 | */ | 
|  | 5146 | CINDEX_LINKAGE unsigned | 
|  | 5147 | clang_getCompletionNumAnnotations(CXCompletionString completion_string); | 
|  | 5148 |  | 
|  | 5149 | /** | 
|  | 5150 | * \brief Retrieve the annotation associated with the given completion string. | 
|  | 5151 | * | 
|  | 5152 | * \param completion_string the completion string to query. | 
|  | 5153 | * | 
|  | 5154 | * \param annotation_number the 0-based index of the annotation of the | 
|  | 5155 | * completion string. | 
|  | 5156 | * | 
|  | 5157 | * \returns annotation string associated with the completion at index | 
|  | 5158 | * \c annotation_number, or a NULL string if that annotation is not available. | 
|  | 5159 | */ | 
|  | 5160 | CINDEX_LINKAGE CXString | 
|  | 5161 | clang_getCompletionAnnotation(CXCompletionString completion_string, | 
|  | 5162 | unsigned annotation_number); | 
|  | 5163 |  | 
|  | 5164 | /** | 
| Douglas Gregor | 78254c8 | 2012-03-27 23:34:16 +0000 | [diff] [blame] | 5165 | * \brief Retrieve the parent context of the given completion string. | 
|  | 5166 | * | 
|  | 5167 | * The parent context of a completion string is the semantic parent of | 
|  | 5168 | * the declaration (if any) that the code completion represents. For example, | 
|  | 5169 | * a code completion for an Objective-C method would have the method's class | 
|  | 5170 | * or protocol as its context. | 
|  | 5171 | * | 
|  | 5172 | * \param completion_string The code completion string whose parent is | 
|  | 5173 | * being queried. | 
|  | 5174 | * | 
| Argyrios Kyrtzidis | 9ae3956 | 2012-09-26 16:39:56 +0000 | [diff] [blame] | 5175 | * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL. | 
| Douglas Gregor | 78254c8 | 2012-03-27 23:34:16 +0000 | [diff] [blame] | 5176 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5177 | * \returns The name of the completion parent, e.g., "NSObject" if | 
| Douglas Gregor | 78254c8 | 2012-03-27 23:34:16 +0000 | [diff] [blame] | 5178 | * the completion string represents a method in the NSObject class. | 
|  | 5179 | */ | 
|  | 5180 | CINDEX_LINKAGE CXString | 
|  | 5181 | clang_getCompletionParent(CXCompletionString completion_string, | 
|  | 5182 | enum CXCursorKind *kind); | 
| Dmitri Gribenko | 3292d06 | 2012-07-02 17:35:10 +0000 | [diff] [blame] | 5183 |  | 
|  | 5184 | /** | 
|  | 5185 | * \brief Retrieve the brief documentation comment attached to the declaration | 
|  | 5186 | * that corresponds to the given completion string. | 
|  | 5187 | */ | 
|  | 5188 | CINDEX_LINKAGE CXString | 
|  | 5189 | clang_getCompletionBriefComment(CXCompletionString completion_string); | 
|  | 5190 |  | 
| Douglas Gregor | 78254c8 | 2012-03-27 23:34:16 +0000 | [diff] [blame] | 5191 | /** | 
| Douglas Gregor | 3f35bb2 | 2011-08-04 20:04:59 +0000 | [diff] [blame] | 5192 | * \brief Retrieve a completion string for an arbitrary declaration or macro | 
|  | 5193 | * definition cursor. | 
|  | 5194 | * | 
|  | 5195 | * \param cursor The cursor to query. | 
|  | 5196 | * | 
|  | 5197 | * \returns A non-context-sensitive completion string for declaration and macro | 
|  | 5198 | * definition cursors, or NULL for other kinds of cursors. | 
|  | 5199 | */ | 
|  | 5200 | CINDEX_LINKAGE CXCompletionString | 
|  | 5201 | clang_getCursorCompletionString(CXCursor cursor); | 
|  | 5202 |  | 
|  | 5203 | /** | 
| Douglas Gregor | f72b6ac | 2009-12-18 16:20:58 +0000 | [diff] [blame] | 5204 | * \brief Contains the results of code-completion. | 
|  | 5205 | * | 
|  | 5206 | * This data structure contains the results of code completion, as | 
| Douglas Gregor | 6a958028 | 2010-10-11 21:51:20 +0000 | [diff] [blame] | 5207 | * produced by \c clang_codeCompleteAt(). Its contents must be freed by | 
| Douglas Gregor | f72b6ac | 2009-12-18 16:20:58 +0000 | [diff] [blame] | 5208 | * \c clang_disposeCodeCompleteResults. | 
|  | 5209 | */ | 
|  | 5210 | typedef struct { | 
|  | 5211 | /** | 
|  | 5212 | * \brief The code-completion results. | 
|  | 5213 | */ | 
|  | 5214 | CXCompletionResult *Results; | 
|  | 5215 |  | 
|  | 5216 | /** | 
|  | 5217 | * \brief The number of code-completion results stored in the | 
|  | 5218 | * \c Results array. | 
|  | 5219 | */ | 
|  | 5220 | unsigned NumResults; | 
|  | 5221 | } CXCodeCompleteResults; | 
|  | 5222 |  | 
|  | 5223 | /** | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5224 | * \brief Flags that can be passed to \c clang_codeCompleteAt() to | 
|  | 5225 | * modify its behavior. | 
|  | 5226 | * | 
|  | 5227 | * The enumerators in this enumeration can be bitwise-OR'd together to | 
|  | 5228 | * provide multiple options to \c clang_codeCompleteAt(). | 
|  | 5229 | */ | 
|  | 5230 | enum CXCodeComplete_Flags { | 
|  | 5231 | /** | 
|  | 5232 | * \brief Whether to include macros within the set of code | 
|  | 5233 | * completions returned. | 
|  | 5234 | */ | 
|  | 5235 | CXCodeComplete_IncludeMacros = 0x01, | 
|  | 5236 |  | 
|  | 5237 | /** | 
|  | 5238 | * \brief Whether to include code patterns for language constructs | 
|  | 5239 | * within the set of code completions, e.g., for loops. | 
|  | 5240 | */ | 
| Dmitri Gribenko | 3292d06 | 2012-07-02 17:35:10 +0000 | [diff] [blame] | 5241 | CXCodeComplete_IncludeCodePatterns = 0x02, | 
|  | 5242 |  | 
|  | 5243 | /** | 
|  | 5244 | * \brief Whether to include brief documentation within the set of code | 
|  | 5245 | * completions returned. | 
|  | 5246 | */ | 
| Sam McCall | bb2cf63 | 2018-01-12 14:51:47 +0000 | [diff] [blame] | 5247 | CXCodeComplete_IncludeBriefComments = 0x04, | 
|  | 5248 |  | 
|  | 5249 | /** | 
|  | 5250 | * \brief Whether to speed up completion by omitting some entities which are | 
|  | 5251 | * defined in the preamble. There's no guarantee any particular entity will | 
|  | 5252 | * be omitted. This may be useful if the headers are indexed externally. | 
|  | 5253 | */ | 
|  | 5254 | CXCodeComplete_SkipPreamble = 0x08 | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5255 | }; | 
|  | 5256 |  | 
|  | 5257 | /** | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5258 | * \brief Bits that represent the context under which completion is occurring. | 
|  | 5259 | * | 
|  | 5260 | * The enumerators in this enumeration may be bitwise-OR'd together if multiple | 
|  | 5261 | * contexts are occurring simultaneously. | 
|  | 5262 | */ | 
|  | 5263 | enum CXCompletionContext { | 
|  | 5264 | /** | 
|  | 5265 | * \brief The context for completions is unexposed, as only Clang results | 
|  | 5266 | * should be included. (This is equivalent to having no context bits set.) | 
|  | 5267 | */ | 
|  | 5268 | CXCompletionContext_Unexposed = 0, | 
|  | 5269 |  | 
|  | 5270 | /** | 
|  | 5271 | * \brief Completions for any possible type should be included in the results. | 
|  | 5272 | */ | 
|  | 5273 | CXCompletionContext_AnyType = 1 << 0, | 
|  | 5274 |  | 
|  | 5275 | /** | 
|  | 5276 | * \brief Completions for any possible value (variables, function calls, etc.) | 
|  | 5277 | * should be included in the results. | 
|  | 5278 | */ | 
|  | 5279 | CXCompletionContext_AnyValue = 1 << 1, | 
|  | 5280 | /** | 
|  | 5281 | * \brief Completions for values that resolve to an Objective-C object should | 
|  | 5282 | * be included in the results. | 
|  | 5283 | */ | 
|  | 5284 | CXCompletionContext_ObjCObjectValue = 1 << 2, | 
|  | 5285 | /** | 
|  | 5286 | * \brief Completions for values that resolve to an Objective-C selector | 
|  | 5287 | * should be included in the results. | 
|  | 5288 | */ | 
|  | 5289 | CXCompletionContext_ObjCSelectorValue = 1 << 3, | 
|  | 5290 | /** | 
|  | 5291 | * \brief Completions for values that resolve to a C++ class type should be | 
|  | 5292 | * included in the results. | 
|  | 5293 | */ | 
|  | 5294 | CXCompletionContext_CXXClassTypeValue = 1 << 4, | 
|  | 5295 |  | 
|  | 5296 | /** | 
|  | 5297 | * \brief Completions for fields of the member being accessed using the dot | 
|  | 5298 | * operator should be included in the results. | 
|  | 5299 | */ | 
|  | 5300 | CXCompletionContext_DotMemberAccess = 1 << 5, | 
|  | 5301 | /** | 
|  | 5302 | * \brief Completions for fields of the member being accessed using the arrow | 
|  | 5303 | * operator should be included in the results. | 
|  | 5304 | */ | 
|  | 5305 | CXCompletionContext_ArrowMemberAccess = 1 << 6, | 
|  | 5306 | /** | 
|  | 5307 | * \brief Completions for properties of the Objective-C object being accessed | 
|  | 5308 | * using the dot operator should be included in the results. | 
|  | 5309 | */ | 
|  | 5310 | CXCompletionContext_ObjCPropertyAccess = 1 << 7, | 
|  | 5311 |  | 
|  | 5312 | /** | 
|  | 5313 | * \brief Completions for enum tags should be included in the results. | 
|  | 5314 | */ | 
|  | 5315 | CXCompletionContext_EnumTag = 1 << 8, | 
|  | 5316 | /** | 
|  | 5317 | * \brief Completions for union tags should be included in the results. | 
|  | 5318 | */ | 
|  | 5319 | CXCompletionContext_UnionTag = 1 << 9, | 
|  | 5320 | /** | 
|  | 5321 | * \brief Completions for struct tags should be included in the results. | 
|  | 5322 | */ | 
|  | 5323 | CXCompletionContext_StructTag = 1 << 10, | 
|  | 5324 |  | 
|  | 5325 | /** | 
|  | 5326 | * \brief Completions for C++ class names should be included in the results. | 
|  | 5327 | */ | 
|  | 5328 | CXCompletionContext_ClassTag = 1 << 11, | 
|  | 5329 | /** | 
|  | 5330 | * \brief Completions for C++ namespaces and namespace aliases should be | 
|  | 5331 | * included in the results. | 
|  | 5332 | */ | 
|  | 5333 | CXCompletionContext_Namespace = 1 << 12, | 
|  | 5334 | /** | 
|  | 5335 | * \brief Completions for C++ nested name specifiers should be included in | 
|  | 5336 | * the results. | 
|  | 5337 | */ | 
|  | 5338 | CXCompletionContext_NestedNameSpecifier = 1 << 13, | 
|  | 5339 |  | 
|  | 5340 | /** | 
|  | 5341 | * \brief Completions for Objective-C interfaces (classes) should be included | 
|  | 5342 | * in the results. | 
|  | 5343 | */ | 
|  | 5344 | CXCompletionContext_ObjCInterface = 1 << 14, | 
|  | 5345 | /** | 
|  | 5346 | * \brief Completions for Objective-C protocols should be included in | 
|  | 5347 | * the results. | 
|  | 5348 | */ | 
|  | 5349 | CXCompletionContext_ObjCProtocol = 1 << 15, | 
|  | 5350 | /** | 
|  | 5351 | * \brief Completions for Objective-C categories should be included in | 
|  | 5352 | * the results. | 
|  | 5353 | */ | 
|  | 5354 | CXCompletionContext_ObjCCategory = 1 << 16, | 
|  | 5355 | /** | 
|  | 5356 | * \brief Completions for Objective-C instance messages should be included | 
|  | 5357 | * in the results. | 
|  | 5358 | */ | 
|  | 5359 | CXCompletionContext_ObjCInstanceMessage = 1 << 17, | 
|  | 5360 | /** | 
|  | 5361 | * \brief Completions for Objective-C class messages should be included in | 
|  | 5362 | * the results. | 
|  | 5363 | */ | 
|  | 5364 | CXCompletionContext_ObjCClassMessage = 1 << 18, | 
|  | 5365 | /** | 
|  | 5366 | * \brief Completions for Objective-C selector names should be included in | 
|  | 5367 | * the results. | 
|  | 5368 | */ | 
|  | 5369 | CXCompletionContext_ObjCSelectorName = 1 << 19, | 
|  | 5370 |  | 
|  | 5371 | /** | 
|  | 5372 | * \brief Completions for preprocessor macro names should be included in | 
|  | 5373 | * the results. | 
|  | 5374 | */ | 
|  | 5375 | CXCompletionContext_MacroName = 1 << 20, | 
|  | 5376 |  | 
|  | 5377 | /** | 
|  | 5378 | * \brief Natural language completions should be included in the results. | 
|  | 5379 | */ | 
|  | 5380 | CXCompletionContext_NaturalLanguage = 1 << 21, | 
|  | 5381 |  | 
|  | 5382 | /** | 
|  | 5383 | * \brief The current context is unknown, so set all contexts. | 
|  | 5384 | */ | 
|  | 5385 | CXCompletionContext_Unknown = ((1 << 22) - 1) | 
|  | 5386 | }; | 
|  | 5387 |  | 
|  | 5388 | /** | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5389 | * \brief Returns a default set of code-completion options that can be | 
|  | 5390 | * passed to\c clang_codeCompleteAt(). | 
|  | 5391 | */ | 
|  | 5392 | CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void); | 
|  | 5393 |  | 
|  | 5394 | /** | 
| Douglas Gregor | 8e984da | 2010-08-04 16:47:14 +0000 | [diff] [blame] | 5395 | * \brief Perform code completion at a given location in a translation unit. | 
|  | 5396 | * | 
|  | 5397 | * This function performs code completion at a particular file, line, and | 
|  | 5398 | * column within source code, providing results that suggest potential | 
|  | 5399 | * code snippets based on the context of the completion. The basic model | 
|  | 5400 | * for code completion is that Clang will parse a complete source file, | 
|  | 5401 | * performing syntax checking up to the location where code-completion has | 
|  | 5402 | * been requested. At that point, a special code-completion token is passed | 
|  | 5403 | * to the parser, which recognizes this token and determines, based on the | 
|  | 5404 | * current location in the C/Objective-C/C++ grammar and the state of | 
|  | 5405 | * semantic analysis, what completions to provide. These completions are | 
|  | 5406 | * returned via a new \c CXCodeCompleteResults structure. | 
|  | 5407 | * | 
|  | 5408 | * Code completion itself is meant to be triggered by the client when the | 
|  | 5409 | * user types punctuation characters or whitespace, at which point the | 
|  | 5410 | * code-completion location will coincide with the cursor. For example, if \c p | 
|  | 5411 | * is a pointer, code-completion might be triggered after the "-" and then | 
|  | 5412 | * after the ">" in \c p->. When the code-completion location is afer the ">", | 
|  | 5413 | * the completion results will provide, e.g., the members of the struct that | 
|  | 5414 | * "p" points to. The client is responsible for placing the cursor at the | 
|  | 5415 | * beginning of the token currently being typed, then filtering the results | 
|  | 5416 | * based on the contents of the token. For example, when code-completing for | 
|  | 5417 | * the expression \c p->get, the client should provide the location just after | 
|  | 5418 | * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the | 
|  | 5419 | * client can filter the results based on the current token text ("get"), only | 
|  | 5420 | * showing those results that start with "get". The intent of this interface | 
|  | 5421 | * is to separate the relatively high-latency acquisition of code-completion | 
|  | 5422 | * results from the filtering of results on a per-character basis, which must | 
|  | 5423 | * have a lower latency. | 
|  | 5424 | * | 
|  | 5425 | * \param TU The translation unit in which code-completion should | 
|  | 5426 | * occur. The source files for this translation unit need not be | 
|  | 5427 | * completely up-to-date (and the contents of those source files may | 
|  | 5428 | * be overridden via \p unsaved_files). Cursors referring into the | 
|  | 5429 | * translation unit may be invalidated by this invocation. | 
|  | 5430 | * | 
|  | 5431 | * \param complete_filename The name of the source file where code | 
|  | 5432 | * completion should be performed. This filename may be any file | 
|  | 5433 | * included in the translation unit. | 
|  | 5434 | * | 
|  | 5435 | * \param complete_line The line at which code-completion should occur. | 
|  | 5436 | * | 
|  | 5437 | * \param complete_column The column at which code-completion should occur. | 
|  | 5438 | * Note that the column should point just after the syntactic construct that | 
|  | 5439 | * initiated code completion, and not in the middle of a lexical token. | 
|  | 5440 | * | 
| Vedant Kumar | cbfe7bb | 2016-03-23 23:51:36 +0000 | [diff] [blame] | 5441 | * \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] | 5442 | * but may be required for parsing or code completion, including the | 
|  | 5443 | * contents of those files.  The contents and name of these files (as | 
|  | 5444 | * specified by CXUnsavedFile) are copied when necessary, so the | 
|  | 5445 | * client only needs to guarantee their validity until the call to | 
|  | 5446 | * this function returns. | 
|  | 5447 | * | 
|  | 5448 | * \param num_unsaved_files The number of unsaved file entries in \p | 
|  | 5449 | * unsaved_files. | 
|  | 5450 | * | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5451 | * \param options Extra options that control the behavior of code | 
|  | 5452 | * completion, expressed as a bitwise OR of the enumerators of the | 
|  | 5453 | * CXCodeComplete_Flags enumeration. The | 
|  | 5454 | * \c clang_defaultCodeCompleteOptions() function returns a default set | 
|  | 5455 | * of code-completion options. | 
|  | 5456 | * | 
| Douglas Gregor | 8e984da | 2010-08-04 16:47:14 +0000 | [diff] [blame] | 5457 | * \returns If successful, a new \c CXCodeCompleteResults structure | 
|  | 5458 | * containing code-completion results, which should eventually be | 
|  | 5459 | * freed with \c clang_disposeCodeCompleteResults(). If code | 
|  | 5460 | * completion fails, returns NULL. | 
|  | 5461 | */ | 
|  | 5462 | CINDEX_LINKAGE | 
|  | 5463 | CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU, | 
|  | 5464 | const char *complete_filename, | 
|  | 5465 | unsigned complete_line, | 
|  | 5466 | unsigned complete_column, | 
|  | 5467 | struct CXUnsavedFile *unsaved_files, | 
| Douglas Gregor | b68bc59 | 2010-08-05 09:09:23 +0000 | [diff] [blame] | 5468 | unsigned num_unsaved_files, | 
|  | 5469 | unsigned options); | 
| Douglas Gregor | 8e984da | 2010-08-04 16:47:14 +0000 | [diff] [blame] | 5470 |  | 
|  | 5471 | /** | 
| Douglas Gregor | 49f67ce | 2010-08-26 13:48:20 +0000 | [diff] [blame] | 5472 | * \brief Sort the code-completion results in case-insensitive alphabetical | 
|  | 5473 | * order. | 
|  | 5474 | * | 
|  | 5475 | * \param Results The set of results to sort. | 
|  | 5476 | * \param NumResults The number of results in \p Results. | 
|  | 5477 | */ | 
|  | 5478 | CINDEX_LINKAGE | 
|  | 5479 | void clang_sortCodeCompletionResults(CXCompletionResult *Results, | 
|  | 5480 | unsigned NumResults); | 
|  | 5481 |  | 
|  | 5482 | /** | 
| Douglas Gregor | f72b6ac | 2009-12-18 16:20:58 +0000 | [diff] [blame] | 5483 | * \brief Free the given set of code-completion results. | 
|  | 5484 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5485 | CINDEX_LINKAGE | 
| Douglas Gregor | f72b6ac | 2009-12-18 16:20:58 +0000 | [diff] [blame] | 5486 | void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results); | 
| Douglas Gregor | f757a12 | 2010-08-23 23:00:57 +0000 | [diff] [blame] | 5487 |  | 
| Douglas Gregor | 52606ff | 2010-01-20 01:10:47 +0000 | [diff] [blame] | 5488 | /** | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 5489 | * \brief Determine the number of diagnostics produced prior to the | 
|  | 5490 | * location where code completion was performed. | 
|  | 5491 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 5492 | CINDEX_LINKAGE | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 5493 | unsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results); | 
|  | 5494 |  | 
|  | 5495 | /** | 
|  | 5496 | * \brief Retrieve a diagnostic associated with the given code completion. | 
|  | 5497 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5498 | * \param Results the code completion results to query. | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 5499 | * \param Index the zero-based diagnostic number to retrieve. | 
|  | 5500 | * | 
|  | 5501 | * \returns the requested diagnostic. This diagnostic must be freed | 
|  | 5502 | * via a call to \c clang_disposeDiagnostic(). | 
|  | 5503 | */ | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 5504 | CINDEX_LINKAGE | 
| Douglas Gregor | 33cdd81 | 2010-02-18 18:08:43 +0000 | [diff] [blame] | 5505 | CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results, | 
|  | 5506 | unsigned Index); | 
|  | 5507 |  | 
|  | 5508 | /** | 
| Nico Weber | dd9c19f | 2014-04-24 03:06:18 +0000 | [diff] [blame] | 5509 | * \brief Determines what completions are appropriate for the context | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5510 | * the given code completion. | 
|  | 5511 | * | 
|  | 5512 | * \param Results the code completion results to query | 
|  | 5513 | * | 
|  | 5514 | * \returns the kinds of completions that are appropriate for use | 
|  | 5515 | * along with the given code completion results. | 
|  | 5516 | */ | 
|  | 5517 | CINDEX_LINKAGE | 
|  | 5518 | unsigned long long clang_codeCompleteGetContexts( | 
|  | 5519 | CXCodeCompleteResults *Results); | 
| Douglas Gregor | 63745d5 | 2011-07-21 01:05:26 +0000 | [diff] [blame] | 5520 |  | 
|  | 5521 | /** | 
|  | 5522 | * \brief Returns the cursor kind for the container for the current code | 
|  | 5523 | * completion context. The container is only guaranteed to be set for | 
|  | 5524 | * contexts where a container exists (i.e. member accesses or Objective-C | 
|  | 5525 | * message sends); if there is not a container, this function will return | 
|  | 5526 | * CXCursor_InvalidCode. | 
|  | 5527 | * | 
|  | 5528 | * \param Results the code completion results to query | 
|  | 5529 | * | 
|  | 5530 | * \param IsIncomplete on return, this value will be false if Clang has complete | 
|  | 5531 | * information about the container. If Clang does not have complete | 
|  | 5532 | * information, this value will be true. | 
|  | 5533 | * | 
|  | 5534 | * \returns the container kind, or CXCursor_InvalidCode if there is not a | 
|  | 5535 | * container | 
|  | 5536 | */ | 
|  | 5537 | CINDEX_LINKAGE | 
|  | 5538 | enum CXCursorKind clang_codeCompleteGetContainerKind( | 
|  | 5539 | CXCodeCompleteResults *Results, | 
|  | 5540 | unsigned *IsIncomplete); | 
|  | 5541 |  | 
|  | 5542 | /** | 
|  | 5543 | * \brief Returns the USR for the container for the current code completion | 
|  | 5544 | * context. If there is not a container for the current context, this | 
|  | 5545 | * function will return the empty string. | 
|  | 5546 | * | 
|  | 5547 | * \param Results the code completion results to query | 
|  | 5548 | * | 
|  | 5549 | * \returns the USR for the container | 
|  | 5550 | */ | 
|  | 5551 | CINDEX_LINKAGE | 
|  | 5552 | CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results); | 
| NAKAMURA Takumi | aa13f94 | 2015-12-09 07:52:46 +0000 | [diff] [blame] | 5553 |  | 
| Douglas Gregor | ea77740 | 2011-07-26 15:24:30 +0000 | [diff] [blame] | 5554 | /** | 
|  | 5555 | * \brief Returns the currently-entered selector for an Objective-C message | 
|  | 5556 | * send, formatted like "initWithFoo:bar:". Only guaranteed to return a | 
|  | 5557 | * non-empty string for CXCompletionContext_ObjCInstanceMessage and | 
|  | 5558 | * CXCompletionContext_ObjCClassMessage. | 
|  | 5559 | * | 
|  | 5560 | * \param Results the code completion results to query | 
|  | 5561 | * | 
|  | 5562 | * \returns the selector (or partial selector) that has been entered thus far | 
|  | 5563 | * for an Objective-C message send. | 
|  | 5564 | */ | 
|  | 5565 | CINDEX_LINKAGE | 
|  | 5566 | CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results); | 
|  | 5567 |  | 
| Douglas Gregor | 2132584 | 2011-07-07 16:03:39 +0000 | [diff] [blame] | 5568 | /** | 
| Douglas Gregor | 52606ff | 2010-01-20 01:10:47 +0000 | [diff] [blame] | 5569 | * @} | 
|  | 5570 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5571 |  | 
| Ted Kremenek | c0f3f72 | 2010-01-22 22:44:15 +0000 | [diff] [blame] | 5572 | /** | 
|  | 5573 | * \defgroup CINDEX_MISC Miscellaneous utility functions | 
|  | 5574 | * | 
|  | 5575 | * @{ | 
|  | 5576 | */ | 
| Ted Kremenek | 3e315a2 | 2010-01-23 17:51:23 +0000 | [diff] [blame] | 5577 |  | 
|  | 5578 | /** | 
|  | 5579 | * \brief Return a version string, suitable for showing to a user, but not | 
|  | 5580 | *        intended to be parsed (the format is not guaranteed to be stable). | 
|  | 5581 | */ | 
| NAKAMURA Takumi | eacd667 | 2013-01-10 02:12:38 +0000 | [diff] [blame] | 5582 | CINDEX_LINKAGE CXString clang_getClangVersion(void); | 
| Ted Kremenek | c0f3f72 | 2010-01-22 22:44:15 +0000 | [diff] [blame] | 5583 |  | 
| Ted Kremenek | 1ec7b33 | 2011-03-18 23:05:39 +0000 | [diff] [blame] | 5584 | /** | 
|  | 5585 | * \brief Enable/disable crash recovery. | 
|  | 5586 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5587 | * \param isEnabled Flag to indicate if crash recovery is enabled.  A non-zero | 
|  | 5588 | *        value enables crash recovery, while 0 disables it. | 
| Ted Kremenek | 1ec7b33 | 2011-03-18 23:05:39 +0000 | [diff] [blame] | 5589 | */ | 
|  | 5590 | CINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled); | 
|  | 5591 |  | 
| Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 5592 | /** | 
| Ted Kremenek | d071c60 | 2010-03-13 02:50:34 +0000 | [diff] [blame] | 5593 | * \brief Visitor invoked for each file in a translation unit | 
| Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 5594 | *        (used with clang_getInclusions()). | 
|  | 5595 | * | 
|  | 5596 | * This visitor function will be invoked by clang_getInclusions() for each | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5597 | * file included (either at the top-level or by \#include directives) within | 
| Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 5598 | * a translation unit.  The first argument is the file being included, and | 
|  | 5599 | * the second and third arguments provide the inclusion stack.  The | 
|  | 5600 | * array is sorted in order of immediate inclusion.  For example, | 
|  | 5601 | * the first element refers to the location that included 'included_file'. | 
|  | 5602 | */ | 
|  | 5603 | typedef void (*CXInclusionVisitor)(CXFile included_file, | 
|  | 5604 | CXSourceLocation* inclusion_stack, | 
|  | 5605 | unsigned include_len, | 
|  | 5606 | CXClientData client_data); | 
|  | 5607 |  | 
|  | 5608 | /** | 
|  | 5609 | * \brief Visit the set of preprocessor inclusions in a translation unit. | 
|  | 5610 | *   The visitor function is called with the provided data for every included | 
|  | 5611 | *   file.  This does not include headers included by the PCH file (unless one | 
|  | 5612 | *   is inspecting the inclusions in the PCH file itself). | 
|  | 5613 | */ | 
|  | 5614 | CINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu, | 
|  | 5615 | CXInclusionVisitor visitor, | 
|  | 5616 | CXClientData client_data); | 
|  | 5617 |  | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5618 | typedef enum { | 
|  | 5619 | CXEval_Int = 1 , | 
|  | 5620 | CXEval_Float = 2, | 
|  | 5621 | CXEval_ObjCStrLiteral = 3, | 
|  | 5622 | CXEval_StrLiteral = 4, | 
|  | 5623 | CXEval_CFStr = 5, | 
|  | 5624 | CXEval_Other = 6, | 
|  | 5625 |  | 
|  | 5626 | CXEval_UnExposed = 0 | 
|  | 5627 |  | 
|  | 5628 | } CXEvalResultKind ; | 
|  | 5629 |  | 
|  | 5630 | /** | 
|  | 5631 | * \brief Evaluation result of a cursor | 
|  | 5632 | */ | 
|  | 5633 | typedef void * CXEvalResult; | 
|  | 5634 |  | 
|  | 5635 | /** | 
|  | 5636 | * \brief If cursor is a statement declaration tries to evaluate the | 
|  | 5637 | * statement and if its variable, tries to evaluate its initializer, | 
|  | 5638 | * into its corresponding type. | 
|  | 5639 | */ | 
|  | 5640 | CINDEX_LINKAGE CXEvalResult clang_Cursor_Evaluate(CXCursor C); | 
|  | 5641 |  | 
|  | 5642 | /** | 
|  | 5643 | * \brief Returns the kind of the evaluated result. | 
|  | 5644 | */ | 
| Argyrios Kyrtzidis | a851d7e | 2016-01-16 03:01:20 +0000 | [diff] [blame] | 5645 | CINDEX_LINKAGE CXEvalResultKind clang_EvalResult_getKind(CXEvalResult E); | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5646 |  | 
|  | 5647 | /** | 
|  | 5648 | * \brief Returns the evaluation result as integer if the | 
|  | 5649 | * kind is Int. | 
|  | 5650 | */ | 
| Argyrios Kyrtzidis | a851d7e | 2016-01-16 03:01:20 +0000 | [diff] [blame] | 5651 | CINDEX_LINKAGE int clang_EvalResult_getAsInt(CXEvalResult E); | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5652 |  | 
|  | 5653 | /** | 
| Argyrios Kyrtzidis | 5dda112 | 2016-12-01 23:41:27 +0000 | [diff] [blame] | 5654 | * \brief Returns the evaluation result as a long long integer if the | 
|  | 5655 | * kind is Int. This prevents overflows that may happen if the result is | 
|  | 5656 | * returned with clang_EvalResult_getAsInt. | 
|  | 5657 | */ | 
|  | 5658 | CINDEX_LINKAGE long long clang_EvalResult_getAsLongLong(CXEvalResult E); | 
|  | 5659 |  | 
|  | 5660 | /** | 
|  | 5661 | * \brief Returns a non-zero value if the kind is Int and the evaluation | 
|  | 5662 | * result resulted in an unsigned integer. | 
|  | 5663 | */ | 
|  | 5664 | CINDEX_LINKAGE unsigned clang_EvalResult_isUnsignedInt(CXEvalResult E); | 
|  | 5665 |  | 
|  | 5666 | /** | 
|  | 5667 | * \brief Returns the evaluation result as an unsigned integer if | 
|  | 5668 | * the kind is Int and clang_EvalResult_isUnsignedInt is non-zero. | 
|  | 5669 | */ | 
|  | 5670 | CINDEX_LINKAGE unsigned long long clang_EvalResult_getAsUnsigned(CXEvalResult E); | 
|  | 5671 |  | 
|  | 5672 | /** | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5673 | * \brief Returns the evaluation result as double if the | 
|  | 5674 | * kind is double. | 
|  | 5675 | */ | 
| Argyrios Kyrtzidis | a851d7e | 2016-01-16 03:01:20 +0000 | [diff] [blame] | 5676 | CINDEX_LINKAGE double clang_EvalResult_getAsDouble(CXEvalResult E); | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5677 |  | 
|  | 5678 | /** | 
|  | 5679 | * \brief Returns the evaluation result as a constant string if the | 
|  | 5680 | * kind is other than Int or float. User must not free this pointer, | 
|  | 5681 | * instead call clang_EvalResult_dispose on the CXEvalResult returned | 
|  | 5682 | * by clang_Cursor_Evaluate. | 
|  | 5683 | */ | 
| Argyrios Kyrtzidis | a851d7e | 2016-01-16 03:01:20 +0000 | [diff] [blame] | 5684 | CINDEX_LINKAGE const char* clang_EvalResult_getAsStr(CXEvalResult E); | 
| Argyrios Kyrtzidis | 785705b | 2016-01-16 00:20:02 +0000 | [diff] [blame] | 5685 |  | 
|  | 5686 | /** | 
|  | 5687 | * \brief Disposes the created Eval memory. | 
|  | 5688 | */ | 
| Argyrios Kyrtzidis | a851d7e | 2016-01-16 03:01:20 +0000 | [diff] [blame] | 5689 | CINDEX_LINKAGE void clang_EvalResult_dispose(CXEvalResult E); | 
| Ted Kremenek | 0b86e3a | 2010-01-26 19:31:51 +0000 | [diff] [blame] | 5690 | /** | 
| Ted Kremenek | c0f3f72 | 2010-01-22 22:44:15 +0000 | [diff] [blame] | 5691 | * @} | 
|  | 5692 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 5693 |  | 
| Argyrios Kyrtzidis | f89cc69 | 2011-07-11 20:15:00 +0000 | [diff] [blame] | 5694 | /** \defgroup CINDEX_REMAPPING Remapping functions | 
|  | 5695 | * | 
|  | 5696 | * @{ | 
|  | 5697 | */ | 
|  | 5698 |  | 
|  | 5699 | /** | 
|  | 5700 | * \brief A remapping of original source files and their translated files. | 
|  | 5701 | */ | 
|  | 5702 | typedef void *CXRemapping; | 
|  | 5703 |  | 
|  | 5704 | /** | 
|  | 5705 | * \brief Retrieve a remapping. | 
|  | 5706 | * | 
|  | 5707 | * \param path the path that contains metadata about remappings. | 
|  | 5708 | * | 
|  | 5709 | * \returns the requested remapping. This remapping must be freed | 
|  | 5710 | * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. | 
|  | 5711 | */ | 
|  | 5712 | CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path); | 
|  | 5713 |  | 
|  | 5714 | /** | 
| Ted Kremenek | f7639e1 | 2012-03-06 20:06:33 +0000 | [diff] [blame] | 5715 | * \brief Retrieve a remapping. | 
|  | 5716 | * | 
|  | 5717 | * \param filePaths pointer to an array of file paths containing remapping info. | 
|  | 5718 | * | 
|  | 5719 | * \param numFiles number of file paths. | 
|  | 5720 | * | 
|  | 5721 | * \returns the requested remapping. This remapping must be freed | 
|  | 5722 | * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. | 
|  | 5723 | */ | 
|  | 5724 | CINDEX_LINKAGE | 
|  | 5725 | CXRemapping clang_getRemappingsFromFileList(const char **filePaths, | 
|  | 5726 | unsigned numFiles); | 
|  | 5727 |  | 
|  | 5728 | /** | 
| Argyrios Kyrtzidis | f89cc69 | 2011-07-11 20:15:00 +0000 | [diff] [blame] | 5729 | * \brief Determine the number of remappings. | 
|  | 5730 | */ | 
|  | 5731 | CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping); | 
|  | 5732 |  | 
|  | 5733 | /** | 
|  | 5734 | * \brief Get the original and the associated filename from the remapping. | 
|  | 5735 | * | 
|  | 5736 | * \param original If non-NULL, will be set to the original filename. | 
|  | 5737 | * | 
|  | 5738 | * \param transformed If non-NULL, will be set to the filename that the original | 
|  | 5739 | * is associated with. | 
|  | 5740 | */ | 
|  | 5741 | CINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index, | 
|  | 5742 | CXString *original, CXString *transformed); | 
|  | 5743 |  | 
|  | 5744 | /** | 
|  | 5745 | * \brief Dispose the remapping. | 
|  | 5746 | */ | 
|  | 5747 | CINDEX_LINKAGE void clang_remap_dispose(CXRemapping); | 
|  | 5748 |  | 
|  | 5749 | /** | 
|  | 5750 | * @} | 
|  | 5751 | */ | 
|  | 5752 |  | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5753 | /** \defgroup CINDEX_HIGH Higher level API functions | 
|  | 5754 | * | 
|  | 5755 | * @{ | 
|  | 5756 | */ | 
|  | 5757 |  | 
|  | 5758 | enum CXVisitorResult { | 
|  | 5759 | CXVisit_Break, | 
|  | 5760 | CXVisit_Continue | 
|  | 5761 | }; | 
|  | 5762 |  | 
| Saleem Abdulrasool | ec988b7 | 2016-05-24 01:23:24 +0000 | [diff] [blame] | 5763 | typedef struct CXCursorAndRangeVisitor { | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5764 | void *context; | 
|  | 5765 | enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange); | 
|  | 5766 | } CXCursorAndRangeVisitor; | 
|  | 5767 |  | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5768 | typedef enum { | 
|  | 5769 | /** | 
|  | 5770 | * \brief Function returned successfully. | 
|  | 5771 | */ | 
|  | 5772 | CXResult_Success = 0, | 
|  | 5773 | /** | 
|  | 5774 | * \brief One of the parameters was invalid for the function. | 
|  | 5775 | */ | 
|  | 5776 | CXResult_Invalid = 1, | 
|  | 5777 | /** | 
|  | 5778 | * \brief The function was terminated by a callback (e.g. it returned | 
|  | 5779 | * CXVisit_Break) | 
|  | 5780 | */ | 
|  | 5781 | CXResult_VisitBreak = 2 | 
|  | 5782 |  | 
|  | 5783 | } CXResult; | 
|  | 5784 |  | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5785 | /** | 
|  | 5786 | * \brief Find references of a declaration in a specific file. | 
|  | 5787 | * | 
|  | 5788 | * \param cursor pointing to a declaration or a reference of one. | 
|  | 5789 | * | 
|  | 5790 | * \param file to search for references. | 
|  | 5791 | * | 
|  | 5792 | * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for | 
|  | 5793 | * each reference found. | 
|  | 5794 | * The CXSourceRange will point inside the file; if the reference is inside | 
|  | 5795 | * a macro (and not a macro argument) the CXSourceRange will be invalid. | 
| Argyrios Kyrtzidis | 951f61f | 2013-03-08 20:42:33 +0000 | [diff] [blame] | 5796 | * | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5797 | * \returns one of the CXResult enumerators. | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5798 | */ | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5799 | CINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file, | 
|  | 5800 | CXCursorAndRangeVisitor visitor); | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5801 |  | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5802 | /** | 
|  | 5803 | * \brief Find #import/#include directives in a specific file. | 
|  | 5804 | * | 
|  | 5805 | * \param TU translation unit containing the file to query. | 
|  | 5806 | * | 
|  | 5807 | * \param file to search for #import/#include directives. | 
|  | 5808 | * | 
|  | 5809 | * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for | 
|  | 5810 | * each directive found. | 
| Argyrios Kyrtzidis | 951f61f | 2013-03-08 20:42:33 +0000 | [diff] [blame] | 5811 | * | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5812 | * \returns one of the CXResult enumerators. | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5813 | */ | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5814 | CINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU, | 
|  | 5815 | CXFile file, | 
|  | 5816 | CXCursorAndRangeVisitor visitor); | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5817 |  | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5818 | #ifdef __has_feature | 
|  | 5819 | #  if __has_feature(blocks) | 
|  | 5820 |  | 
|  | 5821 | typedef enum CXVisitorResult | 
|  | 5822 | (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange); | 
|  | 5823 |  | 
|  | 5824 | CINDEX_LINKAGE | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5825 | CXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile, | 
|  | 5826 | CXCursorAndRangeVisitorBlock); | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5827 |  | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5828 | CINDEX_LINKAGE | 
| Argyrios Kyrtzidis | 51c3318 | 2013-03-08 22:47:41 +0000 | [diff] [blame] | 5829 | CXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile, | 
|  | 5830 | CXCursorAndRangeVisitorBlock); | 
| Argyrios Kyrtzidis | 503c83a | 2013-03-08 02:32:34 +0000 | [diff] [blame] | 5831 |  | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 5832 | #  endif | 
|  | 5833 | #endif | 
|  | 5834 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5835 | /** | 
|  | 5836 | * \brief The client's data object that is associated with a CXFile. | 
|  | 5837 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5838 | typedef void *CXIdxClientFile; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5839 |  | 
|  | 5840 | /** | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 5841 | * \brief The client's data object that is associated with a semantic entity. | 
|  | 5842 | */ | 
|  | 5843 | typedef void *CXIdxClientEntity; | 
|  | 5844 |  | 
|  | 5845 | /** | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5846 | * \brief The client's data object that is associated with a semantic container | 
|  | 5847 | * of entities. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5848 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5849 | typedef void *CXIdxClientContainer; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5850 |  | 
|  | 5851 | /** | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5852 | * \brief The client's data object that is associated with an AST file (PCH | 
|  | 5853 | * or module). | 
|  | 5854 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5855 | typedef void *CXIdxClientASTFile; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5856 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5857 | /** | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5858 | * \brief Source location passed to index callbacks. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5859 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5860 | typedef struct { | 
|  | 5861 | void *ptr_data[2]; | 
|  | 5862 | unsigned int_data; | 
|  | 5863 | } CXIdxLoc; | 
|  | 5864 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5865 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5866 | * \brief Data for ppIncludedFile callback. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5867 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5868 | typedef struct { | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5869 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5870 | * \brief Location of '#' in the \#include/\#import directive. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5871 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5872 | CXIdxLoc hashLoc; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5873 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5874 | * \brief Filename as written in the \#include/\#import directive. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5875 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5876 | const char *filename; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5877 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5878 | * \brief The actual file that the \#include/\#import directive resolved to. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5879 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5880 | CXFile file; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5881 | int isImport; | 
|  | 5882 | int isAngled; | 
| Argyrios Kyrtzidis | 5e2ec48 | 2012-10-18 00:17:05 +0000 | [diff] [blame] | 5883 | /** | 
|  | 5884 | * \brief Non-zero if the directive was automatically turned into a module | 
|  | 5885 | * import. | 
|  | 5886 | */ | 
|  | 5887 | int isModuleImport; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5888 | } CXIdxIncludedFileInfo; | 
|  | 5889 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5890 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 5891 | * \brief Data for IndexerCallbacks#importedASTFile. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5892 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5893 | typedef struct { | 
| Argyrios Kyrtzidis | 472eda0 | 2012-10-02 16:10:38 +0000 | [diff] [blame] | 5894 | /** | 
|  | 5895 | * \brief Top level AST file containing the imported PCH, module or submodule. | 
|  | 5896 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5897 | CXFile file; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5898 | /** | 
| Argyrios Kyrtzidis | dc78f3e | 2012-10-05 00:22:40 +0000 | [diff] [blame] | 5899 | * \brief The imported module or NULL if the AST file is a PCH. | 
|  | 5900 | */ | 
|  | 5901 | CXModule module; | 
|  | 5902 | /** | 
| Argyrios Kyrtzidis | 472eda0 | 2012-10-02 16:10:38 +0000 | [diff] [blame] | 5903 | * \brief Location where the file is imported. Applicable only for modules. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5904 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5905 | CXIdxLoc loc; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 5906 | /** | 
| Argyrios Kyrtzidis | 472eda0 | 2012-10-02 16:10:38 +0000 | [diff] [blame] | 5907 | * \brief Non-zero if an inclusion directive was automatically turned into | 
| Argyrios Kyrtzidis | dc78f3e | 2012-10-05 00:22:40 +0000 | [diff] [blame] | 5908 | * a module import. Applicable only for modules. | 
| Argyrios Kyrtzidis | 472eda0 | 2012-10-02 16:10:38 +0000 | [diff] [blame] | 5909 | */ | 
| Argyrios Kyrtzidis | 184b144 | 2012-10-03 21:05:44 +0000 | [diff] [blame] | 5910 | int isImplicit; | 
| Argyrios Kyrtzidis | 472eda0 | 2012-10-02 16:10:38 +0000 | [diff] [blame] | 5911 |  | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 5912 | } CXIdxImportedASTFileInfo; | 
|  | 5913 |  | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5914 | typedef enum { | 
|  | 5915 | CXIdxEntity_Unexposed     = 0, | 
|  | 5916 | CXIdxEntity_Typedef       = 1, | 
|  | 5917 | CXIdxEntity_Function      = 2, | 
|  | 5918 | CXIdxEntity_Variable      = 3, | 
|  | 5919 | CXIdxEntity_Field         = 4, | 
|  | 5920 | CXIdxEntity_EnumConstant  = 5, | 
|  | 5921 |  | 
|  | 5922 | CXIdxEntity_ObjCClass     = 6, | 
|  | 5923 | CXIdxEntity_ObjCProtocol  = 7, | 
|  | 5924 | CXIdxEntity_ObjCCategory  = 8, | 
|  | 5925 |  | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 5926 | CXIdxEntity_ObjCInstanceMethod = 9, | 
|  | 5927 | CXIdxEntity_ObjCClassMethod    = 10, | 
|  | 5928 | CXIdxEntity_ObjCProperty  = 11, | 
|  | 5929 | CXIdxEntity_ObjCIvar      = 12, | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 5930 |  | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 5931 | CXIdxEntity_Enum          = 13, | 
|  | 5932 | CXIdxEntity_Struct        = 14, | 
|  | 5933 | CXIdxEntity_Union         = 15, | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 5934 |  | 
|  | 5935 | CXIdxEntity_CXXClass              = 16, | 
|  | 5936 | CXIdxEntity_CXXNamespace          = 17, | 
|  | 5937 | CXIdxEntity_CXXNamespaceAlias     = 18, | 
|  | 5938 | CXIdxEntity_CXXStaticVariable     = 19, | 
|  | 5939 | CXIdxEntity_CXXStaticMethod       = 20, | 
|  | 5940 | CXIdxEntity_CXXInstanceMethod     = 21, | 
| Joao Matos | e9a3ed4 | 2012-08-31 22:18:20 +0000 | [diff] [blame] | 5941 | CXIdxEntity_CXXConstructor        = 22, | 
|  | 5942 | CXIdxEntity_CXXDestructor         = 23, | 
|  | 5943 | CXIdxEntity_CXXConversionFunction = 24, | 
|  | 5944 | CXIdxEntity_CXXTypeAlias          = 25, | 
|  | 5945 | CXIdxEntity_CXXInterface          = 26 | 
|  | 5946 |  | 
|  | 5947 | } CXIdxEntityKind; | 
|  | 5948 |  | 
| Argyrios Kyrtzidis | 5200288 | 2011-12-07 20:44:12 +0000 | [diff] [blame] | 5949 | typedef enum { | 
|  | 5950 | CXIdxEntityLang_None = 0, | 
|  | 5951 | CXIdxEntityLang_C    = 1, | 
|  | 5952 | CXIdxEntityLang_ObjC = 2, | 
| Argyrios Kyrtzidis | b4b85f2 | 2017-04-24 14:52:00 +0000 | [diff] [blame] | 5953 | CXIdxEntityLang_CXX  = 3, | 
|  | 5954 | CXIdxEntityLang_Swift  = 4 | 
| Argyrios Kyrtzidis | 5200288 | 2011-12-07 20:44:12 +0000 | [diff] [blame] | 5955 | } CXIdxEntityLanguage; | 
|  | 5956 |  | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 5957 | /** | 
|  | 5958 | * \brief Extra C++ template information for an entity. This can apply to: | 
|  | 5959 | * CXIdxEntity_Function | 
|  | 5960 | * CXIdxEntity_CXXClass | 
|  | 5961 | * CXIdxEntity_CXXStaticMethod | 
|  | 5962 | * CXIdxEntity_CXXInstanceMethod | 
|  | 5963 | * CXIdxEntity_CXXConstructor | 
|  | 5964 | * CXIdxEntity_CXXConversionFunction | 
|  | 5965 | * CXIdxEntity_CXXTypeAlias | 
|  | 5966 | */ | 
|  | 5967 | typedef enum { | 
|  | 5968 | CXIdxEntity_NonTemplate   = 0, | 
|  | 5969 | CXIdxEntity_Template      = 1, | 
|  | 5970 | CXIdxEntity_TemplatePartialSpecialization = 2, | 
|  | 5971 | CXIdxEntity_TemplateSpecialization = 3 | 
|  | 5972 | } CXIdxEntityCXXTemplateKind; | 
|  | 5973 |  | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 5974 | typedef enum { | 
|  | 5975 | CXIdxAttr_Unexposed     = 0, | 
|  | 5976 | CXIdxAttr_IBAction      = 1, | 
|  | 5977 | CXIdxAttr_IBOutlet      = 2, | 
|  | 5978 | CXIdxAttr_IBOutletCollection = 3 | 
|  | 5979 | } CXIdxAttrKind; | 
|  | 5980 |  | 
|  | 5981 | typedef struct { | 
|  | 5982 | CXIdxAttrKind kind; | 
|  | 5983 | CXCursor cursor; | 
|  | 5984 | CXIdxLoc loc; | 
|  | 5985 | } CXIdxAttrInfo; | 
|  | 5986 |  | 
|  | 5987 | typedef struct { | 
| Argyrios Kyrtzidis | 4d873b7 | 2011-12-15 00:05:00 +0000 | [diff] [blame] | 5988 | CXIdxEntityKind kind; | 
|  | 5989 | CXIdxEntityCXXTemplateKind templateKind; | 
|  | 5990 | CXIdxEntityLanguage lang; | 
|  | 5991 | const char *name; | 
|  | 5992 | const char *USR; | 
|  | 5993 | CXCursor cursor; | 
|  | 5994 | const CXIdxAttrInfo *const *attributes; | 
|  | 5995 | unsigned numAttributes; | 
|  | 5996 | } CXIdxEntityInfo; | 
|  | 5997 |  | 
|  | 5998 | typedef struct { | 
|  | 5999 | CXCursor cursor; | 
|  | 6000 | } CXIdxContainerInfo; | 
|  | 6001 |  | 
|  | 6002 | typedef struct { | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6003 | const CXIdxAttrInfo *attrInfo; | 
|  | 6004 | const CXIdxEntityInfo *objcClass; | 
|  | 6005 | CXCursor classCursor; | 
|  | 6006 | CXIdxLoc classLoc; | 
|  | 6007 | } CXIdxIBOutletCollectionAttrInfo; | 
|  | 6008 |  | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6009 | typedef enum { | 
|  | 6010 | CXIdxDeclFlag_Skipped = 0x1 | 
|  | 6011 | } CXIdxDeclInfoFlags; | 
|  | 6012 |  | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6013 | typedef struct { | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6014 | const CXIdxEntityInfo *entityInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6015 | CXCursor cursor; | 
|  | 6016 | CXIdxLoc loc; | 
| Argyrios Kyrtzidis | 663c8ec | 2011-12-07 20:44:19 +0000 | [diff] [blame] | 6017 | const CXIdxContainerInfo *semanticContainer; | 
|  | 6018 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6019 | * \brief Generally same as #semanticContainer but can be different in | 
| Argyrios Kyrtzidis | 663c8ec | 2011-12-07 20:44:19 +0000 | [diff] [blame] | 6020 | * cases like out-of-line C++ member functions. | 
|  | 6021 | */ | 
|  | 6022 | const CXIdxContainerInfo *lexicalContainer; | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6023 | int isRedeclaration; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6024 | int isDefinition; | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6025 | int isContainer; | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6026 | const CXIdxContainerInfo *declAsContainer; | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6027 | /** | 
|  | 6028 | * \brief Whether the declaration exists in code or was created implicitly | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 6029 | * by the compiler, e.g. implicit Objective-C methods for properties. | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6030 | */ | 
|  | 6031 | int isImplicit; | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6032 | const CXIdxAttrInfo *const *attributes; | 
|  | 6033 | unsigned numAttributes; | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6034 |  | 
|  | 6035 | unsigned flags; | 
|  | 6036 |  | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6037 | } CXIdxDeclInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6038 |  | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6039 | typedef enum { | 
|  | 6040 | CXIdxObjCContainer_ForwardRef = 0, | 
|  | 6041 | CXIdxObjCContainer_Interface = 1, | 
|  | 6042 | CXIdxObjCContainer_Implementation = 2 | 
|  | 6043 | } CXIdxObjCContainerKind; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6044 |  | 
|  | 6045 | typedef struct { | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6046 | const CXIdxDeclInfo *declInfo; | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6047 | CXIdxObjCContainerKind kind; | 
|  | 6048 | } CXIdxObjCContainerDeclInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6049 |  | 
|  | 6050 | typedef struct { | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6051 | const CXIdxEntityInfo *base; | 
|  | 6052 | CXCursor cursor; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6053 | CXIdxLoc loc; | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6054 | } CXIdxBaseClassInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6055 |  | 
|  | 6056 | typedef struct { | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6057 | const CXIdxEntityInfo *protocol; | 
|  | 6058 | CXCursor cursor; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6059 | CXIdxLoc loc; | 
|  | 6060 | } CXIdxObjCProtocolRefInfo; | 
|  | 6061 |  | 
|  | 6062 | typedef struct { | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6063 | const CXIdxObjCProtocolRefInfo *const *protocols; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6064 | unsigned numProtocols; | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6065 | } CXIdxObjCProtocolRefListInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6066 |  | 
|  | 6067 | typedef struct { | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6068 | const CXIdxObjCContainerDeclInfo *containerInfo; | 
|  | 6069 | const CXIdxBaseClassInfo *superInfo; | 
|  | 6070 | const CXIdxObjCProtocolRefListInfo *protocols; | 
|  | 6071 | } CXIdxObjCInterfaceDeclInfo; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6072 |  | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6073 | typedef struct { | 
| Argyrios Kyrtzidis | 9b9f7a9 | 2011-12-13 18:47:45 +0000 | [diff] [blame] | 6074 | const CXIdxObjCContainerDeclInfo *containerInfo; | 
|  | 6075 | const CXIdxEntityInfo *objcClass; | 
|  | 6076 | CXCursor classCursor; | 
|  | 6077 | CXIdxLoc classLoc; | 
|  | 6078 | const CXIdxObjCProtocolRefListInfo *protocols; | 
|  | 6079 | } CXIdxObjCCategoryDeclInfo; | 
|  | 6080 |  | 
|  | 6081 | typedef struct { | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6082 | const CXIdxDeclInfo *declInfo; | 
| Argyrios Kyrtzidis | 93db292 | 2012-02-28 17:50:33 +0000 | [diff] [blame] | 6083 | const CXIdxEntityInfo *getter; | 
|  | 6084 | const CXIdxEntityInfo *setter; | 
|  | 6085 | } CXIdxObjCPropertyDeclInfo; | 
|  | 6086 |  | 
|  | 6087 | typedef struct { | 
|  | 6088 | const CXIdxDeclInfo *declInfo; | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6089 | const CXIdxBaseClassInfo *const *bases; | 
|  | 6090 | unsigned numBases; | 
|  | 6091 | } CXIdxCXXClassDeclInfo; | 
|  | 6092 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6093 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6094 | * \brief Data for IndexerCallbacks#indexEntityReference. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6095 | */ | 
| Argyrios Kyrtzidis | 0c7735e5 | 2011-10-18 15:50:50 +0000 | [diff] [blame] | 6096 | typedef enum { | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6097 | /** | 
|  | 6098 | * \brief The entity is referenced directly in user's code. | 
|  | 6099 | */ | 
| Argyrios Kyrtzidis | 0c7735e5 | 2011-10-18 15:50:50 +0000 | [diff] [blame] | 6100 | CXIdxEntityRef_Direct = 1, | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6101 | /** | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 6102 | * \brief An implicit reference, e.g. a reference of an Objective-C method | 
|  | 6103 | * via the dot syntax. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6104 | */ | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6105 | CXIdxEntityRef_Implicit = 2 | 
| Argyrios Kyrtzidis | 0c7735e5 | 2011-10-18 15:50:50 +0000 | [diff] [blame] | 6106 | } CXIdxEntityRefKind; | 
|  | 6107 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6108 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6109 | * \brief Data for IndexerCallbacks#indexEntityReference. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6110 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6111 | typedef struct { | 
| Argyrios Kyrtzidis | 663c8ec | 2011-12-07 20:44:19 +0000 | [diff] [blame] | 6112 | CXIdxEntityRefKind kind; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6113 | /** | 
|  | 6114 | * \brief Reference cursor. | 
|  | 6115 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6116 | CXCursor cursor; | 
|  | 6117 | CXIdxLoc loc; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6118 | /** | 
|  | 6119 | * \brief The entity that gets referenced. | 
|  | 6120 | */ | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6121 | const CXIdxEntityInfo *referencedEntity; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6122 | /** | 
|  | 6123 | * \brief Immediate "parent" of the reference. For example: | 
|  | 6124 | * | 
|  | 6125 | * \code | 
|  | 6126 | * Foo *var; | 
|  | 6127 | * \endcode | 
|  | 6128 | * | 
|  | 6129 | * The parent of reference of type 'Foo' is the variable 'var'. | 
| Argyrios Kyrtzidis | 25cb0ff | 2011-12-13 18:47:41 +0000 | [diff] [blame] | 6130 | * For references inside statement bodies of functions/methods, | 
|  | 6131 | * the parentEntity will be the function/method. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6132 | */ | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6133 | const CXIdxEntityInfo *parentEntity; | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6134 | /** | 
| Argyrios Kyrtzidis | 25cb0ff | 2011-12-13 18:47:41 +0000 | [diff] [blame] | 6135 | * \brief Lexical container context of the reference. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6136 | */ | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6137 | const CXIdxContainerInfo *container; | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6138 | } CXIdxEntityRefInfo; | 
|  | 6139 |  | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6140 | /** | 
|  | 6141 | * \brief A group of callbacks used by #clang_indexSourceFile and | 
|  | 6142 | * #clang_indexTranslationUnit. | 
|  | 6143 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6144 | typedef struct { | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6145 | /** | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6146 | * \brief Called periodically to check whether indexing should be aborted. | 
|  | 6147 | * Should return 0 to continue, and non-zero to abort. | 
|  | 6148 | */ | 
|  | 6149 | int (*abortQuery)(CXClientData client_data, void *reserved); | 
|  | 6150 |  | 
|  | 6151 | /** | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6152 | * \brief Called at the end of indexing; passes the complete diagnostic set. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6153 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6154 | void (*diagnostic)(CXClientData client_data, | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6155 | CXDiagnosticSet, void *reserved); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6156 |  | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6157 | CXIdxClientFile (*enteredMainFile)(CXClientData client_data, | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6158 | CXFile mainFile, void *reserved); | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6159 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6160 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6161 | * \brief Called when a file gets \#included/\#imported. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6162 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6163 | CXIdxClientFile (*ppIncludedFile)(CXClientData client_data, | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6164 | const CXIdxIncludedFileInfo *); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6165 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6166 | /** | 
|  | 6167 | * \brief Called when a AST file (PCH or module) gets imported. | 
|  | 6168 | * | 
|  | 6169 | * AST files will not get indexed (there will not be callbacks to index all | 
|  | 6170 | * 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] | 6171 | * file is not already indexed, to initiate a new indexing job specific to | 
|  | 6172 | * the AST file. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6173 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6174 | CXIdxClientASTFile (*importedASTFile)(CXClientData client_data, | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6175 | const CXIdxImportedASTFileInfo *); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6176 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6177 | /** | 
|  | 6178 | * \brief Called at the beginning of indexing a translation unit. | 
|  | 6179 | */ | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6180 | CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data, | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6181 | void *reserved); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6182 |  | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6183 | void (*indexDeclaration)(CXClientData client_data, | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6184 | const CXIdxDeclInfo *); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6185 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6186 | /** | 
|  | 6187 | * \brief Called to index a reference of an entity. | 
|  | 6188 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6189 | void (*indexEntityReference)(CXClientData client_data, | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6190 | const CXIdxEntityRefInfo *); | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6191 |  | 
|  | 6192 | } IndexerCallbacks; | 
|  | 6193 |  | 
| NAKAMURA Takumi | aacef7e | 2011-11-11 02:51:09 +0000 | [diff] [blame] | 6194 | CINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind); | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6195 | CINDEX_LINKAGE const CXIdxObjCContainerDeclInfo * | 
|  | 6196 | clang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *); | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6197 |  | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6198 | CINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo * | 
|  | 6199 | clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *); | 
|  | 6200 |  | 
| NAKAMURA Takumi | aacef7e | 2011-11-11 02:51:09 +0000 | [diff] [blame] | 6201 | CINDEX_LINKAGE | 
| Argyrios Kyrtzidis | 3e429e7 | 2011-11-12 02:16:30 +0000 | [diff] [blame] | 6202 | const CXIdxObjCCategoryDeclInfo * | 
|  | 6203 | clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *); | 
|  | 6204 |  | 
| Argyrios Kyrtzidis | 86acd72 | 2011-11-14 22:39:19 +0000 | [diff] [blame] | 6205 | CINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo * | 
|  | 6206 | clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *); | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6207 |  | 
| Argyrios Kyrtzidis | 93db292 | 2012-02-28 17:50:33 +0000 | [diff] [blame] | 6208 | CINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo * | 
|  | 6209 | clang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *); | 
|  | 6210 |  | 
| Argyrios Kyrtzidis | effdbf5 | 2011-11-18 00:26:51 +0000 | [diff] [blame] | 6211 | CINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo * | 
|  | 6212 | clang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *); | 
|  | 6213 |  | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6214 | CINDEX_LINKAGE const CXIdxCXXClassDeclInfo * | 
|  | 6215 | clang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *); | 
|  | 6216 |  | 
|  | 6217 | /** | 
|  | 6218 | * \brief For retrieving a custom CXIdxClientContainer attached to a | 
|  | 6219 | * container. | 
|  | 6220 | */ | 
|  | 6221 | CINDEX_LINKAGE CXIdxClientContainer | 
|  | 6222 | clang_index_getClientContainer(const CXIdxContainerInfo *); | 
|  | 6223 |  | 
|  | 6224 | /** | 
|  | 6225 | * \brief For setting a custom CXIdxClientContainer attached to a | 
|  | 6226 | * container. | 
|  | 6227 | */ | 
|  | 6228 | CINDEX_LINKAGE void | 
|  | 6229 | clang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer); | 
|  | 6230 |  | 
|  | 6231 | /** | 
|  | 6232 | * \brief For retrieving a custom CXIdxClientEntity attached to an entity. | 
|  | 6233 | */ | 
|  | 6234 | CINDEX_LINKAGE CXIdxClientEntity | 
|  | 6235 | clang_index_getClientEntity(const CXIdxEntityInfo *); | 
|  | 6236 |  | 
|  | 6237 | /** | 
|  | 6238 | * \brief For setting a custom CXIdxClientEntity attached to an entity. | 
|  | 6239 | */ | 
|  | 6240 | CINDEX_LINKAGE void | 
|  | 6241 | clang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity); | 
|  | 6242 |  | 
|  | 6243 | /** | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6244 | * \brief An indexing action/session, to be applied to one or multiple | 
|  | 6245 | * translation units. | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6246 | */ | 
|  | 6247 | typedef void *CXIndexAction; | 
|  | 6248 |  | 
|  | 6249 | /** | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6250 | * \brief An indexing action/session, to be applied to one or multiple | 
|  | 6251 | * translation units. | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6252 | * | 
|  | 6253 | * \param CIdx The index object with which the index action will be associated. | 
|  | 6254 | */ | 
|  | 6255 | CINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx); | 
|  | 6256 |  | 
|  | 6257 | /** | 
|  | 6258 | * \brief Destroy the given index action. | 
|  | 6259 | * | 
|  | 6260 | * The index action must not be destroyed until all of the translation units | 
|  | 6261 | * created within that index action have been destroyed. | 
|  | 6262 | */ | 
|  | 6263 | CINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction); | 
|  | 6264 |  | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6265 | typedef enum { | 
|  | 6266 | /** | 
|  | 6267 | * \brief Used to indicate that no special indexing options are needed. | 
|  | 6268 | */ | 
|  | 6269 | CXIndexOpt_None = 0x0, | 
|  | 6270 |  | 
|  | 6271 | /** | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6272 | * \brief Used to indicate that IndexerCallbacks#indexEntityReference should | 
|  | 6273 | * be invoked for only one reference of an entity per source file that does | 
|  | 6274 | * not also include a declaration/definition of the entity. | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6275 | */ | 
| Argyrios Kyrtzidis | fb7d145 | 2012-01-14 00:11:49 +0000 | [diff] [blame] | 6276 | CXIndexOpt_SuppressRedundantRefs = 0x1, | 
|  | 6277 |  | 
|  | 6278 | /** | 
|  | 6279 | * \brief Function-local symbols should be indexed. If this is not set | 
|  | 6280 | * function-local symbols will be ignored. | 
|  | 6281 | */ | 
| Argyrios Kyrtzidis | 7e74795 | 2012-02-14 22:23:11 +0000 | [diff] [blame] | 6282 | CXIndexOpt_IndexFunctionLocalSymbols = 0x2, | 
|  | 6283 |  | 
|  | 6284 | /** | 
|  | 6285 | * \brief Implicit function/class template instantiations should be indexed. | 
|  | 6286 | * If this is not set, implicit instantiations will be ignored. | 
|  | 6287 | */ | 
| Argyrios Kyrtzidis | 6c9ed7d | 2012-03-27 21:38:03 +0000 | [diff] [blame] | 6288 | CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4, | 
|  | 6289 |  | 
|  | 6290 | /** | 
|  | 6291 | * \brief Suppress all compiler warnings when parsing for indexing. | 
|  | 6292 | */ | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6293 | CXIndexOpt_SuppressWarnings = 0x8, | 
|  | 6294 |  | 
|  | 6295 | /** | 
|  | 6296 | * \brief Skip a function/method body that was already parsed during an | 
| Nico Weber | 7deebef | 2014-04-24 03:17:47 +0000 | [diff] [blame] | 6297 | * indexing session associated with a \c CXIndexAction object. | 
| Argyrios Kyrtzidis | 8b71bc7 | 2012-12-06 19:41:16 +0000 | [diff] [blame] | 6298 | * Bodies in system headers are always skipped. | 
|  | 6299 | */ | 
|  | 6300 | CXIndexOpt_SkipParsedBodiesInSession = 0x10 | 
|  | 6301 |  | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6302 | } CXIndexOptFlags; | 
|  | 6303 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6304 | /** | 
|  | 6305 | * \brief Index the given source file and the translation unit corresponding | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6306 | * to that file via callbacks implemented through #IndexerCallbacks. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6307 | * | 
|  | 6308 | * \param client_data pointer data supplied by the client, which will | 
|  | 6309 | * be passed to the invoked callbacks. | 
|  | 6310 | * | 
|  | 6311 | * \param index_callbacks Pointer to indexing callbacks that the client | 
|  | 6312 | * implements. | 
|  | 6313 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6314 | * \param index_callbacks_size Size of #IndexerCallbacks structure that gets | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6315 | * passed in index_callbacks. | 
|  | 6316 | * | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6317 | * \param index_options A bitmask of options that affects how indexing is | 
|  | 6318 | * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6319 | * | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 6320 | * \param[out] out_TU pointer to store a \c CXTranslationUnit that can be | 
|  | 6321 | * 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] | 6322 | * | 
| Dmitri Gribenko | ea4d1c3 | 2014-02-12 19:12:37 +0000 | [diff] [blame] | 6323 | * \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] | 6324 | * 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] | 6325 | * a non-zero \c CXErrorCode. | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6326 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6327 | * The rest of the parameters are the same as #clang_parseTranslationUnit. | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6328 | */ | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6329 | CINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction, | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6330 | CXClientData client_data, | 
|  | 6331 | IndexerCallbacks *index_callbacks, | 
|  | 6332 | unsigned index_callbacks_size, | 
|  | 6333 | unsigned index_options, | 
|  | 6334 | const char *source_filename, | 
|  | 6335 | const char * const *command_line_args, | 
|  | 6336 | int num_command_line_args, | 
|  | 6337 | struct CXUnsavedFile *unsaved_files, | 
|  | 6338 | unsigned num_unsaved_files, | 
|  | 6339 | CXTranslationUnit *out_TU, | 
|  | 6340 | unsigned TU_options); | 
|  | 6341 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6342 | /** | 
| Benjamin Kramer | c02670e | 2015-11-18 16:14:27 +0000 | [diff] [blame] | 6343 | * \brief Same as clang_indexSourceFile but requires a full command line | 
|  | 6344 | * for \c command_line_args including argv[0]. This is useful if the standard | 
|  | 6345 | * library paths are relative to the binary. | 
|  | 6346 | */ | 
|  | 6347 | CINDEX_LINKAGE int clang_indexSourceFileFullArgv( | 
|  | 6348 | CXIndexAction, CXClientData client_data, IndexerCallbacks *index_callbacks, | 
|  | 6349 | unsigned index_callbacks_size, unsigned index_options, | 
|  | 6350 | const char *source_filename, const char *const *command_line_args, | 
|  | 6351 | int num_command_line_args, struct CXUnsavedFile *unsaved_files, | 
|  | 6352 | unsigned num_unsaved_files, CXTranslationUnit *out_TU, unsigned TU_options); | 
|  | 6353 |  | 
|  | 6354 | /** | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6355 | * \brief Index the given translation unit via callbacks implemented through | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6356 | * #IndexerCallbacks. | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6357 | * | 
|  | 6358 | * The order of callback invocations is not guaranteed to be the same as | 
|  | 6359 | * when indexing a source file. The high level order will be: | 
|  | 6360 | * | 
|  | 6361 | *   -Preprocessor callbacks invocations | 
|  | 6362 | *   -Declaration/reference callbacks invocations | 
|  | 6363 | *   -Diagnostic callback invocations | 
|  | 6364 | * | 
| James Dennett | 574cb4c | 2012-06-15 05:41:51 +0000 | [diff] [blame] | 6365 | * The parameters are the same as #clang_indexSourceFile. | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6366 | * | 
| Eric Christopher | 2c4555a | 2015-06-19 01:52:53 +0000 | [diff] [blame] | 6367 | * \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] | 6368 | * non-zero, otherwise returns 0. | 
|  | 6369 | */ | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6370 | CINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction, | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6371 | CXClientData client_data, | 
|  | 6372 | IndexerCallbacks *index_callbacks, | 
|  | 6373 | unsigned index_callbacks_size, | 
| Argyrios Kyrtzidis | 4c910b1 | 2011-11-22 07:24:51 +0000 | [diff] [blame] | 6374 | unsigned index_options, | 
|  | 6375 | CXTranslationUnit); | 
| Argyrios Kyrtzidis | d992e14 | 2011-11-15 06:20:16 +0000 | [diff] [blame] | 6376 |  | 
|  | 6377 | /** | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6378 | * \brief Retrieve the CXIdxFile, file, line, column, and offset represented by | 
|  | 6379 | * the given CXIdxLoc. | 
|  | 6380 | * | 
|  | 6381 | * If the location refers into a macro expansion, retrieves the | 
|  | 6382 | * location of the macro expansion and if it refers into a macro argument | 
|  | 6383 | * retrieves the location of the argument. | 
|  | 6384 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6385 | CINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc, | 
| Argyrios Kyrtzidis | 7519c5e | 2011-11-11 00:23:36 +0000 | [diff] [blame] | 6386 | CXIdxClientFile *indexFile, | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6387 | CXFile *file, | 
|  | 6388 | unsigned *line, | 
|  | 6389 | unsigned *column, | 
|  | 6390 | unsigned *offset); | 
|  | 6391 |  | 
| Argyrios Kyrtzidis | 11d6114 | 2011-10-27 17:36:12 +0000 | [diff] [blame] | 6392 | /** | 
|  | 6393 | * \brief Retrieve the CXSourceLocation represented by the given CXIdxLoc. | 
|  | 6394 | */ | 
| Argyrios Kyrtzidis | dc199a3 | 2011-10-17 19:48:19 +0000 | [diff] [blame] | 6395 | CINDEX_LINKAGE | 
|  | 6396 | CXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc); | 
|  | 6397 |  | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 6398 | /** | 
| Argyrios Kyrtzidis | 2bff516 | 2015-04-13 16:55:04 +0000 | [diff] [blame] | 6399 | * \brief Visitor invoked for each field found by a traversal. | 
|  | 6400 | * | 
|  | 6401 | * This visitor function will be invoked for each field found by | 
|  | 6402 | * \c clang_Type_visitFields. Its first argument is the cursor being | 
|  | 6403 | * visited, its second argument is the client data provided to | 
|  | 6404 | * \c clang_Type_visitFields. | 
|  | 6405 | * | 
|  | 6406 | * The visitor should return one of the \c CXVisitorResult values | 
|  | 6407 | * to direct \c clang_Type_visitFields. | 
|  | 6408 | */ | 
|  | 6409 | typedef enum CXVisitorResult (*CXFieldVisitor)(CXCursor C, | 
|  | 6410 | CXClientData client_data); | 
|  | 6411 |  | 
|  | 6412 | /** | 
|  | 6413 | * \brief Visit the fields of a particular type. | 
|  | 6414 | * | 
|  | 6415 | * This function visits all the direct fields of the given cursor, | 
|  | 6416 | * invoking the given \p visitor function with the cursors of each | 
|  | 6417 | * visited field. The traversal may be ended prematurely, if | 
|  | 6418 | * the visitor returns \c CXFieldVisit_Break. | 
|  | 6419 | * | 
|  | 6420 | * \param T the record type whose field may be visited. | 
|  | 6421 | * | 
|  | 6422 | * \param visitor the visitor function that will be invoked for each | 
|  | 6423 | * field of \p T. | 
|  | 6424 | * | 
|  | 6425 | * \param client_data pointer data supplied by the client, which will | 
|  | 6426 | * be passed to the visitor each time it is invoked. | 
|  | 6427 | * | 
|  | 6428 | * \returns a non-zero value if the traversal was terminated | 
|  | 6429 | * prematurely by the visitor returning \c CXFieldVisit_Break. | 
|  | 6430 | */ | 
|  | 6431 | CINDEX_LINKAGE unsigned clang_Type_visitFields(CXType T, | 
|  | 6432 | CXFieldVisitor visitor, | 
|  | 6433 | CXClientData client_data); | 
|  | 6434 |  | 
| Argyrios Kyrtzidis | 2bff516 | 2015-04-13 16:55:04 +0000 | [diff] [blame] | 6435 | /** | 
| Argyrios Kyrtzidis | cddafd3 | 2011-10-06 07:00:54 +0000 | [diff] [blame] | 6436 | * @} | 
|  | 6437 | */ | 
|  | 6438 |  | 
| Douglas Gregor | 6007cf2 | 2010-01-22 22:29:16 +0000 | [diff] [blame] | 6439 | /** | 
|  | 6440 | * @} | 
|  | 6441 | */ | 
| Daniel Dunbar | 62ebf25 | 2010-01-24 02:54:26 +0000 | [diff] [blame] | 6442 |  | 
| Ted Kremenek | b60d87c | 2009-08-26 22:36:44 +0000 | [diff] [blame] | 6443 | #ifdef __cplusplus | 
|  | 6444 | } | 
|  | 6445 | #endif | 
|  | 6446 | #endif |