clang
20.0.0git
include
clang-c
Index.h
Go to the documentation of this file.
1
/*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\
2
|* *|
3
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
4
|* Exceptions. *|
5
|* See https://llvm.org/LICENSE.txt for license information. *|
6
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
7
|* *|
8
|*===----------------------------------------------------------------------===*|
9
|* *|
10
|* This header provides a public interface to a Clang library for extracting *|
11
|* high-level symbol information from source files without exposing the full *|
12
|* Clang C++ API. *|
13
|* *|
14
\*===----------------------------------------------------------------------===*/
15
16
#ifndef LLVM_CLANG_C_INDEX_H
17
#define LLVM_CLANG_C_INDEX_H
18
19
#include "
clang-c/BuildSystem.h
"
20
#include "
clang-c/CXDiagnostic.h
"
21
#include "
clang-c/CXErrorCode.h
"
22
#include "
clang-c/CXFile.h
"
23
#include "
clang-c/CXSourceLocation.h
"
24
#include "
clang-c/CXString.h
"
25
#include "
clang-c/ExternC.h
"
26
#include "
clang-c/Platform.h
"
27
28
/**
29
* The version constants for the libclang API.
30
* CINDEX_VERSION_MINOR should increase when there are API additions.
31
* CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes.
32
*
33
* The policy about the libclang API was always to keep it source and ABI
34
* compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
35
*/
36
#define CINDEX_VERSION_MAJOR 0
37
#define CINDEX_VERSION_MINOR 64
38
39
#define CINDEX_VERSION_ENCODE(major, minor) (((major)*10000) + ((minor)*1))
40
41
#define CINDEX_VERSION \
42
CINDEX_VERSION_ENCODE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR)
43
44
#define CINDEX_VERSION_STRINGIZE_(major, minor) #major "."
#minor
45
#define CINDEX_VERSION_STRINGIZE(major, minor) \
46
CINDEX_VERSION_STRINGIZE_(major, minor)
47
48
#define CINDEX_VERSION_STRING \
49
CINDEX_VERSION_STRINGIZE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR)
50
51
#ifndef __has_feature
52
#define __has_feature(feature) 0
53
#endif
54
55
LLVM_CLANG_C_EXTERN_C_BEGIN
56
57
/** \defgroup CINDEX libclang: C Interface to Clang
58
*
59
* The C Interface to Clang provides a relatively small API that exposes
60
* facilities for parsing source code into an abstract syntax tree (AST),
61
* loading already-parsed ASTs, traversing the AST, associating
62
* physical source locations with elements within the AST, and other
63
* facilities that support Clang-based development tools.
64
*
65
* This C interface to Clang will never provide all of the information
66
* representation stored in Clang's C++ AST, nor should it: the intent is to
67
* maintain an API that is relatively stable from one release to the next,
68
* providing only the basic functionality needed to support development tools.
69
*
70
* To avoid namespace pollution, data types are prefixed with "CX" and
71
* functions are prefixed with "clang_".
72
*
73
* @{
74
*/
75
76
/**
77
* An "index" that consists of a set of translation units that would
78
* typically be linked together into an executable or library.
79
*/
80
typedef
void
*
CXIndex
;
81
82
/**
83
* An opaque type representing target information for a given translation
84
* unit.
85
*/
86
typedef
struct
CXTargetInfoImpl *
CXTargetInfo
;
87
88
/**
89
* A single translation unit, which resides in an index.
90
*/
91
typedef
struct
CXTranslationUnitImpl *
CXTranslationUnit
;
92
93
/**
94
* Opaque pointer representing client data that will be passed through
95
* to various callbacks and visitors.
96
*/
97
typedef
void
*
CXClientData
;
98
99
/**
100
* Provides the contents of a file that has not yet been saved to disk.
101
*
102
* Each CXUnsavedFile instance provides the name of a file on the
103
* system along with the current contents of that file that have not
104
* yet been saved to disk.
105
*/
106
struct
CXUnsavedFile
{
107
/**
108
* The file whose contents have not yet been saved.
109
*
110
* This file must already exist in the file system.
111
*/
112
const
char
*
Filename
;
113
114
/**
115
* A buffer containing the unsaved contents of this file.
116
*/
117
const
char
*
Contents
;
118
119
/**
120
* The length of the unsaved contents of this buffer.
121
*/
122
unsigned
long
Length
;
123
};
124
125
/**
126
* Describes the availability of a particular entity, which indicates
127
* whether the use of this entity will result in a warning or error due to
128
* it being deprecated or unavailable.
129
*/
130
enum
CXAvailabilityKind
{
131
/**
132
* The entity is available.
133
*/
134
CXAvailability_Available
,
135
/**
136
* The entity is available, but has been deprecated (and its use is
137
* not recommended).
138
*/
139
CXAvailability_Deprecated
,
140
/**
141
* The entity is not available; any use of it will be an error.
142
*/
143
CXAvailability_NotAvailable
,
144
/**
145
* The entity is available, but not accessible; any use of it will be
146
* an error.
147
*/
148
CXAvailability_NotAccessible
149
};
150
151
/**
152
* Describes a version number of the form major.minor.subminor.
153
*/
154
typedef
struct
CXVersion
{
155
/**
156
* The major version number, e.g., the '10' in '10.7.3'. A negative
157
* value indicates that there is no version number at all.
158
*/
159
int
Major
;
160
/**
161
* The minor version number, e.g., the '7' in '10.7.3'. This value
162
* will be negative if no minor version number was provided, e.g., for
163
* version '10'.
164
*/
165
int
Minor
;
166
/**
167
* The subminor version number, e.g., the '3' in '10.7.3'. This value
168
* will be negative if no minor or subminor version number was provided,
169
* e.g., in version '10' or '10.7'.
170
*/
171
int
Subminor
;
172
}
CXVersion
;
173
174
/**
175
* Describes the exception specification of a cursor.
176
*
177
* A negative value indicates that the cursor is not a function declaration.
178
*/
179
enum
CXCursor_ExceptionSpecificationKind
{
180
/**
181
* The cursor has no exception specification.
182
*/
183
CXCursor_ExceptionSpecificationKind_None
,
184
185
/**
186
* The cursor has exception specification throw()
187
*/
188
CXCursor_ExceptionSpecificationKind_DynamicNone
,
189
190
/**
191
* The cursor has exception specification throw(T1, T2)
192
*/
193
CXCursor_ExceptionSpecificationKind_Dynamic
,
194
195
/**
196
* The cursor has exception specification throw(...).
197
*/
198
CXCursor_ExceptionSpecificationKind_MSAny
,
199
200
/**
201
* The cursor has exception specification basic noexcept.
202
*/
203
CXCursor_ExceptionSpecificationKind_BasicNoexcept
,
204
205
/**
206
* The cursor has exception specification computed noexcept.
207
*/
208
CXCursor_ExceptionSpecificationKind_ComputedNoexcept
,
209
210
/**
211
* The exception specification has not yet been evaluated.
212
*/
213
CXCursor_ExceptionSpecificationKind_Unevaluated
,
214
215
/**
216
* The exception specification has not yet been instantiated.
217
*/
218
CXCursor_ExceptionSpecificationKind_Uninstantiated
,
219
220
/**
221
* The exception specification has not been parsed yet.
222
*/
223
CXCursor_ExceptionSpecificationKind_Unparsed
,
224
225
/**
226
* The cursor has a __declspec(nothrow) exception specification.
227
*/
228
CXCursor_ExceptionSpecificationKind_NoThrow
229
};
230
231
/**
232
* Provides a shared context for creating translation units.
233
*
234
* It provides two options:
235
*
236
* - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
237
* declarations (when loading any new translation units). A "local" declaration
238
* is one that belongs in the translation unit itself and not in a precompiled
239
* header that was used by the translation unit. If zero, all declarations
240
* will be enumerated.
241
*
242
* Here is an example:
243
*
244
* \code
245
* // excludeDeclsFromPCH = 1, displayDiagnostics=1
246
* Idx = clang_createIndex(1, 1);
247
*
248
* // IndexTest.pch was produced with the following command:
249
* // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
250
* TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
251
*
252
* // This will load all the symbols from 'IndexTest.pch'
253
* clang_visitChildren(clang_getTranslationUnitCursor(TU),
254
* TranslationUnitVisitor, 0);
255
* clang_disposeTranslationUnit(TU);
256
*
257
* // This will load all the symbols from 'IndexTest.c', excluding symbols
258
* // from 'IndexTest.pch'.
259
* char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
260
* TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
261
* 0, 0);
262
* clang_visitChildren(clang_getTranslationUnitCursor(TU),
263
* TranslationUnitVisitor, 0);
264
* clang_disposeTranslationUnit(TU);
265
* \endcode
266
*
267
* This process of creating the 'pch', loading it separately, and using it (via
268
* -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
269
* (which gives the indexer the same performance benefit as the compiler).
270
*/
271
CINDEX_LINKAGE
CXIndex
clang_createIndex
(
int
excludeDeclarationsFromPCH,
272
int
displayDiagnostics);
273
274
/**
275
* Destroy the given index.
276
*
277
* The index must not be destroyed until all of the translation units created
278
* within that index have been destroyed.
279
*/
280
CINDEX_LINKAGE
void
clang_disposeIndex
(
CXIndex
index);
281
282
typedef
enum
{
283
/**
284
* Use the default value of an option that may depend on the process
285
* environment.
286
*/
287
CXChoice_Default
= 0,
288
/**
289
* Enable the option.
290
*/
291
CXChoice_Enabled
= 1,
292
/**
293
* Disable the option.
294
*/
295
CXChoice_Disabled
= 2
296
}
CXChoice
;
297
298
typedef
enum
{
299
/**
300
* Used to indicate that no special CXIndex options are needed.
301
*/
302
CXGlobalOpt_None
= 0x0,
303
304
/**
305
* Used to indicate that threads that libclang creates for indexing
306
* purposes should use background priority.
307
*
308
* Affects #clang_indexSourceFile, #clang_indexTranslationUnit,
309
* #clang_parseTranslationUnit, #clang_saveTranslationUnit.
310
*/
311
CXGlobalOpt_ThreadBackgroundPriorityForIndexing
= 0x1,
312
313
/**
314
* Used to indicate that threads that libclang creates for editing
315
* purposes should use background priority.
316
*
317
* Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt,
318
* #clang_annotateTokens
319
*/
320
CXGlobalOpt_ThreadBackgroundPriorityForEditing
= 0x2,
321
322
/**
323
* Used to indicate that all threads that libclang creates should use
324
* background priority.
325
*/
326
CXGlobalOpt_ThreadBackgroundPriorityForAll
=
327
CXGlobalOpt_ThreadBackgroundPriorityForIndexing
|
328
CXGlobalOpt_ThreadBackgroundPriorityForEditing
329
330
}
CXGlobalOptFlags
;
331
332
/**
333
* Index initialization options.
334
*
335
* 0 is the default value of each member of this struct except for Size.
336
* Initialize the struct in one of the following three ways to avoid adapting
337
* code each time a new member is added to it:
338
* \code
339
* CXIndexOptions Opts;
340
* memset(&Opts, 0, sizeof(Opts));
341
* Opts.Size = sizeof(CXIndexOptions);
342
* \endcode
343
* or explicitly initialize the first data member and zero-initialize the rest:
344
* \code
345
* CXIndexOptions Opts = { sizeof(CXIndexOptions) };
346
* \endcode
347
* or to prevent the -Wmissing-field-initializers warning for the above version:
348
* \code
349
* CXIndexOptions Opts{};
350
* Opts.Size = sizeof(CXIndexOptions);
351
* \endcode
352
*/
353
typedef
struct
CXIndexOptions
{
354
/**
355
* The size of struct CXIndexOptions used for option versioning.
356
*
357
* Always initialize this member to sizeof(CXIndexOptions), or assign
358
* sizeof(CXIndexOptions) to it right after creating a CXIndexOptions object.
359
*/
360
unsigned
Size
;
361
/**
362
* A CXChoice enumerator that specifies the indexing priority policy.
363
* \sa CXGlobalOpt_ThreadBackgroundPriorityForIndexing
364
*/
365
unsigned
char
ThreadBackgroundPriorityForIndexing
;
366
/**
367
* A CXChoice enumerator that specifies the editing priority policy.
368
* \sa CXGlobalOpt_ThreadBackgroundPriorityForEditing
369
*/
370
unsigned
char
ThreadBackgroundPriorityForEditing
;
371
/**
372
* \see clang_createIndex()
373
*/
374
unsigned
ExcludeDeclarationsFromPCH
: 1;
375
/**
376
* \see clang_createIndex()
377
*/
378
unsigned
DisplayDiagnostics
: 1;
379
/**
380
* Store PCH in memory. If zero, PCH are stored in temporary files.
381
*/
382
unsigned
StorePreamblesInMemory
: 1;
383
unsigned
/*Reserved*/
: 13;
384
385
/**
386
* The path to a directory, in which to store temporary PCH files. If null or
387
* empty, the default system temporary directory is used. These PCH files are
388
* deleted on clean exit but stay on disk if the program crashes or is killed.
389
*
390
* This option is ignored if \a StorePreamblesInMemory is non-zero.
391
*
392
* Libclang does not create the directory at the specified path in the file
393
* system. Therefore it must exist, or storing PCH files will fail.
394
*/
395
const
char
*
PreambleStoragePath
;
396
/**
397
* Specifies a path which will contain log files for certain libclang
398
* invocations. A null value implies that libclang invocations are not logged.
399
*/
400
const
char
*
InvocationEmissionPath
;
401
}
CXIndexOptions
;
402
403
/**
404
* Provides a shared context for creating translation units.
405
*
406
* Call this function instead of clang_createIndex() if you need to configure
407
* the additional options in CXIndexOptions.
408
*
409
* \returns The created index or null in case of error, such as an unsupported
410
* value of options->Size.
411
*
412
* For example:
413
* \code
414
* CXIndex createIndex(const char *ApplicationTemporaryPath) {
415
* const int ExcludeDeclarationsFromPCH = 1;
416
* const int DisplayDiagnostics = 1;
417
* CXIndex Idx;
418
* #if CINDEX_VERSION_MINOR >= 64
419
* CXIndexOptions Opts;
420
* memset(&Opts, 0, sizeof(Opts));
421
* Opts.Size = sizeof(CXIndexOptions);
422
* Opts.ThreadBackgroundPriorityForIndexing = 1;
423
* Opts.ExcludeDeclarationsFromPCH = ExcludeDeclarationsFromPCH;
424
* Opts.DisplayDiagnostics = DisplayDiagnostics;
425
* Opts.PreambleStoragePath = ApplicationTemporaryPath;
426
* Idx = clang_createIndexWithOptions(&Opts);
427
* if (Idx)
428
* return Idx;
429
* fprintf(stderr,
430
* "clang_createIndexWithOptions() failed. "
431
* "CINDEX_VERSION_MINOR = %d, sizeof(CXIndexOptions) = %u\n",
432
* CINDEX_VERSION_MINOR, Opts.Size);
433
* #else
434
* (void)ApplicationTemporaryPath;
435
* #endif
436
* Idx = clang_createIndex(ExcludeDeclarationsFromPCH, DisplayDiagnostics);
437
* clang_CXIndex_setGlobalOptions(
438
* Idx, clang_CXIndex_getGlobalOptions(Idx) |
439
* CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
440
* return Idx;
441
* }
442
* \endcode
443
*
444
* \sa clang_createIndex()
445
*/
446
CINDEX_LINKAGE
CXIndex
447
clang_createIndexWithOptions
(
const
CXIndexOptions
*options);
448
449
/**
450
* Sets general options associated with a CXIndex.
451
*
452
* This function is DEPRECATED. Set
453
* CXIndexOptions::ThreadBackgroundPriorityForIndexing and/or
454
* CXIndexOptions::ThreadBackgroundPriorityForEditing and call
455
* clang_createIndexWithOptions() instead.
456
*
457
* For example:
458
* \code
459
* CXIndex idx = ...;
460
* clang_CXIndex_setGlobalOptions(idx,
461
* clang_CXIndex_getGlobalOptions(idx) |
462
* CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
463
* \endcode
464
*
465
* \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.
466
*/
467
CINDEX_LINKAGE
void
clang_CXIndex_setGlobalOptions
(
CXIndex
,
unsigned
options);
468
469
/**
470
* Gets the general options associated with a CXIndex.
471
*
472
* This function allows to obtain the final option values used by libclang after
473
* specifying the option policies via CXChoice enumerators.
474
*
475
* \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that
476
* are associated with the given CXIndex object.
477
*/
478
CINDEX_LINKAGE
unsigned
clang_CXIndex_getGlobalOptions
(
CXIndex
);
479
480
/**
481
* Sets the invocation emission path option in a CXIndex.
482
*
483
* This function is DEPRECATED. Set CXIndexOptions::InvocationEmissionPath and
484
* call clang_createIndexWithOptions() instead.
485
*
486
* The invocation emission path specifies a path which will contain log
487
* files for certain libclang invocations. A null value (default) implies that
488
* libclang invocations are not logged..
489
*/
490
CINDEX_LINKAGE
void
491
clang_CXIndex_setInvocationEmissionPathOption
(
CXIndex
,
const
char
*
Path
);
492
493
/**
494
* Determine whether the given header is guarded against
495
* multiple inclusions, either with the conventional
496
* \#ifndef/\#define/\#endif macro guards or with \#pragma once.
497
*/
498
CINDEX_LINKAGE
unsigned
clang_isFileMultipleIncludeGuarded
(
CXTranslationUnit
tu,
499
CXFile
file);
500
501
/**
502
* Retrieve a file handle within the given translation unit.
503
*
504
* \param tu the translation unit
505
*
506
* \param file_name the name of the file.
507
*
508
* \returns the file handle for the named file in the translation unit \p tu,
509
* or a NULL file handle if the file was not a part of this translation unit.
510
*/
511
CINDEX_LINKAGE
CXFile
clang_getFile
(
CXTranslationUnit
tu,
512
const
char
*file_name);
513
514
/**
515
* Retrieve the buffer associated with the given file.
516
*
517
* \param tu the translation unit
518
*
519
* \param file the file for which to retrieve the buffer.
520
*
521
* \param size [out] if non-NULL, will be set to the size of the buffer.
522
*
523
* \returns a pointer to the buffer in memory that holds the contents of
524
* \p file, or a NULL pointer when the file is not loaded.
525
*/
526
CINDEX_LINKAGE
const
char
*
clang_getFileContents
(
CXTranslationUnit
tu,
527
CXFile
file,
size_t
*size);
528
529
/**
530
* Retrieves the source location associated with a given file/line/column
531
* in a particular translation unit.
532
*/
533
CINDEX_LINKAGE
CXSourceLocation
clang_getLocation
(
CXTranslationUnit
tu,
534
CXFile
file,
unsigned
line,
535
unsigned
column);
536
/**
537
* Retrieves the source location associated with a given character offset
538
* in a particular translation unit.
539
*/
540
CINDEX_LINKAGE
CXSourceLocation
clang_getLocationForOffset
(
CXTranslationUnit
tu,
541
CXFile
file,
542
unsigned
offset);
543
544
/**
545
* Retrieve all ranges that were skipped by the preprocessor.
546
*
547
* The preprocessor will skip lines when they are surrounded by an
548
* if/ifdef/ifndef directive whose condition does not evaluate to true.
549
*/
550
CINDEX_LINKAGE
CXSourceRangeList
*
clang_getSkippedRanges
(
CXTranslationUnit
tu,
551
CXFile
file);
552
553
/**
554
* Retrieve all ranges from all files that were skipped by the
555
* preprocessor.
556
*
557
* The preprocessor will skip lines when they are surrounded by an
558
* if/ifdef/ifndef directive whose condition does not evaluate to true.
559
*/
560
CINDEX_LINKAGE
CXSourceRangeList
*
561
clang_getAllSkippedRanges
(
CXTranslationUnit
tu);
562
563
/**
564
* Determine the number of diagnostics produced for the given
565
* translation unit.
566
*/
567
CINDEX_LINKAGE
unsigned
clang_getNumDiagnostics
(
CXTranslationUnit
Unit);
568
569
/**
570
* Retrieve a diagnostic associated with the given translation unit.
571
*
572
* \param Unit the translation unit to query.
573
* \param Index the zero-based diagnostic number to retrieve.
574
*
575
* \returns the requested diagnostic. This diagnostic must be freed
576
* via a call to \c clang_disposeDiagnostic().
577
*/
578
CINDEX_LINKAGE
CXDiagnostic
clang_getDiagnostic
(
CXTranslationUnit
Unit,
579
unsigned
Index);
580
581
/**
582
* Retrieve the complete set of diagnostics associated with a
583
* translation unit.
584
*
585
* \param Unit the translation unit to query.
586
*/
587
CINDEX_LINKAGE
CXDiagnosticSet
588
clang_getDiagnosticSetFromTU
(
CXTranslationUnit
Unit);
589
590
/**
591
* \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation
592
*
593
* The routines in this group provide the ability to create and destroy
594
* translation units from files, either by parsing the contents of the files or
595
* by reading in a serialized representation of a translation unit.
596
*
597
* @{
598
*/
599
600
/**
601
* Get the original translation unit source file name.
602
*/
603
CINDEX_LINKAGE
CXString
604
clang_getTranslationUnitSpelling
(
CXTranslationUnit
CTUnit);
605
606
/**
607
* Return the CXTranslationUnit for a given source file and the provided
608
* command line arguments one would pass to the compiler.
609
*
610
* Note: The 'source_filename' argument is optional. If the caller provides a
611
* NULL pointer, the name of the source file is expected to reside in the
612
* specified command line arguments.
613
*
614
* Note: When encountered in 'clang_command_line_args', the following options
615
* are ignored:
616
*
617
* '-c'
618
* '-emit-ast'
619
* '-fsyntax-only'
620
* '-o <output file>' (both '-o' and '<output file>' are ignored)
621
*
622
* \param CIdx The index object with which the translation unit will be
623
* associated.
624
*
625
* \param source_filename The name of the source file to load, or NULL if the
626
* source file is included in \p clang_command_line_args.
627
*
628
* \param num_clang_command_line_args The number of command-line arguments in
629
* \p clang_command_line_args.
630
*
631
* \param clang_command_line_args The command-line arguments that would be
632
* passed to the \c clang executable if it were being invoked out-of-process.
633
* These command-line options will be parsed and will affect how the translation
634
* unit is parsed. Note that the following options are ignored: '-c',
635
* '-emit-ast', '-fsyntax-only' (which is the default), and '-o <output file>'.
636
*
637
* \param num_unsaved_files the number of unsaved file entries in \p
638
* unsaved_files.
639
*
640
* \param unsaved_files the files that have not yet been saved to disk
641
* but may be required for code completion, including the contents of
642
* those files. The contents and name of these files (as specified by
643
* CXUnsavedFile) are copied when necessary, so the client only needs to
644
* guarantee their validity until the call to this function returns.
645
*/
646
CINDEX_LINKAGE
CXTranslationUnit
clang_createTranslationUnitFromSourceFile
(
647
CXIndex
CIdx,
const
char
*source_filename,
int
num_clang_command_line_args,
648
const
char
*
const
*clang_command_line_args,
unsigned
num_unsaved_files,
649
struct
CXUnsavedFile
*unsaved_files);
650
651
/**
652
* Same as \c clang_createTranslationUnit2, but returns
653
* the \c CXTranslationUnit instead of an error code. In case of an error this
654
* routine returns a \c NULL \c CXTranslationUnit, without further detailed
655
* error codes.
656
*/
657
CINDEX_LINKAGE
CXTranslationUnit
658
clang_createTranslationUnit
(
CXIndex
CIdx,
const
char
*ast_filename);
659
660
/**
661
* Create a translation unit from an AST file (\c -emit-ast).
662
*
663
* \param[out] out_TU A non-NULL pointer to store the created
664
* \c CXTranslationUnit.
665
*
666
* \returns Zero on success, otherwise returns an error code.
667
*/
668
CINDEX_LINKAGE
enum
CXErrorCode
669
clang_createTranslationUnit2
(
CXIndex
CIdx,
const
char
*ast_filename,
670
CXTranslationUnit
*out_TU);
671
672
/**
673
* Flags that control the creation of translation units.
674
*
675
* The enumerators in this enumeration type are meant to be bitwise
676
* ORed together to specify which options should be used when
677
* constructing the translation unit.
678
*/
679
enum
CXTranslationUnit_Flags
{
680
/**
681
* Used to indicate that no special translation-unit options are
682
* needed.
683
*/
684
CXTranslationUnit_None
= 0x0,
685
686
/**
687
* Used to indicate that the parser should construct a "detailed"
688
* preprocessing record, including all macro definitions and instantiations.
689
*
690
* Constructing a detailed preprocessing record requires more memory
691
* and time to parse, since the information contained in the record
692
* is usually not retained. However, it can be useful for
693
* applications that require more detailed information about the
694
* behavior of the preprocessor.
695
*/
696
CXTranslationUnit_DetailedPreprocessingRecord
= 0x01,
697
698
/**
699
* Used to indicate that the translation unit is incomplete.
700
*
701
* When a translation unit is considered "incomplete", semantic
702
* analysis that is typically performed at the end of the
703
* translation unit will be suppressed. For example, this suppresses
704
* the completion of tentative declarations in C and of
705
* instantiation of implicitly-instantiation function templates in
706
* C++. This option is typically used when parsing a header with the
707
* intent of producing a precompiled header.
708
*/
709
CXTranslationUnit_Incomplete
= 0x02,
710
711
/**
712
* Used to indicate that the translation unit should be built with an
713
* implicit precompiled header for the preamble.
714
*
715
* An implicit precompiled header is used as an optimization when a
716
* particular translation unit is likely to be reparsed many times
717
* when the sources aren't changing that often. In this case, an
718
* implicit precompiled header will be built containing all of the
719
* initial includes at the top of the main file (what we refer to as
720
* the "preamble" of the file). In subsequent parses, if the
721
* preamble or the files in it have not changed, \c
722
* clang_reparseTranslationUnit() will re-use the implicit
723
* precompiled header to improve parsing performance.
724
*/
725
CXTranslationUnit_PrecompiledPreamble
= 0x04,
726
727
/**
728
* Used to indicate that the translation unit should cache some
729
* code-completion results with each reparse of the source file.
730
*
731
* Caching of code-completion results is a performance optimization that
732
* introduces some overhead to reparsing but improves the performance of
733
* code-completion operations.
734
*/
735
CXTranslationUnit_CacheCompletionResults
= 0x08,
736
737
/**
738
* Used to indicate that the translation unit will be serialized with
739
* \c clang_saveTranslationUnit.
740
*
741
* This option is typically used when parsing a header with the intent of
742
* producing a precompiled header.
743
*/
744
CXTranslationUnit_ForSerialization
= 0x10,
745
746
/**
747
* DEPRECATED: Enabled chained precompiled preambles in C++.
748
*
749
* Note: this is a *temporary* option that is available only while
750
* we are testing C++ precompiled preamble support. It is deprecated.
751
*/
752
CXTranslationUnit_CXXChainedPCH
= 0x20,
753
754
/**
755
* Used to indicate that function/method bodies should be skipped while
756
* parsing.
757
*
758
* This option can be used to search for declarations/definitions while
759
* ignoring the usages.
760
*/
761
CXTranslationUnit_SkipFunctionBodies
= 0x40,
762
763
/**
764
* Used to indicate that brief documentation comments should be
765
* included into the set of code completions returned from this translation
766
* unit.
767
*/
768
CXTranslationUnit_IncludeBriefCommentsInCodeCompletion
= 0x80,
769
770
/**
771
* Used to indicate that the precompiled preamble should be created on
772
* the first parse. Otherwise it will be created on the first reparse. This
773
* trades runtime on the first parse (serializing the preamble takes time) for
774
* reduced runtime on the second parse (can now reuse the preamble).
775
*/
776
CXTranslationUnit_CreatePreambleOnFirstParse
= 0x100,
777
778
/**
779
* Do not stop processing when fatal errors are encountered.
780
*
781
* When fatal errors are encountered while parsing a translation unit,
782
* semantic analysis is typically stopped early when compiling code. A common
783
* source for fatal errors are unresolvable include files. For the
784
* purposes of an IDE, this is undesirable behavior and as much information
785
* as possible should be reported. Use this flag to enable this behavior.
786
*/
787
CXTranslationUnit_KeepGoing
= 0x200,
788
789
/**
790
* Sets the preprocessor in a mode for parsing a single file only.
791
*/
792
CXTranslationUnit_SingleFileParse
= 0x400,
793
794
/**
795
* Used in combination with CXTranslationUnit_SkipFunctionBodies to
796
* constrain the skipping of function bodies to the preamble.
797
*
798
* The function bodies of the main file are not skipped.
799
*/
800
CXTranslationUnit_LimitSkipFunctionBodiesToPreamble
= 0x800,
801
802
/**
803
* Used to indicate that attributed types should be included in CXType.
804
*/
805
CXTranslationUnit_IncludeAttributedTypes
= 0x1000,
806
807
/**
808
* Used to indicate that implicit attributes should be visited.
809
*/
810
CXTranslationUnit_VisitImplicitAttributes
= 0x2000,
811
812
/**
813
* Used to indicate that non-errors from included files should be ignored.
814
*
815
* If set, clang_getDiagnosticSetFromTU() will not report e.g. warnings from
816
* included files anymore. This speeds up clang_getDiagnosticSetFromTU() for
817
* the case where these warnings are not of interest, as for an IDE for
818
* example, which typically shows only the diagnostics in the main file.
819
*/
820
CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles
= 0x4000,
821
822
/**
823
* Tells the preprocessor not to skip excluded conditional blocks.
824
*/
825
CXTranslationUnit_RetainExcludedConditionalBlocks
= 0x8000
826
};
827
828
/**
829
* Returns the set of flags that is suitable for parsing a translation
830
* unit that is being edited.
831
*
832
* The set of flags returned provide options for \c clang_parseTranslationUnit()
833
* to indicate that the translation unit is likely to be reparsed many times,
834
* either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
835
* (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
836
* set contains an unspecified set of optimizations (e.g., the precompiled
837
* preamble) geared toward improving the performance of these routines. The
838
* set of optimizations enabled may change from one version to the next.
839
*/
840
CINDEX_LINKAGE
unsigned
clang_defaultEditingTranslationUnitOptions
(
void
);
841
842
/**
843
* Same as \c clang_parseTranslationUnit2, but returns
844
* the \c CXTranslationUnit instead of an error code. In case of an error this
845
* routine returns a \c NULL \c CXTranslationUnit, without further detailed
846
* error codes.
847
*/
848
CINDEX_LINKAGE
CXTranslationUnit
clang_parseTranslationUnit
(
849
CXIndex
CIdx,
const
char
*source_filename,
850
const
char
*
const
*command_line_args,
int
num_command_line_args,
851
struct
CXUnsavedFile
*unsaved_files,
unsigned
num_unsaved_files,
852
unsigned
options);
853
854
/**
855
* Parse the given source file and the translation unit corresponding
856
* to that file.
857
*
858
* This routine is the main entry point for the Clang C API, providing the
859
* ability to parse a source file into a translation unit that can then be
860
* queried by other functions in the API. This routine accepts a set of
861
* command-line arguments so that the compilation can be configured in the same
862
* way that the compiler is configured on the command line.
863
*
864
* \param CIdx The index object with which the translation unit will be
865
* associated.
866
*
867
* \param source_filename The name of the source file to load, or NULL if the
868
* source file is included in \c command_line_args.
869
*
870
* \param command_line_args The command-line arguments that would be
871
* passed to the \c clang executable if it were being invoked out-of-process.
872
* These command-line options will be parsed and will affect how the translation
873
* unit is parsed. Note that the following options are ignored: '-c',
874
* '-emit-ast', '-fsyntax-only' (which is the default), and '-o <output file>'.
875
*
876
* \param num_command_line_args The number of command-line arguments in
877
* \c command_line_args.
878
*
879
* \param unsaved_files the files that have not yet been saved to disk
880
* but may be required for parsing, including the contents of
881
* those files. The contents and name of these files (as specified by
882
* CXUnsavedFile) are copied when necessary, so the client only needs to
883
* guarantee their validity until the call to this function returns.
884
*
885
* \param num_unsaved_files the number of unsaved file entries in \p
886
* unsaved_files.
887
*
888
* \param options A bitmask of options that affects how the translation unit
889
* is managed but not its compilation. This should be a bitwise OR of the
890
* CXTranslationUnit_XXX flags.
891
*
892
* \param[out] out_TU A non-NULL pointer to store the created
893
* \c CXTranslationUnit, describing the parsed code and containing any
894
* diagnostics produced by the compiler.
895
*
896
* \returns Zero on success, otherwise returns an error code.
897
*/
898
CINDEX_LINKAGE
enum
CXErrorCode
clang_parseTranslationUnit2
(
899
CXIndex
CIdx,
const
char
*source_filename,
900
const
char
*
const
*command_line_args,
int
num_command_line_args,
901
struct
CXUnsavedFile
*unsaved_files,
unsigned
num_unsaved_files,
902
unsigned
options,
CXTranslationUnit
*out_TU);
903
904
/**
905
* Same as clang_parseTranslationUnit2 but requires a full command line
906
* for \c command_line_args including argv[0]. This is useful if the standard
907
* library paths are relative to the binary.
908
*/
909
CINDEX_LINKAGE
enum
CXErrorCode
clang_parseTranslationUnit2FullArgv
(
910
CXIndex
CIdx,
const
char
*source_filename,
911
const
char
*
const
*command_line_args,
int
num_command_line_args,
912
struct
CXUnsavedFile
*unsaved_files,
unsigned
num_unsaved_files,
913
unsigned
options,
CXTranslationUnit
*out_TU);
914
915
/**
916
* Flags that control how translation units are saved.
917
*
918
* The enumerators in this enumeration type are meant to be bitwise
919
* ORed together to specify which options should be used when
920
* saving the translation unit.
921
*/
922
enum
CXSaveTranslationUnit_Flags
{
923
/**
924
* Used to indicate that no special saving options are needed.
925
*/
926
CXSaveTranslationUnit_None
= 0x0
927
};
928
929
/**
930
* Returns the set of flags that is suitable for saving a translation
931
* unit.
932
*
933
* The set of flags returned provide options for
934
* \c clang_saveTranslationUnit() by default. The returned flag
935
* set contains an unspecified set of options that save translation units with
936
* the most commonly-requested data.
937
*/
938
CINDEX_LINKAGE
unsigned
clang_defaultSaveOptions
(
CXTranslationUnit
TU);
939
940
/**
941
* Describes the kind of error that occurred (if any) in a call to
942
* \c clang_saveTranslationUnit().
943
*/
944
enum
CXSaveError
{
945
/**
946
* Indicates that no error occurred while saving a translation unit.
947
*/
948
CXSaveError_None
= 0,
949
950
/**
951
* Indicates that an unknown error occurred while attempting to save
952
* the file.
953
*
954
* This error typically indicates that file I/O failed when attempting to
955
* write the file.
956
*/
957
CXSaveError_Unknown
= 1,
958
959
/**
960
* Indicates that errors during translation prevented this attempt
961
* to save the translation unit.
962
*
963
* Errors that prevent the translation unit from being saved can be
964
* extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
965
*/
966
CXSaveError_TranslationErrors
= 2,
967
968
/**
969
* Indicates that the translation unit to be saved was somehow
970
* invalid (e.g., NULL).
971
*/
972
CXSaveError_InvalidTU
= 3
973
};
974
975
/**
976
* Saves a translation unit into a serialized representation of
977
* that translation unit on disk.
978
*
979
* Any translation unit that was parsed without error can be saved
980
* into a file. The translation unit can then be deserialized into a
981
* new \c CXTranslationUnit with \c clang_createTranslationUnit() or,
982
* if it is an incomplete translation unit that corresponds to a
983
* header, used as a precompiled header when parsing other translation
984
* units.
985
*
986
* \param TU The translation unit to save.
987
*
988
* \param FileName The file to which the translation unit will be saved.
989
*
990
* \param options A bitmask of options that affects how the translation unit
991
* is saved. This should be a bitwise OR of the
992
* CXSaveTranslationUnit_XXX flags.
993
*
994
* \returns A value that will match one of the enumerators of the CXSaveError
995
* enumeration. Zero (CXSaveError_None) indicates that the translation unit was
996
* saved successfully, while a non-zero value indicates that a problem occurred.
997
*/
998
CINDEX_LINKAGE
int
clang_saveTranslationUnit
(
CXTranslationUnit
TU,
999
const
char
*FileName,
1000
unsigned
options);
1001
1002
/**
1003
* Suspend a translation unit in order to free memory associated with it.
1004
*
1005
* A suspended translation unit uses significantly less memory but on the other
1006
* side does not support any other calls than \c clang_reparseTranslationUnit
1007
* to resume it or \c clang_disposeTranslationUnit to dispose it completely.
1008
*/
1009
CINDEX_LINKAGE
unsigned
clang_suspendTranslationUnit
(
CXTranslationUnit
);
1010
1011
/**
1012
* Destroy the specified CXTranslationUnit object.
1013
*/
1014
CINDEX_LINKAGE
void
clang_disposeTranslationUnit
(
CXTranslationUnit
);
1015
1016
/**
1017
* Flags that control the reparsing of translation units.
1018
*
1019
* The enumerators in this enumeration type are meant to be bitwise
1020
* ORed together to specify which options should be used when
1021
* reparsing the translation unit.
1022
*/
1023
enum
CXReparse_Flags
{
1024
/**
1025
* Used to indicate that no special reparsing options are needed.
1026
*/
1027
CXReparse_None
= 0x0
1028
};
1029
1030
/**
1031
* Returns the set of flags that is suitable for reparsing a translation
1032
* unit.
1033
*
1034
* The set of flags returned provide options for
1035
* \c clang_reparseTranslationUnit() by default. The returned flag
1036
* set contains an unspecified set of optimizations geared toward common uses
1037
* of reparsing. The set of optimizations enabled may change from one version
1038
* to the next.
1039
*/
1040
CINDEX_LINKAGE
unsigned
clang_defaultReparseOptions
(
CXTranslationUnit
TU);
1041
1042
/**
1043
* Reparse the source files that produced this translation unit.
1044
*
1045
* This routine can be used to re-parse the source files that originally
1046
* created the given translation unit, for example because those source files
1047
* have changed (either on disk or as passed via \p unsaved_files). The
1048
* source code will be reparsed with the same command-line options as it
1049
* was originally parsed.
1050
*
1051
* Reparsing a translation unit invalidates all cursors and source locations
1052
* that refer into that translation unit. This makes reparsing a translation
1053
* unit semantically equivalent to destroying the translation unit and then
1054
* creating a new translation unit with the same command-line arguments.
1055
* However, it may be more efficient to reparse a translation
1056
* unit using this routine.
1057
*
1058
* \param TU The translation unit whose contents will be re-parsed. The
1059
* translation unit must originally have been built with
1060
* \c clang_createTranslationUnitFromSourceFile().
1061
*
1062
* \param num_unsaved_files The number of unsaved file entries in \p
1063
* unsaved_files.
1064
*
1065
* \param unsaved_files The files that have not yet been saved to disk
1066
* but may be required for parsing, including the contents of
1067
* those files. The contents and name of these files (as specified by
1068
* CXUnsavedFile) are copied when necessary, so the client only needs to
1069
* guarantee their validity until the call to this function returns.
1070
*
1071
* \param options A bitset of options composed of the flags in CXReparse_Flags.
1072
* The function \c clang_defaultReparseOptions() produces a default set of
1073
* options recommended for most uses, based on the translation unit.
1074
*
1075
* \returns 0 if the sources could be reparsed. A non-zero error code will be
1076
* returned if reparsing was impossible, such that the translation unit is
1077
* invalid. In such cases, the only valid call for \c TU is
1078
* \c clang_disposeTranslationUnit(TU). The error codes returned by this
1079
* routine are described by the \c CXErrorCode enum.
1080
*/
1081
CINDEX_LINKAGE
int
1082
clang_reparseTranslationUnit
(
CXTranslationUnit
TU,
unsigned
num_unsaved_files,
1083
struct
CXUnsavedFile
*unsaved_files,
1084
unsigned
options);
1085
1086
/**
1087
* Categorizes how memory is being used by a translation unit.
1088
*/
1089
enum
CXTUResourceUsageKind
{
1090
CXTUResourceUsage_AST
= 1,
1091
CXTUResourceUsage_Identifiers
= 2,
1092
CXTUResourceUsage_Selectors
= 3,
1093
CXTUResourceUsage_GlobalCompletionResults
= 4,
1094
CXTUResourceUsage_SourceManagerContentCache
= 5,
1095
CXTUResourceUsage_AST_SideTables
= 6,
1096
CXTUResourceUsage_SourceManager_Membuffer_Malloc
= 7,
1097
CXTUResourceUsage_SourceManager_Membuffer_MMap
= 8,
1098
CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc
= 9,
1099
CXTUResourceUsage_ExternalASTSource_Membuffer_MMap
= 10,
1100
CXTUResourceUsage_Preprocessor
= 11,
1101
CXTUResourceUsage_PreprocessingRecord
= 12,
1102
CXTUResourceUsage_SourceManager_DataStructures
= 13,
1103
CXTUResourceUsage_Preprocessor_HeaderSearch
= 14,
1104
CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN
=
CXTUResourceUsage_AST
,
1105
CXTUResourceUsage_MEMORY_IN_BYTES_END
=
1106
CXTUResourceUsage_Preprocessor_HeaderSearch
,
1107
1108
CXTUResourceUsage_First
=
CXTUResourceUsage_AST
,
1109
CXTUResourceUsage_Last
=
CXTUResourceUsage_Preprocessor_HeaderSearch
1110
};
1111
1112
/**
1113
* Returns the human-readable null-terminated C string that represents
1114
* the name of the memory category. This string should never be freed.
1115
*/
1116
CINDEX_LINKAGE
1117
const
char
*
clang_getTUResourceUsageName
(
enum
CXTUResourceUsageKind
kind);
1118
1119
typedef
struct
CXTUResourceUsageEntry
{
1120
/* The memory usage category. */
1121
enum
CXTUResourceUsageKind
kind
;
1122
/* Amount of resources used.
1123
The units will depend on the resource kind. */
1124
unsigned
long
amount
;
1125
}
CXTUResourceUsageEntry
;
1126
1127
/**
1128
* The memory usage of a CXTranslationUnit, broken into categories.
1129
*/
1130
typedef
struct
CXTUResourceUsage
{
1131
/* Private data member, used for queries. */
1132
void
*
data
;
1133
1134
/* The number of entries in the 'entries' array. */
1135
unsigned
numEntries
;
1136
1137
/* An array of key-value pairs, representing the breakdown of memory
1138
usage. */
1139
CXTUResourceUsageEntry
*
entries
;
1140
1141
}
CXTUResourceUsage
;
1142
1143
/**
1144
* Return the memory usage of a translation unit. This object
1145
* should be released with clang_disposeCXTUResourceUsage().
1146
*/
1147
CINDEX_LINKAGE
CXTUResourceUsage
1148
clang_getCXTUResourceUsage
(
CXTranslationUnit
TU);
1149
1150
CINDEX_LINKAGE
void
clang_disposeCXTUResourceUsage
(
CXTUResourceUsage
usage);
1151
1152
/**
1153
* Get target information for this translation unit.
1154
*
1155
* The CXTargetInfo object cannot outlive the CXTranslationUnit object.
1156
*/
1157
CINDEX_LINKAGE
CXTargetInfo
1158
clang_getTranslationUnitTargetInfo
(
CXTranslationUnit
CTUnit);
1159
1160
/**
1161
* Destroy the CXTargetInfo object.
1162
*/
1163
CINDEX_LINKAGE
void
clang_TargetInfo_dispose
(
CXTargetInfo
Info);
1164
1165
/**
1166
* Get the normalized target triple as a string.
1167
*
1168
* Returns the empty string in case of any error.
1169
*/
1170
CINDEX_LINKAGE
CXString
clang_TargetInfo_getTriple
(
CXTargetInfo
Info);
1171
1172
/**
1173
* Get the pointer width of the target in bits.
1174
*
1175
* Returns -1 in case of error.
1176
*/
1177
CINDEX_LINKAGE
int
clang_TargetInfo_getPointerWidth
(
CXTargetInfo
Info);
1178
1179
/**
1180
* @}
1181
*/
1182
1183
/**
1184
* Describes the kind of entity that a cursor refers to.
1185
*/
1186
enum
CXCursorKind
{
1187
/* Declarations */
1188
/**
1189
* A declaration whose specific kind is not exposed via this
1190
* interface.
1191
*
1192
* Unexposed declarations have the same operations as any other kind
1193
* of declaration; one can extract their location information,
1194
* spelling, find their definitions, etc. However, the specific kind
1195
* of the declaration is not reported.
1196
*/
1197
CXCursor_UnexposedDecl
= 1,
1198
/** A C or C++ struct. */
1199
CXCursor_StructDecl
= 2,
1200
/** A C or C++ union. */
1201
CXCursor_UnionDecl
= 3,
1202
/** A C++ class. */
1203
CXCursor_ClassDecl
= 4,
1204
/** An enumeration. */
1205
CXCursor_EnumDecl
= 5,
1206
/**
1207
* A field (in C) or non-static data member (in C++) in a
1208
* struct, union, or C++ class.
1209
*/
1210
CXCursor_FieldDecl
= 6,
1211
/** An enumerator constant. */
1212
CXCursor_EnumConstantDecl
= 7,
1213
/** A function. */
1214
CXCursor_FunctionDecl
= 8,
1215
/** A variable. */
1216
CXCursor_VarDecl
= 9,
1217
/** A function or method parameter. */
1218
CXCursor_ParmDecl
= 10,
1219
/** An Objective-C \@interface. */
1220
CXCursor_ObjCInterfaceDecl
= 11,
1221
/** An Objective-C \@interface for a category. */
1222
CXCursor_ObjCCategoryDecl
= 12,
1223
/** An Objective-C \@protocol declaration. */
1224
CXCursor_ObjCProtocolDecl
= 13,
1225
/** An Objective-C \@property declaration. */
1226
CXCursor_ObjCPropertyDecl
= 14,
1227
/** An Objective-C instance variable. */
1228
CXCursor_ObjCIvarDecl
= 15,
1229
/** An Objective-C instance method. */
1230
CXCursor_ObjCInstanceMethodDecl
= 16,
1231
/** An Objective-C class method. */
1232
CXCursor_ObjCClassMethodDecl
= 17,
1233
/** An Objective-C \@implementation. */
1234
CXCursor_ObjCImplementationDecl
= 18,
1235
/** An Objective-C \@implementation for a category. */
1236
CXCursor_ObjCCategoryImplDecl
= 19,
1237
/** A typedef. */
1238
CXCursor_TypedefDecl
= 20,
1239
/** A C++ class method. */
1240
CXCursor_CXXMethod
= 21,
1241
/** A C++ namespace. */
1242
CXCursor_Namespace
= 22,
1243
/** A linkage specification, e.g. 'extern "C"'. */
1244
CXCursor_LinkageSpec
= 23,
1245
/** A C++ constructor. */
1246
CXCursor_Constructor
= 24,
1247
/** A C++ destructor. */
1248
CXCursor_Destructor
= 25,
1249
/** A C++ conversion function. */
1250
CXCursor_ConversionFunction
= 26,
1251
/** A C++ template type parameter. */
1252
CXCursor_TemplateTypeParameter
= 27,
1253
/** A C++ non-type template parameter. */
1254
CXCursor_NonTypeTemplateParameter
= 28,
1255
/** A C++ template template parameter. */
1256
CXCursor_TemplateTemplateParameter
= 29,
1257
/** A C++ function template. */
1258
CXCursor_FunctionTemplate
= 30,
1259
/** A C++ class template. */
1260
CXCursor_ClassTemplate
= 31,
1261
/** A C++ class template partial specialization. */
1262
CXCursor_ClassTemplatePartialSpecialization
= 32,
1263
/** A C++ namespace alias declaration. */
1264
CXCursor_NamespaceAlias
= 33,
1265
/** A C++ using directive. */
1266
CXCursor_UsingDirective
= 34,
1267
/** A C++ using declaration. */
1268
CXCursor_UsingDeclaration
= 35,
1269
/** A C++ alias declaration */
1270
CXCursor_TypeAliasDecl
= 36,
1271
/** An Objective-C \@synthesize definition. */
1272
CXCursor_ObjCSynthesizeDecl
= 37,
1273
/** An Objective-C \@dynamic definition. */
1274
CXCursor_ObjCDynamicDecl
= 38,
1275
/** An access specifier. */
1276
CXCursor_CXXAccessSpecifier
= 39,
1277
1278
CXCursor_FirstDecl
=
CXCursor_UnexposedDecl
,
1279
CXCursor_LastDecl
=
CXCursor_CXXAccessSpecifier
,
1280
1281
/* References */
1282
CXCursor_FirstRef
= 40,
/* Decl references */
1283
CXCursor_ObjCSuperClassRef
= 40,
1284
CXCursor_ObjCProtocolRef
= 41,
1285
CXCursor_ObjCClassRef
= 42,
1286
/**
1287
* A reference to a type declaration.
1288
*
1289
* A type reference occurs anywhere where a type is named but not
1290
* declared. For example, given:
1291
*
1292
* \code
1293
* typedef unsigned size_type;
1294
* size_type size;
1295
* \endcode
1296
*
1297
* The typedef is a declaration of size_type (CXCursor_TypedefDecl),
1298
* while the type of the variable "size" is referenced. The cursor
1299
* referenced by the type of size is the typedef for size_type.
1300
*/
1301
CXCursor_TypeRef
= 43,
1302
CXCursor_CXXBaseSpecifier
= 44,
1303
/**
1304
* A reference to a class template, function template, template
1305
* template parameter, or class template partial specialization.
1306
*/
1307
CXCursor_TemplateRef
= 45,
1308
/**
1309
* A reference to a namespace or namespace alias.
1310
*/
1311
CXCursor_NamespaceRef
= 46,
1312
/**
1313
* A reference to a member of a struct, union, or class that occurs in
1314
* some non-expression context, e.g., a designated initializer.
1315
*/
1316
CXCursor_MemberRef
= 47,
1317
/**
1318
* A reference to a labeled statement.
1319
*
1320
* This cursor kind is used to describe the jump to "start_over" in the
1321
* goto statement in the following example:
1322
*
1323
* \code
1324
* start_over:
1325
* ++counter;
1326
*
1327
* goto start_over;
1328
* \endcode
1329
*
1330
* A label reference cursor refers to a label statement.
1331
*/
1332
CXCursor_LabelRef
= 48,
1333
1334
/**
1335
* A reference to a set of overloaded functions or function templates
1336
* that has not yet been resolved to a specific function or function template.
1337
*
1338
* An overloaded declaration reference cursor occurs in C++ templates where
1339
* a dependent name refers to a function. For example:
1340
*
1341
* \code
1342
* template<typename T> void swap(T&, T&);
1343
*
1344
* struct X { ... };
1345
* void swap(X&, X&);
1346
*
1347
* template<typename T>
1348
* void reverse(T* first, T* last) {
1349
* while (first < last - 1) {
1350
* swap(*first, *--last);
1351
* ++first;
1352
* }
1353
* }
1354
*
1355
* struct Y { };
1356
* void swap(Y&, Y&);
1357
* \endcode
1358
*
1359
* Here, the identifier "swap" is associated with an overloaded declaration
1360
* reference. In the template definition, "swap" refers to either of the two
1361
* "swap" functions declared above, so both results will be available. At
1362
* instantiation time, "swap" may also refer to other functions found via
1363
* argument-dependent lookup (e.g., the "swap" function at the end of the
1364
* example).
1365
*
1366
* The functions \c clang_getNumOverloadedDecls() and
1367
* \c clang_getOverloadedDecl() can be used to retrieve the definitions
1368
* referenced by this cursor.
1369
*/
1370
CXCursor_OverloadedDeclRef
= 49,
1371
1372
/**
1373
* A reference to a variable that occurs in some non-expression
1374
* context, e.g., a C++ lambda capture list.
1375
*/
1376
CXCursor_VariableRef
= 50,
1377
1378
CXCursor_LastRef
=
CXCursor_VariableRef
,
1379
1380
/* Error conditions */
1381
CXCursor_FirstInvalid
= 70,
1382
CXCursor_InvalidFile
= 70,
1383
CXCursor_NoDeclFound
= 71,
1384
CXCursor_NotImplemented
= 72,
1385
CXCursor_InvalidCode
= 73,
1386
CXCursor_LastInvalid
=
CXCursor_InvalidCode
,
1387
1388
/* Expressions */
1389
CXCursor_FirstExpr
= 100,
1390
1391
/**
1392
* An expression whose specific kind is not exposed via this
1393
* interface.
1394
*
1395
* Unexposed expressions have the same operations as any other kind
1396
* of expression; one can extract their location information,
1397
* spelling, children, etc. However, the specific kind of the
1398
* expression is not reported.
1399
*/
1400
CXCursor_UnexposedExpr
= 100,
1401
1402
/**
1403
* An expression that refers to some value declaration, such
1404
* as a function, variable, or enumerator.
1405
*/
1406
CXCursor_DeclRefExpr
= 101,
1407
1408
/**
1409
* An expression that refers to a member of a struct, union,
1410
* class, Objective-C class, etc.
1411
*/
1412
CXCursor_MemberRefExpr
= 102,
1413
1414
/** An expression that calls a function. */
1415
CXCursor_CallExpr
= 103,
1416
1417
/** An expression that sends a message to an Objective-C
1418
object or class. */
1419
CXCursor_ObjCMessageExpr
= 104,
1420
1421
/** An expression that represents a block literal. */
1422
CXCursor_BlockExpr
= 105,
1423
1424
/** An integer literal.
1425
*/
1426
CXCursor_IntegerLiteral
= 106,
1427
1428
/** A floating point number literal.
1429
*/
1430
CXCursor_FloatingLiteral
= 107,
1431
1432
/** An imaginary number literal.
1433
*/
1434
CXCursor_ImaginaryLiteral
= 108,
1435
1436
/** A string literal.
1437
*/
1438
CXCursor_StringLiteral
= 109,
1439
1440
/** A character literal.
1441
*/
1442
CXCursor_CharacterLiteral
= 110,
1443
1444
/** A parenthesized expression, e.g. "(1)".
1445
*
1446
* This AST node is only formed if full location information is requested.
1447
*/
1448
CXCursor_ParenExpr
= 111,
1449
1450
/** This represents the unary-expression's (except sizeof and
1451
* alignof).
1452
*/
1453
CXCursor_UnaryOperator
= 112,
1454
1455
/** [C99 6.5.2.1] Array Subscripting.
1456
*/
1457
CXCursor_ArraySubscriptExpr
= 113,
1458
1459
/** A builtin binary operation expression such as "x + y" or
1460
* "x <= y".
1461
*/
1462
CXCursor_BinaryOperator
= 114,
1463
1464
/** Compound assignment such as "+=".
1465
*/
1466
CXCursor_CompoundAssignOperator
= 115,
1467
1468
/** The ?: ternary operator.
1469
*/
1470
CXCursor_ConditionalOperator
= 116,
1471
1472
/** An explicit cast in C (C99 6.5.4) or a C-style cast in C++
1473
* (C++ [expr.cast]), which uses the syntax (Type)expr.
1474
*
1475
* For example: (int)f.
1476
*/
1477
CXCursor_CStyleCastExpr
= 117,
1478
1479
/** [C99 6.5.2.5]
1480
*/
1481
CXCursor_CompoundLiteralExpr
= 118,
1482
1483
/** Describes an C or C++ initializer list.
1484
*/
1485
CXCursor_InitListExpr
= 119,
1486
1487
/** The GNU address of label extension, representing &&label.
1488
*/
1489
CXCursor_AddrLabelExpr
= 120,
1490
1491
/** This is the GNU Statement Expression extension: ({int X=4; X;})
1492
*/
1493
CXCursor_StmtExpr
= 121,
1494
1495
/** Represents a C11 generic selection.
1496
*/
1497
CXCursor_GenericSelectionExpr
= 122,
1498
1499
/** Implements the GNU __null extension, which is a name for a null
1500
* pointer constant that has integral type (e.g., int or long) and is the same
1501
* size and alignment as a pointer.
1502
*
1503
* The __null extension is typically only used by system headers, which define
1504
* NULL as __null in C++ rather than using 0 (which is an integer that may not
1505
* match the size of a pointer).
1506
*/
1507
CXCursor_GNUNullExpr
= 123,
1508
1509
/** C++'s static_cast<> expression.
1510
*/
1511
CXCursor_CXXStaticCastExpr
= 124,
1512
1513
/** C++'s dynamic_cast<> expression.
1514
*/
1515
CXCursor_CXXDynamicCastExpr
= 125,
1516
1517
/** C++'s reinterpret_cast<> expression.
1518
*/
1519
CXCursor_CXXReinterpretCastExpr
= 126,
1520
1521
/** C++'s const_cast<> expression.
1522
*/
1523
CXCursor_CXXConstCastExpr
= 127,
1524
1525
/** Represents an explicit C++ type conversion that uses "functional"
1526
* notion (C++ [expr.type.conv]).
1527
*
1528
* Example:
1529
* \code
1530
* x = int(0.5);
1531
* \endcode
1532
*/
1533
CXCursor_CXXFunctionalCastExpr
= 128,
1534
1535
/** A C++ typeid expression (C++ [expr.typeid]).
1536
*/
1537
CXCursor_CXXTypeidExpr
= 129,
1538
1539
/** [C++ 2.13.5] C++ Boolean Literal.
1540
*/
1541
CXCursor_CXXBoolLiteralExpr
= 130,
1542
1543
/** [C++0x 2.14.7] C++ Pointer Literal.
1544
*/
1545
CXCursor_CXXNullPtrLiteralExpr
= 131,
1546
1547
/** Represents the "this" expression in C++
1548
*/
1549
CXCursor_CXXThisExpr
= 132,
1550
1551
/** [C++ 15] C++ Throw Expression.
1552
*
1553
* This handles 'throw' and 'throw' assignment-expression. When
1554
* assignment-expression isn't present, Op will be null.
1555
*/
1556
CXCursor_CXXThrowExpr
= 133,
1557
1558
/** A new expression for memory allocation and constructor calls, e.g:
1559
* "new CXXNewExpr(foo)".
1560
*/
1561
CXCursor_CXXNewExpr
= 134,
1562
1563
/** A delete expression for memory deallocation and destructor calls,
1564
* e.g. "delete[] pArray".
1565
*/
1566
CXCursor_CXXDeleteExpr
= 135,
1567
1568
/** A unary expression. (noexcept, sizeof, or other traits)
1569
*/
1570
CXCursor_UnaryExpr
= 136,
1571
1572
/** An Objective-C string literal i.e. @"foo".
1573
*/
1574
CXCursor_ObjCStringLiteral
= 137,
1575
1576
/** An Objective-C \@encode expression.
1577
*/
1578
CXCursor_ObjCEncodeExpr
= 138,
1579
1580
/** An Objective-C \@selector expression.
1581
*/
1582
CXCursor_ObjCSelectorExpr
= 139,
1583
1584
/** An Objective-C \@protocol expression.
1585
*/
1586
CXCursor_ObjCProtocolExpr
= 140,
1587
1588
/** An Objective-C "bridged" cast expression, which casts between
1589
* Objective-C pointers and C pointers, transferring ownership in the process.
1590
*
1591
* \code
1592
* NSString *str = (__bridge_transfer NSString *)CFCreateString();
1593
* \endcode
1594
*/
1595
CXCursor_ObjCBridgedCastExpr
= 141,
1596
1597
/** Represents a C++0x pack expansion that produces a sequence of
1598
* expressions.
1599
*
1600
* A pack expansion expression contains a pattern (which itself is an
1601
* expression) followed by an ellipsis. For example:
1602
*
1603
* \code
1604
* template<typename F, typename ...Types>
1605
* void forward(F f, Types &&...args) {
1606
* f(static_cast<Types&&>(args)...);
1607
* }
1608
* \endcode
1609
*/
1610
CXCursor_PackExpansionExpr
= 142,
1611
1612
/** Represents an expression that computes the length of a parameter
1613
* pack.
1614
*
1615
* \code
1616
* template<typename ...Types>
1617
* struct count {
1618
* static const unsigned value = sizeof...(Types);
1619
* };
1620
* \endcode
1621
*/
1622
CXCursor_SizeOfPackExpr
= 143,
1623
1624
/* Represents a C++ lambda expression that produces a local function
1625
* object.
1626
*
1627
* \code
1628
* void abssort(float *x, unsigned N) {
1629
* std::sort(x, x + N,
1630
* [](float a, float b) {
1631
* return std::abs(a) < std::abs(b);
1632
* });
1633
* }
1634
* \endcode
1635
*/
1636
CXCursor_LambdaExpr
= 144,
1637
1638
/** Objective-c Boolean Literal.
1639
*/
1640
CXCursor_ObjCBoolLiteralExpr
= 145,
1641
1642
/** Represents the "self" expression in an Objective-C method.
1643
*/
1644
CXCursor_ObjCSelfExpr
= 146,
1645
1646
/** OpenMP 5.0 [2.1.5, Array Section].
1647
* OpenACC 3.3 [2.7.1, Data Specification for Data Clauses (Sub Arrays)]
1648
*/
1649
CXCursor_ArraySectionExpr
= 147,
1650
1651
/** Represents an @available(...) check.
1652
*/
1653
CXCursor_ObjCAvailabilityCheckExpr
= 148,
1654
1655
/**
1656
* Fixed point literal
1657
*/
1658
CXCursor_FixedPointLiteral
= 149,
1659
1660
/** OpenMP 5.0 [2.1.4, Array Shaping].
1661
*/
1662
CXCursor_OMPArrayShapingExpr
= 150,
1663
1664
/**
1665
* OpenMP 5.0 [2.1.6 Iterators]
1666
*/
1667
CXCursor_OMPIteratorExpr
= 151,
1668
1669
/** OpenCL's addrspace_cast<> expression.
1670
*/
1671
CXCursor_CXXAddrspaceCastExpr
= 152,
1672
1673
/**
1674
* Expression that references a C++20 concept.
1675
*/
1676
CXCursor_ConceptSpecializationExpr
= 153,
1677
1678
/**
1679
* Expression that references a C++20 requires expression.
1680
*/
1681
CXCursor_RequiresExpr
= 154,
1682
1683
/**
1684
* Expression that references a C++20 parenthesized list aggregate
1685
* initializer.
1686
*/
1687
CXCursor_CXXParenListInitExpr
= 155,
1688
1689
/**
1690
* Represents a C++26 pack indexing expression.
1691
*/
1692
CXCursor_PackIndexingExpr
= 156,
1693
1694
CXCursor_LastExpr
=
CXCursor_PackIndexingExpr
,
1695
1696
/* Statements */
1697
CXCursor_FirstStmt
= 200,
1698
/**
1699
* A statement whose specific kind is not exposed via this
1700
* interface.
1701
*
1702
* Unexposed statements have the same operations as any other kind of
1703
* statement; one can extract their location information, spelling,
1704
* children, etc. However, the specific kind of the statement is not
1705
* reported.
1706
*/
1707
CXCursor_UnexposedStmt
= 200,
1708
1709
/** A labelled statement in a function.
1710
*
1711
* This cursor kind is used to describe the "start_over:" label statement in
1712
* the following example:
1713
*
1714
* \code
1715
* start_over:
1716
* ++counter;
1717
* \endcode
1718
*
1719
*/
1720
CXCursor_LabelStmt
= 201,
1721
1722
/** A group of statements like { stmt stmt }.
1723
*
1724
* This cursor kind is used to describe compound statements, e.g. function
1725
* bodies.
1726
*/
1727
CXCursor_CompoundStmt
= 202,
1728
1729
/** A case statement.
1730
*/
1731
CXCursor_CaseStmt
= 203,
1732
1733
/** A default statement.
1734
*/
1735
CXCursor_DefaultStmt
= 204,
1736
1737
/** An if statement
1738
*/
1739
CXCursor_IfStmt
= 205,
1740
1741
/** A switch statement.
1742
*/
1743
CXCursor_SwitchStmt
= 206,
1744
1745
/** A while statement.
1746
*/
1747
CXCursor_WhileStmt
= 207,
1748
1749
/** A do statement.
1750
*/
1751
CXCursor_DoStmt
= 208,
1752
1753
/** A for statement.
1754
*/
1755
CXCursor_ForStmt
= 209,
1756
1757
/** A goto statement.
1758
*/
1759
CXCursor_GotoStmt
= 210,
1760
1761
/** An indirect goto statement.
1762
*/
1763
CXCursor_IndirectGotoStmt
= 211,
1764
1765
/** A continue statement.
1766
*/
1767
CXCursor_ContinueStmt
= 212,
1768
1769
/** A break statement.
1770
*/
1771
CXCursor_BreakStmt
= 213,
1772
1773
/** A return statement.
1774
*/
1775
CXCursor_ReturnStmt
= 214,
1776
1777
/** A GCC inline assembly statement extension.
1778
*/
1779
CXCursor_GCCAsmStmt
= 215,
1780
CXCursor_AsmStmt
=
CXCursor_GCCAsmStmt
,
1781
1782
/** Objective-C's overall \@try-\@catch-\@finally statement.
1783
*/
1784
CXCursor_ObjCAtTryStmt
= 216,
1785
1786
/** Objective-C's \@catch statement.
1787
*/
1788
CXCursor_ObjCAtCatchStmt
= 217,
1789
1790
/** Objective-C's \@finally statement.
1791
*/
1792
CXCursor_ObjCAtFinallyStmt
= 218,
1793
1794
/** Objective-C's \@throw statement.
1795
*/
1796
CXCursor_ObjCAtThrowStmt
= 219,
1797
1798
/** Objective-C's \@synchronized statement.
1799
*/
1800
CXCursor_ObjCAtSynchronizedStmt
= 220,
1801
1802
/** Objective-C's autorelease pool statement.
1803
*/
1804
CXCursor_ObjCAutoreleasePoolStmt
= 221,
1805
1806
/** Objective-C's collection statement.
1807
*/
1808
CXCursor_ObjCForCollectionStmt
= 222,
1809
1810
/** C++'s catch statement.
1811
*/
1812
CXCursor_CXXCatchStmt
= 223,
1813
1814
/** C++'s try statement.
1815
*/
1816
CXCursor_CXXTryStmt
= 224,
1817
1818
/** C++'s for (* : *) statement.
1819
*/
1820
CXCursor_CXXForRangeStmt
= 225,
1821
1822
/** Windows Structured Exception Handling's try statement.
1823
*/
1824
CXCursor_SEHTryStmt
= 226,
1825
1826
/** Windows Structured Exception Handling's except statement.
1827
*/
1828
CXCursor_SEHExceptStmt
= 227,
1829
1830
/** Windows Structured Exception Handling's finally statement.
1831
*/
1832
CXCursor_SEHFinallyStmt
= 228,
1833
1834
/** A MS inline assembly statement extension.
1835
*/
1836
CXCursor_MSAsmStmt
= 229,
1837
1838
/** The null statement ";": C99 6.8.3p3.
1839
*
1840
* This cursor kind is used to describe the null statement.
1841
*/
1842
CXCursor_NullStmt
= 230,
1843
1844
/** Adaptor class for mixing declarations with statements and
1845
* expressions.
1846
*/
1847
CXCursor_DeclStmt
= 231,
1848
1849
/** OpenMP parallel directive.
1850
*/
1851
CXCursor_OMPParallelDirective
= 232,
1852
1853
/** OpenMP SIMD directive.
1854
*/
1855
CXCursor_OMPSimdDirective
= 233,
1856
1857
/** OpenMP for directive.
1858
*/
1859
CXCursor_OMPForDirective
= 234,
1860
1861
/** OpenMP sections directive.
1862
*/
1863
CXCursor_OMPSectionsDirective
= 235,
1864
1865
/** OpenMP section directive.
1866
*/
1867
CXCursor_OMPSectionDirective
= 236,
1868
1869
/** OpenMP single directive.
1870
*/
1871
CXCursor_OMPSingleDirective
= 237,
1872
1873
/** OpenMP parallel for directive.
1874
*/
1875
CXCursor_OMPParallelForDirective
= 238,
1876
1877
/** OpenMP parallel sections directive.
1878
*/
1879
CXCursor_OMPParallelSectionsDirective
= 239,
1880
1881
/** OpenMP task directive.
1882
*/
1883
CXCursor_OMPTaskDirective
= 240,
1884
1885
/** OpenMP master directive.
1886
*/
1887
CXCursor_OMPMasterDirective
= 241,
1888
1889
/** OpenMP critical directive.
1890
*/
1891
CXCursor_OMPCriticalDirective
= 242,
1892
1893
/** OpenMP taskyield directive.
1894
*/
1895
CXCursor_OMPTaskyieldDirective
= 243,
1896
1897
/** OpenMP barrier directive.
1898
*/
1899
CXCursor_OMPBarrierDirective
= 244,
1900
1901
/** OpenMP taskwait directive.
1902
*/
1903
CXCursor_OMPTaskwaitDirective
= 245,
1904
1905
/** OpenMP flush directive.
1906
*/
1907
CXCursor_OMPFlushDirective
= 246,
1908
1909
/** Windows Structured Exception Handling's leave statement.
1910
*/
1911
CXCursor_SEHLeaveStmt
= 247,
1912
1913
/** OpenMP ordered directive.
1914
*/
1915
CXCursor_OMPOrderedDirective
= 248,
1916
1917
/** OpenMP atomic directive.
1918
*/
1919
CXCursor_OMPAtomicDirective
= 249,
1920
1921
/** OpenMP for SIMD directive.
1922
*/
1923
CXCursor_OMPForSimdDirective
= 250,
1924
1925
/** OpenMP parallel for SIMD directive.
1926
*/
1927
CXCursor_OMPParallelForSimdDirective
= 251,
1928
1929
/** OpenMP target directive.
1930
*/
1931
CXCursor_OMPTargetDirective
= 252,
1932
1933
/** OpenMP teams directive.
1934
*/
1935
CXCursor_OMPTeamsDirective
= 253,
1936
1937
/** OpenMP taskgroup directive.
1938
*/
1939
CXCursor_OMPTaskgroupDirective
= 254,
1940
1941
/** OpenMP cancellation point directive.
1942
*/
1943
CXCursor_OMPCancellationPointDirective
= 255,
1944
1945
/** OpenMP cancel directive.
1946
*/
1947
CXCursor_OMPCancelDirective
= 256,
1948
1949
/** OpenMP target data directive.
1950
*/
1951
CXCursor_OMPTargetDataDirective
= 257,
1952
1953
/** OpenMP taskloop directive.
1954
*/
1955
CXCursor_OMPTaskLoopDirective
= 258,
1956
1957
/** OpenMP taskloop simd directive.
1958
*/
1959
CXCursor_OMPTaskLoopSimdDirective
= 259,
1960
1961
/** OpenMP distribute directive.
1962
*/
1963
CXCursor_OMPDistributeDirective
= 260,
1964
1965
/** OpenMP target enter data directive.
1966
*/
1967
CXCursor_OMPTargetEnterDataDirective
= 261,
1968
1969
/** OpenMP target exit data directive.
1970
*/
1971
CXCursor_OMPTargetExitDataDirective
= 262,
1972
1973
/** OpenMP target parallel directive.
1974
*/
1975
CXCursor_OMPTargetParallelDirective
= 263,
1976
1977
/** OpenMP target parallel for directive.
1978
*/
1979
CXCursor_OMPTargetParallelForDirective
= 264,
1980
1981
/** OpenMP target update directive.
1982
*/
1983
CXCursor_OMPTargetUpdateDirective
= 265,
1984
1985
/** OpenMP distribute parallel for directive.
1986
*/
1987
CXCursor_OMPDistributeParallelForDirective
= 266,
1988
1989
/** OpenMP distribute parallel for simd directive.
1990
*/
1991
CXCursor_OMPDistributeParallelForSimdDirective
= 267,
1992
1993
/** OpenMP distribute simd directive.
1994
*/
1995
CXCursor_OMPDistributeSimdDirective
= 268,
1996
1997
/** OpenMP target parallel for simd directive.
1998
*/
1999
CXCursor_OMPTargetParallelForSimdDirective
= 269,
2000
2001
/** OpenMP target simd directive.
2002
*/
2003
CXCursor_OMPTargetSimdDirective
= 270,
2004
2005
/** OpenMP teams distribute directive.
2006
*/
2007
CXCursor_OMPTeamsDistributeDirective
= 271,
2008
2009
/** OpenMP teams distribute simd directive.
2010
*/
2011
CXCursor_OMPTeamsDistributeSimdDirective
= 272,
2012
2013
/** OpenMP teams distribute parallel for simd directive.
2014
*/
2015
CXCursor_OMPTeamsDistributeParallelForSimdDirective
= 273,
2016
2017
/** OpenMP teams distribute parallel for directive.
2018
*/
2019
CXCursor_OMPTeamsDistributeParallelForDirective
= 274,
2020
2021
/** OpenMP target teams directive.
2022
*/
2023
CXCursor_OMPTargetTeamsDirective
= 275,
2024
2025
/** OpenMP target teams distribute directive.
2026
*/
2027
CXCursor_OMPTargetTeamsDistributeDirective
= 276,
2028
2029
/** OpenMP target teams distribute parallel for directive.
2030
*/
2031
CXCursor_OMPTargetTeamsDistributeParallelForDirective
= 277,
2032
2033
/** OpenMP target teams distribute parallel for simd directive.
2034
*/
2035
CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective
= 278,
2036
2037
/** OpenMP target teams distribute simd directive.
2038
*/
2039
CXCursor_OMPTargetTeamsDistributeSimdDirective
= 279,
2040
2041
/** C++2a std::bit_cast expression.
2042
*/
2043
CXCursor_BuiltinBitCastExpr
= 280,
2044
2045
/** OpenMP master taskloop directive.
2046
*/
2047
CXCursor_OMPMasterTaskLoopDirective
= 281,
2048
2049
/** OpenMP parallel master taskloop directive.
2050
*/
2051
CXCursor_OMPParallelMasterTaskLoopDirective
= 282,
2052
2053
/** OpenMP master taskloop simd directive.
2054
*/
2055
CXCursor_OMPMasterTaskLoopSimdDirective
= 283,
2056
2057
/** OpenMP parallel master taskloop simd directive.
2058
*/
2059
CXCursor_OMPParallelMasterTaskLoopSimdDirective
= 284,
2060
2061
/** OpenMP parallel master directive.
2062
*/
2063
CXCursor_OMPParallelMasterDirective
= 285,
2064
2065
/** OpenMP depobj directive.
2066
*/
2067
CXCursor_OMPDepobjDirective
= 286,
2068
2069
/** OpenMP scan directive.
2070
*/
2071
CXCursor_OMPScanDirective
= 287,
2072
2073
/** OpenMP tile directive.
2074
*/
2075
CXCursor_OMPTileDirective
= 288,
2076
2077
/** OpenMP canonical loop.
2078
*/
2079
CXCursor_OMPCanonicalLoop
= 289,
2080
2081
/** OpenMP interop directive.
2082
*/
2083
CXCursor_OMPInteropDirective
= 290,
2084
2085
/** OpenMP dispatch directive.
2086
*/
2087
CXCursor_OMPDispatchDirective
= 291,
2088
2089
/** OpenMP masked directive.
2090
*/
2091
CXCursor_OMPMaskedDirective
= 292,
2092
2093
/** OpenMP unroll directive.
2094
*/
2095
CXCursor_OMPUnrollDirective
= 293,
2096
2097
/** OpenMP metadirective directive.
2098
*/
2099
CXCursor_OMPMetaDirective
= 294,
2100
2101
/** OpenMP loop directive.
2102
*/
2103
CXCursor_OMPGenericLoopDirective
= 295,
2104
2105
/** OpenMP teams loop directive.
2106
*/
2107
CXCursor_OMPTeamsGenericLoopDirective
= 296,
2108
2109
/** OpenMP target teams loop directive.
2110
*/
2111
CXCursor_OMPTargetTeamsGenericLoopDirective
= 297,
2112
2113
/** OpenMP parallel loop directive.
2114
*/
2115
CXCursor_OMPParallelGenericLoopDirective
= 298,
2116
2117
/** OpenMP target parallel loop directive.
2118
*/
2119
CXCursor_OMPTargetParallelGenericLoopDirective
= 299,
2120
2121
/** OpenMP parallel masked directive.
2122
*/
2123
CXCursor_OMPParallelMaskedDirective
= 300,
2124
2125
/** OpenMP masked taskloop directive.
2126
*/
2127
CXCursor_OMPMaskedTaskLoopDirective
= 301,
2128
2129
/** OpenMP masked taskloop simd directive.
2130
*/
2131
CXCursor_OMPMaskedTaskLoopSimdDirective
= 302,
2132
2133
/** OpenMP parallel masked taskloop directive.
2134
*/
2135
CXCursor_OMPParallelMaskedTaskLoopDirective
= 303,
2136
2137
/** OpenMP parallel masked taskloop simd directive.
2138
*/
2139
CXCursor_OMPParallelMaskedTaskLoopSimdDirective
= 304,
2140
2141
/** OpenMP error directive.
2142
*/
2143
CXCursor_OMPErrorDirective
= 305,
2144
2145
/** OpenMP scope directive.
2146
*/
2147
CXCursor_OMPScopeDirective
= 306,
2148
2149
/** OpenMP reverse directive.
2150
*/
2151
CXCursor_OMPReverseDirective
= 307,
2152
2153
/** OpenMP interchange directive.
2154
*/
2155
CXCursor_OMPInterchangeDirective
= 308,
2156
2157
/** OpenMP assume directive.
2158
*/
2159
CXCursor_OMPAssumeDirective
= 309,
2160
2161
/** OpenACC Compute Construct.
2162
*/
2163
CXCursor_OpenACCComputeConstruct
= 320,
2164
2165
/** OpenACC Loop Construct.
2166
*/
2167
CXCursor_OpenACCLoopConstruct
= 321,
2168
2169
CXCursor_LastStmt
=
CXCursor_OpenACCLoopConstruct
,
2170
2171
/**
2172
* Cursor that represents the translation unit itself.
2173
*
2174
* The translation unit cursor exists primarily to act as the root
2175
* cursor for traversing the contents of a translation unit.
2176
*/
2177
CXCursor_TranslationUnit
= 350,
2178
2179
/* Attributes */
2180
CXCursor_FirstAttr
= 400,
2181
/**
2182
* An attribute whose specific kind is not exposed via this
2183
* interface.
2184
*/
2185
CXCursor_UnexposedAttr
= 400,
2186
2187
CXCursor_IBActionAttr
= 401,
2188
CXCursor_IBOutletAttr
= 402,
2189
CXCursor_IBOutletCollectionAttr
= 403,
2190
CXCursor_CXXFinalAttr
= 404,
2191
CXCursor_CXXOverrideAttr
= 405,
2192
CXCursor_AnnotateAttr
= 406,
2193
CXCursor_AsmLabelAttr
= 407,
2194
CXCursor_PackedAttr
= 408,
2195
CXCursor_PureAttr
= 409,
2196
CXCursor_ConstAttr
= 410,
2197
CXCursor_NoDuplicateAttr
= 411,
2198
CXCursor_CUDAConstantAttr
= 412,
2199
CXCursor_CUDADeviceAttr
= 413,
2200
CXCursor_CUDAGlobalAttr
= 414,
2201
CXCursor_CUDAHostAttr
= 415,
2202
CXCursor_CUDASharedAttr
= 416,
2203
CXCursor_VisibilityAttr
= 417,
2204
CXCursor_DLLExport
= 418,
2205
CXCursor_DLLImport
= 419,
2206
CXCursor_NSReturnsRetained
= 420,
2207
CXCursor_NSReturnsNotRetained
= 421,
2208
CXCursor_NSReturnsAutoreleased
= 422,
2209
CXCursor_NSConsumesSelf
= 423,
2210
CXCursor_NSConsumed
= 424,
2211
CXCursor_ObjCException
= 425,
2212
CXCursor_ObjCNSObject
= 426,
2213
CXCursor_ObjCIndependentClass
= 427,
2214
CXCursor_ObjCPreciseLifetime
= 428,
2215
CXCursor_ObjCReturnsInnerPointer
= 429,
2216
CXCursor_ObjCRequiresSuper
= 430,
2217
CXCursor_ObjCRootClass
= 431,
2218
CXCursor_ObjCSubclassingRestricted
= 432,
2219
CXCursor_ObjCExplicitProtocolImpl
= 433,
2220
CXCursor_ObjCDesignatedInitializer
= 434,
2221
CXCursor_ObjCRuntimeVisible
= 435,
2222
CXCursor_ObjCBoxable
= 436,
2223
CXCursor_FlagEnum
= 437,
2224
CXCursor_ConvergentAttr
= 438,
2225
CXCursor_WarnUnusedAttr
= 439,
2226
CXCursor_WarnUnusedResultAttr
= 440,
2227
CXCursor_AlignedAttr
= 441,
2228
CXCursor_LastAttr
=
CXCursor_AlignedAttr
,
2229
2230
/* Preprocessing */
2231
CXCursor_PreprocessingDirective
= 500,
2232
CXCursor_MacroDefinition
= 501,
2233
CXCursor_MacroExpansion
= 502,
2234
CXCursor_MacroInstantiation
=
CXCursor_MacroExpansion
,
2235
CXCursor_InclusionDirective
= 503,
2236
CXCursor_FirstPreprocessing
=
CXCursor_PreprocessingDirective
,
2237
CXCursor_LastPreprocessing
=
CXCursor_InclusionDirective
,
2238
2239
/* Extra Declarations */
2240
/**
2241
* A module import declaration.
2242
*/
2243
CXCursor_ModuleImportDecl
= 600,
2244
CXCursor_TypeAliasTemplateDecl
= 601,
2245
/**
2246
* A static_assert or _Static_assert node
2247
*/
2248
CXCursor_StaticAssert
= 602,
2249
/**
2250
* a friend declaration.
2251
*/
2252
CXCursor_FriendDecl
= 603,
2253
/**
2254
* a concept declaration.
2255
*/
2256
CXCursor_ConceptDecl
= 604,
2257
2258
CXCursor_FirstExtraDecl
=
CXCursor_ModuleImportDecl
,
2259
CXCursor_LastExtraDecl
=
CXCursor_ConceptDecl
,
2260
2261
/**
2262
* A code completion overload candidate.
2263
*/
2264
CXCursor_OverloadCandidate
= 700
2265
};
2266
2267
/**
2268
* A cursor representing some element in the abstract syntax tree for
2269
* a translation unit.
2270
*
2271
* The cursor abstraction unifies the different kinds of entities in a
2272
* program--declaration, statements, expressions, references to declarations,
2273
* etc.--under a single "cursor" abstraction with a common set of operations.
2274
* Common operation for a cursor include: getting the physical location in
2275
* a source file where the cursor points, getting the name associated with a
2276
* cursor, and retrieving cursors for any child nodes of a particular cursor.
2277
*
2278
* Cursors can be produced in two specific ways.
2279
* clang_getTranslationUnitCursor() produces a cursor for a translation unit,
2280
* from which one can use clang_visitChildren() to explore the rest of the
2281
* translation unit. clang_getCursor() maps from a physical source location
2282
* to the entity that resides at that location, allowing one to map from the
2283
* source code into the AST.
2284
*/
2285
typedef
struct
{
2286
enum
CXCursorKind
kind
;
2287
int
xdata
;
2288
const
void
*data[3];
2289
}
CXCursor
;
2290
2291
/**
2292
* \defgroup CINDEX_CURSOR_MANIP Cursor manipulations
2293
*
2294
* @{
2295
*/
2296
2297
/**
2298
* Retrieve the NULL cursor, which represents no entity.
2299
*/
2300
CINDEX_LINKAGE
CXCursor
clang_getNullCursor
(
void
);
2301
2302
/**
2303
* Retrieve the cursor that represents the given translation unit.
2304
*
2305
* The translation unit cursor can be used to start traversing the
2306
* various declarations within the given translation unit.
2307
*/
2308
CINDEX_LINKAGE
CXCursor
clang_getTranslationUnitCursor
(
CXTranslationUnit
);
2309
2310
/**
2311
* Determine whether two cursors are equivalent.
2312
*/
2313
CINDEX_LINKAGE
unsigned
clang_equalCursors
(
CXCursor
,
CXCursor
);
2314
2315
/**
2316
* Returns non-zero if \p cursor is null.
2317
*/
2318
CINDEX_LINKAGE
int
clang_Cursor_isNull
(
CXCursor
cursor);
2319
2320
/**
2321
* Compute a hash value for the given cursor.
2322
*/
2323
CINDEX_LINKAGE
unsigned
clang_hashCursor
(
CXCursor
);
2324
2325
/**
2326
* Retrieve the kind of the given cursor.
2327
*/
2328
CINDEX_LINKAGE
enum
CXCursorKind
clang_getCursorKind
(
CXCursor
);
2329
2330
/**
2331
* Determine whether the given cursor kind represents a declaration.
2332
*/
2333
CINDEX_LINKAGE
unsigned
clang_isDeclaration
(
enum
CXCursorKind
);
2334
2335
/**
2336
* Determine whether the given declaration is invalid.
2337
*
2338
* A declaration is invalid if it could not be parsed successfully.
2339
*
2340
* \returns non-zero if the cursor represents a declaration and it is
2341
* invalid, otherwise NULL.
2342
*/
2343
CINDEX_LINKAGE
unsigned
clang_isInvalidDeclaration
(
CXCursor
);
2344
2345
/**
2346
* Determine whether the given cursor kind represents a simple
2347
* reference.
2348
*
2349
* Note that other kinds of cursors (such as expressions) can also refer to
2350
* other cursors. Use clang_getCursorReferenced() to determine whether a
2351
* particular cursor refers to another entity.
2352
*/
2353
CINDEX_LINKAGE
unsigned
clang_isReference
(
enum
CXCursorKind
);
2354
2355
/**
2356
* Determine whether the given cursor kind represents an expression.
2357
*/
2358
CINDEX_LINKAGE
unsigned
clang_isExpression
(
enum
CXCursorKind
);
2359
2360
/**
2361
* Determine whether the given cursor kind represents a statement.
2362
*/
2363
CINDEX_LINKAGE
unsigned
clang_isStatement
(
enum
CXCursorKind
);
2364
2365
/**
2366
* Determine whether the given cursor kind represents an attribute.
2367
*/
2368
CINDEX_LINKAGE
unsigned
clang_isAttribute
(
enum
CXCursorKind
);
2369
2370
/**
2371
* Determine whether the given cursor has any attributes.
2372
*/
2373
CINDEX_LINKAGE
unsigned
clang_Cursor_hasAttrs
(
CXCursor
C);
2374
2375
/**
2376
* Determine whether the given cursor kind represents an invalid
2377
* cursor.
2378
*/
2379
CINDEX_LINKAGE
unsigned
clang_isInvalid
(
enum
CXCursorKind
);
2380
2381
/**
2382
* Determine whether the given cursor kind represents a translation
2383
* unit.
2384
*/
2385
CINDEX_LINKAGE
unsigned
clang_isTranslationUnit
(
enum
CXCursorKind
);
2386
2387
/***
2388
* Determine whether the given cursor represents a preprocessing
2389
* element, such as a preprocessor directive or macro instantiation.
2390
*/
2391
CINDEX_LINKAGE
unsigned
clang_isPreprocessing
(
enum
CXCursorKind
);
2392
2393
/***
2394
* Determine whether the given cursor represents a currently
2395
* unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
2396
*/
2397
CINDEX_LINKAGE
unsigned
clang_isUnexposed
(
enum
CXCursorKind
);
2398
2399
/**
2400
* Describe the linkage of the entity referred to by a cursor.
2401
*/
2402
enum
CXLinkageKind
{
2403
/** This value indicates that no linkage information is available
2404
* for a provided CXCursor. */
2405
CXLinkage_Invalid
,
2406
/**
2407
* This is the linkage for variables, parameters, and so on that
2408
* have automatic storage. This covers normal (non-extern) local variables.
2409
*/
2410
CXLinkage_NoLinkage
,
2411
/** This is the linkage for static variables and static functions. */
2412
CXLinkage_Internal
,
2413
/** This is the linkage for entities with external linkage that live
2414
* in C++ anonymous namespaces.*/
2415
CXLinkage_UniqueExternal
,
2416
/** This is the linkage for entities with true, external linkage. */
2417
CXLinkage_External
2418
};
2419
2420
/**
2421
* Determine the linkage of the entity referred to by a given cursor.
2422
*/
2423
CINDEX_LINKAGE
enum
CXLinkageKind
clang_getCursorLinkage
(
CXCursor
cursor);
2424
2425
enum
CXVisibilityKind
{
2426
/** This value indicates that no visibility information is available
2427
* for a provided CXCursor. */
2428
CXVisibility_Invalid
,
2429
2430
/** Symbol not seen by the linker. */
2431
CXVisibility_Hidden
,
2432
/** Symbol seen by the linker but resolves to a symbol inside this object. */
2433
CXVisibility_Protected
,
2434
/** Symbol seen by the linker and acts like a normal symbol. */
2435
CXVisibility_Default
2436
};
2437
2438
/**
2439
* Describe the visibility of the entity referred to by a cursor.
2440
*
2441
* This returns the default visibility if not explicitly specified by
2442
* a visibility attribute. The default visibility may be changed by
2443
* commandline arguments.
2444
*
2445
* \param cursor The cursor to query.
2446
*
2447
* \returns The visibility of the cursor.
2448
*/
2449
CINDEX_LINKAGE
enum
CXVisibilityKind
clang_getCursorVisibility
(
CXCursor
cursor);
2450
2451
/**
2452
* Determine the availability of the entity that this cursor refers to,
2453
* taking the current target platform into account.
2454
*
2455
* \param cursor The cursor to query.
2456
*
2457
* \returns The availability of the cursor.
2458
*/
2459
CINDEX_LINKAGE
enum
CXAvailabilityKind
2460
clang_getCursorAvailability
(
CXCursor
cursor);
2461
2462
/**
2463
* Describes the availability of a given entity on a particular platform, e.g.,
2464
* a particular class might only be available on Mac OS 10.7 or newer.
2465
*/
2466
typedef
struct
CXPlatformAvailability
{
2467
/**
2468
* A string that describes the platform for which this structure
2469
* provides availability information.
2470
*
2471
* Possible values are "ios" or "macos".
2472
*/
2473
CXString
Platform
;
2474
/**
2475
* The version number in which this entity was introduced.
2476
*/
2477
CXVersion
Introduced
;
2478
/**
2479
* The version number in which this entity was deprecated (but is
2480
* still available).
2481
*/
2482
CXVersion
Deprecated
;
2483
/**
2484
* The version number in which this entity was obsoleted, and therefore
2485
* is no longer available.
2486
*/
2487
CXVersion
Obsoleted
;
2488
/**
2489
* Whether the entity is unconditionally unavailable on this platform.
2490
*/
2491
int
Unavailable
;
2492
/**
2493
* An optional message to provide to a user of this API, e.g., to
2494
* suggest replacement APIs.
2495
*/
2496
CXString
Message
;
2497
}
CXPlatformAvailability
;
2498
2499
/**
2500
* Determine the availability of the entity that this cursor refers to
2501
* on any platforms for which availability information is known.
2502
*
2503
* \param cursor The cursor to query.
2504
*
2505
* \param always_deprecated If non-NULL, will be set to indicate whether the
2506
* entity is deprecated on all platforms.
2507
*
2508
* \param deprecated_message If non-NULL, will be set to the message text
2509
* provided along with the unconditional deprecation of this entity. The client
2510
* is responsible for deallocating this string.
2511
*
2512
* \param always_unavailable If non-NULL, will be set to indicate whether the
2513
* entity is unavailable on all platforms.
2514
*
2515
* \param unavailable_message If non-NULL, will be set to the message text
2516
* provided along with the unconditional unavailability of this entity. The
2517
* client is responsible for deallocating this string.
2518
*
2519
* \param availability If non-NULL, an array of CXPlatformAvailability instances
2520
* that will be populated with platform availability information, up to either
2521
* the number of platforms for which availability information is available (as
2522
* returned by this function) or \c availability_size, whichever is smaller.
2523
*
2524
* \param availability_size The number of elements available in the
2525
* \c availability array.
2526
*
2527
* \returns The number of platforms (N) for which availability information is
2528
* available (which is unrelated to \c availability_size).
2529
*
2530
* Note that the client is responsible for calling
2531
* \c clang_disposeCXPlatformAvailability to free each of the
2532
* platform-availability structures returned. There are
2533
* \c min(N, availability_size) such structures.
2534
*/
2535
CINDEX_LINKAGE
int
clang_getCursorPlatformAvailability
(
2536
CXCursor
cursor,
int
*always_deprecated,
CXString
*deprecated_message,
2537
int
*always_unavailable,
CXString
*unavailable_message,
2538
CXPlatformAvailability
*availability,
int
availability_size);
2539
2540
/**
2541
* Free the memory associated with a \c CXPlatformAvailability structure.
2542
*/
2543
CINDEX_LINKAGE
void
2544
clang_disposeCXPlatformAvailability
(
CXPlatformAvailability
*availability);
2545
2546
/**
2547
* If cursor refers to a variable declaration and it has initializer returns
2548
* cursor referring to the initializer otherwise return null cursor.
2549
*/
2550
CINDEX_LINKAGE
CXCursor
clang_Cursor_getVarDeclInitializer
(
CXCursor
cursor);
2551
2552
/**
2553
* If cursor refers to a variable declaration that has global storage returns 1.
2554
* If cursor refers to a variable declaration that doesn't have global storage
2555
* returns 0. Otherwise returns -1.
2556
*/
2557
CINDEX_LINKAGE
int
clang_Cursor_hasVarDeclGlobalStorage
(
CXCursor
cursor);
2558
2559
/**
2560
* If cursor refers to a variable declaration that has external storage
2561
* returns 1. If cursor refers to a variable declaration that doesn't have
2562
* external storage returns 0. Otherwise returns -1.
2563
*/
2564
CINDEX_LINKAGE
int
clang_Cursor_hasVarDeclExternalStorage
(
CXCursor
cursor);
2565
2566
/**
2567
* Describe the "language" of the entity referred to by a cursor.
2568
*/
2569
enum
CXLanguageKind
{
2570
CXLanguage_Invalid
= 0,
2571
CXLanguage_C
,
2572
CXLanguage_ObjC
,
2573
CXLanguage_CPlusPlus
2574
};
2575
2576
/**
2577
* Determine the "language" of the entity referred to by a given cursor.
2578
*/
2579
CINDEX_LINKAGE
enum
CXLanguageKind
clang_getCursorLanguage
(
CXCursor
cursor);
2580
2581
/**
2582
* Describe the "thread-local storage (TLS) kind" of the declaration
2583
* referred to by a cursor.
2584
*/
2585
enum
CXTLSKind
{
CXTLS_None
= 0,
CXTLS_Dynamic
,
CXTLS_Static
};
2586
2587
/**
2588
* Determine the "thread-local storage (TLS) kind" of the declaration
2589
* referred to by a cursor.
2590
*/
2591
CINDEX_LINKAGE
enum
CXTLSKind
clang_getCursorTLSKind
(
CXCursor
cursor);
2592
2593
/**
2594
* Returns the translation unit that a cursor originated from.
2595
*/
2596
CINDEX_LINKAGE
CXTranslationUnit
clang_Cursor_getTranslationUnit
(
CXCursor
);
2597
2598
/**
2599
* A fast container representing a set of CXCursors.
2600
*/
2601
typedef
struct
CXCursorSetImpl *
CXCursorSet
;
2602
2603
/**
2604
* Creates an empty CXCursorSet.
2605
*/
2606
CINDEX_LINKAGE
CXCursorSet
clang_createCXCursorSet
(
void
);
2607
2608
/**
2609
* Disposes a CXCursorSet and releases its associated memory.
2610
*/
2611
CINDEX_LINKAGE
void
clang_disposeCXCursorSet
(
CXCursorSet
cset);
2612
2613
/**
2614
* Queries a CXCursorSet to see if it contains a specific CXCursor.
2615
*
2616
* \returns non-zero if the set contains the specified cursor.
2617
*/
2618
CINDEX_LINKAGE
unsigned
clang_CXCursorSet_contains
(
CXCursorSet
cset,
2619
CXCursor
cursor);
2620
2621
/**
2622
* Inserts a CXCursor into a CXCursorSet.
2623
*
2624
* \returns zero if the CXCursor was already in the set, and non-zero otherwise.
2625
*/
2626
CINDEX_LINKAGE
unsigned
clang_CXCursorSet_insert
(
CXCursorSet
cset,
2627
CXCursor
cursor);
2628
2629
/**
2630
* Determine the semantic parent of the given cursor.
2631
*
2632
* The semantic parent of a cursor is the cursor that semantically contains
2633
* the given \p cursor. For many declarations, the lexical and semantic parents
2634
* are equivalent (the lexical parent is returned by
2635
* \c clang_getCursorLexicalParent()). They diverge when declarations or
2636
* definitions are provided out-of-line. For example:
2637
*
2638
* \code
2639
* class C {
2640
* void f();
2641
* };
2642
*
2643
* void C::f() { }
2644
* \endcode
2645
*
2646
* In the out-of-line definition of \c C::f, the semantic parent is
2647
* the class \c C, of which this function is a member. The lexical parent is
2648
* the place where the declaration actually occurs in the source code; in this
2649
* case, the definition occurs in the translation unit. In general, the
2650
* lexical parent for a given entity can change without affecting the semantics
2651
* of the program, and the lexical parent of different declarations of the
2652
* same entity may be different. Changing the semantic parent of a declaration,
2653
* on the other hand, can have a major impact on semantics, and redeclarations
2654
* of a particular entity should all have the same semantic context.
2655
*
2656
* In the example above, both declarations of \c C::f have \c C as their
2657
* semantic context, while the lexical context of the first \c C::f is \c C
2658
* and the lexical context of the second \c C::f is the translation unit.
2659
*
2660
* For global declarations, the semantic parent is the translation unit.
2661
*/
2662
CINDEX_LINKAGE
CXCursor
clang_getCursorSemanticParent
(
CXCursor
cursor);
2663
2664
/**
2665
* Determine the lexical parent of the given cursor.
2666
*
2667
* The lexical parent of a cursor is the cursor in which the given \p cursor
2668
* was actually written. For many declarations, the lexical and semantic parents
2669
* are equivalent (the semantic parent is returned by
2670
* \c clang_getCursorSemanticParent()). They diverge when declarations or
2671
* definitions are provided out-of-line. For example:
2672
*
2673
* \code
2674
* class C {
2675
* void f();
2676
* };
2677
*
2678
* void C::f() { }
2679
* \endcode
2680
*
2681
* In the out-of-line definition of \c C::f, the semantic parent is
2682
* the class \c C, of which this function is a member. The lexical parent is
2683
* the place where the declaration actually occurs in the source code; in this
2684
* case, the definition occurs in the translation unit. In general, the
2685
* lexical parent for a given entity can change without affecting the semantics
2686
* of the program, and the lexical parent of different declarations of the
2687
* same entity may be different. Changing the semantic parent of a declaration,
2688
* on the other hand, can have a major impact on semantics, and redeclarations
2689
* of a particular entity should all have the same semantic context.
2690
*
2691
* In the example above, both declarations of \c C::f have \c C as their
2692
* semantic context, while the lexical context of the first \c C::f is \c C
2693
* and the lexical context of the second \c C::f is the translation unit.
2694
*
2695
* For declarations written in the global scope, the lexical parent is
2696
* the translation unit.
2697
*/
2698
CINDEX_LINKAGE
CXCursor
clang_getCursorLexicalParent
(
CXCursor
cursor);
2699
2700
/**
2701
* Determine the set of methods that are overridden by the given
2702
* method.
2703
*
2704
* In both Objective-C and C++, a method (aka virtual member function,
2705
* in C++) can override a virtual method in a base class. For
2706
* Objective-C, a method is said to override any method in the class's
2707
* base class, its protocols, or its categories' protocols, that has the same
2708
* selector and is of the same kind (class or instance).
2709
* If no such method exists, the search continues to the class's superclass,
2710
* its protocols, and its categories, and so on. A method from an Objective-C
2711
* implementation is considered to override the same methods as its
2712
* corresponding method in the interface.
2713
*
2714
* For C++, a virtual member function overrides any virtual member
2715
* function with the same signature that occurs in its base
2716
* classes. With multiple inheritance, a virtual member function can
2717
* override several virtual member functions coming from different
2718
* base classes.
2719
*
2720
* In all cases, this function determines the immediate overridden
2721
* method, rather than all of the overridden methods. For example, if
2722
* a method is originally declared in a class A, then overridden in B
2723
* (which in inherits from A) and also in C (which inherited from B),
2724
* then the only overridden method returned from this function when
2725
* invoked on C's method will be B's method. The client may then
2726
* invoke this function again, given the previously-found overridden
2727
* methods, to map out the complete method-override set.
2728
*
2729
* \param cursor A cursor representing an Objective-C or C++
2730
* method. This routine will compute the set of methods that this
2731
* method overrides.
2732
*
2733
* \param overridden A pointer whose pointee will be replaced with a
2734
* pointer to an array of cursors, representing the set of overridden
2735
* methods. If there are no overridden methods, the pointee will be
2736
* set to NULL. The pointee must be freed via a call to
2737
* \c clang_disposeOverriddenCursors().
2738
*
2739
* \param num_overridden A pointer to the number of overridden
2740
* functions, will be set to the number of overridden functions in the
2741
* array pointed to by \p overridden.
2742
*/
2743
CINDEX_LINKAGE
void
clang_getOverriddenCursors
(
CXCursor
cursor,
2744
CXCursor
**overridden,
2745
unsigned
*num_overridden);
2746
2747
/**
2748
* Free the set of overridden cursors returned by \c
2749
* clang_getOverriddenCursors().
2750
*/
2751
CINDEX_LINKAGE
void
clang_disposeOverriddenCursors
(
CXCursor
*overridden);
2752
2753
/**
2754
* Retrieve the file that is included by the given inclusion directive
2755
* cursor.
2756
*/
2757
CINDEX_LINKAGE
CXFile
clang_getIncludedFile
(
CXCursor
cursor);
2758
2759
/**
2760
* @}
2761
*/
2762
2763
/**
2764
* \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code
2765
*
2766
* Cursors represent a location within the Abstract Syntax Tree (AST). These
2767
* routines help map between cursors and the physical locations where the
2768
* described entities occur in the source code. The mapping is provided in
2769
* both directions, so one can map from source code to the AST and back.
2770
*
2771
* @{
2772
*/
2773
2774
/**
2775
* Map a source location to the cursor that describes the entity at that
2776
* location in the source code.
2777
*
2778
* clang_getCursor() maps an arbitrary source location within a translation
2779
* unit down to the most specific cursor that describes the entity at that
2780
* location. For example, given an expression \c x + y, invoking
2781
* clang_getCursor() with a source location pointing to "x" will return the
2782
* cursor for "x"; similarly for "y". If the cursor points anywhere between
2783
* "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
2784
* will return a cursor referring to the "+" expression.
2785
*
2786
* \returns a cursor representing the entity at the given source location, or
2787
* a NULL cursor if no such entity can be found.
2788
*/
2789
CINDEX_LINKAGE
CXCursor
clang_getCursor
(
CXTranslationUnit
,
CXSourceLocation
);
2790
2791
/**
2792
* Retrieve the physical location of the source constructor referenced
2793
* by the given cursor.
2794
*
2795
* The location of a declaration is typically the location of the name of that
2796
* declaration, where the name of that declaration would occur if it is
2797
* unnamed, or some keyword that introduces that particular declaration.
2798
* The location of a reference is where that reference occurs within the
2799
* source code.
2800
*/
2801
CINDEX_LINKAGE
CXSourceLocation
clang_getCursorLocation
(
CXCursor
);
2802
2803
/**
2804
* Retrieve the physical extent of the source construct referenced by
2805
* the given cursor.
2806
*
2807
* The extent of a cursor starts with the file/line/column pointing at the
2808
* first character within the source construct that the cursor refers to and
2809
* ends with the last character within that source construct. For a
2810
* declaration, the extent covers the declaration itself. For a reference,
2811
* the extent covers the location of the reference (e.g., where the referenced
2812
* entity was actually used).
2813
*/
2814
CINDEX_LINKAGE
CXSourceRange
clang_getCursorExtent
(
CXCursor
);
2815
2816
/**
2817
* @}
2818
*/
2819
2820
/**
2821
* \defgroup CINDEX_TYPES Type information for CXCursors
2822
*
2823
* @{
2824
*/
2825
2826
/**
2827
* Describes the kind of type
2828
*/
2829
enum
CXTypeKind
{
2830
/**
2831
* Represents an invalid type (e.g., where no type is available).
2832
*/
2833
CXType_Invalid
= 0,
2834
2835
/**
2836
* A type whose specific kind is not exposed via this
2837
* interface.
2838
*/
2839
CXType_Unexposed
= 1,
2840
2841
/* Builtin types */
2842
CXType_Void
= 2,
2843
CXType_Bool
= 3,
2844
CXType_Char_U
= 4,
2845
CXType_UChar
= 5,
2846
CXType_Char16
= 6,
2847
CXType_Char32
= 7,
2848
CXType_UShort
= 8,
2849
CXType_UInt
= 9,
2850
CXType_ULong
= 10,
2851
CXType_ULongLong
= 11,
2852
CXType_UInt128
= 12,
2853
CXType_Char_S
= 13,
2854
CXType_SChar
= 14,
2855
CXType_WChar
= 15,
2856
CXType_Short
= 16,
2857
CXType_Int
= 17,
2858
CXType_Long
= 18,
2859
CXType_LongLong
= 19,
2860
CXType_Int128
= 20,
2861
CXType_Float
= 21,
2862
CXType_Double
= 22,
2863
CXType_LongDouble
= 23,
2864
CXType_NullPtr
= 24,
2865
CXType_Overload
= 25,
2866
CXType_Dependent
= 26,
2867
CXType_ObjCId
= 27,
2868
CXType_ObjCClass
= 28,
2869
CXType_ObjCSel
= 29,
2870
CXType_Float128
= 30,
2871
CXType_Half
= 31,
2872
CXType_Float16
= 32,
2873
CXType_ShortAccum
= 33,
2874
CXType_Accum
= 34,
2875
CXType_LongAccum
= 35,
2876
CXType_UShortAccum
= 36,
2877
CXType_UAccum
= 37,
2878
CXType_ULongAccum
= 38,
2879
CXType_BFloat16
= 39,
2880
CXType_Ibm128
= 40,
2881
CXType_FirstBuiltin
=
CXType_Void
,
2882
CXType_LastBuiltin
=
CXType_Ibm128
,
2883
2884
CXType_Complex
= 100,
2885
CXType_Pointer
= 101,
2886
CXType_BlockPointer
= 102,
2887
CXType_LValueReference
= 103,
2888
CXType_RValueReference
= 104,
2889
CXType_Record
= 105,
2890
CXType_Enum
= 106,
2891
CXType_Typedef
= 107,
2892
CXType_ObjCInterface
= 108,
2893
CXType_ObjCObjectPointer
= 109,
2894
CXType_FunctionNoProto
= 110,
2895
CXType_FunctionProto
= 111,
2896
CXType_ConstantArray
= 112,
2897
CXType_Vector
= 113,
2898
CXType_IncompleteArray
= 114,
2899
CXType_VariableArray
= 115,
2900
CXType_DependentSizedArray
= 116,
2901
CXType_MemberPointer
= 117,
2902
CXType_Auto
= 118,
2903
2904
/**
2905
* Represents a type that was referred to using an elaborated type keyword.
2906
*
2907
* E.g., struct S, or via a qualified name, e.g., N::M::type, or both.
2908
*/
2909
CXType_Elaborated
= 119,
2910
2911
/* OpenCL PipeType. */
2912
CXType_Pipe
= 120,
2913
2914
/* OpenCL builtin types. */
2915
CXType_OCLImage1dRO
= 121,
2916
CXType_OCLImage1dArrayRO
= 122,
2917
CXType_OCLImage1dBufferRO
= 123,
2918
CXType_OCLImage2dRO
= 124,
2919
CXType_OCLImage2dArrayRO
= 125,
2920
CXType_OCLImage2dDepthRO
= 126,
2921
CXType_OCLImage2dArrayDepthRO
= 127,
2922
CXType_OCLImage2dMSAARO
= 128,
2923
CXType_OCLImage2dArrayMSAARO
= 129,
2924
CXType_OCLImage2dMSAADepthRO
= 130,
2925
CXType_OCLImage2dArrayMSAADepthRO
= 131,
2926
CXType_OCLImage3dRO
= 132,
2927
CXType_OCLImage1dWO
= 133,
2928
CXType_OCLImage1dArrayWO
= 134,
2929
CXType_OCLImage1dBufferWO
= 135,
2930
CXType_OCLImage2dWO
= 136,
2931
CXType_OCLImage2dArrayWO
= 137,
2932
CXType_OCLImage2dDepthWO
= 138,
2933
CXType_OCLImage2dArrayDepthWO
= 139,
2934
CXType_OCLImage2dMSAAWO
= 140,
2935
CXType_OCLImage2dArrayMSAAWO
= 141,
2936
CXType_OCLImage2dMSAADepthWO
= 142,
2937
CXType_OCLImage2dArrayMSAADepthWO
= 143,
2938
CXType_OCLImage3dWO
= 144,
2939
CXType_OCLImage1dRW
= 145,
2940
CXType_OCLImage1dArrayRW
= 146,
2941
CXType_OCLImage1dBufferRW
= 147,
2942
CXType_OCLImage2dRW
= 148,
2943
CXType_OCLImage2dArrayRW
= 149,
2944
CXType_OCLImage2dDepthRW
= 150,
2945
CXType_OCLImage2dArrayDepthRW
= 151,
2946
CXType_OCLImage2dMSAARW
= 152,
2947
CXType_OCLImage2dArrayMSAARW
= 153,
2948
CXType_OCLImage2dMSAADepthRW
= 154,
2949
CXType_OCLImage2dArrayMSAADepthRW
= 155,
2950
CXType_OCLImage3dRW
= 156,
2951
CXType_OCLSampler
= 157,
2952
CXType_OCLEvent
= 158,
2953
CXType_OCLQueue
= 159,
2954
CXType_OCLReserveID
= 160,
2955
2956
CXType_ObjCObject
= 161,
2957
CXType_ObjCTypeParam
= 162,
2958
CXType_Attributed
= 163,
2959
2960
CXType_OCLIntelSubgroupAVCMcePayload
= 164,
2961
CXType_OCLIntelSubgroupAVCImePayload
= 165,
2962
CXType_OCLIntelSubgroupAVCRefPayload
= 166,
2963
CXType_OCLIntelSubgroupAVCSicPayload
= 167,
2964
CXType_OCLIntelSubgroupAVCMceResult
= 168,
2965
CXType_OCLIntelSubgroupAVCImeResult
= 169,
2966
CXType_OCLIntelSubgroupAVCRefResult
= 170,
2967
CXType_OCLIntelSubgroupAVCSicResult
= 171,
2968
CXType_OCLIntelSubgroupAVCImeResultSingleReferenceStreamout
= 172,
2969
CXType_OCLIntelSubgroupAVCImeResultDualReferenceStreamout
= 173,
2970
CXType_OCLIntelSubgroupAVCImeSingleReferenceStreamin
= 174,
2971
CXType_OCLIntelSubgroupAVCImeDualReferenceStreamin
= 175,
2972
2973
/* Old aliases for AVC OpenCL extension types. */
2974
CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout
= 172,
2975
CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout
= 173,
2976
CXType_OCLIntelSubgroupAVCImeSingleRefStreamin
= 174,
2977
CXType_OCLIntelSubgroupAVCImeDualRefStreamin
= 175,
2978
2979
CXType_ExtVector
= 176,
2980
CXType_Atomic
= 177,
2981
CXType_BTFTagAttributed
= 178,
2982
2983
// HLSL Intangible Types
2984
CXType_HLSLResource
= 179
2985
};
2986
2987
/**
2988
* Describes the calling convention of a function type
2989
*/
2990
enum
CXCallingConv
{
2991
CXCallingConv_Default
= 0,
2992
CXCallingConv_C
= 1,
2993
CXCallingConv_X86StdCall
= 2,
2994
CXCallingConv_X86FastCall
= 3,
2995
CXCallingConv_X86ThisCall
= 4,
2996
CXCallingConv_X86Pascal
= 5,
2997
CXCallingConv_AAPCS
= 6,
2998
CXCallingConv_AAPCS_VFP
= 7,
2999
CXCallingConv_X86RegCall
= 8,
3000
CXCallingConv_IntelOclBicc
= 9,
3001
CXCallingConv_Win64
= 10,
3002
/* Alias for compatibility with older versions of API. */
3003
CXCallingConv_X86_64Win64
=
CXCallingConv_Win64
,
3004
CXCallingConv_X86_64SysV
= 11,
3005
CXCallingConv_X86VectorCall
= 12,
3006
CXCallingConv_Swift
= 13,
3007
CXCallingConv_PreserveMost
= 14,
3008
CXCallingConv_PreserveAll
= 15,
3009
CXCallingConv_AArch64VectorCall
= 16,
3010
CXCallingConv_SwiftAsync
= 17,
3011
CXCallingConv_AArch64SVEPCS
= 18,
3012
CXCallingConv_M68kRTD
= 19,
3013
CXCallingConv_PreserveNone
= 20,
3014
CXCallingConv_RISCVVectorCall
= 21,
3015
3016
CXCallingConv_Invalid
= 100,
3017
CXCallingConv_Unexposed
= 200
3018
};
3019
3020
/**
3021
* The type of an element in the abstract syntax tree.
3022
*
3023
*/
3024
typedef
struct
{
3025
enum
CXTypeKind
kind
;
3026
void
*data[2];
3027
}
CXType
;
3028
3029
/**
3030
* Retrieve the type of a CXCursor (if any).
3031
*/
3032
CINDEX_LINKAGE
CXType
clang_getCursorType
(
CXCursor
C);
3033
3034
/**
3035
* Pretty-print the underlying type using the rules of the
3036
* language of the translation unit from which it came.
3037
*
3038
* If the type is invalid, an empty string is returned.
3039
*/
3040
CINDEX_LINKAGE
CXString
clang_getTypeSpelling
(
CXType
CT);
3041
3042
/**
3043
* Retrieve the underlying type of a typedef declaration.
3044
*
3045
* If the cursor does not reference a typedef declaration, an invalid type is
3046
* returned.
3047
*/
3048
CINDEX_LINKAGE
CXType
clang_getTypedefDeclUnderlyingType
(
CXCursor
C);
3049
3050
/**
3051
* Retrieve the integer type of an enum declaration.
3052
*
3053
* If the cursor does not reference an enum declaration, an invalid type is
3054
* returned.
3055
*/
3056
CINDEX_LINKAGE
CXType
clang_getEnumDeclIntegerType
(
CXCursor
C);
3057
3058
/**
3059
* Retrieve the integer value of an enum constant declaration as a signed
3060
* long long.
3061
*
3062
* If the cursor does not reference an enum constant declaration, LLONG_MIN is
3063
* returned. Since this is also potentially a valid constant value, the kind of
3064
* the cursor must be verified before calling this function.
3065
*/
3066
CINDEX_LINKAGE
long
long
clang_getEnumConstantDeclValue
(
CXCursor
C);
3067
3068
/**
3069
* Retrieve the integer value of an enum constant declaration as an unsigned
3070
* long long.
3071
*
3072
* If the cursor does not reference an enum constant declaration, ULLONG_MAX is
3073
* returned. Since this is also potentially a valid constant value, the kind of
3074
* the cursor must be verified before calling this function.
3075
*/
3076
CINDEX_LINKAGE
unsigned
long
long
3077
clang_getEnumConstantDeclUnsignedValue
(
CXCursor
C);
3078
3079
/**
3080
* Returns non-zero if the cursor specifies a Record member that is a bit-field.
3081
*/
3082
CINDEX_LINKAGE
unsigned
clang_Cursor_isBitField
(
CXCursor
C);
3083
3084
/**
3085
* Retrieve the bit width of a bit-field declaration as an integer.
3086
*
3087
* If the cursor does not reference a bit-field, or if the bit-field's width
3088
* expression cannot be evaluated, -1 is returned.
3089
*
3090
* For example:
3091
* \code
3092
* if (clang_Cursor_isBitField(Cursor)) {
3093
* int Width = clang_getFieldDeclBitWidth(Cursor);
3094
* if (Width != -1) {
3095
* // The bit-field width is not value-dependent.
3096
* }
3097
* }
3098
* \endcode
3099
*/
3100
CINDEX_LINKAGE
int
clang_getFieldDeclBitWidth
(
CXCursor
C);
3101
3102
/**
3103
* Retrieve the number of non-variadic arguments associated with a given
3104
* cursor.
3105
*
3106
* The number of arguments can be determined for calls as well as for
3107
* declarations of functions or methods. For other cursors -1 is returned.
3108
*/
3109
CINDEX_LINKAGE
int
clang_Cursor_getNumArguments
(
CXCursor
C);
3110
3111
/**
3112
* Retrieve the argument cursor of a function or method.
3113
*
3114
* The argument cursor can be determined for calls as well as for declarations
3115
* of functions or methods. For other cursors and for invalid indices, an
3116
* invalid cursor is returned.
3117
*/
3118
CINDEX_LINKAGE
CXCursor
clang_Cursor_getArgument
(
CXCursor
C,
unsigned
i);
3119
3120
/**
3121
* Describes the kind of a template argument.
3122
*
3123
* See the definition of llvm::clang::TemplateArgument::ArgKind for full
3124
* element descriptions.
3125
*/
3126
enum
CXTemplateArgumentKind
{
3127
CXTemplateArgumentKind_Null
,
3128
CXTemplateArgumentKind_Type
,
3129
CXTemplateArgumentKind_Declaration
,
3130
CXTemplateArgumentKind_NullPtr
,
3131
CXTemplateArgumentKind_Integral
,
3132
CXTemplateArgumentKind_Template
,
3133
CXTemplateArgumentKind_TemplateExpansion
,
3134
CXTemplateArgumentKind_Expression
,
3135
CXTemplateArgumentKind_Pack
,
3136
/* Indicates an error case, preventing the kind from being deduced. */
3137
CXTemplateArgumentKind_Invalid
3138
};
3139
3140
/**
3141
* Returns the number of template args of a function, struct, or class decl
3142
* representing a template specialization.
3143
*
3144
* If the argument cursor cannot be converted into a template function
3145
* declaration, -1 is returned.
3146
*
3147
* For example, for the following declaration and specialization:
3148
* template <typename T, int kInt, bool kBool>
3149
* void foo() { ... }
3150
*
3151
* template <>
3152
* void foo<float, -7, true>();
3153
*
3154
* The value 3 would be returned from this call.
3155
*/
3156
CINDEX_LINKAGE
int
clang_Cursor_getNumTemplateArguments
(
CXCursor
C);
3157
3158
/**
3159
* Retrieve the kind of the I'th template argument of the CXCursor C.
3160
*
3161
* If the argument CXCursor does not represent a FunctionDecl, StructDecl, or
3162
* ClassTemplatePartialSpecialization, an invalid template argument kind is
3163
* returned.
3164
*
3165
* For example, for the following declaration and specialization:
3166
* template <typename T, int kInt, bool kBool>
3167
* void foo() { ... }
3168
*
3169
* template <>
3170
* void foo<float, -7, true>();
3171
*
3172
* For I = 0, 1, and 2, Type, Integral, and Integral will be returned,
3173
* respectively.
3174
*/
3175
CINDEX_LINKAGE
enum
CXTemplateArgumentKind
3176
clang_Cursor_getTemplateArgumentKind
(
CXCursor
C,
unsigned
I);
3177
3178
/**
3179
* Retrieve a CXType representing the type of a TemplateArgument of a
3180
* function decl representing a template specialization.
3181
*
3182
* If the argument CXCursor does not represent a FunctionDecl, StructDecl,
3183
* ClassDecl or ClassTemplatePartialSpecialization whose I'th template argument
3184
* has a kind of CXTemplateArgKind_Integral, an invalid type is returned.
3185
*
3186
* For example, for the following declaration and specialization:
3187
* template <typename T, int kInt, bool kBool>
3188
* void foo() { ... }
3189
*
3190
* template <>
3191
* void foo<float, -7, true>();
3192
*
3193
* If called with I = 0, "float", will be returned.
3194
* Invalid types will be returned for I == 1 or 2.
3195
*/
3196
CINDEX_LINKAGE
CXType
clang_Cursor_getTemplateArgumentType
(
CXCursor
C,
3197
unsigned
I);
3198
3199
/**
3200
* Retrieve the value of an Integral TemplateArgument (of a function
3201
* decl representing a template specialization) as a signed long long.
3202
*
3203
* It is undefined to call this function on a CXCursor that does not represent a
3204
* FunctionDecl, StructDecl, ClassDecl or ClassTemplatePartialSpecialization
3205
* whose I'th template argument is not an integral value.
3206
*
3207
* For example, for the following declaration and specialization:
3208
* template <typename T, int kInt, bool kBool>
3209
* void foo() { ... }
3210
*
3211
* template <>
3212
* void foo<float, -7, true>();
3213
*
3214
* If called with I = 1 or 2, -7 or true will be returned, respectively.
3215
* For I == 0, this function's behavior is undefined.
3216
*/
3217
CINDEX_LINKAGE
long
long
clang_Cursor_getTemplateArgumentValue
(
CXCursor
C,
3218
unsigned
I);
3219
3220
/**
3221
* Retrieve the value of an Integral TemplateArgument (of a function
3222
* decl representing a template specialization) as an unsigned long long.
3223
*
3224
* It is undefined to call this function on a CXCursor that does not represent a
3225
* FunctionDecl, StructDecl, ClassDecl or ClassTemplatePartialSpecialization or
3226
* whose I'th template argument is not an integral value.
3227
*
3228
* For example, for the following declaration and specialization:
3229
* template <typename T, int kInt, bool kBool>
3230
* void foo() { ... }
3231
*
3232
* template <>
3233
* void foo<float, 2147483649, true>();
3234
*
3235
* If called with I = 1 or 2, 2147483649 or true will be returned, respectively.
3236
* For I == 0, this function's behavior is undefined.
3237
*/
3238
CINDEX_LINKAGE
unsigned
long
long
3239
clang_Cursor_getTemplateArgumentUnsignedValue
(
CXCursor
C,
unsigned
I);
3240
3241
/**
3242
* Determine whether two CXTypes represent the same type.
3243
*
3244
* \returns non-zero if the CXTypes represent the same type and
3245
* zero otherwise.
3246
*/
3247
CINDEX_LINKAGE
unsigned
clang_equalTypes
(
CXType
A,
CXType
B);
3248
3249
/**
3250
* Return the canonical type for a CXType.
3251
*
3252
* Clang's type system explicitly models typedefs and all the ways
3253
* a specific type can be represented. The canonical type is the underlying
3254
* type with all the "sugar" removed. For example, if 'T' is a typedef
3255
* for 'int', the canonical type for 'T' would be 'int'.
3256
*/
3257
CINDEX_LINKAGE
CXType
clang_getCanonicalType
(
CXType
T);
3258
3259
/**
3260
* Determine whether a CXType has the "const" qualifier set,
3261
* without looking through typedefs that may have added "const" at a
3262
* different level.
3263
*/
3264
CINDEX_LINKAGE
unsigned
clang_isConstQualifiedType
(
CXType
T);
3265
3266
/**
3267
* Determine whether a CXCursor that is a macro, is
3268
* function like.
3269
*/
3270
CINDEX_LINKAGE
unsigned
clang_Cursor_isMacroFunctionLike
(
CXCursor
C);
3271
3272
/**
3273
* Determine whether a CXCursor that is a macro, is a
3274
* builtin one.
3275
*/
3276
CINDEX_LINKAGE
unsigned
clang_Cursor_isMacroBuiltin
(
CXCursor
C);
3277
3278
/**
3279
* Determine whether a CXCursor that is a function declaration, is an
3280
* inline declaration.
3281
*/
3282
CINDEX_LINKAGE
unsigned
clang_Cursor_isFunctionInlined
(
CXCursor
C);
3283
3284
/**
3285
* Determine whether a CXType has the "volatile" qualifier set,
3286
* without looking through typedefs that may have added "volatile" at
3287
* a different level.
3288
*/
3289
CINDEX_LINKAGE
unsigned
clang_isVolatileQualifiedType
(
CXType
T);
3290
3291
/**
3292
* Determine whether a CXType has the "restrict" qualifier set,
3293
* without looking through typedefs that may have added "restrict" at a
3294
* different level.
3295
*/
3296
CINDEX_LINKAGE
unsigned
clang_isRestrictQualifiedType
(
CXType
T);
3297
3298
/**
3299
* Returns the address space of the given type.
3300
*/
3301
CINDEX_LINKAGE
unsigned
clang_getAddressSpace
(
CXType
T);
3302
3303
/**
3304
* Returns the typedef name of the given type.
3305
*/
3306
CINDEX_LINKAGE
CXString
clang_getTypedefName
(
CXType
CT);
3307
3308
/**
3309
* For pointer types, returns the type of the pointee.
3310
*/
3311
CINDEX_LINKAGE
CXType
clang_getPointeeType
(
CXType
T);
3312
3313
/**
3314
* Retrieve the unqualified variant of the given type, removing as
3315
* little sugar as possible.
3316
*
3317
* For example, given the following series of typedefs:
3318
*
3319
* \code
3320
* typedef int Integer;
3321
* typedef const Integer CInteger;
3322
* typedef CInteger DifferenceType;
3323
* \endcode
3324
*
3325
* Executing \c clang_getUnqualifiedType() on a \c CXType that
3326
* represents \c DifferenceType, will desugar to a type representing
3327
* \c Integer, that has no qualifiers.
3328
*
3329
* And, executing \c clang_getUnqualifiedType() on the type of the
3330
* first argument of the following function declaration:
3331
*
3332
* \code
3333
* void foo(const int);
3334
* \endcode
3335
*
3336
* Will return a type representing \c int, removing the \c const
3337
* qualifier.
3338
*
3339
* Sugar over array types is not desugared.
3340
*
3341
* A type can be checked for qualifiers with \c
3342
* clang_isConstQualifiedType(), \c clang_isVolatileQualifiedType()
3343
* and \c clang_isRestrictQualifiedType().
3344
*
3345
* A type that resulted from a call to \c clang_getUnqualifiedType
3346
* will return \c false for all of the above calls.
3347
*/
3348
CINDEX_LINKAGE
CXType
clang_getUnqualifiedType
(
CXType
CT);
3349
3350
/**
3351
* For reference types (e.g., "const int&"), returns the type that the
3352
* reference refers to (e.g "const int").
3353
*
3354
* Otherwise, returns the type itself.
3355
*
3356
* A type that has kind \c CXType_LValueReference or
3357
* \c CXType_RValueReference is a reference type.
3358
*/
3359
CINDEX_LINKAGE
CXType
clang_getNonReferenceType
(
CXType
CT);
3360
3361
/**
3362
* Return the cursor for the declaration of the given type.
3363
*/
3364
CINDEX_LINKAGE
CXCursor
clang_getTypeDeclaration
(
CXType
T);
3365
3366
/**
3367
* Returns the Objective-C type encoding for the specified declaration.
3368
*/
3369
CINDEX_LINKAGE
CXString
clang_getDeclObjCTypeEncoding
(
CXCursor
C);
3370
3371
/**
3372
* Returns the Objective-C type encoding for the specified CXType.
3373
*/
3374
CINDEX_LINKAGE
CXString
clang_Type_getObjCEncoding
(
CXType
type);
3375
3376
/**
3377
* Retrieve the spelling of a given CXTypeKind.
3378
*/
3379
CINDEX_LINKAGE
CXString
clang_getTypeKindSpelling
(
enum
CXTypeKind
K);
3380
3381
/**
3382
* Retrieve the calling convention associated with a function type.
3383
*
3384
* If a non-function type is passed in, CXCallingConv_Invalid is returned.
3385
*/
3386
CINDEX_LINKAGE
enum
CXCallingConv
clang_getFunctionTypeCallingConv
(
CXType
T);
3387
3388
/**
3389
* Retrieve the return type associated with a function type.
3390
*
3391
* If a non-function type is passed in, an invalid type is returned.
3392
*/
3393
CINDEX_LINKAGE
CXType
clang_getResultType
(
CXType
T);
3394
3395
/**
3396
* Retrieve the exception specification type associated with a function type.
3397
* This is a value of type CXCursor_ExceptionSpecificationKind.
3398
*
3399
* If a non-function type is passed in, an error code of -1 is returned.
3400
*/
3401
CINDEX_LINKAGE
int
clang_getExceptionSpecificationType
(
CXType
T);
3402
3403
/**
3404
* Retrieve the number of non-variadic parameters associated with a
3405
* function type.
3406
*
3407
* If a non-function type is passed in, -1 is returned.
3408
*/
3409
CINDEX_LINKAGE
int
clang_getNumArgTypes
(
CXType
T);
3410
3411
/**
3412
* Retrieve the type of a parameter of a function type.
3413
*
3414
* If a non-function type is passed in or the function does not have enough
3415
* parameters, an invalid type is returned.
3416
*/
3417
CINDEX_LINKAGE
CXType
clang_getArgType
(
CXType
T,
unsigned
i);
3418
3419
/**
3420
* Retrieves the base type of the ObjCObjectType.
3421
*
3422
* If the type is not an ObjC object, an invalid type is returned.
3423
*/
3424
CINDEX_LINKAGE
CXType
clang_Type_getObjCObjectBaseType
(
CXType
T);
3425
3426
/**
3427
* Retrieve the number of protocol references associated with an ObjC object/id.
3428
*
3429
* If the type is not an ObjC object, 0 is returned.
3430
*/
3431
CINDEX_LINKAGE
unsigned
clang_Type_getNumObjCProtocolRefs
(
CXType
T);
3432
3433
/**
3434
* Retrieve the decl for a protocol reference for an ObjC object/id.
3435
*
3436
* If the type is not an ObjC object or there are not enough protocol
3437
* references, an invalid cursor is returned.
3438
*/
3439
CINDEX_LINKAGE
CXCursor
clang_Type_getObjCProtocolDecl
(
CXType
T,
unsigned
i);
3440
3441
/**
3442
* Retrieve the number of type arguments associated with an ObjC object.
3443
*
3444
* If the type is not an ObjC object, 0 is returned.
3445
*/
3446
CINDEX_LINKAGE
unsigned
clang_Type_getNumObjCTypeArgs
(
CXType
T);
3447
3448
/**
3449
* Retrieve a type argument associated with an ObjC object.
3450
*
3451
* If the type is not an ObjC or the index is not valid,
3452
* an invalid type is returned.
3453
*/
3454
CINDEX_LINKAGE
CXType
clang_Type_getObjCTypeArg
(
CXType
T,
unsigned
i);
3455
3456
/**
3457
* Return 1 if the CXType is a variadic function type, and 0 otherwise.
3458
*/
3459
CINDEX_LINKAGE
unsigned
clang_isFunctionTypeVariadic
(
CXType
T);
3460
3461
/**
3462
* Retrieve the return type associated with a given cursor.
3463
*
3464
* This only returns a valid type if the cursor refers to a function or method.
3465
*/
3466
CINDEX_LINKAGE
CXType
clang_getCursorResultType
(
CXCursor
C);
3467
3468
/**
3469
* Retrieve the exception specification type associated with a given cursor.
3470
* This is a value of type CXCursor_ExceptionSpecificationKind.
3471
*
3472
* This only returns a valid result if the cursor refers to a function or
3473
* method.
3474
*/
3475
CINDEX_LINKAGE
int
clang_getCursorExceptionSpecificationType
(
CXCursor
C);
3476
3477
/**
3478
* Return 1 if the CXType is a POD (plain old data) type, and 0
3479
* otherwise.
3480
*/
3481
CINDEX_LINKAGE
unsigned
clang_isPODType
(
CXType
T);
3482
3483
/**
3484
* Return the element type of an array, complex, or vector type.
3485
*
3486
* If a type is passed in that is not an array, complex, or vector type,
3487
* an invalid type is returned.
3488
*/
3489
CINDEX_LINKAGE
CXType
clang_getElementType
(
CXType
T);
3490
3491
/**
3492
* Return the number of elements of an array or vector type.
3493
*
3494
* If a type is passed in that is not an array or vector type,
3495
* -1 is returned.
3496
*/
3497
CINDEX_LINKAGE
long
long
clang_getNumElements
(
CXType
T);
3498
3499
/**
3500
* Return the element type of an array type.
3501
*
3502
* If a non-array type is passed in, an invalid type is returned.
3503
*/
3504
CINDEX_LINKAGE
CXType
clang_getArrayElementType
(
CXType
T);
3505
3506
/**
3507
* Return the array size of a constant array.
3508
*
3509
* If a non-array type is passed in, -1 is returned.
3510
*/
3511
CINDEX_LINKAGE
long
long
clang_getArraySize
(
CXType
T);
3512
3513
/**
3514
* Retrieve the type named by the qualified-id.
3515
*
3516
* If a non-elaborated type is passed in, an invalid type is returned.
3517
*/
3518
CINDEX_LINKAGE
CXType
clang_Type_getNamedType
(
CXType
T);
3519
3520
/**
3521
* Determine if a typedef is 'transparent' tag.
3522
*
3523
* A typedef is considered 'transparent' if it shares a name and spelling
3524
* location with its underlying tag type, as is the case with the NS_ENUM macro.
3525
*
3526
* \returns non-zero if transparent and zero otherwise.
3527
*/
3528
CINDEX_LINKAGE
unsigned
clang_Type_isTransparentTagTypedef
(
CXType
T);
3529
3530
enum
CXTypeNullabilityKind
{
3531
/**
3532
* Values of this type can never be null.
3533
*/
3534
CXTypeNullability_NonNull
= 0,
3535
/**
3536
* Values of this type can be null.
3537
*/
3538
CXTypeNullability_Nullable
= 1,
3539
/**
3540
* Whether values of this type can be null is (explicitly)
3541
* unspecified. This captures a (fairly rare) case where we
3542
* can't conclude anything about the nullability of the type even
3543
* though it has been considered.
3544
*/
3545
CXTypeNullability_Unspecified
= 2,
3546
/**
3547
* Nullability is not applicable to this type.
3548
*/
3549
CXTypeNullability_Invalid
= 3,
3550
3551
/**
3552
* Generally behaves like Nullable, except when used in a block parameter that
3553
* was imported into a swift async method. There, swift will assume that the
3554
* parameter can get null even if no error occurred. _Nullable parameters are
3555
* assumed to only get null on error.
3556
*/
3557
CXTypeNullability_NullableResult
= 4
3558
};
3559
3560
/**
3561
* Retrieve the nullability kind of a pointer type.
3562
*/
3563
CINDEX_LINKAGE
enum
CXTypeNullabilityKind
clang_Type_getNullability
(
CXType
T);
3564
3565
/**
3566
* List the possible error codes for \c clang_Type_getSizeOf,
3567
* \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
3568
* \c clang_Cursor_getOffsetOf.
3569
*
3570
* A value of this enumeration type can be returned if the target type is not
3571
* a valid argument to sizeof, alignof or offsetof.
3572
*/
3573
enum
CXTypeLayoutError
{
3574
/**
3575
* Type is of kind CXType_Invalid.
3576
*/
3577
CXTypeLayoutError_Invalid
= -1,
3578
/**
3579
* The type is an incomplete Type.
3580
*/
3581
CXTypeLayoutError_Incomplete
= -2,
3582
/**
3583
* The type is a dependent Type.
3584
*/
3585
CXTypeLayoutError_Dependent
= -3,
3586
/**
3587
* The type is not a constant size type.
3588
*/
3589
CXTypeLayoutError_NotConstantSize
= -4,
3590
/**
3591
* The Field name is not valid for this record.
3592
*/
3593
CXTypeLayoutError_InvalidFieldName
= -5,
3594
/**
3595
* The type is undeduced.
3596
*/
3597
CXTypeLayoutError_Undeduced
= -6
3598
};
3599
3600
/**
3601
* Return the alignment of a type in bytes as per C++[expr.alignof]
3602
* standard.
3603
*
3604
* If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
3605
* If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
3606
* is returned.
3607
* If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
3608
* returned.
3609
* If the type declaration is not a constant size type,
3610
* CXTypeLayoutError_NotConstantSize is returned.
3611
*/
3612
CINDEX_LINKAGE
long
long
clang_Type_getAlignOf
(
CXType
T);
3613
3614
/**
3615
* Return the class type of an member pointer type.
3616
*
3617
* If a non-member-pointer type is passed in, an invalid type is returned.
3618
*/
3619
CINDEX_LINKAGE
CXType
clang_Type_getClassType
(
CXType
T);
3620
3621
/**
3622
* Return the size of a type in bytes as per C++[expr.sizeof] standard.
3623
*
3624
* If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
3625
* If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
3626
* is returned.
3627
* If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
3628
* returned.
3629
*/
3630
CINDEX_LINKAGE
long
long
clang_Type_getSizeOf
(
CXType
T);
3631
3632
/**
3633
* Return the offset of a field named S in a record of type T in bits
3634
* as it would be returned by __offsetof__ as per C++11[18.2p4]
3635
*
3636
* If the cursor is not a record field declaration, CXTypeLayoutError_Invalid
3637
* is returned.
3638
* If the field's type declaration is an incomplete type,
3639
* CXTypeLayoutError_Incomplete is returned.
3640
* If the field's type declaration is a dependent type,
3641
* CXTypeLayoutError_Dependent is returned.
3642
* If the field's name S is not found,
3643
* CXTypeLayoutError_InvalidFieldName is returned.
3644
*/
3645
CINDEX_LINKAGE
long
long
clang_Type_getOffsetOf
(
CXType
T,
const
char
*S);
3646
3647
/**
3648
* Return the type that was modified by this attributed type.
3649
*
3650
* If the type is not an attributed type, an invalid type is returned.
3651
*/
3652
CINDEX_LINKAGE
CXType
clang_Type_getModifiedType
(
CXType
T);
3653
3654
/**
3655
* Gets the type contained by this atomic type.
3656
*
3657
* If a non-atomic type is passed in, an invalid type is returned.
3658
*/
3659
CINDEX_LINKAGE
CXType
clang_Type_getValueType
(
CXType
CT);
3660
3661
/**
3662
* Return the offset of the field represented by the Cursor.
3663
*
3664
* If the cursor is not a field declaration, -1 is returned.
3665
* If the cursor semantic parent is not a record field declaration,
3666
* CXTypeLayoutError_Invalid is returned.
3667
* If the field's type declaration is an incomplete type,
3668
* CXTypeLayoutError_Incomplete is returned.
3669
* If the field's type declaration is a dependent type,
3670
* CXTypeLayoutError_Dependent is returned.
3671
* If the field's name S is not found,
3672
* CXTypeLayoutError_InvalidFieldName is returned.
3673
*/
3674
CINDEX_LINKAGE
long
long
clang_Cursor_getOffsetOfField
(
CXCursor
C);
3675
3676
/**
3677
* Determine whether the given cursor represents an anonymous
3678
* tag or namespace
3679
*/
3680
CINDEX_LINKAGE
unsigned
clang_Cursor_isAnonymous
(
CXCursor
C);
3681
3682
/**
3683
* Determine whether the given cursor represents an anonymous record
3684
* declaration.
3685
*/
3686
CINDEX_LINKAGE
unsigned
clang_Cursor_isAnonymousRecordDecl
(
CXCursor
C);
3687
3688
/**
3689
* Determine whether the given cursor represents an inline namespace
3690
* declaration.
3691
*/
3692
CINDEX_LINKAGE
unsigned
clang_Cursor_isInlineNamespace
(
CXCursor
C);
3693
3694
enum
CXRefQualifierKind
{
3695
/** No ref-qualifier was provided. */
3696
CXRefQualifier_None
= 0,
3697
/** An lvalue ref-qualifier was provided (\c &). */
3698
CXRefQualifier_LValue
,
3699
/** An rvalue ref-qualifier was provided (\c &&). */
3700
CXRefQualifier_RValue
3701
};
3702
3703
/**
3704
* Returns the number of template arguments for given template
3705
* specialization, or -1 if type \c T is not a template specialization.
3706
*/
3707
CINDEX_LINKAGE
int
clang_Type_getNumTemplateArguments
(
CXType
T);
3708
3709
/**
3710
* Returns the type template argument of a template class specialization
3711
* at given index.
3712
*
3713
* This function only returns template type arguments and does not handle
3714
* template template arguments or variadic packs.
3715
*/
3716
CINDEX_LINKAGE
CXType
clang_Type_getTemplateArgumentAsType
(
CXType
T,
3717
unsigned
i);
3718
3719
/**
3720
* Retrieve the ref-qualifier kind of a function or method.
3721
*
3722
* The ref-qualifier is returned for C++ functions or methods. For other types
3723
* or non-C++ declarations, CXRefQualifier_None is returned.
3724
*/
3725
CINDEX_LINKAGE
enum
CXRefQualifierKind
clang_Type_getCXXRefQualifier
(
CXType
T);
3726
3727
/**
3728
* Returns 1 if the base class specified by the cursor with kind
3729
* CX_CXXBaseSpecifier is virtual.
3730
*/
3731
CINDEX_LINKAGE
unsigned
clang_isVirtualBase
(
CXCursor
);
3732
3733
/**
3734
* Represents the C++ access control level to a base class for a
3735
* cursor with kind CX_CXXBaseSpecifier.
3736
*/
3737
enum
CX_CXXAccessSpecifier
{
3738
CX_CXXInvalidAccessSpecifier
,
3739
CX_CXXPublic
,
3740
CX_CXXProtected
,
3741
CX_CXXPrivate
3742
};
3743
3744
/**
3745
* Returns the access control level for the referenced object.
3746
*
3747
* If the cursor refers to a C++ declaration, its access control level within
3748
* its parent scope is returned. Otherwise, if the cursor refers to a base
3749
* specifier or access specifier, the specifier itself is returned.
3750
*/
3751
CINDEX_LINKAGE
enum
CX_CXXAccessSpecifier
clang_getCXXAccessSpecifier
(
CXCursor
);
3752
3753
/**
3754
* Represents the storage classes as declared in the source. CX_SC_Invalid
3755
* was added for the case that the passed cursor in not a declaration.
3756
*/
3757
enum
CX_StorageClass
{
3758
CX_SC_Invalid
,
3759
CX_SC_None
,
3760
CX_SC_Extern
,
3761
CX_SC_Static
,
3762
CX_SC_PrivateExtern
,
3763
CX_SC_OpenCLWorkGroupLocal
,
3764
CX_SC_Auto
,
3765
CX_SC_Register
3766
};
3767
3768
/**
3769
* Represents a specific kind of binary operator which can appear at a cursor.
3770
*/
3771
enum
CX_BinaryOperatorKind
{
3772
CX_BO_Invalid
= 0,
3773
CX_BO_PtrMemD
= 1,
3774
CX_BO_PtrMemI
= 2,
3775
CX_BO_Mul
= 3,
3776
CX_BO_Div
= 4,
3777
CX_BO_Rem
= 5,
3778
CX_BO_Add
= 6,
3779
CX_BO_Sub
= 7,
3780
CX_BO_Shl
= 8,
3781
CX_BO_Shr
= 9,
3782
CX_BO_Cmp
= 10,
3783
CX_BO_LT
= 11,
3784
CX_BO_GT
= 12,
3785
CX_BO_LE
= 13,
3786
CX_BO_GE
= 14,
3787
CX_BO_EQ
= 15,
3788
CX_BO_NE
= 16,
3789
CX_BO_And
= 17,
3790
CX_BO_Xor
= 18,
3791
CX_BO_Or
= 19,
3792
CX_BO_LAnd
= 20,
3793
CX_BO_LOr
= 21,
3794
CX_BO_Assign
= 22,
3795
CX_BO_MulAssign
= 23,
3796
CX_BO_DivAssign
= 24,
3797
CX_BO_RemAssign
= 25,
3798
CX_BO_AddAssign
= 26,
3799
CX_BO_SubAssign
= 27,
3800
CX_BO_ShlAssign
= 28,
3801
CX_BO_ShrAssign
= 29,
3802
CX_BO_AndAssign
= 30,
3803
CX_BO_XorAssign
= 31,
3804
CX_BO_OrAssign
= 32,
3805
CX_BO_Comma
= 33,
3806
CX_BO_LAST
=
CX_BO_Comma
3807
};
3808
3809
/**
3810
* \brief Returns the operator code for the binary operator.
3811
*/
3812
CINDEX_LINKAGE
enum
CX_BinaryOperatorKind
3813
clang_Cursor_getBinaryOpcode
(
CXCursor
C);
3814
3815
/**
3816
* \brief Returns a string containing the spelling of the binary operator.
3817
*/
3818
CINDEX_LINKAGE
CXString
3819
clang_Cursor_getBinaryOpcodeStr
(
enum
CX_BinaryOperatorKind
Op);
3820
3821
/**
3822
* Returns the storage class for a function or variable declaration.
3823
*
3824
* If the passed in Cursor is not a function or variable declaration,
3825
* CX_SC_Invalid is returned else the storage class.
3826
*/
3827
CINDEX_LINKAGE
enum
CX_StorageClass
clang_Cursor_getStorageClass
(
CXCursor
);
3828
3829
/**
3830
* Determine the number of overloaded declarations referenced by a
3831
* \c CXCursor_OverloadedDeclRef cursor.
3832
*
3833
* \param cursor The cursor whose overloaded declarations are being queried.
3834
*
3835
* \returns The number of overloaded declarations referenced by \c cursor. If it
3836
* is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
3837
*/
3838
CINDEX_LINKAGE
unsigned
clang_getNumOverloadedDecls
(
CXCursor
cursor);
3839
3840
/**
3841
* Retrieve a cursor for one of the overloaded declarations referenced
3842
* by a \c CXCursor_OverloadedDeclRef cursor.
3843
*
3844
* \param cursor The cursor whose overloaded declarations are being queried.
3845
*
3846
* \param index The zero-based index into the set of overloaded declarations in
3847
* the cursor.
3848
*
3849
* \returns A cursor representing the declaration referenced by the given
3850
* \c cursor at the specified \c index. If the cursor does not have an
3851
* associated set of overloaded declarations, or if the index is out of bounds,
3852
* returns \c clang_getNullCursor();
3853
*/
3854
CINDEX_LINKAGE
CXCursor
clang_getOverloadedDecl
(
CXCursor
cursor,
3855
unsigned
index);
3856
3857
/**
3858
* @}
3859
*/
3860
3861
/**
3862
* \defgroup CINDEX_ATTRIBUTES Information for attributes
3863
*
3864
* @{
3865
*/
3866
3867
/**
3868
* For cursors representing an iboutletcollection attribute,
3869
* this function returns the collection element type.
3870
*
3871
*/
3872
CINDEX_LINKAGE
CXType
clang_getIBOutletCollectionType
(
CXCursor
);
3873
3874
/**
3875
* @}
3876
*/
3877
3878
/**
3879
* \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors
3880
*
3881
* These routines provide the ability to traverse the abstract syntax tree
3882
* using cursors.
3883
*
3884
* @{
3885
*/
3886
3887
/**
3888
* Describes how the traversal of the children of a particular
3889
* cursor should proceed after visiting a particular child cursor.
3890
*
3891
* A value of this enumeration type should be returned by each
3892
* \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
3893
*/
3894
enum
CXChildVisitResult
{
3895
/**
3896
* Terminates the cursor traversal.
3897
*/
3898
CXChildVisit_Break
,
3899
/**
3900
* Continues the cursor traversal with the next sibling of
3901
* the cursor just visited, without visiting its children.
3902
*/
3903
CXChildVisit_Continue
,
3904
/**
3905
* Recursively traverse the children of this cursor, using
3906
* the same visitor and client data.
3907
*/
3908
CXChildVisit_Recurse
3909
};
3910
3911
/**
3912
* Visitor invoked for each cursor found by a traversal.
3913
*
3914
* This visitor function will be invoked for each cursor found by
3915
* clang_visitCursorChildren(). Its first argument is the cursor being
3916
* visited, its second argument is the parent visitor for that cursor,
3917
* and its third argument is the client data provided to
3918
* clang_visitCursorChildren().
3919
*
3920
* The visitor should return one of the \c CXChildVisitResult values
3921
* to direct clang_visitCursorChildren().
3922
*/
3923
typedef
enum
CXChildVisitResult
(*
CXCursorVisitor
)(
CXCursor
cursor,
3924
CXCursor
parent,
3925
CXClientData
client_data);
3926
3927
/**
3928
* Visit the children of a particular cursor.
3929
*
3930
* This function visits all the direct children of the given cursor,
3931
* invoking the given \p visitor function with the cursors of each
3932
* visited child. The traversal may be recursive, if the visitor returns
3933
* \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
3934
* the visitor returns \c CXChildVisit_Break.
3935
*
3936
* \param parent the cursor whose child may be visited. All kinds of
3937
* cursors can be visited, including invalid cursors (which, by
3938
* definition, have no children).
3939
*
3940
* \param visitor the visitor function that will be invoked for each
3941
* child of \p parent.
3942
*
3943
* \param client_data pointer data supplied by the client, which will
3944
* be passed to the visitor each time it is invoked.
3945
*
3946
* \returns a non-zero value if the traversal was terminated
3947
* prematurely by the visitor returning \c CXChildVisit_Break.
3948
*/
3949
CINDEX_LINKAGE
unsigned
clang_visitChildren
(
CXCursor
parent,
3950
CXCursorVisitor
visitor,
3951
CXClientData
client_data);
3952
/**
3953
* Visitor invoked for each cursor found by a traversal.
3954
*
3955
* This visitor block will be invoked for each cursor found by
3956
* clang_visitChildrenWithBlock(). Its first argument is the cursor being
3957
* visited, its second argument is the parent visitor for that cursor.
3958
*
3959
* The visitor should return one of the \c CXChildVisitResult values
3960
* to direct clang_visitChildrenWithBlock().
3961
*/
3962
#if __has_feature(blocks)
3963
typedef
enum
CXChildVisitResult
(^
CXCursorVisitorBlock
)(
CXCursor
cursor,
3964
CXCursor
parent);
3965
#else
3966
typedef
struct
_CXChildVisitResult *
CXCursorVisitorBlock
;
3967
#endif
3968
3969
/**
3970
* Visits the children of a cursor using the specified block. Behaves
3971
* identically to clang_visitChildren() in all other respects.
3972
*/
3973
CINDEX_LINKAGE
unsigned
3974
clang_visitChildrenWithBlock
(
CXCursor
parent,
CXCursorVisitorBlock
block);
3975
3976
/**
3977
* @}
3978
*/
3979
3980
/**
3981
* \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST
3982
*
3983
* These routines provide the ability to determine references within and
3984
* across translation units, by providing the names of the entities referenced
3985
* by cursors, follow reference cursors to the declarations they reference,
3986
* and associate declarations with their definitions.
3987
*
3988
* @{
3989
*/
3990
3991
/**
3992
* Retrieve a Unified Symbol Resolution (USR) for the entity referenced
3993
* by the given cursor.
3994
*
3995
* A Unified Symbol Resolution (USR) is a string that identifies a particular
3996
* entity (function, class, variable, etc.) within a program. USRs can be
3997
* compared across translation units to determine, e.g., when references in
3998
* one translation refer to an entity defined in another translation unit.
3999
*/
4000
CINDEX_LINKAGE
CXString
clang_getCursorUSR
(
CXCursor
);
4001
4002
/**
4003
* Construct a USR for a specified Objective-C class.
4004
*/
4005
CINDEX_LINKAGE
CXString
clang_constructUSR_ObjCClass
(
const
char
*class_name);
4006
4007
/**
4008
* Construct a USR for a specified Objective-C category.
4009
*/
4010
CINDEX_LINKAGE
CXString
clang_constructUSR_ObjCCategory
(
4011
const
char
*class_name,
const
char
*category_name);
4012
4013
/**
4014
* Construct a USR for a specified Objective-C protocol.
4015
*/
4016
CINDEX_LINKAGE
CXString
4017
clang_constructUSR_ObjCProtocol
(
const
char
*protocol_name);
4018
4019
/**
4020
* Construct a USR for a specified Objective-C instance variable and
4021
* the USR for its containing class.
4022
*/
4023
CINDEX_LINKAGE
CXString
clang_constructUSR_ObjCIvar
(
const
char
*name,
4024
CXString
classUSR);
4025
4026
/**
4027
* Construct a USR for a specified Objective-C method and
4028
* the USR for its containing class.
4029
*/
4030
CINDEX_LINKAGE
CXString
clang_constructUSR_ObjCMethod
(
const
char
*name,
4031
unsigned
isInstanceMethod,
4032
CXString
classUSR);
4033
4034
/**
4035
* Construct a USR for a specified Objective-C property and the USR
4036
* for its containing class.
4037
*/
4038
CINDEX_LINKAGE
CXString
clang_constructUSR_ObjCProperty
(
const
char
*property,
4039
CXString
classUSR);
4040
4041
/**
4042
* Retrieve a name for the entity referenced by this cursor.
4043
*/
4044
CINDEX_LINKAGE
CXString
clang_getCursorSpelling
(
CXCursor
);
4045
4046
/**
4047
* Retrieve a range for a piece that forms the cursors spelling name.
4048
* Most of the times there is only one range for the complete spelling but for
4049
* Objective-C methods and Objective-C message expressions, there are multiple
4050
* pieces for each selector identifier.
4051
*
4052
* \param pieceIndex the index of the spelling name piece. If this is greater
4053
* than the actual number of pieces, it will return a NULL (invalid) range.
4054
*
4055
* \param options Reserved.
4056
*/
4057
CINDEX_LINKAGE
CXSourceRange
clang_Cursor_getSpellingNameRange
(
4058
CXCursor
,
unsigned
pieceIndex,
unsigned
options);
4059
4060
/**
4061
* Opaque pointer representing a policy that controls pretty printing
4062
* for \c clang_getCursorPrettyPrinted.
4063
*/
4064
typedef
void
*
CXPrintingPolicy
;
4065
4066
/**
4067
* Properties for the printing policy.
4068
*
4069
* See \c clang::PrintingPolicy for more information.
4070
*/
4071
enum
CXPrintingPolicyProperty
{
4072
CXPrintingPolicy_Indentation
,
4073
CXPrintingPolicy_SuppressSpecifiers
,
4074
CXPrintingPolicy_SuppressTagKeyword
,
4075
CXPrintingPolicy_IncludeTagDefinition
,
4076
CXPrintingPolicy_SuppressScope
,
4077
CXPrintingPolicy_SuppressUnwrittenScope
,
4078
CXPrintingPolicy_SuppressInitializers
,
4079
CXPrintingPolicy_ConstantArraySizeAsWritten
,
4080
CXPrintingPolicy_AnonymousTagLocations
,
4081
CXPrintingPolicy_SuppressStrongLifetime
,
4082
CXPrintingPolicy_SuppressLifetimeQualifiers
,
4083
CXPrintingPolicy_SuppressTemplateArgsInCXXConstructors
,
4084
CXPrintingPolicy_Bool
,
4085
CXPrintingPolicy_Restrict
,
4086
CXPrintingPolicy_Alignof
,
4087
CXPrintingPolicy_UnderscoreAlignof
,
4088
CXPrintingPolicy_UseVoidForZeroParams
,
4089
CXPrintingPolicy_TerseOutput
,
4090
CXPrintingPolicy_PolishForDeclaration
,
4091
CXPrintingPolicy_Half
,
4092
CXPrintingPolicy_MSWChar
,
4093
CXPrintingPolicy_IncludeNewlines
,
4094
CXPrintingPolicy_MSVCFormatting
,
4095
CXPrintingPolicy_ConstantsAsWritten
,
4096
CXPrintingPolicy_SuppressImplicitBase
,
4097
CXPrintingPolicy_FullyQualifiedName
,
4098
4099
CXPrintingPolicy_LastProperty
=
CXPrintingPolicy_FullyQualifiedName
4100
};
4101
4102
/**
4103
* Get a property value for the given printing policy.
4104
*/
4105
CINDEX_LINKAGE
unsigned
4106
clang_PrintingPolicy_getProperty
(
CXPrintingPolicy
Policy,
4107
enum
CXPrintingPolicyProperty
Property);
4108
4109
/**
4110
* Set a property value for the given printing policy.
4111
*/
4112
CINDEX_LINKAGE
void
4113
clang_PrintingPolicy_setProperty
(
CXPrintingPolicy
Policy,
4114
enum
CXPrintingPolicyProperty
Property,
4115
unsigned
Value
);
4116
4117
/**
4118
* Retrieve the default policy for the cursor.
4119
*
4120
* The policy should be released after use with \c
4121
* clang_PrintingPolicy_dispose.
4122
*/
4123
CINDEX_LINKAGE
CXPrintingPolicy
clang_getCursorPrintingPolicy
(
CXCursor
);
4124
4125
/**
4126
* Release a printing policy.
4127
*/
4128
CINDEX_LINKAGE
void
clang_PrintingPolicy_dispose
(
CXPrintingPolicy
Policy);
4129
4130
/**
4131
* Pretty print declarations.
4132
*
4133
* \param Cursor The cursor representing a declaration.
4134
*
4135
* \param Policy The policy to control the entities being printed. If
4136
* NULL, a default policy is used.
4137
*
4138
* \returns The pretty printed declaration or the empty string for
4139
* other cursors.
4140
*/
4141
CINDEX_LINKAGE
CXString
clang_getCursorPrettyPrinted
(
CXCursor
Cursor,
4142
CXPrintingPolicy
Policy);
4143
4144
/**
4145
* Retrieve the display name for the entity referenced by this cursor.
4146
*
4147
* The display name contains extra information that helps identify the cursor,
4148
* such as the parameters of a function or template or the arguments of a
4149
* class template specialization.
4150
*/
4151
CINDEX_LINKAGE
CXString
clang_getCursorDisplayName
(
CXCursor
);
4152
4153
/** For a cursor that is a reference, retrieve a cursor representing the
4154
* entity that it references.
4155
*
4156
* Reference cursors refer to other entities in the AST. For example, an
4157
* Objective-C superclass reference cursor refers to an Objective-C class.
4158
* This function produces the cursor for the Objective-C class from the
4159
* cursor for the superclass reference. If the input cursor is a declaration or
4160
* definition, it returns that declaration or definition unchanged.
4161
* Otherwise, returns the NULL cursor.
4162
*/
4163
CINDEX_LINKAGE
CXCursor
clang_getCursorReferenced
(
CXCursor
);
4164
4165
/**
4166
* For a cursor that is either a reference to or a declaration
4167
* of some entity, retrieve a cursor that describes the definition of
4168
* that entity.
4169
*
4170
* Some entities can be declared multiple times within a translation
4171
* unit, but only one of those declarations can also be a
4172
* definition. For example, given:
4173
*
4174
* \code
4175
* int f(int, int);
4176
* int g(int x, int y) { return f(x, y); }
4177
* int f(int a, int b) { return a + b; }
4178
* int f(int, int);
4179
* \endcode
4180
*
4181
* there are three declarations of the function "f", but only the
4182
* second one is a definition. The clang_getCursorDefinition()
4183
* function will take any cursor pointing to a declaration of "f"
4184
* (the first or fourth lines of the example) or a cursor referenced
4185
* that uses "f" (the call to "f' inside "g") and will return a
4186
* declaration cursor pointing to the definition (the second "f"
4187
* declaration).
4188
*
4189
* If given a cursor for which there is no corresponding definition,
4190
* e.g., because there is no definition of that entity within this
4191
* translation unit, returns a NULL cursor.
4192
*/
4193
CINDEX_LINKAGE
CXCursor
clang_getCursorDefinition
(
CXCursor
);
4194
4195
/**
4196
* Determine whether the declaration pointed to by this cursor
4197
* is also a definition of that entity.
4198
*/
4199
CINDEX_LINKAGE
unsigned
clang_isCursorDefinition
(
CXCursor
);
4200
4201
/**
4202
* Retrieve the canonical cursor corresponding to the given cursor.
4203
*
4204
* In the C family of languages, many kinds of entities can be declared several
4205
* times within a single translation unit. For example, a structure type can
4206
* be forward-declared (possibly multiple times) and later defined:
4207
*
4208
* \code
4209
* struct X;
4210
* struct X;
4211
* struct X {
4212
* int member;
4213
* };
4214
* \endcode
4215
*
4216
* The declarations and the definition of \c X are represented by three
4217
* different cursors, all of which are declarations of the same underlying
4218
* entity. One of these cursor is considered the "canonical" cursor, which
4219
* is effectively the representative for the underlying entity. One can
4220
* determine if two cursors are declarations of the same underlying entity by
4221
* comparing their canonical cursors.
4222
*
4223
* \returns The canonical cursor for the entity referred to by the given cursor.
4224
*/
4225
CINDEX_LINKAGE
CXCursor
clang_getCanonicalCursor
(
CXCursor
);
4226
4227
/**
4228
* If the cursor points to a selector identifier in an Objective-C
4229
* method or message expression, this returns the selector index.
4230
*
4231
* After getting a cursor with #clang_getCursor, this can be called to
4232
* determine if the location points to a selector identifier.
4233
*
4234
* \returns The selector index if the cursor is an Objective-C method or message
4235
* expression and the cursor is pointing to a selector identifier, or -1
4236
* otherwise.
4237
*/
4238
CINDEX_LINKAGE
int
clang_Cursor_getObjCSelectorIndex
(
CXCursor
);
4239
4240
/**
4241
* Given a cursor pointing to a C++ method call or an Objective-C
4242
* message, returns non-zero if the method/message is "dynamic", meaning:
4243
*
4244
* For a C++ method: the call is virtual.
4245
* For an Objective-C message: the receiver is an object instance, not 'super'
4246
* or a specific class.
4247
*
4248
* If the method/message is "static" or the cursor does not point to a
4249
* method/message, it will return zero.
4250
*/
4251
CINDEX_LINKAGE
int
clang_Cursor_isDynamicCall
(
CXCursor
C);
4252
4253
/**
4254
* Given a cursor pointing to an Objective-C message or property
4255
* reference, or C++ method call, returns the CXType of the receiver.
4256
*/
4257
CINDEX_LINKAGE
CXType
clang_Cursor_getReceiverType
(
CXCursor
C);
4258
4259
/**
4260
* Property attributes for a \c CXCursor_ObjCPropertyDecl.
4261
*/
4262
typedef
enum
{
4263
CXObjCPropertyAttr_noattr
= 0x00,
4264
CXObjCPropertyAttr_readonly
= 0x01,
4265
CXObjCPropertyAttr_getter
= 0x02,
4266
CXObjCPropertyAttr_assign
= 0x04,
4267
CXObjCPropertyAttr_readwrite
= 0x08,
4268
CXObjCPropertyAttr_retain
= 0x10,
4269
CXObjCPropertyAttr_copy
= 0x20,
4270
CXObjCPropertyAttr_nonatomic
= 0x40,
4271
CXObjCPropertyAttr_setter
= 0x80,
4272
CXObjCPropertyAttr_atomic
= 0x100,
4273
CXObjCPropertyAttr_weak
= 0x200,
4274
CXObjCPropertyAttr_strong
= 0x400,
4275
CXObjCPropertyAttr_unsafe_unretained
= 0x800,
4276
CXObjCPropertyAttr_class
= 0x1000
4277
}
CXObjCPropertyAttrKind
;
4278
4279
/**
4280
* Given a cursor that represents a property declaration, return the
4281
* associated property attributes. The bits are formed from
4282
* \c CXObjCPropertyAttrKind.
4283
*
4284
* \param reserved Reserved for future use, pass 0.
4285
*/
4286
CINDEX_LINKAGE
unsigned
4287
clang_Cursor_getObjCPropertyAttributes
(
CXCursor
C,
unsigned
reserved);
4288
4289
/**
4290
* Given a cursor that represents a property declaration, return the
4291
* name of the method that implements the getter.
4292
*/
4293
CINDEX_LINKAGE
CXString
clang_Cursor_getObjCPropertyGetterName
(
CXCursor
C);
4294
4295
/**
4296
* Given a cursor that represents a property declaration, return the
4297
* name of the method that implements the setter, if any.
4298
*/
4299
CINDEX_LINKAGE
CXString
clang_Cursor_getObjCPropertySetterName
(
CXCursor
C);
4300
4301
/**
4302
* 'Qualifiers' written next to the return and parameter types in
4303
* Objective-C method declarations.
4304
*/
4305
typedef
enum
{
4306
CXObjCDeclQualifier_None
= 0x0,
4307
CXObjCDeclQualifier_In
= 0x1,
4308
CXObjCDeclQualifier_Inout
= 0x2,
4309
CXObjCDeclQualifier_Out
= 0x4,
4310
CXObjCDeclQualifier_Bycopy
= 0x8,
4311
CXObjCDeclQualifier_Byref
= 0x10,
4312
CXObjCDeclQualifier_Oneway
= 0x20
4313
}
CXObjCDeclQualifierKind
;
4314
4315
/**
4316
* Given a cursor that represents an Objective-C method or parameter
4317
* declaration, return the associated Objective-C qualifiers for the return
4318
* type or the parameter respectively. The bits are formed from
4319
* CXObjCDeclQualifierKind.
4320
*/
4321
CINDEX_LINKAGE
unsigned
clang_Cursor_getObjCDeclQualifiers
(
CXCursor
C);
4322
4323
/**
4324
* Given a cursor that represents an Objective-C method or property
4325
* declaration, return non-zero if the declaration was affected by "\@optional".
4326
* Returns zero if the cursor is not such a declaration or it is "\@required".
4327
*/
4328
CINDEX_LINKAGE
unsigned
clang_Cursor_isObjCOptional
(
CXCursor
C);
4329
4330
/**
4331
* Returns non-zero if the given cursor is a variadic function or method.
4332
*/
4333
CINDEX_LINKAGE
unsigned
clang_Cursor_isVariadic
(
CXCursor
C);
4334
4335
/**
4336
* Returns non-zero if the given cursor points to a symbol marked with
4337
* external_source_symbol attribute.
4338
*
4339
* \param language If non-NULL, and the attribute is present, will be set to
4340
* the 'language' string from the attribute.
4341
*
4342
* \param definedIn If non-NULL, and the attribute is present, will be set to
4343
* the 'definedIn' string from the attribute.
4344
*
4345
* \param isGenerated If non-NULL, and the attribute is present, will be set to
4346
* non-zero if the 'generated_declaration' is set in the attribute.
4347
*/
4348
CINDEX_LINKAGE
unsigned
clang_Cursor_isExternalSymbol
(
CXCursor
C,
4349
CXString
*language,
4350
CXString
*definedIn,
4351
unsigned
*isGenerated);
4352
4353
/**
4354
* Given a cursor that represents a declaration, return the associated
4355
* comment's source range. The range may include multiple consecutive comments
4356
* with whitespace in between.
4357
*/
4358
CINDEX_LINKAGE
CXSourceRange
clang_Cursor_getCommentRange
(
CXCursor
C);
4359
4360
/**
4361
* Given a cursor that represents a declaration, return the associated
4362
* comment text, including comment markers.
4363
*/
4364
CINDEX_LINKAGE
CXString
clang_Cursor_getRawCommentText
(
CXCursor
C);
4365
4366
/**
4367
* Given a cursor that represents a documentable entity (e.g.,
4368
* declaration), return the associated \paragraph; otherwise return the
4369
* first paragraph.
4370
*/
4371
CINDEX_LINKAGE
CXString
clang_Cursor_getBriefCommentText
(
CXCursor
C);
4372
4373
/**
4374
* @}
4375
*/
4376
4377
/** \defgroup CINDEX_MANGLE Name Mangling API Functions
4378
*
4379
* @{
4380
*/
4381
4382
/**
4383
* Retrieve the CXString representing the mangled name of the cursor.
4384
*/
4385
CINDEX_LINKAGE
CXString
clang_Cursor_getMangling
(
CXCursor
);
4386
4387
/**
4388
* Retrieve the CXStrings representing the mangled symbols of the C++
4389
* constructor or destructor at the cursor.
4390
*/
4391
CINDEX_LINKAGE
CXStringSet
*
clang_Cursor_getCXXManglings
(
CXCursor
);
4392
4393
/**
4394
* Retrieve the CXStrings representing the mangled symbols of the ObjC
4395
* class interface or implementation at the cursor.
4396
*/
4397
CINDEX_LINKAGE
CXStringSet
*
clang_Cursor_getObjCManglings
(
CXCursor
);
4398
4399
/**
4400
* @}
4401
*/
4402
4403
/**
4404
* \defgroup CINDEX_MODULE Module introspection
4405
*
4406
* The functions in this group provide access to information about modules.
4407
*
4408
* @{
4409
*/
4410
4411
typedef
void
*
CXModule
;
4412
4413
/**
4414
* Given a CXCursor_ModuleImportDecl cursor, return the associated module.
4415
*/
4416
CINDEX_LINKAGE
CXModule
clang_Cursor_getModule
(
CXCursor
C);
4417
4418
/**
4419
* Given a CXFile header file, return the module that contains it, if one
4420
* exists.
4421
*/
4422
CINDEX_LINKAGE
CXModule
clang_getModuleForFile
(
CXTranslationUnit
,
CXFile
);
4423
4424
/**
4425
* \param Module a module object.
4426
*
4427
* \returns the module file where the provided module object came from.
4428
*/
4429
CINDEX_LINKAGE
CXFile
clang_Module_getASTFile
(
CXModule
Module);
4430
4431
/**
4432
* \param Module a module object.
4433
*
4434
* \returns the parent of a sub-module or NULL if the given module is top-level,
4435
* e.g. for 'std.vector' it will return the 'std' module.
4436
*/
4437
CINDEX_LINKAGE
CXModule
clang_Module_getParent
(
CXModule
Module);
4438
4439
/**
4440
* \param Module a module object.
4441
*
4442
* \returns the name of the module, e.g. for the 'std.vector' sub-module it
4443
* will return "vector".
4444
*/
4445
CINDEX_LINKAGE
CXString
clang_Module_getName
(
CXModule
Module);
4446
4447
/**
4448
* \param Module a module object.
4449
*
4450
* \returns the full name of the module, e.g. "std.vector".
4451
*/
4452
CINDEX_LINKAGE
CXString
clang_Module_getFullName
(
CXModule
Module);
4453
4454
/**
4455
* \param Module a module object.
4456
*
4457
* \returns non-zero if the module is a system one.
4458
*/
4459
CINDEX_LINKAGE
int
clang_Module_isSystem
(
CXModule
Module);
4460
4461
/**
4462
* \param Module a module object.
4463
*
4464
* \returns the number of top level headers associated with this module.
4465
*/
4466
CINDEX_LINKAGE
unsigned
clang_Module_getNumTopLevelHeaders
(
CXTranslationUnit
,
4467
CXModule
Module);
4468
4469
/**
4470
* \param Module a module object.
4471
*
4472
* \param Index top level header index (zero-based).
4473
*
4474
* \returns the specified top level header associated with the module.
4475
*/
4476
CINDEX_LINKAGE
4477
CXFile
clang_Module_getTopLevelHeader
(
CXTranslationUnit
,
CXModule
Module,
4478
unsigned
Index);
4479
4480
/**
4481
* @}
4482
*/
4483
4484
/**
4485
* \defgroup CINDEX_CPP C++ AST introspection
4486
*
4487
* The routines in this group provide access information in the ASTs specific
4488
* to C++ language features.
4489
*
4490
* @{
4491
*/
4492
4493
/**
4494
* Determine if a C++ constructor is a converting constructor.
4495
*/
4496
CINDEX_LINKAGE
unsigned
4497
clang_CXXConstructor_isConvertingConstructor
(
CXCursor
C);
4498
4499
/**
4500
* Determine if a C++ constructor is a copy constructor.
4501
*/
4502
CINDEX_LINKAGE
unsigned
clang_CXXConstructor_isCopyConstructor
(
CXCursor
C);
4503
4504
/**
4505
* Determine if a C++ constructor is the default constructor.
4506
*/
4507
CINDEX_LINKAGE
unsigned
clang_CXXConstructor_isDefaultConstructor
(
CXCursor
C);
4508
4509
/**
4510
* Determine if a C++ constructor is a move constructor.
4511
*/
4512
CINDEX_LINKAGE
unsigned
clang_CXXConstructor_isMoveConstructor
(
CXCursor
C);
4513
4514
/**
4515
* Determine if a C++ field is declared 'mutable'.
4516
*/
4517
CINDEX_LINKAGE
unsigned
clang_CXXField_isMutable
(
CXCursor
C);
4518
4519
/**
4520
* Determine if a C++ method is declared '= default'.
4521
*/
4522
CINDEX_LINKAGE
unsigned
clang_CXXMethod_isDefaulted
(
CXCursor
C);
4523
4524
/**
4525
* Determine if a C++ method is declared '= delete'.
4526
*/
4527
CINDEX_LINKAGE
unsigned
clang_CXXMethod_isDeleted
(
CXCursor
C);
4528
4529
/**
4530
* Determine if a C++ member function or member function template is
4531
* pure virtual.
4532
*/
4533
CINDEX_LINKAGE
unsigned
clang_CXXMethod_isPureVirtual
(
CXCursor
C);
4534
4535
/**
4536
* Determine if a C++ member function or member function template is
4537
* declared 'static'.
4538
*/
4539
CINDEX_LINKAGE
unsigned
clang_CXXMethod_isStatic
(
CXCursor
C);
4540
4541
/**
4542
* Determine if a C++ member function or member function template is
4543
* explicitly declared 'virtual' or if it overrides a virtual method from
4544
* one of the base classes.
4545
*/
4546
CINDEX_LINKAGE
unsigned
clang_CXXMethod_isVirtual
(
CXCursor
C);
4547
4548
/**
4549
* Determine if a C++ member function is a copy-assignment operator,
4550
* returning 1 if such is the case and 0 otherwise.
4551
*
4552
* > A copy-assignment operator `X::operator=` is a non-static,
4553
* > non-template member function of _class_ `X` with exactly one
4554
* > parameter of type `X`, `X&`, `const X&`, `volatile X&` or `const
4555
* > volatile X&`.
4556
*
4557
* That is, for example, the `operator=` in:
4558
*
4559
* class Foo {
4560
* bool operator=(const volatile Foo&);
4561
* };
4562
*
4563
* Is a copy-assignment operator, while the `operator=` in:
4564
*
4565
* class Bar {
4566
* bool operator=(const int&);
4567
* };
4568
*
4569
* Is not.
4570
*/
4571
CINDEX_LINKAGE
unsigned
clang_CXXMethod_isCopyAssignmentOperator
(
CXCursor
C);
4572
4573
/**
4574
* Determine if a C++ member function is a move-assignment operator,
4575
* returning 1 if such is the case and 0 otherwise.
4576
*
4577
* > A move-assignment operator `X::operator=` is a non-static,
4578
* > non-template member function of _class_ `X` with exactly one
4579
* > parameter of type `X&&`, `const X&&`, `volatile X&&` or `const
4580
* > volatile X&&`.
4581
*
4582
* That is, for example, the `operator=` in:
4583
*
4584
* class Foo {
4585
* bool operator=(const volatile Foo&&);
4586
* };
4587
*
4588
* Is a move-assignment operator, while the `operator=` in:
4589
*
4590
* class Bar {
4591
* bool operator=(const int&&);
4592
* };
4593
*
4594
* Is not.
4595
*/
4596
CINDEX_LINKAGE
unsigned
clang_CXXMethod_isMoveAssignmentOperator
(
CXCursor
C);
4597
4598
/**
4599
* Determines if a C++ constructor or conversion function was declared
4600
* explicit, returning 1 if such is the case and 0 otherwise.
4601
*
4602
* Constructors or conversion functions are declared explicit through
4603
* the use of the explicit specifier.
4604
*
4605
* For example, the following constructor and conversion function are
4606
* not explicit as they lack the explicit specifier:
4607
*
4608
* class Foo {
4609
* Foo();
4610
* operator int();
4611
* };
4612
*
4613
* While the following constructor and conversion function are
4614
* explicit as they are declared with the explicit specifier.
4615
*
4616
* class Foo {
4617
* explicit Foo();
4618
* explicit operator int();
4619
* };
4620
*
4621
* This function will return 0 when given a cursor pointing to one of
4622
* the former declarations and it will return 1 for a cursor pointing
4623
* to the latter declarations.
4624
*
4625
* The explicit specifier allows the user to specify a
4626
* conditional compile-time expression whose value decides
4627
* whether the marked element is explicit or not.
4628
*
4629
* For example:
4630
*
4631
* constexpr bool foo(int i) { return i % 2 == 0; }
4632
*
4633
* class Foo {
4634
* explicit(foo(1)) Foo();
4635
* explicit(foo(2)) operator int();
4636
* }
4637
*
4638
* This function will return 0 for the constructor and 1 for
4639
* the conversion function.
4640
*/
4641
CINDEX_LINKAGE
unsigned
clang_CXXMethod_isExplicit
(
CXCursor
C);
4642
4643
/**
4644
* Determine if a C++ record is abstract, i.e. whether a class or struct
4645
* has a pure virtual member function.
4646
*/
4647
CINDEX_LINKAGE
unsigned
clang_CXXRecord_isAbstract
(
CXCursor
C);
4648
4649
/**
4650
* Determine if an enum declaration refers to a scoped enum.
4651
*/
4652
CINDEX_LINKAGE
unsigned
clang_EnumDecl_isScoped
(
CXCursor
C);
4653
4654
/**
4655
* Determine if a C++ member function or member function template is
4656
* declared 'const'.
4657
*/
4658
CINDEX_LINKAGE
unsigned
clang_CXXMethod_isConst
(
CXCursor
C);
4659
4660
/**
4661
* Given a cursor that represents a template, determine
4662
* the cursor kind of the specializations would be generated by instantiating
4663
* the template.
4664
*
4665
* This routine can be used to determine what flavor of function template,
4666
* class template, or class template partial specialization is stored in the
4667
* cursor. For example, it can describe whether a class template cursor is
4668
* declared with "struct", "class" or "union".
4669
*
4670
* \param C The cursor to query. This cursor should represent a template
4671
* declaration.
4672
*
4673
* \returns The cursor kind of the specializations that would be generated
4674
* by instantiating the template \p C. If \p C is not a template, returns
4675
* \c CXCursor_NoDeclFound.
4676
*/
4677
CINDEX_LINKAGE
enum
CXCursorKind
clang_getTemplateCursorKind
(
CXCursor
C);
4678
4679
/**
4680
* Given a cursor that may represent a specialization or instantiation
4681
* of a template, retrieve the cursor that represents the template that it
4682
* specializes or from which it was instantiated.
4683
*
4684
* This routine determines the template involved both for explicit
4685
* specializations of templates and for implicit instantiations of the template,
4686
* both of which are referred to as "specializations". For a class template
4687
* specialization (e.g., \c std::vector<bool>), this routine will return
4688
* either the primary template (\c std::vector) or, if the specialization was
4689
* instantiated from a class template partial specialization, the class template
4690
* partial specialization. For a class template partial specialization and a
4691
* function template specialization (including instantiations), this
4692
* this routine will return the specialized template.
4693
*
4694
* For members of a class template (e.g., member functions, member classes, or
4695
* static data members), returns the specialized or instantiated member.
4696
* Although not strictly "templates" in the C++ language, members of class
4697
* templates have the same notions of specializations and instantiations that
4698
* templates do, so this routine treats them similarly.
4699
*
4700
* \param C A cursor that may be a specialization of a template or a member
4701
* of a template.
4702
*
4703
* \returns If the given cursor is a specialization or instantiation of a
4704
* template or a member thereof, the template or member that it specializes or
4705
* from which it was instantiated. Otherwise, returns a NULL cursor.
4706
*/
4707
CINDEX_LINKAGE
CXCursor
clang_getSpecializedCursorTemplate
(
CXCursor
C);
4708
4709
/**
4710
* Given a cursor that references something else, return the source range
4711
* covering that reference.
4712
*
4713
* \param C A cursor pointing to a member reference, a declaration reference, or
4714
* an operator call.
4715
* \param NameFlags A bitset with three independent flags:
4716
* CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
4717
* CXNameRange_WantSinglePiece.
4718
* \param PieceIndex For contiguous names or when passing the flag
4719
* CXNameRange_WantSinglePiece, only one piece with index 0 is
4720
* available. When the CXNameRange_WantSinglePiece flag is not passed for a
4721
* non-contiguous names, this index can be used to retrieve the individual
4722
* pieces of the name. See also CXNameRange_WantSinglePiece.
4723
*
4724
* \returns The piece of the name pointed to by the given cursor. If there is no
4725
* name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
4726
*/
4727
CINDEX_LINKAGE
CXSourceRange
clang_getCursorReferenceNameRange
(
4728
CXCursor
C,
unsigned
NameFlags,
unsigned
PieceIndex);
4729
4730
enum
CXNameRefFlags
{
4731
/**
4732
* Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
4733
* range.
4734
*/
4735
CXNameRange_WantQualifier
= 0x1,
4736
4737
/**
4738
* Include the explicit template arguments, e.g. <int> in x.f<int>,
4739
* in the range.
4740
*/
4741
CXNameRange_WantTemplateArgs
= 0x2,
4742
4743
/**
4744
* If the name is non-contiguous, return the full spanning range.
4745
*
4746
* Non-contiguous names occur in Objective-C when a selector with two or more
4747
* parameters is used, or in C++ when using an operator:
4748
* \code
4749
* [object doSomething:here withValue:there]; // Objective-C
4750
* return some_vector[1]; // C++
4751
* \endcode
4752
*/
4753
CXNameRange_WantSinglePiece
= 0x4
4754
};
4755
4756
/**
4757
* @}
4758
*/
4759
4760
/**
4761
* \defgroup CINDEX_LEX Token extraction and manipulation
4762
*
4763
* The routines in this group provide access to the tokens within a
4764
* translation unit, along with a semantic mapping of those tokens to
4765
* their corresponding cursors.
4766
*
4767
* @{
4768
*/
4769
4770
/**
4771
* Describes a kind of token.
4772
*/
4773
typedef
enum
CXTokenKind
{
4774
/**
4775
* A token that contains some kind of punctuation.
4776
*/
4777
CXToken_Punctuation
,
4778
4779
/**
4780
* A language keyword.
4781
*/
4782
CXToken_Keyword
,
4783
4784
/**
4785
* An identifier (that is not a keyword).
4786
*/
4787
CXToken_Identifier
,
4788
4789
/**
4790
* A numeric, string, or character literal.
4791
*/
4792
CXToken_Literal
,
4793
4794
/**
4795
* A comment.
4796
*/
4797
CXToken_Comment
4798
}
CXTokenKind
;
4799
4800
/**
4801
* Describes a single preprocessing token.
4802
*/
4803
typedef
struct
{
4804
unsigned
int_data[4];
4805
void
*
ptr_data
;
4806
}
CXToken
;
4807
4808
/**
4809
* Get the raw lexical token starting with the given location.
4810
*
4811
* \param TU the translation unit whose text is being tokenized.
4812
*
4813
* \param Location the source location with which the token starts.
4814
*
4815
* \returns The token starting with the given location or NULL if no such token
4816
* exist. The returned pointer must be freed with clang_disposeTokens before the
4817
* translation unit is destroyed.
4818
*/
4819
CINDEX_LINKAGE
CXToken
*
clang_getToken
(
CXTranslationUnit
TU,
4820
CXSourceLocation
Location);
4821
4822
/**
4823
* Determine the kind of the given token.
4824
*/
4825
CINDEX_LINKAGE
CXTokenKind
clang_getTokenKind
(
CXToken
);
4826
4827
/**
4828
* Determine the spelling of the given token.
4829
*
4830
* The spelling of a token is the textual representation of that token, e.g.,
4831
* the text of an identifier or keyword.
4832
*/
4833
CINDEX_LINKAGE
CXString
clang_getTokenSpelling
(
CXTranslationUnit
,
CXToken
);
4834
4835
/**
4836
* Retrieve the source location of the given token.
4837
*/
4838
CINDEX_LINKAGE
CXSourceLocation
clang_getTokenLocation
(
CXTranslationUnit
,
4839
CXToken
);
4840
4841
/**
4842
* Retrieve a source range that covers the given token.
4843
*/
4844
CINDEX_LINKAGE
CXSourceRange
clang_getTokenExtent
(
CXTranslationUnit
,
CXToken
);
4845
4846
/**
4847
* Tokenize the source code described by the given range into raw
4848
* lexical tokens.
4849
*
4850
* \param TU the translation unit whose text is being tokenized.
4851
*
4852
* \param Range the source range in which text should be tokenized. All of the
4853
* tokens produced by tokenization will fall within this source range,
4854
*
4855
* \param Tokens this pointer will be set to point to the array of tokens
4856
* that occur within the given source range. The returned pointer must be
4857
* freed with clang_disposeTokens() before the translation unit is destroyed.
4858
*
4859
* \param NumTokens will be set to the number of tokens in the \c *Tokens
4860
* array.
4861
*
4862
*/
4863
CINDEX_LINKAGE
void
clang_tokenize
(
CXTranslationUnit
TU,
CXSourceRange
Range
,
4864
CXToken
**Tokens,
unsigned
*NumTokens);
4865
4866
/**
4867
* Annotate the given set of tokens by providing cursors for each token
4868
* that can be mapped to a specific entity within the abstract syntax tree.
4869
*
4870
* This token-annotation routine is equivalent to invoking
4871
* clang_getCursor() for the source locations of each of the
4872
* tokens. The cursors provided are filtered, so that only those
4873
* cursors that have a direct correspondence to the token are
4874
* accepted. For example, given a function call \c f(x),
4875
* clang_getCursor() would provide the following cursors:
4876
*
4877
* * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
4878
* * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
4879
* * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
4880
*
4881
* Only the first and last of these cursors will occur within the
4882
* annotate, since the tokens "f" and "x' directly refer to a function
4883
* and a variable, respectively, but the parentheses are just a small
4884
* part of the full syntax of the function call expression, which is
4885
* not provided as an annotation.
4886
*
4887
* \param TU the translation unit that owns the given tokens.
4888
*
4889
* \param Tokens the set of tokens to annotate.
4890
*
4891
* \param NumTokens the number of tokens in \p Tokens.
4892
*
4893
* \param Cursors an array of \p NumTokens cursors, whose contents will be
4894
* replaced with the cursors corresponding to each token.
4895
*/
4896
CINDEX_LINKAGE
void
clang_annotateTokens
(
CXTranslationUnit
TU,
CXToken
*Tokens,
4897
unsigned
NumTokens,
CXCursor
*Cursors);
4898
4899
/**
4900
* Free the given set of tokens.
4901
*/
4902
CINDEX_LINKAGE
void
clang_disposeTokens
(
CXTranslationUnit
TU,
CXToken
*Tokens,
4903
unsigned
NumTokens);
4904
4905
/**
4906
* @}
4907
*/
4908
4909
/**
4910
* \defgroup CINDEX_DEBUG Debugging facilities
4911
*
4912
* These routines are used for testing and debugging, only, and should not
4913
* be relied upon.
4914
*
4915
* @{
4916
*/
4917
4918
/* for debug/testing */
4919
CINDEX_LINKAGE
CXString
clang_getCursorKindSpelling
(
enum
CXCursorKind
Kind
);
4920
CINDEX_LINKAGE
void
clang_getDefinitionSpellingAndExtent
(
4921
CXCursor
,
const
char
**startBuf,
const
char
**endBuf,
unsigned
*startLine,
4922
unsigned
*startColumn,
unsigned
*endLine,
unsigned
*endColumn);
4923
CINDEX_LINKAGE
void
clang_enableStackTraces
(
void
);
4924
CINDEX_LINKAGE
void
clang_executeOnThread
(
void
(*fn)(
void
*),
void
*user_data,
4925
unsigned
stack_size);
4926
4927
/**
4928
* @}
4929
*/
4930
4931
/**
4932
* \defgroup CINDEX_CODE_COMPLET Code completion
4933
*
4934
* Code completion involves taking an (incomplete) source file, along with
4935
* knowledge of where the user is actively editing that file, and suggesting
4936
* syntactically- and semantically-valid constructs that the user might want to
4937
* use at that particular point in the source code. These data structures and
4938
* routines provide support for code completion.
4939
*
4940
* @{
4941
*/
4942
4943
/**
4944
* A semantic string that describes a code-completion result.
4945
*
4946
* A semantic string that describes the formatting of a code-completion
4947
* result as a single "template" of text that should be inserted into the
4948
* source buffer when a particular code-completion result is selected.
4949
* Each semantic string is made up of some number of "chunks", each of which
4950
* contains some text along with a description of what that text means, e.g.,
4951
* the name of the entity being referenced, whether the text chunk is part of
4952
* the template, or whether it is a "placeholder" that the user should replace
4953
* with actual code,of a specific kind. See \c CXCompletionChunkKind for a
4954
* description of the different kinds of chunks.
4955
*/
4956
typedef
void
*
CXCompletionString
;
4957
4958
/**
4959
* A single result of code completion.
4960
*/
4961
typedef
struct
{
4962
/**
4963
* The kind of entity that this completion refers to.
4964
*
4965
* The cursor kind will be a macro, keyword, or a declaration (one of the
4966
* *Decl cursor kinds), describing the entity that the completion is
4967
* referring to.
4968
*
4969
* \todo In the future, we would like to provide a full cursor, to allow
4970
* the client to extract additional information from declaration.
4971
*/
4972
enum
CXCursorKind
CursorKind
;
4973
4974
/**
4975
* The code-completion string that describes how to insert this
4976
* code-completion result into the editing buffer.
4977
*/
4978
CXCompletionString
CompletionString
;
4979
}
CXCompletionResult
;
4980
4981
/**
4982
* Describes a single piece of text within a code-completion string.
4983
*
4984
* Each "chunk" within a code-completion string (\c CXCompletionString) is
4985
* either a piece of text with a specific "kind" that describes how that text
4986
* should be interpreted by the client or is another completion string.
4987
*/
4988
enum
CXCompletionChunkKind
{
4989
/**
4990
* A code-completion string that describes "optional" text that
4991
* could be a part of the template (but is not required).
4992
*
4993
* The Optional chunk is the only kind of chunk that has a code-completion
4994
* string for its representation, which is accessible via
4995
* \c clang_getCompletionChunkCompletionString(). The code-completion string
4996
* describes an additional part of the template that is completely optional.
4997
* For example, optional chunks can be used to describe the placeholders for
4998
* arguments that match up with defaulted function parameters, e.g. given:
4999
*
5000
* \code
5001
* void f(int x, float y = 3.14, double z = 2.71828);
5002
* \endcode
5003
*
5004
* The code-completion string for this function would contain:
5005
* - a TypedText chunk for "f".
5006
* - a LeftParen chunk for "(".
5007
* - a Placeholder chunk for "int x"
5008
* - an Optional chunk containing the remaining defaulted arguments, e.g.,
5009
* - a Comma chunk for ","
5010
* - a Placeholder chunk for "float y"
5011
* - an Optional chunk containing the last defaulted argument:
5012
* - a Comma chunk for ","
5013
* - a Placeholder chunk for "double z"
5014
* - a RightParen chunk for ")"
5015
*
5016
* There are many ways to handle Optional chunks. Two simple approaches are:
5017
* - Completely ignore optional chunks, in which case the template for the
5018
* function "f" would only include the first parameter ("int x").
5019
* - Fully expand all optional chunks, in which case the template for the
5020
* function "f" would have all of the parameters.
5021
*/
5022
CXCompletionChunk_Optional
,
5023
/**
5024
* Text that a user would be expected to type to get this
5025
* code-completion result.
5026
*
5027
* There will be exactly one "typed text" chunk in a semantic string, which
5028
* will typically provide the spelling of a keyword or the name of a
5029
* declaration that could be used at the current code point. Clients are
5030
* expected to filter the code-completion results based on the text in this
5031
* chunk.
5032
*/
5033
CXCompletionChunk_TypedText
,
5034
/**
5035
* Text that should be inserted as part of a code-completion result.
5036
*
5037
* A "text" chunk represents text that is part of the template to be
5038
* inserted into user code should this particular code-completion result
5039
* be selected.
5040
*/
5041
CXCompletionChunk_Text
,
5042
/**
5043
* Placeholder text that should be replaced by the user.
5044
*
5045
* A "placeholder" chunk marks a place where the user should insert text
5046
* into the code-completion template. For example, placeholders might mark
5047
* the function parameters for a function declaration, to indicate that the
5048
* user should provide arguments for each of those parameters. The actual
5049
* text in a placeholder is a suggestion for the text to display before
5050
* the user replaces the placeholder with real code.
5051
*/
5052
CXCompletionChunk_Placeholder
,
5053
/**
5054
* Informative text that should be displayed but never inserted as
5055
* part of the template.
5056
*
5057
* An "informative" chunk contains annotations that can be displayed to
5058
* help the user decide whether a particular code-completion result is the
5059
* right option, but which is not part of the actual template to be inserted
5060
* by code completion.
5061
*/
5062
CXCompletionChunk_Informative
,
5063
/**
5064
* Text that describes the current parameter when code-completion is
5065
* referring to function call, message send, or template specialization.
5066
*
5067
* A "current parameter" chunk occurs when code-completion is providing
5068
* information about a parameter corresponding to the argument at the
5069
* code-completion point. For example, given a function
5070
*
5071
* \code
5072
* int add(int x, int y);
5073
* \endcode
5074
*
5075
* and the source code \c add(, where the code-completion point is after the
5076
* "(", the code-completion string will contain a "current parameter" chunk
5077
* for "int x", indicating that the current argument will initialize that
5078
* parameter. After typing further, to \c add(17, (where the code-completion
5079
* point is after the ","), the code-completion string will contain a
5080
* "current parameter" chunk to "int y".
5081
*/
5082
CXCompletionChunk_CurrentParameter
,
5083
/**
5084
* A left parenthesis ('('), used to initiate a function call or
5085
* signal the beginning of a function parameter list.
5086
*/
5087
CXCompletionChunk_LeftParen
,
5088
/**
5089
* A right parenthesis (')'), used to finish a function call or
5090
* signal the end of a function parameter list.
5091
*/
5092
CXCompletionChunk_RightParen
,
5093
/**
5094
* A left bracket ('[').
5095
*/
5096
CXCompletionChunk_LeftBracket
,
5097
/**
5098
* A right bracket (']').
5099
*/
5100
CXCompletionChunk_RightBracket
,
5101
/**
5102
* A left brace ('{').
5103
*/
5104
CXCompletionChunk_LeftBrace
,
5105
/**
5106
* A right brace ('}').
5107
*/
5108
CXCompletionChunk_RightBrace
,
5109
/**
5110
* A left angle bracket ('<').
5111
*/
5112
CXCompletionChunk_LeftAngle
,
5113
/**
5114
* A right angle bracket ('>').
5115
*/
5116
CXCompletionChunk_RightAngle
,
5117
/**
5118
* A comma separator (',').
5119
*/
5120
CXCompletionChunk_Comma
,
5121
/**
5122
* Text that specifies the result type of a given result.
5123
*
5124
* This special kind of informative chunk is not meant to be inserted into
5125
* the text buffer. Rather, it is meant to illustrate the type that an
5126
* expression using the given completion string would have.
5127
*/
5128
CXCompletionChunk_ResultType
,
5129
/**
5130
* A colon (':').
5131
*/
5132
CXCompletionChunk_Colon
,
5133
/**
5134
* A semicolon (';').
5135
*/
5136
CXCompletionChunk_SemiColon
,
5137
/**
5138
* An '=' sign.
5139
*/
5140
CXCompletionChunk_Equal
,
5141
/**
5142
* Horizontal space (' ').
5143
*/
5144
CXCompletionChunk_HorizontalSpace
,
5145
/**
5146
* Vertical space ('\\n'), after which it is generally a good idea to
5147
* perform indentation.
5148
*/
5149
CXCompletionChunk_VerticalSpace
5150
};
5151
5152
/**
5153
* Determine the kind of a particular chunk within a completion string.
5154
*
5155
* \param completion_string the completion string to query.
5156
*
5157
* \param chunk_number the 0-based index of the chunk in the completion string.
5158
*
5159
* \returns the kind of the chunk at the index \c chunk_number.
5160
*/
5161
CINDEX_LINKAGE
enum
CXCompletionChunkKind
5162
clang_getCompletionChunkKind
(
CXCompletionString
completion_string,