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 module clang.c.Index;
17 
18 import core.stdc.config;
19 import core.stdc.time;
20 
21 public import clang.c.CXErrorCode;
22 public import clang.c.CXString;
23 
24 extern (C):
25 
26 /**
27  * The version constants for the libclang API.
28  * CINDEX_VERSION_MINOR should increase when there are API additions.
29  * CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes.
30  *
31  * The policy about the libclang API was always to keep it source and ABI
32  * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
33  */
34 enum CINDEX_VERSION_MAJOR = 0;
35 enum CINDEX_VERSION_MINOR = 61;
36 
37 extern (D) auto CINDEX_VERSION_ENCODE(T0, T1)(auto ref T0 major, auto ref T1 minor)
38 {
39     return (major * 10000) + (minor * 1);
40 }
41 
42 enum CINDEX_VERSION = CINDEX_VERSION_ENCODE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR);
43 
44 extern (D) string CINDEX_VERSION_STRINGIZE_(T0, T1)(auto ref T0 major, auto ref T1 minor)
45 {
46     import std.conv : to;
47 
48     return to!string(major) ~ "." ~ to!string(minor);
49 }
50 
51 alias CINDEX_VERSION_STRINGIZE = CINDEX_VERSION_STRINGIZE_;
52 
53 enum CINDEX_VERSION_STRING = CINDEX_VERSION_STRINGIZE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR);
54 
55 /** \defgroup CINDEX libclang: C Interface to Clang
56  *
57  * The C Interface to Clang provides a relatively small API that exposes
58  * facilities for parsing source code into an abstract syntax tree (AST),
59  * loading already-parsed ASTs, traversing the AST, associating
60  * physical source locations with elements within the AST, and other
61  * facilities that support Clang-based development tools.
62  *
63  * This C interface to Clang will never provide all of the information
64  * representation stored in Clang's C++ AST, nor should it: the intent is to
65  * maintain an API that is relatively stable from one release to the next,
66  * providing only the basic functionality needed to support development tools.
67  *
68  * To avoid namespace pollution, data types are prefixed with "CX" and
69  * functions are prefixed with "clang_".
70  *
71  * @{
72  */
73 
74 /**
75  * An "index" that consists of a set of translation units that would
76  * typically be linked together into an executable or library.
77  */
78 alias CXIndex = void*;
79 
80 /**
81  * An opaque type representing target information for a given translation
82  * unit.
83  */
84 struct CXTargetInfoImpl;
85 alias CXTargetInfo = CXTargetInfoImpl*;
86 
87 /**
88  * A single translation unit, which resides in an index.
89  */
90 struct CXTranslationUnitImpl;
91 alias CXTranslationUnit = CXTranslationUnitImpl*;
92 
93 /**
94  * Opaque pointer representing client data that will be passed through
95  * to various callbacks and visitors.
96  */
97 alias CXClientData = void*;
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     /**
109      * The file whose contents have not yet been saved.
110      *
111      * This file must already exist in the file system.
112      */
113     const(char)* Filename;
114 
115     /**
116      * A buffer containing the unsaved contents of this file.
117      */
118     const(char)* Contents;
119 
120     /**
121      * The length of the unsaved contents of this buffer.
122      */
123     c_ulong Length;
124 }
125 
126 /**
127  * Describes the availability of a particular entity, which indicates
128  * whether the use of this entity will result in a warning or error due to
129  * it being deprecated or unavailable.
130  */
131 enum CXAvailabilityKind
132 {
133     /**
134      * The entity is available.
135      */
136     available = 0,
137     /**
138      * The entity is available, but has been deprecated (and its use is
139      * not recommended).
140      */
141     deprecated_ = 1,
142     /**
143      * The entity is not available; any use of it will be an error.
144      */
145     notAvailable = 2,
146     /**
147      * The entity is available, but not accessible; any use of it will be
148      * an error.
149      */
150     notAccessible = 3
151 }
152 
153 /**
154  * Describes a version number of the form major.minor.subminor.
155  */
156 struct CXVersion
157 {
158     /**
159      * The major version number, e.g., the '10' in '10.7.3'. A negative
160      * value indicates that there is no version number at all.
161      */
162     int Major;
163     /**
164      * The minor version number, e.g., the '7' in '10.7.3'. This value
165      * will be negative if no minor version number was provided, e.g., for
166      * version '10'.
167      */
168     int Minor;
169     /**
170      * The subminor version number, e.g., the '3' in '10.7.3'. This value
171      * will be negative if no minor or subminor version number was provided,
172      * e.g., in version '10' or '10.7'.
173      */
174     int Subminor;
175 }
176 
177 /**
178  * Describes the exception specification of a cursor.
179  *
180  * A negative value indicates that the cursor is not a function declaration.
181  */
182 enum CXCursor_ExceptionSpecificationKind
183 {
184     /**
185      * The cursor has no exception specification.
186      */
187     none = 0,
188 
189     /**
190      * The cursor has exception specification throw()
191      */
192     dynamicNone = 1,
193 
194     /**
195      * The cursor has exception specification throw(T1, T2)
196      */
197     dynamic = 2,
198 
199     /**
200      * The cursor has exception specification throw(...).
201      */
202     msAny = 3,
203 
204     /**
205      * The cursor has exception specification basic noexcept.
206      */
207     basicNoexcept = 4,
208 
209     /**
210      * The cursor has exception specification computed noexcept.
211      */
212     computedNoexcept = 5,
213 
214     /**
215      * The exception specification has not yet been evaluated.
216      */
217     unevaluated = 6,
218 
219     /**
220      * The exception specification has not yet been instantiated.
221      */
222     uninstantiated = 7,
223 
224     /**
225      * The exception specification has not been parsed yet.
226      */
227     unparsed = 8,
228 
229     /**
230      * The cursor has a __declspec(nothrow) exception specification.
231      */
232     noThrow = 9
233 }
234 
235 /**
236  * Provides a shared context for creating translation units.
237  *
238  * It provides two options:
239  *
240  * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
241  * declarations (when loading any new translation units). A "local" declaration
242  * is one that belongs in the translation unit itself and not in a precompiled
243  * header that was used by the translation unit. If zero, all declarations
244  * will be enumerated.
245  *
246  * Here is an example:
247  *
248  * \code
249  *   // excludeDeclsFromPCH = 1, displayDiagnostics=1
250  *   Idx = clang_createIndex(1, 1);
251  *
252  *   // IndexTest.pch was produced with the following command:
253  *   // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
254  *   TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
255  *
256  *   // This will load all the symbols from 'IndexTest.pch'
257  *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
258  *                       TranslationUnitVisitor, 0);
259  *   clang_disposeTranslationUnit(TU);
260  *
261  *   // This will load all the symbols from 'IndexTest.c', excluding symbols
262  *   // from 'IndexTest.pch'.
263  *   char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
264  *   TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
265  *                                                  0, 0);
266  *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
267  *                       TranslationUnitVisitor, 0);
268  *   clang_disposeTranslationUnit(TU);
269  * \endcode
270  *
271  * This process of creating the 'pch', loading it separately, and using it (via
272  * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
273  * (which gives the indexer the same performance benefit as the compiler).
274  */
275 CXIndex clang_createIndex(
276     int excludeDeclarationsFromPCH,
277     int displayDiagnostics);
278 
279 /**
280  * Destroy the given index.
281  *
282  * The index must not be destroyed until all of the translation units created
283  * within that index have been destroyed.
284  */
285 void clang_disposeIndex(CXIndex index);
286 
287 enum CXGlobalOptFlags
288 {
289     /**
290      * Used to indicate that no special CXIndex options are needed.
291      */
292     none = 0x0,
293 
294     /**
295      * Used to indicate that threads that libclang creates for indexing
296      * purposes should use background priority.
297      *
298      * Affects #clang_indexSourceFile, #clang_indexTranslationUnit,
299      * #clang_parseTranslationUnit, #clang_saveTranslationUnit.
300      */
301     threadBackgroundPriorityForIndexing = 0x1,
302 
303     /**
304      * Used to indicate that threads that libclang creates for editing
305      * purposes should use background priority.
306      *
307      * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt,
308      * #clang_annotateTokens
309      */
310     threadBackgroundPriorityForEditing = 0x2,
311 
312     /**
313      * Used to indicate that all threads that libclang creates should use
314      * background priority.
315      */
316     threadBackgroundPriorityForAll = threadBackgroundPriorityForIndexing | threadBackgroundPriorityForEditing
317 }
318 
319 /**
320  * Sets general options associated with a CXIndex.
321  *
322  * For example:
323  * \code
324  * CXIndex idx = ...;
325  * clang_CXIndex_setGlobalOptions(idx,
326  *     clang_CXIndex_getGlobalOptions(idx) |
327  *     CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
328  * \endcode
329  *
330  * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.
331  */
332 void clang_CXIndex_setGlobalOptions(CXIndex, uint options);
333 
334 /**
335  * Gets the general options associated with a CXIndex.
336  *
337  * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that
338  * are associated with the given CXIndex object.
339  */
340 uint clang_CXIndex_getGlobalOptions(CXIndex);
341 
342 /**
343  * Sets the invocation emission path option in a CXIndex.
344  *
345  * The invocation emission path specifies a path which will contain log
346  * files for certain libclang invocations. A null value (default) implies that
347  * libclang invocations are not logged..
348  */
349 void clang_CXIndex_setInvocationEmissionPathOption(CXIndex, const(char)* Path);
350 
351 /**
352  * \defgroup CINDEX_FILES File manipulation routines
353  *
354  * @{
355  */
356 
357 /**
358  * A particular source file that is part of a translation unit.
359  */
360 alias CXFile = void*;
361 
362 /**
363  * Retrieve the complete file and path name of the given file.
364  */
365 CXString clang_getFileName(CXFile SFile);
366 
367 /**
368  * Retrieve the last modification time of the given file.
369  */
370 time_t clang_getFileTime(CXFile SFile);
371 
372 /**
373  * Uniquely identifies a CXFile, that refers to the same underlying file,
374  * across an indexing session.
375  */
376 struct CXFileUniqueID
377 {
378     ulong[3] data;
379 }
380 
381 /**
382  * Retrieve the unique ID for the given \c file.
383  *
384  * \param file the file to get the ID for.
385  * \param outID stores the returned CXFileUniqueID.
386  * \returns If there was a failure getting the unique ID, returns non-zero,
387  * otherwise returns 0.
388  */
389 int clang_getFileUniqueID(CXFile file, CXFileUniqueID* outID);
390 
391 /**
392  * Determine whether the given header is guarded against
393  * multiple inclusions, either with the conventional
394  * \#ifndef/\#define/\#endif macro guards or with \#pragma once.
395  */
396 uint clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
397 
398 /**
399  * Retrieve a file handle within the given translation unit.
400  *
401  * \param tu the translation unit
402  *
403  * \param file_name the name of the file.
404  *
405  * \returns the file handle for the named file in the translation unit \p tu,
406  * or a NULL file handle if the file was not a part of this translation unit.
407  */
408 CXFile clang_getFile(CXTranslationUnit tu, const(char)* file_name);
409 
410 /**
411  * Retrieve the buffer associated with the given file.
412  *
413  * \param tu the translation unit
414  *
415  * \param file the file for which to retrieve the buffer.
416  *
417  * \param size [out] if non-NULL, will be set to the size of the buffer.
418  *
419  * \returns a pointer to the buffer in memory that holds the contents of
420  * \p file, or a NULL pointer when the file is not loaded.
421  */
422 const(char)* clang_getFileContents(
423     CXTranslationUnit tu,
424     CXFile file,
425     size_t* size);
426 
427 /**
428  * Returns non-zero if the \c file1 and \c file2 point to the same file,
429  * or they are both NULL.
430  */
431 int clang_File_isEqual(CXFile file1, CXFile file2);
432 
433 /**
434  * Returns the real path name of \c file.
435  *
436  * An empty string may be returned. Use \c clang_getFileName() in that case.
437  */
438 CXString clang_File_tryGetRealPathName(CXFile file);
439 
440 /**
441  * @}
442  */
443 
444 /**
445  * \defgroup CINDEX_LOCATIONS Physical source locations
446  *
447  * Clang represents physical source locations in its abstract syntax tree in
448  * great detail, with file, line, and column information for the majority of
449  * the tokens parsed in the source code. These data types and functions are
450  * used to represent source location information, either for a particular
451  * point in the program or for a range of points in the program, and extract
452  * specific location information from those data types.
453  *
454  * @{
455  */
456 
457 /**
458  * Identifies a specific source location within a translation
459  * unit.
460  *
461  * Use clang_getExpansionLocation() or clang_getSpellingLocation()
462  * to map a source location to a particular file, line, and column.
463  */
464 struct CXSourceLocation
465 {
466     const(void)*[2] ptr_data;
467     uint int_data;
468 }
469 
470 /**
471  * Identifies a half-open character range in the source code.
472  *
473  * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
474  * starting and end locations from a source range, respectively.
475  */
476 struct CXSourceRange
477 {
478     const(void)*[2] ptr_data;
479     uint begin_int_data;
480     uint end_int_data;
481 }
482 
483 /**
484  * Retrieve a NULL (invalid) source location.
485  */
486 CXSourceLocation clang_getNullLocation();
487 
488 /**
489  * Determine whether two source locations, which must refer into
490  * the same translation unit, refer to exactly the same point in the source
491  * code.
492  *
493  * \returns non-zero if the source locations refer to the same location, zero
494  * if they refer to different locations.
495  */
496 uint clang_equalLocations(CXSourceLocation loc1, CXSourceLocation loc2);
497 
498 /**
499  * Retrieves the source location associated with a given file/line/column
500  * in a particular translation unit.
501  */
502 CXSourceLocation clang_getLocation(
503     CXTranslationUnit tu,
504     CXFile file,
505     uint line,
506     uint column);
507 /**
508  * Retrieves the source location associated with a given character offset
509  * in a particular translation unit.
510  */
511 CXSourceLocation clang_getLocationForOffset(
512     CXTranslationUnit tu,
513     CXFile file,
514     uint offset);
515 
516 /**
517  * Returns non-zero if the given source location is in a system header.
518  */
519 int clang_Location_isInSystemHeader(CXSourceLocation location);
520 
521 /**
522  * Returns non-zero if the given source location is in the main file of
523  * the corresponding translation unit.
524  */
525 int clang_Location_isFromMainFile(CXSourceLocation location);
526 
527 /**
528  * Retrieve a NULL (invalid) source range.
529  */
530 CXSourceRange clang_getNullRange();
531 
532 /**
533  * Retrieve a source range given the beginning and ending source
534  * locations.
535  */
536 CXSourceRange clang_getRange(CXSourceLocation begin, CXSourceLocation end);
537 
538 /**
539  * Determine whether two ranges are equivalent.
540  *
541  * \returns non-zero if the ranges are the same, zero if they differ.
542  */
543 uint clang_equalRanges(CXSourceRange range1, CXSourceRange range2);
544 
545 /**
546  * Returns non-zero if \p range is null.
547  */
548 int clang_Range_isNull(CXSourceRange range);
549 
550 /**
551  * Retrieve the file, line, column, and offset represented by
552  * the given source location.
553  *
554  * If the location refers into a macro expansion, retrieves the
555  * location of the macro expansion.
556  *
557  * \param location the location within a source file that will be decomposed
558  * into its parts.
559  *
560  * \param file [out] if non-NULL, will be set to the file to which the given
561  * source location points.
562  *
563  * \param line [out] if non-NULL, will be set to the line to which the given
564  * source location points.
565  *
566  * \param column [out] if non-NULL, will be set to the column to which the given
567  * source location points.
568  *
569  * \param offset [out] if non-NULL, will be set to the offset into the
570  * buffer to which the given source location points.
571  */
572 void clang_getExpansionLocation(
573     CXSourceLocation location,
574     CXFile* file,
575     uint* line,
576     uint* column,
577     uint* offset);
578 
579 /**
580  * Retrieve the file, line and column represented by the given source
581  * location, as specified in a # line directive.
582  *
583  * Example: given the following source code in a file somefile.c
584  *
585  * \code
586  * #123 "dummy.c" 1
587  *
588  * static int func(void)
589  * {
590  *     return 0;
591  * }
592  * \endcode
593  *
594  * the location information returned by this function would be
595  *
596  * File: dummy.c Line: 124 Column: 12
597  *
598  * whereas clang_getExpansionLocation would have returned
599  *
600  * File: somefile.c Line: 3 Column: 12
601  *
602  * \param location the location within a source file that will be decomposed
603  * into its parts.
604  *
605  * \param filename [out] if non-NULL, will be set to the filename of the
606  * source location. Note that filenames returned will be for "virtual" files,
607  * which don't necessarily exist on the machine running clang - e.g. when
608  * parsing preprocessed output obtained from a different environment. If
609  * a non-NULL value is passed in, remember to dispose of the returned value
610  * using \c clang_disposeString() once you've finished with it. For an invalid
611  * source location, an empty string is returned.
612  *
613  * \param line [out] if non-NULL, will be set to the line number of the
614  * source location. For an invalid source location, zero is returned.
615  *
616  * \param column [out] if non-NULL, will be set to the column number of the
617  * source location. For an invalid source location, zero is returned.
618  */
619 void clang_getPresumedLocation(
620     CXSourceLocation location,
621     CXString* filename,
622     uint* line,
623     uint* column);
624 
625 /**
626  * Legacy API to retrieve the file, line, column, and offset represented
627  * by the given source location.
628  *
629  * This interface has been replaced by the newer interface
630  * #clang_getExpansionLocation(). See that interface's documentation for
631  * details.
632  */
633 void clang_getInstantiationLocation(
634     CXSourceLocation location,
635     CXFile* file,
636     uint* line,
637     uint* column,
638     uint* offset);
639 
640 /**
641  * Retrieve the file, line, column, and offset represented by
642  * the given source location.
643  *
644  * If the location refers into a macro instantiation, return where the
645  * location was originally spelled in the source file.
646  *
647  * \param location the location within a source file that will be decomposed
648  * into its parts.
649  *
650  * \param file [out] if non-NULL, will be set to the file to which the given
651  * source location points.
652  *
653  * \param line [out] if non-NULL, will be set to the line to which the given
654  * source location points.
655  *
656  * \param column [out] if non-NULL, will be set to the column to which the given
657  * source location points.
658  *
659  * \param offset [out] if non-NULL, will be set to the offset into the
660  * buffer to which the given source location points.
661  */
662 void clang_getSpellingLocation(
663     CXSourceLocation location,
664     CXFile* file,
665     uint* line,
666     uint* column,
667     uint* offset);
668 
669 /**
670  * Retrieve the file, line, column, and offset represented by
671  * the given source location.
672  *
673  * If the location refers into a macro expansion, return where the macro was
674  * expanded or where the macro argument was written, if the location points at
675  * a macro argument.
676  *
677  * \param location the location within a source file that will be decomposed
678  * into its parts.
679  *
680  * \param file [out] if non-NULL, will be set to the file to which the given
681  * source location points.
682  *
683  * \param line [out] if non-NULL, will be set to the line to which the given
684  * source location points.
685  *
686  * \param column [out] if non-NULL, will be set to the column to which the given
687  * source location points.
688  *
689  * \param offset [out] if non-NULL, will be set to the offset into the
690  * buffer to which the given source location points.
691  */
692 void clang_getFileLocation(
693     CXSourceLocation location,
694     CXFile* file,
695     uint* line,
696     uint* column,
697     uint* offset);
698 
699 /**
700  * Retrieve a source location representing the first character within a
701  * source range.
702  */
703 CXSourceLocation clang_getRangeStart(CXSourceRange range);
704 
705 /**
706  * Retrieve a source location representing the last character within a
707  * source range.
708  */
709 CXSourceLocation clang_getRangeEnd(CXSourceRange range);
710 
711 /**
712  * Identifies an array of ranges.
713  */
714 struct CXSourceRangeList
715 {
716     /** The number of ranges in the \c ranges array. */
717     uint count;
718     /**
719      * An array of \c CXSourceRanges.
720      */
721     CXSourceRange* ranges;
722 }
723 
724 /**
725  * Retrieve all ranges that were skipped by the preprocessor.
726  *
727  * The preprocessor will skip lines when they are surrounded by an
728  * if/ifdef/ifndef directive whose condition does not evaluate to true.
729  */
730 CXSourceRangeList* clang_getSkippedRanges(CXTranslationUnit tu, CXFile file);
731 
732 /**
733  * Retrieve all ranges from all files that were skipped by the
734  * preprocessor.
735  *
736  * The preprocessor will skip lines when they are surrounded by an
737  * if/ifdef/ifndef directive whose condition does not evaluate to true.
738  */
739 CXSourceRangeList* clang_getAllSkippedRanges(CXTranslationUnit tu);
740 
741 /**
742  * Destroy the given \c CXSourceRangeList.
743  */
744 void clang_disposeSourceRangeList(CXSourceRangeList* ranges);
745 
746 /**
747  * @}
748  */
749 
750 /**
751  * \defgroup CINDEX_DIAG Diagnostic reporting
752  *
753  * @{
754  */
755 
756 /**
757  * Describes the severity of a particular diagnostic.
758  */
759 enum CXDiagnosticSeverity
760 {
761     /**
762      * A diagnostic that has been suppressed, e.g., by a command-line
763      * option.
764      */
765     ignored = 0,
766 
767     /**
768      * This diagnostic is a note that should be attached to the
769      * previous (non-note) diagnostic.
770      */
771     note = 1,
772 
773     /**
774      * This diagnostic indicates suspicious code that may not be
775      * wrong.
776      */
777     warning = 2,
778 
779     /**
780      * This diagnostic indicates that the code is ill-formed.
781      */
782     error = 3,
783 
784     /**
785      * This diagnostic indicates that the code is ill-formed such
786      * that future parser recovery is unlikely to produce useful
787      * results.
788      */
789     fatal = 4
790 }
791 
792 /**
793  * A single diagnostic, containing the diagnostic's severity,
794  * location, text, source ranges, and fix-it hints.
795  */
796 alias CXDiagnostic = void*;
797 
798 /**
799  * A group of CXDiagnostics.
800  */
801 alias CXDiagnosticSet = void*;
802 
803 /**
804  * Determine the number of diagnostics in a CXDiagnosticSet.
805  */
806 uint clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags);
807 
808 /**
809  * Retrieve a diagnostic associated with the given CXDiagnosticSet.
810  *
811  * \param Diags the CXDiagnosticSet to query.
812  * \param Index the zero-based diagnostic number to retrieve.
813  *
814  * \returns the requested diagnostic. This diagnostic must be freed
815  * via a call to \c clang_disposeDiagnostic().
816  */
817 CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags, uint Index);
818 
819 /**
820  * Describes the kind of error that occurred (if any) in a call to
821  * \c clang_loadDiagnostics.
822  */
823 enum CXLoadDiag_Error
824 {
825     /**
826      * Indicates that no error occurred.
827      */
828     none = 0,
829 
830     /**
831      * Indicates that an unknown error occurred while attempting to
832      * deserialize diagnostics.
833      */
834     unknown = 1,
835 
836     /**
837      * Indicates that the file containing the serialized diagnostics
838      * could not be opened.
839      */
840     cannotLoad = 2,
841 
842     /**
843      * Indicates that the serialized diagnostics file is invalid or
844      * corrupt.
845      */
846     invalidFile = 3
847 }
848 
849 /**
850  * Deserialize a set of diagnostics from a Clang diagnostics bitcode
851  * file.
852  *
853  * \param file The name of the file to deserialize.
854  * \param error A pointer to a enum value recording if there was a problem
855  *        deserializing the diagnostics.
856  * \param errorString A pointer to a CXString for recording the error string
857  *        if the file was not successfully loaded.
858  *
859  * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise.  These
860  * diagnostics should be released using clang_disposeDiagnosticSet().
861  */
862 CXDiagnosticSet clang_loadDiagnostics(
863     const(char)* file,
864     CXLoadDiag_Error* error,
865     CXString* errorString);
866 
867 /**
868  * Release a CXDiagnosticSet and all of its contained diagnostics.
869  */
870 void clang_disposeDiagnosticSet(CXDiagnosticSet Diags);
871 
872 /**
873  * Retrieve the child diagnostics of a CXDiagnostic.
874  *
875  * This CXDiagnosticSet does not need to be released by
876  * clang_disposeDiagnosticSet.
877  */
878 CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D);
879 
880 /**
881  * Determine the number of diagnostics produced for the given
882  * translation unit.
883  */
884 uint clang_getNumDiagnostics(CXTranslationUnit Unit);
885 
886 /**
887  * Retrieve a diagnostic associated with the given translation unit.
888  *
889  * \param Unit the translation unit to query.
890  * \param Index the zero-based diagnostic number to retrieve.
891  *
892  * \returns the requested diagnostic. This diagnostic must be freed
893  * via a call to \c clang_disposeDiagnostic().
894  */
895 CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, uint Index);
896 
897 /**
898  * Retrieve the complete set of diagnostics associated with a
899  *        translation unit.
900  *
901  * \param Unit the translation unit to query.
902  */
903 CXDiagnosticSet clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);
904 
905 /**
906  * Destroy a diagnostic.
907  */
908 void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
909 
910 /**
911  * Options to control the display of diagnostics.
912  *
913  * The values in this enum are meant to be combined to customize the
914  * behavior of \c clang_formatDiagnostic().
915  */
916 enum CXDiagnosticDisplayOptions
917 {
918     /**
919      * Display the source-location information where the
920      * diagnostic was located.
921      *
922      * When set, diagnostics will be prefixed by the file, line, and
923      * (optionally) column to which the diagnostic refers. For example,
924      *
925      * \code
926      * test.c:28: warning: extra tokens at end of #endif directive
927      * \endcode
928      *
929      * This option corresponds to the clang flag \c -fshow-source-location.
930      */
931     displaySourceLocation = 0x01,
932 
933     /**
934      * If displaying the source-location information of the
935      * diagnostic, also include the column number.
936      *
937      * This option corresponds to the clang flag \c -fshow-column.
938      */
939     displayColumn = 0x02,
940 
941     /**
942      * If displaying the source-location information of the
943      * diagnostic, also include information about source ranges in a
944      * machine-parsable format.
945      *
946      * This option corresponds to the clang flag
947      * \c -fdiagnostics-print-source-range-info.
948      */
949     displaySourceRanges = 0x04,
950 
951     /**
952      * Display the option name associated with this diagnostic, if any.
953      *
954      * The option name displayed (e.g., -Wconversion) will be placed in brackets
955      * after the diagnostic text. This option corresponds to the clang flag
956      * \c -fdiagnostics-show-option.
957      */
958     displayOption = 0x08,
959 
960     /**
961      * Display the category number associated with this diagnostic, if any.
962      *
963      * The category number is displayed within brackets after the diagnostic text.
964      * This option corresponds to the clang flag
965      * \c -fdiagnostics-show-category=id.
966      */
967     displayCategoryId = 0x10,
968 
969     /**
970      * Display the category name associated with this diagnostic, if any.
971      *
972      * The category name is displayed within brackets after the diagnostic text.
973      * This option corresponds to the clang flag
974      * \c -fdiagnostics-show-category=name.
975      */
976     displayCategoryName = 0x20
977 }
978 
979 /**
980  * Format the given diagnostic in a manner that is suitable for display.
981  *
982  * This routine will format the given diagnostic to a string, rendering
983  * the diagnostic according to the various options given. The
984  * \c clang_defaultDiagnosticDisplayOptions() function returns the set of
985  * options that most closely mimics the behavior of the clang compiler.
986  *
987  * \param Diagnostic The diagnostic to print.
988  *
989  * \param Options A set of options that control the diagnostic display,
990  * created by combining \c CXDiagnosticDisplayOptions values.
991  *
992  * \returns A new string containing for formatted diagnostic.
993  */
994 CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, uint Options);
995 
996 /**
997  * Retrieve the set of display options most similar to the
998  * default behavior of the clang compiler.
999  *
1000  * \returns A set of display options suitable for use with \c
1001  * clang_formatDiagnostic().
1002  */
1003 uint clang_defaultDiagnosticDisplayOptions();
1004 
1005 /**
1006  * Determine the severity of the given diagnostic.
1007  */
1008 CXDiagnosticSeverity clang_getDiagnosticSeverity(CXDiagnostic);
1009 
1010 /**
1011  * Retrieve the source location of the given diagnostic.
1012  *
1013  * This location is where Clang would print the caret ('^') when
1014  * displaying the diagnostic on the command line.
1015  */
1016 CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic);
1017 
1018 /**
1019  * Retrieve the text of the given diagnostic.
1020  */
1021 CXString clang_getDiagnosticSpelling(CXDiagnostic);
1022 
1023 /**
1024  * Retrieve the name of the command-line option that enabled this
1025  * diagnostic.
1026  *
1027  * \param Diag The diagnostic to be queried.
1028  *
1029  * \param Disable If non-NULL, will be set to the option that disables this
1030  * diagnostic (if any).
1031  *
1032  * \returns A string that contains the command-line option used to enable this
1033  * warning, such as "-Wconversion" or "-pedantic".
1034  */
1035 CXString clang_getDiagnosticOption(CXDiagnostic Diag, CXString* Disable);
1036 
1037 /**
1038  * Retrieve the category number for this diagnostic.
1039  *
1040  * Diagnostics can be categorized into groups along with other, related
1041  * diagnostics (e.g., diagnostics under the same warning flag). This routine
1042  * retrieves the category number for the given diagnostic.
1043  *
1044  * \returns The number of the category that contains this diagnostic, or zero
1045  * if this diagnostic is uncategorized.
1046  */
1047 uint clang_getDiagnosticCategory(CXDiagnostic);
1048 
1049 /**
1050  * Retrieve the name of a particular diagnostic category.  This
1051  *  is now deprecated.  Use clang_getDiagnosticCategoryText()
1052  *  instead.
1053  *
1054  * \param Category A diagnostic category number, as returned by
1055  * \c clang_getDiagnosticCategory().
1056  *
1057  * \returns The name of the given diagnostic category.
1058  */
1059 CXString clang_getDiagnosticCategoryName(uint Category);
1060 
1061 /**
1062  * Retrieve the diagnostic category text for a given diagnostic.
1063  *
1064  * \returns The text of the given diagnostic category.
1065  */
1066 CXString clang_getDiagnosticCategoryText(CXDiagnostic);
1067 
1068 /**
1069  * Determine the number of source ranges associated with the given
1070  * diagnostic.
1071  */
1072 uint clang_getDiagnosticNumRanges(CXDiagnostic);
1073 
1074 /**
1075  * Retrieve a source range associated with the diagnostic.
1076  *
1077  * A diagnostic's source ranges highlight important elements in the source
1078  * code. On the command line, Clang displays source ranges by
1079  * underlining them with '~' characters.
1080  *
1081  * \param Diagnostic the diagnostic whose range is being extracted.
1082  *
1083  * \param Range the zero-based index specifying which range to
1084  *
1085  * \returns the requested source range.
1086  */
1087 CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic, uint Range);
1088 
1089 /**
1090  * Determine the number of fix-it hints associated with the
1091  * given diagnostic.
1092  */
1093 uint clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
1094 
1095 /**
1096  * Retrieve the replacement information for a given fix-it.
1097  *
1098  * Fix-its are described in terms of a source range whose contents
1099  * should be replaced by a string. This approach generalizes over
1100  * three kinds of operations: removal of source code (the range covers
1101  * the code to be removed and the replacement string is empty),
1102  * replacement of source code (the range covers the code to be
1103  * replaced and the replacement string provides the new code), and
1104  * insertion (both the start and end of the range point at the
1105  * insertion location, and the replacement string provides the text to
1106  * insert).
1107  *
1108  * \param Diagnostic The diagnostic whose fix-its are being queried.
1109  *
1110  * \param FixIt The zero-based index of the fix-it.
1111  *
1112  * \param ReplacementRange The source range whose contents will be
1113  * replaced with the returned replacement string. Note that source
1114  * ranges are half-open ranges [a, b), so the source code should be
1115  * replaced from a and up to (but not including) b.
1116  *
1117  * \returns A string containing text that should be replace the source
1118  * code indicated by the \c ReplacementRange.
1119  */
1120 CXString clang_getDiagnosticFixIt(
1121     CXDiagnostic Diagnostic,
1122     uint FixIt,
1123     CXSourceRange* ReplacementRange);
1124 
1125 /**
1126  * @}
1127  */
1128 
1129 /**
1130  * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation
1131  *
1132  * The routines in this group provide the ability to create and destroy
1133  * translation units from files, either by parsing the contents of the files or
1134  * by reading in a serialized representation of a translation unit.
1135  *
1136  * @{
1137  */
1138 
1139 /**
1140  * Get the original translation unit source file name.
1141  */
1142 CXString clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
1143 
1144 /**
1145  * Return the CXTranslationUnit for a given source file and the provided
1146  * command line arguments one would pass to the compiler.
1147  *
1148  * Note: The 'source_filename' argument is optional.  If the caller provides a
1149  * NULL pointer, the name of the source file is expected to reside in the
1150  * specified command line arguments.
1151  *
1152  * Note: When encountered in 'clang_command_line_args', the following options
1153  * are ignored:
1154  *
1155  *   '-c'
1156  *   '-emit-ast'
1157  *   '-fsyntax-only'
1158  *   '-o \<output file>'  (both '-o' and '\<output file>' are ignored)
1159  *
1160  * \param CIdx The index object with which the translation unit will be
1161  * associated.
1162  *
1163  * \param source_filename The name of the source file to load, or NULL if the
1164  * source file is included in \p clang_command_line_args.
1165  *
1166  * \param num_clang_command_line_args The number of command-line arguments in
1167  * \p clang_command_line_args.
1168  *
1169  * \param clang_command_line_args The command-line arguments that would be
1170  * passed to the \c clang executable if it were being invoked out-of-process.
1171  * These command-line options will be parsed and will affect how the translation
1172  * unit is parsed. Note that the following options are ignored: '-c',
1173  * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'.
1174  *
1175  * \param num_unsaved_files the number of unsaved file entries in \p
1176  * unsaved_files.
1177  *
1178  * \param unsaved_files the files that have not yet been saved to disk
1179  * but may be required for code completion, including the contents of
1180  * those files.  The contents and name of these files (as specified by
1181  * CXUnsavedFile) are copied when necessary, so the client only needs to
1182  * guarantee their validity until the call to this function returns.
1183  */
1184 CXTranslationUnit clang_createTranslationUnitFromSourceFile(
1185     CXIndex CIdx,
1186     const(char)* source_filename,
1187     int num_clang_command_line_args,
1188     const(char*)* clang_command_line_args,
1189     uint num_unsaved_files,
1190     CXUnsavedFile* unsaved_files);
1191 
1192 /**
1193  * Same as \c clang_createTranslationUnit2, but returns
1194  * the \c CXTranslationUnit instead of an error code.  In case of an error this
1195  * routine returns a \c NULL \c CXTranslationUnit, without further detailed
1196  * error codes.
1197  */
1198 CXTranslationUnit clang_createTranslationUnit(
1199     CXIndex CIdx,
1200     const(char)* ast_filename);
1201 
1202 /**
1203  * Create a translation unit from an AST file (\c -emit-ast).
1204  *
1205  * \param[out] out_TU A non-NULL pointer to store the created
1206  * \c CXTranslationUnit.
1207  *
1208  * \returns Zero on success, otherwise returns an error code.
1209  */
1210 CXErrorCode clang_createTranslationUnit2(
1211     CXIndex CIdx,
1212     const(char)* ast_filename,
1213     CXTranslationUnit* out_TU);
1214 
1215 /**
1216  * Flags that control the creation of translation units.
1217  *
1218  * The enumerators in this enumeration type are meant to be bitwise
1219  * ORed together to specify which options should be used when
1220  * constructing the translation unit.
1221  */
1222 enum CXTranslationUnit_Flags
1223 {
1224     /**
1225      * Used to indicate that no special translation-unit options are
1226      * needed.
1227      */
1228     none = 0x0,
1229 
1230     /**
1231      * Used to indicate that the parser should construct a "detailed"
1232      * preprocessing record, including all macro definitions and instantiations.
1233      *
1234      * Constructing a detailed preprocessing record requires more memory
1235      * and time to parse, since the information contained in the record
1236      * is usually not retained. However, it can be useful for
1237      * applications that require more detailed information about the
1238      * behavior of the preprocessor.
1239      */
1240     detailedPreprocessingRecord = 0x01,
1241 
1242     /**
1243      * Used to indicate that the translation unit is incomplete.
1244      *
1245      * When a translation unit is considered "incomplete", semantic
1246      * analysis that is typically performed at the end of the
1247      * translation unit will be suppressed. For example, this suppresses
1248      * the completion of tentative declarations in C and of
1249      * instantiation of implicitly-instantiation function templates in
1250      * C++. This option is typically used when parsing a header with the
1251      * intent of producing a precompiled header.
1252      */
1253     incomplete = 0x02,
1254 
1255     /**
1256      * Used to indicate that the translation unit should be built with an
1257      * implicit precompiled header for the preamble.
1258      *
1259      * An implicit precompiled header is used as an optimization when a
1260      * particular translation unit is likely to be reparsed many times
1261      * when the sources aren't changing that often. In this case, an
1262      * implicit precompiled header will be built containing all of the
1263      * initial includes at the top of the main file (what we refer to as
1264      * the "preamble" of the file). In subsequent parses, if the
1265      * preamble or the files in it have not changed, \c
1266      * clang_reparseTranslationUnit() will re-use the implicit
1267      * precompiled header to improve parsing performance.
1268      */
1269     precompiledPreamble = 0x04,
1270 
1271     /**
1272      * Used to indicate that the translation unit should cache some
1273      * code-completion results with each reparse of the source file.
1274      *
1275      * Caching of code-completion results is a performance optimization that
1276      * introduces some overhead to reparsing but improves the performance of
1277      * code-completion operations.
1278      */
1279     cacheCompletionResults = 0x08,
1280 
1281     /**
1282      * Used to indicate that the translation unit will be serialized with
1283      * \c clang_saveTranslationUnit.
1284      *
1285      * This option is typically used when parsing a header with the intent of
1286      * producing a precompiled header.
1287      */
1288     forSerialization = 0x10,
1289 
1290     /**
1291      * DEPRECATED: Enabled chained precompiled preambles in C++.
1292      *
1293      * Note: this is a *temporary* option that is available only while
1294      * we are testing C++ precompiled preamble support. It is deprecated.
1295      */
1296     cxxChainedPCH = 0x20,
1297 
1298     /**
1299      * Used to indicate that function/method bodies should be skipped while
1300      * parsing.
1301      *
1302      * This option can be used to search for declarations/definitions while
1303      * ignoring the usages.
1304      */
1305     skipFunctionBodies = 0x40,
1306 
1307     /**
1308      * Used to indicate that brief documentation comments should be
1309      * included into the set of code completions returned from this translation
1310      * unit.
1311      */
1312     includeBriefCommentsInCodeCompletion = 0x80,
1313 
1314     /**
1315      * Used to indicate that the precompiled preamble should be created on
1316      * the first parse. Otherwise it will be created on the first reparse. This
1317      * trades runtime on the first parse (serializing the preamble takes time) for
1318      * reduced runtime on the second parse (can now reuse the preamble).
1319      */
1320     createPreambleOnFirstParse = 0x100,
1321 
1322     /**
1323      * Do not stop processing when fatal errors are encountered.
1324      *
1325      * When fatal errors are encountered while parsing a translation unit,
1326      * semantic analysis is typically stopped early when compiling code. A common
1327      * source for fatal errors are unresolvable include files. For the
1328      * purposes of an IDE, this is undesirable behavior and as much information
1329      * as possible should be reported. Use this flag to enable this behavior.
1330      */
1331     keepGoing = 0x200,
1332 
1333     /**
1334      * Sets the preprocessor in a mode for parsing a single file only.
1335      */
1336     singleFileParse = 0x400,
1337 
1338     /**
1339      * Used in combination with CXTranslationUnit_SkipFunctionBodies to
1340      * constrain the skipping of function bodies to the preamble.
1341      *
1342      * The function bodies of the main file are not skipped.
1343      */
1344     limitSkipFunctionBodiesToPreamble = 0x800,
1345 
1346     /**
1347      * Used to indicate that attributed types should be included in CXType.
1348      */
1349     includeAttributedTypes = 0x1000,
1350 
1351     /**
1352      * Used to indicate that implicit attributes should be visited.
1353      */
1354     visitImplicitAttributes = 0x2000,
1355 
1356     /**
1357      * Used to indicate that non-errors from included files should be ignored.
1358      *
1359      * If set, clang_getDiagnosticSetFromTU() will not report e.g. warnings from
1360      * included files anymore. This speeds up clang_getDiagnosticSetFromTU() for
1361      * the case where these warnings are not of interest, as for an IDE for
1362      * example, which typically shows only the diagnostics in the main file.
1363      */
1364     ignoreNonErrorsFromIncludedFiles = 0x4000,
1365 
1366     /**
1367      * Tells the preprocessor not to skip excluded conditional blocks.
1368      */
1369     retainExcludedConditionalBlocks = 0x8000
1370 }
1371 
1372 /**
1373  * Returns the set of flags that is suitable for parsing a translation
1374  * unit that is being edited.
1375  *
1376  * The set of flags returned provide options for \c clang_parseTranslationUnit()
1377  * to indicate that the translation unit is likely to be reparsed many times,
1378  * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
1379  * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
1380  * set contains an unspecified set of optimizations (e.g., the precompiled
1381  * preamble) geared toward improving the performance of these routines. The
1382  * set of optimizations enabled may change from one version to the next.
1383  */
1384 uint clang_defaultEditingTranslationUnitOptions();
1385 
1386 /**
1387  * Same as \c clang_parseTranslationUnit2, but returns
1388  * the \c CXTranslationUnit instead of an error code.  In case of an error this
1389  * routine returns a \c NULL \c CXTranslationUnit, without further detailed
1390  * error codes.
1391  */
1392 CXTranslationUnit clang_parseTranslationUnit(
1393     CXIndex CIdx,
1394     const(char)* source_filename,
1395     const(char*)* command_line_args,
1396     int num_command_line_args,
1397     CXUnsavedFile* unsaved_files,
1398     uint num_unsaved_files,
1399     uint options);
1400 
1401 /**
1402  * Parse the given source file and the translation unit corresponding
1403  * to that file.
1404  *
1405  * This routine is the main entry point for the Clang C API, providing the
1406  * ability to parse a source file into a translation unit that can then be
1407  * queried by other functions in the API. This routine accepts a set of
1408  * command-line arguments so that the compilation can be configured in the same
1409  * way that the compiler is configured on the command line.
1410  *
1411  * \param CIdx The index object with which the translation unit will be
1412  * associated.
1413  *
1414  * \param source_filename The name of the source file to load, or NULL if the
1415  * source file is included in \c command_line_args.
1416  *
1417  * \param command_line_args The command-line arguments that would be
1418  * passed to the \c clang executable if it were being invoked out-of-process.
1419  * These command-line options will be parsed and will affect how the translation
1420  * unit is parsed. Note that the following options are ignored: '-c',
1421  * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'.
1422  *
1423  * \param num_command_line_args The number of command-line arguments in
1424  * \c command_line_args.
1425  *
1426  * \param unsaved_files the files that have not yet been saved to disk
1427  * but may be required for parsing, including the contents of
1428  * those files.  The contents and name of these files (as specified by
1429  * CXUnsavedFile) are copied when necessary, so the client only needs to
1430  * guarantee their validity until the call to this function returns.
1431  *
1432  * \param num_unsaved_files the number of unsaved file entries in \p
1433  * unsaved_files.
1434  *
1435  * \param options A bitmask of options that affects how the translation unit
1436  * is managed but not its compilation. This should be a bitwise OR of the
1437  * CXTranslationUnit_XXX flags.
1438  *
1439  * \param[out] out_TU A non-NULL pointer to store the created
1440  * \c CXTranslationUnit, describing the parsed code and containing any
1441  * diagnostics produced by the compiler.
1442  *
1443  * \returns Zero on success, otherwise returns an error code.
1444  */
1445 CXErrorCode clang_parseTranslationUnit2(
1446     CXIndex CIdx,
1447     const(char)* source_filename,
1448     const(char*)* command_line_args,
1449     int num_command_line_args,
1450     CXUnsavedFile* unsaved_files,
1451     uint num_unsaved_files,
1452     uint options,
1453     CXTranslationUnit* out_TU);
1454 
1455 /**
1456  * Same as clang_parseTranslationUnit2 but requires a full command line
1457  * for \c command_line_args including argv[0]. This is useful if the standard
1458  * library paths are relative to the binary.
1459  */
1460 CXErrorCode clang_parseTranslationUnit2FullArgv(
1461     CXIndex CIdx,
1462     const(char)* source_filename,
1463     const(char*)* command_line_args,
1464     int num_command_line_args,
1465     CXUnsavedFile* unsaved_files,
1466     uint num_unsaved_files,
1467     uint options,
1468     CXTranslationUnit* out_TU);
1469 
1470 /**
1471  * Flags that control how translation units are saved.
1472  *
1473  * The enumerators in this enumeration type are meant to be bitwise
1474  * ORed together to specify which options should be used when
1475  * saving the translation unit.
1476  */
1477 enum CXSaveTranslationUnit_Flags
1478 {
1479     /**
1480      * Used to indicate that no special saving options are needed.
1481      */
1482     none = 0x0
1483 }
1484 
1485 /**
1486  * Returns the set of flags that is suitable for saving a translation
1487  * unit.
1488  *
1489  * The set of flags returned provide options for
1490  * \c clang_saveTranslationUnit() by default. The returned flag
1491  * set contains an unspecified set of options that save translation units with
1492  * the most commonly-requested data.
1493  */
1494 uint clang_defaultSaveOptions(CXTranslationUnit TU);
1495 
1496 /**
1497  * Describes the kind of error that occurred (if any) in a call to
1498  * \c clang_saveTranslationUnit().
1499  */
1500 enum CXSaveError
1501 {
1502     /**
1503      * Indicates that no error occurred while saving a translation unit.
1504      */
1505     none = 0,
1506 
1507     /**
1508      * Indicates that an unknown error occurred while attempting to save
1509      * the file.
1510      *
1511      * This error typically indicates that file I/O failed when attempting to
1512      * write the file.
1513      */
1514     unknown = 1,
1515 
1516     /**
1517      * Indicates that errors during translation prevented this attempt
1518      * to save the translation unit.
1519      *
1520      * Errors that prevent the translation unit from being saved can be
1521      * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
1522      */
1523     translationErrors = 2,
1524 
1525     /**
1526      * Indicates that the translation unit to be saved was somehow
1527      * invalid (e.g., NULL).
1528      */
1529     invalidTU = 3
1530 }
1531 
1532 /**
1533  * Saves a translation unit into a serialized representation of
1534  * that translation unit on disk.
1535  *
1536  * Any translation unit that was parsed without error can be saved
1537  * into a file. The translation unit can then be deserialized into a
1538  * new \c CXTranslationUnit with \c clang_createTranslationUnit() or,
1539  * if it is an incomplete translation unit that corresponds to a
1540  * header, used as a precompiled header when parsing other translation
1541  * units.
1542  *
1543  * \param TU The translation unit to save.
1544  *
1545  * \param FileName The file to which the translation unit will be saved.
1546  *
1547  * \param options A bitmask of options that affects how the translation unit
1548  * is saved. This should be a bitwise OR of the
1549  * CXSaveTranslationUnit_XXX flags.
1550  *
1551  * \returns A value that will match one of the enumerators of the CXSaveError
1552  * enumeration. Zero (CXSaveError_None) indicates that the translation unit was
1553  * saved successfully, while a non-zero value indicates that a problem occurred.
1554  */
1555 int clang_saveTranslationUnit(
1556     CXTranslationUnit TU,
1557     const(char)* FileName,
1558     uint options);
1559 
1560 /**
1561  * Suspend a translation unit in order to free memory associated with it.
1562  *
1563  * A suspended translation unit uses significantly less memory but on the other
1564  * side does not support any other calls than \c clang_reparseTranslationUnit
1565  * to resume it or \c clang_disposeTranslationUnit to dispose it completely.
1566  */
1567 uint clang_suspendTranslationUnit(CXTranslationUnit);
1568 
1569 /**
1570  * Destroy the specified CXTranslationUnit object.
1571  */
1572 void clang_disposeTranslationUnit(CXTranslationUnit);
1573 
1574 /**
1575  * Flags that control the reparsing of translation units.
1576  *
1577  * The enumerators in this enumeration type are meant to be bitwise
1578  * ORed together to specify which options should be used when
1579  * reparsing the translation unit.
1580  */
1581 enum CXReparse_Flags
1582 {
1583     /**
1584      * Used to indicate that no special reparsing options are needed.
1585      */
1586     none = 0x0
1587 }
1588 
1589 /**
1590  * Returns the set of flags that is suitable for reparsing a translation
1591  * unit.
1592  *
1593  * The set of flags returned provide options for
1594  * \c clang_reparseTranslationUnit() by default. The returned flag
1595  * set contains an unspecified set of optimizations geared toward common uses
1596  * of reparsing. The set of optimizations enabled may change from one version
1597  * to the next.
1598  */
1599 uint clang_defaultReparseOptions(CXTranslationUnit TU);
1600 
1601 /**
1602  * Reparse the source files that produced this translation unit.
1603  *
1604  * This routine can be used to re-parse the source files that originally
1605  * created the given translation unit, for example because those source files
1606  * have changed (either on disk or as passed via \p unsaved_files). The
1607  * source code will be reparsed with the same command-line options as it
1608  * was originally parsed.
1609  *
1610  * Reparsing a translation unit invalidates all cursors and source locations
1611  * that refer into that translation unit. This makes reparsing a translation
1612  * unit semantically equivalent to destroying the translation unit and then
1613  * creating a new translation unit with the same command-line arguments.
1614  * However, it may be more efficient to reparse a translation
1615  * unit using this routine.
1616  *
1617  * \param TU The translation unit whose contents will be re-parsed. The
1618  * translation unit must originally have been built with
1619  * \c clang_createTranslationUnitFromSourceFile().
1620  *
1621  * \param num_unsaved_files The number of unsaved file entries in \p
1622  * unsaved_files.
1623  *
1624  * \param unsaved_files The files that have not yet been saved to disk
1625  * but may be required for parsing, including the contents of
1626  * those files.  The contents and name of these files (as specified by
1627  * CXUnsavedFile) are copied when necessary, so the client only needs to
1628  * guarantee their validity until the call to this function returns.
1629  *
1630  * \param options A bitset of options composed of the flags in CXReparse_Flags.
1631  * The function \c clang_defaultReparseOptions() produces a default set of
1632  * options recommended for most uses, based on the translation unit.
1633  *
1634  * \returns 0 if the sources could be reparsed.  A non-zero error code will be
1635  * returned if reparsing was impossible, such that the translation unit is
1636  * invalid. In such cases, the only valid call for \c TU is
1637  * \c clang_disposeTranslationUnit(TU).  The error codes returned by this
1638  * routine are described by the \c CXErrorCode enum.
1639  */
1640 int clang_reparseTranslationUnit(
1641     CXTranslationUnit TU,
1642     uint num_unsaved_files,
1643     CXUnsavedFile* unsaved_files,
1644     uint options);
1645 
1646 /**
1647  * Categorizes how memory is being used by a translation unit.
1648  */
1649 enum CXTUResourceUsageKind
1650 {
1651     ast = 1,
1652     identifiers = 2,
1653     selectors = 3,
1654     globalCompletionResults = 4,
1655     sourceManagerContentCache = 5,
1656     astSideTables = 6,
1657     sourceManagerMembufferMalloc = 7,
1658     sourceManagerMembufferMMap = 8,
1659     externalASTSourceMembufferMalloc = 9,
1660     externalASTSourceMembufferMMap = 10,
1661     preprocessor = 11,
1662     preprocessingRecord = 12,
1663     sourceManagerDataStructures = 13,
1664     preprocessorHeaderSearch = 14,
1665     memoryInBytesBegin = ast,
1666     memoryInBytesEnd = preprocessorHeaderSearch,
1667 
1668     first = ast,
1669     last = preprocessorHeaderSearch
1670 }
1671 
1672 /**
1673  * Returns the human-readable null-terminated C string that represents
1674  *  the name of the memory category.  This string should never be freed.
1675  */
1676 const(char)* clang_getTUResourceUsageName(CXTUResourceUsageKind kind);
1677 
1678 struct CXTUResourceUsageEntry
1679 {
1680     /* The memory usage category. */
1681     CXTUResourceUsageKind kind;
1682     /* Amount of resources used.
1683         The units will depend on the resource kind. */
1684     c_ulong amount;
1685 }
1686 
1687 /**
1688  * The memory usage of a CXTranslationUnit, broken into categories.
1689  */
1690 struct CXTUResourceUsage
1691 {
1692     /* Private data member, used for queries. */
1693     void* data;
1694 
1695     /* The number of entries in the 'entries' array. */
1696     uint numEntries;
1697 
1698     /* An array of key-value pairs, representing the breakdown of memory
1699               usage. */
1700     CXTUResourceUsageEntry* entries;
1701 }
1702 
1703 /**
1704  * Return the memory usage of a translation unit.  This object
1705  *  should be released with clang_disposeCXTUResourceUsage().
1706  */
1707 CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU);
1708 
1709 void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);
1710 
1711 /**
1712  * Get target information for this translation unit.
1713  *
1714  * The CXTargetInfo object cannot outlive the CXTranslationUnit object.
1715  */
1716 CXTargetInfo clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit);
1717 
1718 /**
1719  * Destroy the CXTargetInfo object.
1720  */
1721 void clang_TargetInfo_dispose(CXTargetInfo Info);
1722 
1723 /**
1724  * Get the normalized target triple as a string.
1725  *
1726  * Returns the empty string in case of any error.
1727  */
1728 CXString clang_TargetInfo_getTriple(CXTargetInfo Info);
1729 
1730 /**
1731  * Get the pointer width of the target in bits.
1732  *
1733  * Returns -1 in case of error.
1734  */
1735 int clang_TargetInfo_getPointerWidth(CXTargetInfo Info);
1736 
1737 /**
1738  * @}
1739  */
1740 
1741 /**
1742  * Describes the kind of entity that a cursor refers to.
1743  */
1744 enum CXCursorKind
1745 {
1746     /* Declarations */
1747     /**
1748      * A declaration whose specific kind is not exposed via this
1749      * interface.
1750      *
1751      * Unexposed declarations have the same operations as any other kind
1752      * of declaration; one can extract their location information,
1753      * spelling, find their definitions, etc. However, the specific kind
1754      * of the declaration is not reported.
1755      */
1756     unexposedDecl = 1,
1757     /** A C or C++ struct. */
1758     structDecl = 2,
1759     /** A C or C++ union. */
1760     unionDecl = 3,
1761     /** A C++ class. */
1762     classDecl = 4,
1763     /** An enumeration. */
1764     enumDecl = 5,
1765     /**
1766      * A field (in C) or non-static data member (in C++) in a
1767      * struct, union, or C++ class.
1768      */
1769     fieldDecl = 6,
1770     /** An enumerator constant. */
1771     enumConstantDecl = 7,
1772     /** A function. */
1773     functionDecl = 8,
1774     /** A variable. */
1775     varDecl = 9,
1776     /** A function or method parameter. */
1777     parmDecl = 10,
1778     /** An Objective-C \@interface. */
1779     objCInterfaceDecl = 11,
1780     /** An Objective-C \@interface for a category. */
1781     objCCategoryDecl = 12,
1782     /** An Objective-C \@protocol declaration. */
1783     objCProtocolDecl = 13,
1784     /** An Objective-C \@property declaration. */
1785     objCPropertyDecl = 14,
1786     /** An Objective-C instance variable. */
1787     objCIvarDecl = 15,
1788     /** An Objective-C instance method. */
1789     objCInstanceMethodDecl = 16,
1790     /** An Objective-C class method. */
1791     objCClassMethodDecl = 17,
1792     /** An Objective-C \@implementation. */
1793     objCImplementationDecl = 18,
1794     /** An Objective-C \@implementation for a category. */
1795     objCCategoryImplDecl = 19,
1796     /** A typedef. */
1797     typedefDecl = 20,
1798     /** A C++ class method. */
1799     cxxMethod = 21,
1800     /** A C++ namespace. */
1801     namespace = 22,
1802     /** A linkage specification, e.g. 'extern "C"'. */
1803     linkageSpec = 23,
1804     /** A C++ constructor. */
1805     constructor = 24,
1806     /** A C++ destructor. */
1807     destructor = 25,
1808     /** A C++ conversion function. */
1809     conversionFunction = 26,
1810     /** A C++ template type parameter. */
1811     templateTypeParameter = 27,
1812     /** A C++ non-type template parameter. */
1813     nonTypeTemplateParameter = 28,
1814     /** A C++ template template parameter. */
1815     templateTemplateParameter = 29,
1816     /** A C++ function template. */
1817     functionTemplate = 30,
1818     /** A C++ class template. */
1819     classTemplate = 31,
1820     /** A C++ class template partial specialization. */
1821     classTemplatePartialSpecialization = 32,
1822     /** A C++ namespace alias declaration. */
1823     namespaceAlias = 33,
1824     /** A C++ using directive. */
1825     usingDirective = 34,
1826     /** A C++ using declaration. */
1827     usingDeclaration = 35,
1828     /** A C++ alias declaration */
1829     typeAliasDecl = 36,
1830     /** An Objective-C \@synthesize definition. */
1831     objCSynthesizeDecl = 37,
1832     /** An Objective-C \@dynamic definition. */
1833     objCDynamicDecl = 38,
1834     /** An access specifier. */
1835     cxxAccessSpecifier = 39,
1836 
1837     firstDecl = unexposedDecl,
1838     lastDecl = cxxAccessSpecifier,
1839 
1840     /* References */
1841     firstRef = 40, /* Decl references */
1842     objCSuperClassRef = 40,
1843     objCProtocolRef = 41,
1844     objCClassRef = 42,
1845     /**
1846      * A reference to a type declaration.
1847      *
1848      * A type reference occurs anywhere where a type is named but not
1849      * declared. For example, given:
1850      *
1851      * \code
1852      * typedef unsigned size_type;
1853      * size_type size;
1854      * \endcode
1855      *
1856      * The typedef is a declaration of size_type (CXCursor_TypedefDecl),
1857      * while the type of the variable "size" is referenced. The cursor
1858      * referenced by the type of size is the typedef for size_type.
1859      */
1860     typeRef = 43,
1861     cxxBaseSpecifier = 44,
1862     /**
1863      * A reference to a class template, function template, template
1864      * template parameter, or class template partial specialization.
1865      */
1866     templateRef = 45,
1867     /**
1868      * A reference to a namespace or namespace alias.
1869      */
1870     namespaceRef = 46,
1871     /**
1872      * A reference to a member of a struct, union, or class that occurs in
1873      * some non-expression context, e.g., a designated initializer.
1874      */
1875     memberRef = 47,
1876     /**
1877      * A reference to a labeled statement.
1878      *
1879      * This cursor kind is used to describe the jump to "start_over" in the
1880      * goto statement in the following example:
1881      *
1882      * \code
1883      *   start_over:
1884      *     ++counter;
1885      *
1886      *     goto start_over;
1887      * \endcode
1888      *
1889      * A label reference cursor refers to a label statement.
1890      */
1891     labelRef = 48,
1892 
1893     /**
1894      * A reference to a set of overloaded functions or function templates
1895      * that has not yet been resolved to a specific function or function template.
1896      *
1897      * An overloaded declaration reference cursor occurs in C++ templates where
1898      * a dependent name refers to a function. For example:
1899      *
1900      * \code
1901      * template<typename T> void swap(T&, T&);
1902      *
1903      * struct X { ... };
1904      * void swap(X&, X&);
1905      *
1906      * template<typename T>
1907      * void reverse(T* first, T* last) {
1908      *   while (first < last - 1) {
1909      *     swap(*first, *--last);
1910      *     ++first;
1911      *   }
1912      * }
1913      *
1914      * struct Y { };
1915      * void swap(Y&, Y&);
1916      * \endcode
1917      *
1918      * Here, the identifier "swap" is associated with an overloaded declaration
1919      * reference. In the template definition, "swap" refers to either of the two
1920      * "swap" functions declared above, so both results will be available. At
1921      * instantiation time, "swap" may also refer to other functions found via
1922      * argument-dependent lookup (e.g., the "swap" function at the end of the
1923      * example).
1924      *
1925      * The functions \c clang_getNumOverloadedDecls() and
1926      * \c clang_getOverloadedDecl() can be used to retrieve the definitions
1927      * referenced by this cursor.
1928      */
1929     overloadedDeclRef = 49,
1930 
1931     /**
1932      * A reference to a variable that occurs in some non-expression
1933      * context, e.g., a C++ lambda capture list.
1934      */
1935     variableRef = 50,
1936 
1937     lastRef = variableRef,
1938 
1939     /* Error conditions */
1940     firstInvalid = 70,
1941     invalidFile = 70,
1942     noDeclFound = 71,
1943     notImplemented = 72,
1944     invalidCode = 73,
1945     lastInvalid = invalidCode,
1946 
1947     /* Expressions */
1948     firstExpr = 100,
1949 
1950     /**
1951      * An expression whose specific kind is not exposed via this
1952      * interface.
1953      *
1954      * Unexposed expressions have the same operations as any other kind
1955      * of expression; one can extract their location information,
1956      * spelling, children, etc. However, the specific kind of the
1957      * expression is not reported.
1958      */
1959     unexposedExpr = 100,
1960 
1961     /**
1962      * An expression that refers to some value declaration, such
1963      * as a function, variable, or enumerator.
1964      */
1965     declRefExpr = 101,
1966 
1967     /**
1968      * An expression that refers to a member of a struct, union,
1969      * class, Objective-C class, etc.
1970      */
1971     memberRefExpr = 102,
1972 
1973     /** An expression that calls a function. */
1974     callExpr = 103,
1975 
1976     /** An expression that sends a message to an Objective-C
1977      object or class. */
1978     objCMessageExpr = 104,
1979 
1980     /** An expression that represents a block literal. */
1981     blockExpr = 105,
1982 
1983     /** An integer literal.
1984      */
1985     integerLiteral = 106,
1986 
1987     /** A floating point number literal.
1988      */
1989     floatingLiteral = 107,
1990 
1991     /** An imaginary number literal.
1992      */
1993     imaginaryLiteral = 108,
1994 
1995     /** A string literal.
1996      */
1997     stringLiteral = 109,
1998 
1999     /** A character literal.
2000      */
2001     characterLiteral = 110,
2002 
2003     /** A parenthesized expression, e.g. "(1)".
2004      *
2005      * This AST node is only formed if full location information is requested.
2006      */
2007     parenExpr = 111,
2008 
2009     /** This represents the unary-expression's (except sizeof and
2010      * alignof).
2011      */
2012     unaryOperator = 112,
2013 
2014     /** [C99 6.5.2.1] Array Subscripting.
2015      */
2016     arraySubscriptExpr = 113,
2017 
2018     /** A builtin binary operation expression such as "x + y" or
2019      * "x <= y".
2020      */
2021     binaryOperator = 114,
2022 
2023     /** Compound assignment such as "+=".
2024      */
2025     compoundAssignOperator = 115,
2026 
2027     /** The ?: ternary operator.
2028      */
2029     conditionalOperator = 116,
2030 
2031     /** An explicit cast in C (C99 6.5.4) or a C-style cast in C++
2032      * (C++ [expr.cast]), which uses the syntax (Type)expr.
2033      *
2034      * For example: (int)f.
2035      */
2036     cStyleCastExpr = 117,
2037 
2038     /** [C99 6.5.2.5]
2039      */
2040     compoundLiteralExpr = 118,
2041 
2042     /** Describes an C or C++ initializer list.
2043      */
2044     initListExpr = 119,
2045 
2046     /** The GNU address of label extension, representing &&label.
2047      */
2048     addrLabelExpr = 120,
2049 
2050     /** This is the GNU Statement Expression extension: ({int X=4; X;})
2051      */
2052     stmtExpr = 121,
2053 
2054     /** Represents a C11 generic selection.
2055      */
2056     genericSelectionExpr = 122,
2057 
2058     /** Implements the GNU __null extension, which is a name for a null
2059      * pointer constant that has integral type (e.g., int or long) and is the same
2060      * size and alignment as a pointer.
2061      *
2062      * The __null extension is typically only used by system headers, which define
2063      * NULL as __null in C++ rather than using 0 (which is an integer that may not
2064      * match the size of a pointer).
2065      */
2066     gnuNullExpr = 123,
2067 
2068     /** C++'s static_cast<> expression.
2069      */
2070     cxxStaticCastExpr = 124,
2071 
2072     /** C++'s dynamic_cast<> expression.
2073      */
2074     cxxDynamicCastExpr = 125,
2075 
2076     /** C++'s reinterpret_cast<> expression.
2077      */
2078     cxxReinterpretCastExpr = 126,
2079 
2080     /** C++'s const_cast<> expression.
2081      */
2082     cxxConstCastExpr = 127,
2083 
2084     /** Represents an explicit C++ type conversion that uses "functional"
2085      * notion (C++ [expr.type.conv]).
2086      *
2087      * Example:
2088      * \code
2089      *   x = int(0.5);
2090      * \endcode
2091      */
2092     cxxFunctionalCastExpr = 128,
2093 
2094     /** A C++ typeid expression (C++ [expr.typeid]).
2095      */
2096     cxxTypeidExpr = 129,
2097 
2098     /** [C++ 2.13.5] C++ Boolean Literal.
2099      */
2100     cxxBoolLiteralExpr = 130,
2101 
2102     /** [C++0x 2.14.7] C++ Pointer Literal.
2103      */
2104     cxxNullPtrLiteralExpr = 131,
2105 
2106     /** Represents the "this" expression in C++
2107      */
2108     cxxThisExpr = 132,
2109 
2110     /** [C++ 15] C++ Throw Expression.
2111      *
2112      * This handles 'throw' and 'throw' assignment-expression. When
2113      * assignment-expression isn't present, Op will be null.
2114      */
2115     cxxThrowExpr = 133,
2116 
2117     /** A new expression for memory allocation and constructor calls, e.g:
2118      * "new CXXNewExpr(foo)".
2119      */
2120     cxxNewExpr = 134,
2121 
2122     /** A delete expression for memory deallocation and destructor calls,
2123      * e.g. "delete[] pArray".
2124      */
2125     cxxDeleteExpr = 135,
2126 
2127     /** A unary expression. (noexcept, sizeof, or other traits)
2128      */
2129     unaryExpr = 136,
2130 
2131     /** An Objective-C string literal i.e. @"foo".
2132      */
2133     objCStringLiteral = 137,
2134 
2135     /** An Objective-C \@encode expression.
2136      */
2137     objCEncodeExpr = 138,
2138 
2139     /** An Objective-C \@selector expression.
2140      */
2141     objCSelectorExpr = 139,
2142 
2143     /** An Objective-C \@protocol expression.
2144      */
2145     objCProtocolExpr = 140,
2146 
2147     /** An Objective-C "bridged" cast expression, which casts between
2148      * Objective-C pointers and C pointers, transferring ownership in the process.
2149      *
2150      * \code
2151      *   NSString *str = (__bridge_transfer NSString *)CFCreateString();
2152      * \endcode
2153      */
2154     objCBridgedCastExpr = 141,
2155 
2156     /** Represents a C++0x pack expansion that produces a sequence of
2157      * expressions.
2158      *
2159      * A pack expansion expression contains a pattern (which itself is an
2160      * expression) followed by an ellipsis. For example:
2161      *
2162      * \code
2163      * template<typename F, typename ...Types>
2164      * void forward(F f, Types &&...args) {
2165      *  f(static_cast<Types&&>(args)...);
2166      * }
2167      * \endcode
2168      */
2169     packExpansionExpr = 142,
2170 
2171     /** Represents an expression that computes the length of a parameter
2172      * pack.
2173      *
2174      * \code
2175      * template<typename ...Types>
2176      * struct count {
2177      *   static const unsigned value = sizeof...(Types);
2178      * };
2179      * \endcode
2180      */
2181     sizeOfPackExpr = 143,
2182 
2183     /* Represents a C++ lambda expression that produces a local function
2184      * object.
2185      *
2186      * \code
2187      * void abssort(float *x, unsigned N) {
2188      *   std::sort(x, x + N,
2189      *             [](float a, float b) {
2190      *               return std::abs(a) < std::abs(b);
2191      *             });
2192      * }
2193      * \endcode
2194      */
2195     lambdaExpr = 144,
2196 
2197     /** Objective-c Boolean Literal.
2198      */
2199     objCBoolLiteralExpr = 145,
2200 
2201     /** Represents the "self" expression in an Objective-C method.
2202      */
2203     objCSelfExpr = 146,
2204 
2205     /** OpenMP 5.0 [2.1.5, Array Section].
2206      */
2207     ompArraySectionExpr = 147,
2208 
2209     /** Represents an @available(...) check.
2210      */
2211     objCAvailabilityCheckExpr = 148,
2212 
2213     /**
2214      * Fixed point literal
2215      */
2216     fixedPointLiteral = 149,
2217 
2218     /** OpenMP 5.0 [2.1.4, Array Shaping].
2219      */
2220     ompArrayShapingExpr = 150,
2221 
2222     /**
2223      * OpenMP 5.0 [2.1.6 Iterators]
2224      */
2225     ompIteratorExpr = 151,
2226 
2227     /** OpenCL's addrspace_cast<> expression.
2228      */
2229     cxxAddrspaceCastExpr = 152,
2230 
2231     lastExpr = cxxAddrspaceCastExpr,
2232 
2233     /* Statements */
2234     firstStmt = 200,
2235     /**
2236      * A statement whose specific kind is not exposed via this
2237      * interface.
2238      *
2239      * Unexposed statements have the same operations as any other kind of
2240      * statement; one can extract their location information, spelling,
2241      * children, etc. However, the specific kind of the statement is not
2242      * reported.
2243      */
2244     unexposedStmt = 200,
2245 
2246     /** A labelled statement in a function.
2247      *
2248      * This cursor kind is used to describe the "start_over:" label statement in
2249      * the following example:
2250      *
2251      * \code
2252      *   start_over:
2253      *     ++counter;
2254      * \endcode
2255      *
2256      */
2257     labelStmt = 201,
2258 
2259     /** A group of statements like { stmt stmt }.
2260      *
2261      * This cursor kind is used to describe compound statements, e.g. function
2262      * bodies.
2263      */
2264     compoundStmt = 202,
2265 
2266     /** A case statement.
2267      */
2268     caseStmt = 203,
2269 
2270     /** A default statement.
2271      */
2272     defaultStmt = 204,
2273 
2274     /** An if statement
2275      */
2276     ifStmt = 205,
2277 
2278     /** A switch statement.
2279      */
2280     switchStmt = 206,
2281 
2282     /** A while statement.
2283      */
2284     whileStmt = 207,
2285 
2286     /** A do statement.
2287      */
2288     doStmt = 208,
2289 
2290     /** A for statement.
2291      */
2292     forStmt = 209,
2293 
2294     /** A goto statement.
2295      */
2296     gotoStmt = 210,
2297 
2298     /** An indirect goto statement.
2299      */
2300     indirectGotoStmt = 211,
2301 
2302     /** A continue statement.
2303      */
2304     continueStmt = 212,
2305 
2306     /** A break statement.
2307      */
2308     breakStmt = 213,
2309 
2310     /** A return statement.
2311      */
2312     returnStmt = 214,
2313 
2314     /** A GCC inline assembly statement extension.
2315      */
2316     gccAsmStmt = 215,
2317     asmStmt = gccAsmStmt,
2318 
2319     /** Objective-C's overall \@try-\@catch-\@finally statement.
2320      */
2321     objCAtTryStmt = 216,
2322 
2323     /** Objective-C's \@catch statement.
2324      */
2325     objCAtCatchStmt = 217,
2326 
2327     /** Objective-C's \@finally statement.
2328      */
2329     objCAtFinallyStmt = 218,
2330 
2331     /** Objective-C's \@throw statement.
2332      */
2333     objCAtThrowStmt = 219,
2334 
2335     /** Objective-C's \@synchronized statement.
2336      */
2337     objCAtSynchronizedStmt = 220,
2338 
2339     /** Objective-C's autorelease pool statement.
2340      */
2341     objCAutoreleasePoolStmt = 221,
2342 
2343     /** Objective-C's collection statement.
2344      */
2345     objCForCollectionStmt = 222,
2346 
2347     /** C++'s catch statement.
2348      */
2349     cxxCatchStmt = 223,
2350 
2351     /** C++'s try statement.
2352      */
2353     cxxTryStmt = 224,
2354 
2355     /** C++'s for (* : *) statement.
2356      */
2357     cxxForRangeStmt = 225,
2358 
2359     /** Windows Structured Exception Handling's try statement.
2360      */
2361     sehTryStmt = 226,
2362 
2363     /** Windows Structured Exception Handling's except statement.
2364      */
2365     sehExceptStmt = 227,
2366 
2367     /** Windows Structured Exception Handling's finally statement.
2368      */
2369     sehFinallyStmt = 228,
2370 
2371     /** A MS inline assembly statement extension.
2372      */
2373     msAsmStmt = 229,
2374 
2375     /** The null statement ";": C99 6.8.3p3.
2376      *
2377      * This cursor kind is used to describe the null statement.
2378      */
2379     nullStmt = 230,
2380 
2381     /** Adaptor class for mixing declarations with statements and
2382      * expressions.
2383      */
2384     declStmt = 231,
2385 
2386     /** OpenMP parallel directive.
2387      */
2388     ompParallelDirective = 232,
2389 
2390     /** OpenMP SIMD directive.
2391      */
2392     ompSimdDirective = 233,
2393 
2394     /** OpenMP for directive.
2395      */
2396     ompForDirective = 234,
2397 
2398     /** OpenMP sections directive.
2399      */
2400     ompSectionsDirective = 235,
2401 
2402     /** OpenMP section directive.
2403      */
2404     ompSectionDirective = 236,
2405 
2406     /** OpenMP single directive.
2407      */
2408     ompSingleDirective = 237,
2409 
2410     /** OpenMP parallel for directive.
2411      */
2412     ompParallelForDirective = 238,
2413 
2414     /** OpenMP parallel sections directive.
2415      */
2416     ompParallelSectionsDirective = 239,
2417 
2418     /** OpenMP task directive.
2419      */
2420     ompTaskDirective = 240,
2421 
2422     /** OpenMP master directive.
2423      */
2424     ompMasterDirective = 241,
2425 
2426     /** OpenMP critical directive.
2427      */
2428     ompCriticalDirective = 242,
2429 
2430     /** OpenMP taskyield directive.
2431      */
2432     ompTaskyieldDirective = 243,
2433 
2434     /** OpenMP barrier directive.
2435      */
2436     ompBarrierDirective = 244,
2437 
2438     /** OpenMP taskwait directive.
2439      */
2440     ompTaskwaitDirective = 245,
2441 
2442     /** OpenMP flush directive.
2443      */
2444     ompFlushDirective = 246,
2445 
2446     /** Windows Structured Exception Handling's leave statement.
2447      */
2448     sehLeaveStmt = 247,
2449 
2450     /** OpenMP ordered directive.
2451      */
2452     ompOrderedDirective = 248,
2453 
2454     /** OpenMP atomic directive.
2455      */
2456     ompAtomicDirective = 249,
2457 
2458     /** OpenMP for SIMD directive.
2459      */
2460     ompForSimdDirective = 250,
2461 
2462     /** OpenMP parallel for SIMD directive.
2463      */
2464     ompParallelForSimdDirective = 251,
2465 
2466     /** OpenMP target directive.
2467      */
2468     ompTargetDirective = 252,
2469 
2470     /** OpenMP teams directive.
2471      */
2472     ompTeamsDirective = 253,
2473 
2474     /** OpenMP taskgroup directive.
2475      */
2476     ompTaskgroupDirective = 254,
2477 
2478     /** OpenMP cancellation point directive.
2479      */
2480     ompCancellationPointDirective = 255,
2481 
2482     /** OpenMP cancel directive.
2483      */
2484     ompCancelDirective = 256,
2485 
2486     /** OpenMP target data directive.
2487      */
2488     ompTargetDataDirective = 257,
2489 
2490     /** OpenMP taskloop directive.
2491      */
2492     ompTaskLoopDirective = 258,
2493 
2494     /** OpenMP taskloop simd directive.
2495      */
2496     ompTaskLoopSimdDirective = 259,
2497 
2498     /** OpenMP distribute directive.
2499      */
2500     ompDistributeDirective = 260,
2501 
2502     /** OpenMP target enter data directive.
2503      */
2504     ompTargetEnterDataDirective = 261,
2505 
2506     /** OpenMP target exit data directive.
2507      */
2508     ompTargetExitDataDirective = 262,
2509 
2510     /** OpenMP target parallel directive.
2511      */
2512     ompTargetParallelDirective = 263,
2513 
2514     /** OpenMP target parallel for directive.
2515      */
2516     ompTargetParallelForDirective = 264,
2517 
2518     /** OpenMP target update directive.
2519      */
2520     ompTargetUpdateDirective = 265,
2521 
2522     /** OpenMP distribute parallel for directive.
2523      */
2524     ompDistributeParallelForDirective = 266,
2525 
2526     /** OpenMP distribute parallel for simd directive.
2527      */
2528     ompDistributeParallelForSimdDirective = 267,
2529 
2530     /** OpenMP distribute simd directive.
2531      */
2532     ompDistributeSimdDirective = 268,
2533 
2534     /** OpenMP target parallel for simd directive.
2535      */
2536     ompTargetParallelForSimdDirective = 269,
2537 
2538     /** OpenMP target simd directive.
2539      */
2540     ompTargetSimdDirective = 270,
2541 
2542     /** OpenMP teams distribute directive.
2543      */
2544     ompTeamsDistributeDirective = 271,
2545 
2546     /** OpenMP teams distribute simd directive.
2547      */
2548     ompTeamsDistributeSimdDirective = 272,
2549 
2550     /** OpenMP teams distribute parallel for simd directive.
2551      */
2552     ompTeamsDistributeParallelForSimdDirective = 273,
2553 
2554     /** OpenMP teams distribute parallel for directive.
2555      */
2556     ompTeamsDistributeParallelForDirective = 274,
2557 
2558     /** OpenMP target teams directive.
2559      */
2560     ompTargetTeamsDirective = 275,
2561 
2562     /** OpenMP target teams distribute directive.
2563      */
2564     ompTargetTeamsDistributeDirective = 276,
2565 
2566     /** OpenMP target teams distribute parallel for directive.
2567      */
2568     ompTargetTeamsDistributeParallelForDirective = 277,
2569 
2570     /** OpenMP target teams distribute parallel for simd directive.
2571      */
2572     ompTargetTeamsDistributeParallelForSimdDirective = 278,
2573 
2574     /** OpenMP target teams distribute simd directive.
2575      */
2576     ompTargetTeamsDistributeSimdDirective = 279,
2577 
2578     /** C++2a std::bit_cast expression.
2579      */
2580     builtinBitCastExpr = 280,
2581 
2582     /** OpenMP master taskloop directive.
2583      */
2584     ompMasterTaskLoopDirective = 281,
2585 
2586     /** OpenMP parallel master taskloop directive.
2587      */
2588     ompParallelMasterTaskLoopDirective = 282,
2589 
2590     /** OpenMP master taskloop simd directive.
2591      */
2592     ompMasterTaskLoopSimdDirective = 283,
2593 
2594     /** OpenMP parallel master taskloop simd directive.
2595      */
2596     ompParallelMasterTaskLoopSimdDirective = 284,
2597 
2598     /** OpenMP parallel master directive.
2599      */
2600     ompParallelMasterDirective = 285,
2601 
2602     /** OpenMP depobj directive.
2603      */
2604     ompDepobjDirective = 286,
2605 
2606     /** OpenMP scan directive.
2607      */
2608     ompScanDirective = 287,
2609 
2610     lastStmt = ompScanDirective,
2611 
2612     /**
2613      * Cursor that represents the translation unit itself.
2614      *
2615      * The translation unit cursor exists primarily to act as the root
2616      * cursor for traversing the contents of a translation unit.
2617      */
2618     translationUnit = 300,
2619 
2620     /* Attributes */
2621     firstAttr = 400,
2622     /**
2623      * An attribute whose specific kind is not exposed via this
2624      * interface.
2625      */
2626     unexposedAttr = 400,
2627 
2628     ibActionAttr = 401,
2629     ibOutletAttr = 402,
2630     ibOutletCollectionAttr = 403,
2631     cxxFinalAttr = 404,
2632     cxxOverrideAttr = 405,
2633     annotateAttr = 406,
2634     asmLabelAttr = 407,
2635     packedAttr = 408,
2636     pureAttr = 409,
2637     constAttr = 410,
2638     noDuplicateAttr = 411,
2639     cudaConstantAttr = 412,
2640     cudaDeviceAttr = 413,
2641     cudaGlobalAttr = 414,
2642     cudaHostAttr = 415,
2643     cudaSharedAttr = 416,
2644     visibilityAttr = 417,
2645     dllExport = 418,
2646     dllImport = 419,
2647     nsReturnsRetained = 420,
2648     nsReturnsNotRetained = 421,
2649     nsReturnsAutoreleased = 422,
2650     nsConsumesSelf = 423,
2651     nsConsumed = 424,
2652     objCException = 425,
2653     objCNSObject = 426,
2654     objCIndependentClass = 427,
2655     objCPreciseLifetime = 428,
2656     objCReturnsInnerPointer = 429,
2657     objCRequiresSuper = 430,
2658     objCRootClass = 431,
2659     objCSubclassingRestricted = 432,
2660     objCExplicitProtocolImpl = 433,
2661     objCDesignatedInitializer = 434,
2662     objCRuntimeVisible = 435,
2663     objCBoxable = 436,
2664     flagEnum = 437,
2665     convergentAttr = 438,
2666     warnUnusedAttr = 439,
2667     warnUnusedResultAttr = 440,
2668     alignedAttr = 441,
2669     lastAttr = alignedAttr,
2670 
2671     /* Preprocessing */
2672     preprocessingDirective = 500,
2673     macroDefinition = 501,
2674     macroExpansion = 502,
2675     macroInstantiation = macroExpansion,
2676     inclusionDirective = 503,
2677     firstPreprocessing = preprocessingDirective,
2678     lastPreprocessing = inclusionDirective,
2679 
2680     /* Extra Declarations */
2681     /**
2682      * A module import declaration.
2683      */
2684     moduleImportDecl = 600,
2685     typeAliasTemplateDecl = 601,
2686     /**
2687      * A static_assert or _Static_assert node
2688      */
2689     staticAssert = 602,
2690     /**
2691      * a friend declaration.
2692      */
2693     friendDecl = 603,
2694     firstExtraDecl = moduleImportDecl,
2695     lastExtraDecl = friendDecl,
2696 
2697     /**
2698      * A code completion overload candidate.
2699      */
2700     overloadCandidate = 700
2701 }
2702 
2703 /**
2704  * A cursor representing some element in the abstract syntax tree for
2705  * a translation unit.
2706  *
2707  * The cursor abstraction unifies the different kinds of entities in a
2708  * program--declaration, statements, expressions, references to declarations,
2709  * etc.--under a single "cursor" abstraction with a common set of operations.
2710  * Common operation for a cursor include: getting the physical location in
2711  * a source file where the cursor points, getting the name associated with a
2712  * cursor, and retrieving cursors for any child nodes of a particular cursor.
2713  *
2714  * Cursors can be produced in two specific ways.
2715  * clang_getTranslationUnitCursor() produces a cursor for a translation unit,
2716  * from which one can use clang_visitChildren() to explore the rest of the
2717  * translation unit. clang_getCursor() maps from a physical source location
2718  * to the entity that resides at that location, allowing one to map from the
2719  * source code into the AST.
2720  */
2721 struct CXCursor
2722 {
2723     CXCursorKind kind;
2724     int xdata;
2725     const(void)*[3] data;
2726 }
2727 
2728 /**
2729  * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations
2730  *
2731  * @{
2732  */
2733 
2734 /**
2735  * Retrieve the NULL cursor, which represents no entity.
2736  */
2737 CXCursor clang_getNullCursor();
2738 
2739 /**
2740  * Retrieve the cursor that represents the given translation unit.
2741  *
2742  * The translation unit cursor can be used to start traversing the
2743  * various declarations within the given translation unit.
2744  */
2745 CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
2746 
2747 /**
2748  * Determine whether two cursors are equivalent.
2749  */
2750 uint clang_equalCursors(CXCursor, CXCursor);
2751 
2752 /**
2753  * Returns non-zero if \p cursor is null.
2754  */
2755 int clang_Cursor_isNull(CXCursor cursor);
2756 
2757 /**
2758  * Compute a hash value for the given cursor.
2759  */
2760 uint clang_hashCursor(CXCursor);
2761 
2762 /**
2763  * Retrieve the kind of the given cursor.
2764  */
2765 CXCursorKind clang_getCursorKind(CXCursor);
2766 
2767 /**
2768  * Determine whether the given cursor kind represents a declaration.
2769  */
2770 uint clang_isDeclaration(CXCursorKind);
2771 
2772 /**
2773  * Determine whether the given declaration is invalid.
2774  *
2775  * A declaration is invalid if it could not be parsed successfully.
2776  *
2777  * \returns non-zero if the cursor represents a declaration and it is
2778  * invalid, otherwise NULL.
2779  */
2780 uint clang_isInvalidDeclaration(CXCursor);
2781 
2782 /**
2783  * Determine whether the given cursor kind represents a simple
2784  * reference.
2785  *
2786  * Note that other kinds of cursors (such as expressions) can also refer to
2787  * other cursors. Use clang_getCursorReferenced() to determine whether a
2788  * particular cursor refers to another entity.
2789  */
2790 uint clang_isReference(CXCursorKind);
2791 
2792 /**
2793  * Determine whether the given cursor kind represents an expression.
2794  */
2795 uint clang_isExpression(CXCursorKind);
2796 
2797 /**
2798  * Determine whether the given cursor kind represents a statement.
2799  */
2800 uint clang_isStatement(CXCursorKind);
2801 
2802 /**
2803  * Determine whether the given cursor kind represents an attribute.
2804  */
2805 uint clang_isAttribute(CXCursorKind);
2806 
2807 /**
2808  * Determine whether the given cursor has any attributes.
2809  */
2810 uint clang_Cursor_hasAttrs(CXCursor C);
2811 
2812 /**
2813  * Determine whether the given cursor kind represents an invalid
2814  * cursor.
2815  */
2816 uint clang_isInvalid(CXCursorKind);
2817 
2818 /**
2819  * Determine whether the given cursor kind represents a translation
2820  * unit.
2821  */
2822 uint clang_isTranslationUnit(CXCursorKind);
2823 
2824 /***
2825  * Determine whether the given cursor represents a preprocessing
2826  * element, such as a preprocessor directive or macro instantiation.
2827  */
2828 uint clang_isPreprocessing(CXCursorKind);
2829 
2830 /***
2831  * Determine whether the given cursor represents a currently
2832  *  unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
2833  */
2834 uint clang_isUnexposed(CXCursorKind);
2835 
2836 /**
2837  * Describe the linkage of the entity referred to by a cursor.
2838  */
2839 enum CXLinkageKind
2840 {
2841     /** This value indicates that no linkage information is available
2842      * for a provided CXCursor. */
2843     invalid = 0,
2844     /**
2845      * This is the linkage for variables, parameters, and so on that
2846      *  have automatic storage.  This covers normal (non-extern) local variables.
2847      */
2848     noLinkage = 1,
2849     /** This is the linkage for static variables and static functions. */
2850     internal = 2,
2851     /** This is the linkage for entities with external linkage that live
2852      * in C++ anonymous namespaces.*/
2853     uniqueExternal = 3,
2854     /** This is the linkage for entities with true, external linkage. */
2855     external = 4
2856 }
2857 
2858 /**
2859  * Determine the linkage of the entity referred to by a given cursor.
2860  */
2861 CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
2862 
2863 enum CXVisibilityKind
2864 {
2865     /** This value indicates that no visibility information is available
2866      * for a provided CXCursor. */
2867     invalid = 0,
2868 
2869     /** Symbol not seen by the linker. */
2870     hidden = 1,
2871     /** Symbol seen by the linker but resolves to a symbol inside this object. */
2872     protected_ = 2,
2873     /** Symbol seen by the linker and acts like a normal symbol. */
2874     default_ = 3
2875 }
2876 
2877 /**
2878  * Describe the visibility of the entity referred to by a cursor.
2879  *
2880  * This returns the default visibility if not explicitly specified by
2881  * a visibility attribute. The default visibility may be changed by
2882  * commandline arguments.
2883  *
2884  * \param cursor The cursor to query.
2885  *
2886  * \returns The visibility of the cursor.
2887  */
2888 CXVisibilityKind clang_getCursorVisibility(CXCursor cursor);
2889 
2890 /**
2891  * Determine the availability of the entity that this cursor refers to,
2892  * taking the current target platform into account.
2893  *
2894  * \param cursor The cursor to query.
2895  *
2896  * \returns The availability of the cursor.
2897  */
2898 CXAvailabilityKind clang_getCursorAvailability(CXCursor cursor);
2899 
2900 /**
2901  * Describes the availability of a given entity on a particular platform, e.g.,
2902  * a particular class might only be available on Mac OS 10.7 or newer.
2903  */
2904 struct CXPlatformAvailability
2905 {
2906     /**
2907      * A string that describes the platform for which this structure
2908      * provides availability information.
2909      *
2910      * Possible values are "ios" or "macos".
2911      */
2912     CXString Platform;
2913     /**
2914      * The version number in which this entity was introduced.
2915      */
2916     CXVersion Introduced;
2917     /**
2918      * The version number in which this entity was deprecated (but is
2919      * still available).
2920      */
2921     CXVersion Deprecated;
2922     /**
2923      * The version number in which this entity was obsoleted, and therefore
2924      * is no longer available.
2925      */
2926     CXVersion Obsoleted;
2927     /**
2928      * Whether the entity is unconditionally unavailable on this platform.
2929      */
2930     int Unavailable;
2931     /**
2932      * An optional message to provide to a user of this API, e.g., to
2933      * suggest replacement APIs.
2934      */
2935     CXString Message;
2936 }
2937 
2938 /**
2939  * Determine the availability of the entity that this cursor refers to
2940  * on any platforms for which availability information is known.
2941  *
2942  * \param cursor The cursor to query.
2943  *
2944  * \param always_deprecated If non-NULL, will be set to indicate whether the
2945  * entity is deprecated on all platforms.
2946  *
2947  * \param deprecated_message If non-NULL, will be set to the message text
2948  * provided along with the unconditional deprecation of this entity. The client
2949  * is responsible for deallocating this string.
2950  *
2951  * \param always_unavailable If non-NULL, will be set to indicate whether the
2952  * entity is unavailable on all platforms.
2953  *
2954  * \param unavailable_message If non-NULL, will be set to the message text
2955  * provided along with the unconditional unavailability of this entity. The
2956  * client is responsible for deallocating this string.
2957  *
2958  * \param availability If non-NULL, an array of CXPlatformAvailability instances
2959  * that will be populated with platform availability information, up to either
2960  * the number of platforms for which availability information is available (as
2961  * returned by this function) or \c availability_size, whichever is smaller.
2962  *
2963  * \param availability_size The number of elements available in the
2964  * \c availability array.
2965  *
2966  * \returns The number of platforms (N) for which availability information is
2967  * available (which is unrelated to \c availability_size).
2968  *
2969  * Note that the client is responsible for calling
2970  * \c clang_disposeCXPlatformAvailability to free each of the
2971  * platform-availability structures returned. There are
2972  * \c min(N, availability_size) such structures.
2973  */
2974 int clang_getCursorPlatformAvailability(
2975     CXCursor cursor,
2976     int* always_deprecated,
2977     CXString* deprecated_message,
2978     int* always_unavailable,
2979     CXString* unavailable_message,
2980     CXPlatformAvailability* availability,
2981     int availability_size);
2982 
2983 /**
2984  * Free the memory associated with a \c CXPlatformAvailability structure.
2985  */
2986 void clang_disposeCXPlatformAvailability(CXPlatformAvailability* availability);
2987 
2988 /**
2989  * If cursor refers to a variable declaration and it has initializer returns
2990  * cursor referring to the initializer otherwise return null cursor.
2991  */
2992 CXCursor clang_Cursor_getVarDeclInitializer(CXCursor cursor);
2993 
2994 /**
2995  * If cursor refers to a variable declaration that has global storage returns 1.
2996  * If cursor refers to a variable declaration that doesn't have global storage
2997  * returns 0. Otherwise returns -1.
2998  */
2999 int clang_Cursor_hasVarDeclGlobalStorage(CXCursor cursor);
3000 
3001 /**
3002  * If cursor refers to a variable declaration that has external storage
3003  * returns 1. If cursor refers to a variable declaration that doesn't have
3004  * external storage returns 0. Otherwise returns -1.
3005  */
3006 int clang_Cursor_hasVarDeclExternalStorage(CXCursor cursor);
3007 
3008 /**
3009  * Describe the "language" of the entity referred to by a cursor.
3010  */
3011 enum CXLanguageKind
3012 {
3013     invalid = 0,
3014     c = 1,
3015     objC = 2,
3016     cPlusPlus = 3
3017 }
3018 
3019 /**
3020  * Determine the "language" of the entity referred to by a given cursor.
3021  */
3022 CXLanguageKind clang_getCursorLanguage(CXCursor cursor);
3023 
3024 /**
3025  * Describe the "thread-local storage (TLS) kind" of the declaration
3026  * referred to by a cursor.
3027  */
3028 enum CXTLSKind
3029 {
3030     none = 0,
3031     dynamic = 1,
3032     static_ = 2
3033 }
3034 
3035 /**
3036  * Determine the "thread-local storage (TLS) kind" of the declaration
3037  * referred to by a cursor.
3038  */
3039 CXTLSKind clang_getCursorTLSKind(CXCursor cursor);
3040 
3041 /**
3042  * Returns the translation unit that a cursor originated from.
3043  */
3044 CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor);
3045 
3046 /**
3047  * A fast container representing a set of CXCursors.
3048  */
3049 struct CXCursorSetImpl;
3050 alias CXCursorSet = CXCursorSetImpl*;
3051 
3052 /**
3053  * Creates an empty CXCursorSet.
3054  */
3055 CXCursorSet clang_createCXCursorSet();
3056 
3057 /**
3058  * Disposes a CXCursorSet and releases its associated memory.
3059  */
3060 void clang_disposeCXCursorSet(CXCursorSet cset);
3061 
3062 /**
3063  * Queries a CXCursorSet to see if it contains a specific CXCursor.
3064  *
3065  * \returns non-zero if the set contains the specified cursor.
3066  */
3067 uint clang_CXCursorSet_contains(CXCursorSet cset, CXCursor cursor);
3068 
3069 /**
3070  * Inserts a CXCursor into a CXCursorSet.
3071  *
3072  * \returns zero if the CXCursor was already in the set, and non-zero otherwise.
3073  */
3074 uint clang_CXCursorSet_insert(CXCursorSet cset, CXCursor cursor);
3075 
3076 /**
3077  * Determine the semantic parent of the given cursor.
3078  *
3079  * The semantic parent of a cursor is the cursor that semantically contains
3080  * the given \p cursor. For many declarations, the lexical and semantic parents
3081  * are equivalent (the lexical parent is returned by
3082  * \c clang_getCursorLexicalParent()). They diverge when declarations or
3083  * definitions are provided out-of-line. For example:
3084  *
3085  * \code
3086  * class C {
3087  *  void f();
3088  * };
3089  *
3090  * void C::f() { }
3091  * \endcode
3092  *
3093  * In the out-of-line definition of \c C::f, the semantic parent is
3094  * the class \c C, of which this function is a member. The lexical parent is
3095  * the place where the declaration actually occurs in the source code; in this
3096  * case, the definition occurs in the translation unit. In general, the
3097  * lexical parent for a given entity can change without affecting the semantics
3098  * of the program, and the lexical parent of different declarations of the
3099  * same entity may be different. Changing the semantic parent of a declaration,
3100  * on the other hand, can have a major impact on semantics, and redeclarations
3101  * of a particular entity should all have the same semantic context.
3102  *
3103  * In the example above, both declarations of \c C::f have \c C as their
3104  * semantic context, while the lexical context of the first \c C::f is \c C
3105  * and the lexical context of the second \c C::f is the translation unit.
3106  *
3107  * For global declarations, the semantic parent is the translation unit.
3108  */
3109 CXCursor clang_getCursorSemanticParent(CXCursor cursor);
3110 
3111 /**
3112  * Determine the lexical parent of the given cursor.
3113  *
3114  * The lexical parent of a cursor is the cursor in which the given \p cursor
3115  * was actually written. For many declarations, the lexical and semantic parents
3116  * are equivalent (the semantic parent is returned by
3117  * \c clang_getCursorSemanticParent()). They diverge when declarations or
3118  * definitions are provided out-of-line. For example:
3119  *
3120  * \code
3121  * class C {
3122  *  void f();
3123  * };
3124  *
3125  * void C::f() { }
3126  * \endcode
3127  *
3128  * In the out-of-line definition of \c C::f, the semantic parent is
3129  * the class \c C, of which this function is a member. The lexical parent is
3130  * the place where the declaration actually occurs in the source code; in this
3131  * case, the definition occurs in the translation unit. In general, the
3132  * lexical parent for a given entity can change without affecting the semantics
3133  * of the program, and the lexical parent of different declarations of the
3134  * same entity may be different. Changing the semantic parent of a declaration,
3135  * on the other hand, can have a major impact on semantics, and redeclarations
3136  * of a particular entity should all have the same semantic context.
3137  *
3138  * In the example above, both declarations of \c C::f have \c C as their
3139  * semantic context, while the lexical context of the first \c C::f is \c C
3140  * and the lexical context of the second \c C::f is the translation unit.
3141  *
3142  * For declarations written in the global scope, the lexical parent is
3143  * the translation unit.
3144  */
3145 CXCursor clang_getCursorLexicalParent(CXCursor cursor);
3146 
3147 /**
3148  * Determine the set of methods that are overridden by the given
3149  * method.
3150  *
3151  * In both Objective-C and C++, a method (aka virtual member function,
3152  * in C++) can override a virtual method in a base class. For
3153  * Objective-C, a method is said to override any method in the class's
3154  * base class, its protocols, or its categories' protocols, that has the same
3155  * selector and is of the same kind (class or instance).
3156  * If no such method exists, the search continues to the class's superclass,
3157  * its protocols, and its categories, and so on. A method from an Objective-C
3158  * implementation is considered to override the same methods as its
3159  * corresponding method in the interface.
3160  *
3161  * For C++, a virtual member function overrides any virtual member
3162  * function with the same signature that occurs in its base
3163  * classes. With multiple inheritance, a virtual member function can
3164  * override several virtual member functions coming from different
3165  * base classes.
3166  *
3167  * In all cases, this function determines the immediate overridden
3168  * method, rather than all of the overridden methods. For example, if
3169  * a method is originally declared in a class A, then overridden in B
3170  * (which in inherits from A) and also in C (which inherited from B),
3171  * then the only overridden method returned from this function when
3172  * invoked on C's method will be B's method. The client may then
3173  * invoke this function again, given the previously-found overridden
3174  * methods, to map out the complete method-override set.
3175  *
3176  * \param cursor A cursor representing an Objective-C or C++
3177  * method. This routine will compute the set of methods that this
3178  * method overrides.
3179  *
3180  * \param overridden A pointer whose pointee will be replaced with a
3181  * pointer to an array of cursors, representing the set of overridden
3182  * methods. If there are no overridden methods, the pointee will be
3183  * set to NULL. The pointee must be freed via a call to
3184  * \c clang_disposeOverriddenCursors().
3185  *
3186  * \param num_overridden A pointer to the number of overridden
3187  * functions, will be set to the number of overridden functions in the
3188  * array pointed to by \p overridden.
3189  */
3190 void clang_getOverriddenCursors(
3191     CXCursor cursor,
3192     CXCursor** overridden,
3193     uint* num_overridden);
3194 
3195 /**
3196  * Free the set of overridden cursors returned by \c
3197  * clang_getOverriddenCursors().
3198  */
3199 void clang_disposeOverriddenCursors(CXCursor* overridden);
3200 
3201 /**
3202  * Retrieve the file that is included by the given inclusion directive
3203  * cursor.
3204  */
3205 CXFile clang_getIncludedFile(CXCursor cursor);
3206 
3207 /**
3208  * @}
3209  */
3210 
3211 /**
3212  * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code
3213  *
3214  * Cursors represent a location within the Abstract Syntax Tree (AST). These
3215  * routines help map between cursors and the physical locations where the
3216  * described entities occur in the source code. The mapping is provided in
3217  * both directions, so one can map from source code to the AST and back.
3218  *
3219  * @{
3220  */
3221 
3222 /**
3223  * Map a source location to the cursor that describes the entity at that
3224  * location in the source code.
3225  *
3226  * clang_getCursor() maps an arbitrary source location within a translation
3227  * unit down to the most specific cursor that describes the entity at that
3228  * location. For example, given an expression \c x + y, invoking
3229  * clang_getCursor() with a source location pointing to "x" will return the
3230  * cursor for "x"; similarly for "y". If the cursor points anywhere between
3231  * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
3232  * will return a cursor referring to the "+" expression.
3233  *
3234  * \returns a cursor representing the entity at the given source location, or
3235  * a NULL cursor if no such entity can be found.
3236  */
3237 CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation);
3238 
3239 /**
3240  * Retrieve the physical location of the source constructor referenced
3241  * by the given cursor.
3242  *
3243  * The location of a declaration is typically the location of the name of that
3244  * declaration, where the name of that declaration would occur if it is
3245  * unnamed, or some keyword that introduces that particular declaration.
3246  * The location of a reference is where that reference occurs within the
3247  * source code.
3248  */
3249 CXSourceLocation clang_getCursorLocation(CXCursor);
3250 
3251 /**
3252  * Retrieve the physical extent of the source construct referenced by
3253  * the given cursor.
3254  *
3255  * The extent of a cursor starts with the file/line/column pointing at the
3256  * first character within the source construct that the cursor refers to and
3257  * ends with the last character within that source construct. For a
3258  * declaration, the extent covers the declaration itself. For a reference,
3259  * the extent covers the location of the reference (e.g., where the referenced
3260  * entity was actually used).
3261  */
3262 CXSourceRange clang_getCursorExtent(CXCursor);
3263 
3264 /**
3265  * @}
3266  */
3267 
3268 /**
3269  * \defgroup CINDEX_TYPES Type information for CXCursors
3270  *
3271  * @{
3272  */
3273 
3274 /**
3275  * Describes the kind of type
3276  */
3277 enum CXTypeKind
3278 {
3279     /**
3280      * Represents an invalid type (e.g., where no type is available).
3281      */
3282     invalid = 0,
3283 
3284     /**
3285      * A type whose specific kind is not exposed via this
3286      * interface.
3287      */
3288     unexposed = 1,
3289 
3290     /* Builtin types */
3291     void_ = 2,
3292     bool_ = 3,
3293     charU = 4,
3294     uChar = 5,
3295     char16 = 6,
3296     char32 = 7,
3297     uShort = 8,
3298     uInt = 9,
3299     uLong = 10,
3300     uLongLong = 11,
3301     uInt128 = 12,
3302     charS = 13,
3303     sChar = 14,
3304     wChar = 15,
3305     short_ = 16,
3306     int_ = 17,
3307     long_ = 18,
3308     longLong = 19,
3309     int128 = 20,
3310     float_ = 21,
3311     double_ = 22,
3312     longDouble = 23,
3313     nullPtr = 24,
3314     overload = 25,
3315     dependent = 26,
3316     objCId = 27,
3317     objCClass = 28,
3318     objCSel = 29,
3319     float128 = 30,
3320     half = 31,
3321     float16 = 32,
3322     shortAccum = 33,
3323     accum = 34,
3324     longAccum = 35,
3325     uShortAccum = 36,
3326     uAccum = 37,
3327     uLongAccum = 38,
3328     bFloat16 = 39,
3329     firstBuiltin = void_,
3330     lastBuiltin = bFloat16,
3331 
3332     complex = 100,
3333     pointer = 101,
3334     blockPointer = 102,
3335     lValueReference = 103,
3336     rValueReference = 104,
3337     record = 105,
3338     enum_ = 106,
3339     typedef_ = 107,
3340     objCInterface = 108,
3341     objCObjectPointer = 109,
3342     functionNoProto = 110,
3343     functionProto = 111,
3344     constantArray = 112,
3345     vector = 113,
3346     incompleteArray = 114,
3347     variableArray = 115,
3348     dependentSizedArray = 116,
3349     memberPointer = 117,
3350     auto_ = 118,
3351 
3352     /**
3353      * Represents a type that was referred to using an elaborated type keyword.
3354      *
3355      * E.g., struct S, or via a qualified name, e.g., N::M::type, or both.
3356      */
3357     elaborated = 119,
3358 
3359     /* OpenCL PipeType. */
3360     pipe = 120,
3361 
3362     /* OpenCL builtin types. */
3363     oclImage1dRO = 121,
3364     oclImage1dArrayRO = 122,
3365     oclImage1dBufferRO = 123,
3366     oclImage2dRO = 124,
3367     oclImage2dArrayRO = 125,
3368     oclImage2dDepthRO = 126,
3369     oclImage2dArrayDepthRO = 127,
3370     oclImage2dMSAARO = 128,
3371     oclImage2dArrayMSAARO = 129,
3372     oclImage2dMSAADepthRO = 130,
3373     oclImage2dArrayMSAADepthRO = 131,
3374     oclImage3dRO = 132,
3375     oclImage1dWO = 133,
3376     oclImage1dArrayWO = 134,
3377     oclImage1dBufferWO = 135,
3378     oclImage2dWO = 136,
3379     oclImage2dArrayWO = 137,
3380     oclImage2dDepthWO = 138,
3381     oclImage2dArrayDepthWO = 139,
3382     oclImage2dMSAAWO = 140,
3383     oclImage2dArrayMSAAWO = 141,
3384     oclImage2dMSAADepthWO = 142,
3385     oclImage2dArrayMSAADepthWO = 143,
3386     oclImage3dWO = 144,
3387     oclImage1dRW = 145,
3388     oclImage1dArrayRW = 146,
3389     oclImage1dBufferRW = 147,
3390     oclImage2dRW = 148,
3391     oclImage2dArrayRW = 149,
3392     oclImage2dDepthRW = 150,
3393     oclImage2dArrayDepthRW = 151,
3394     oclImage2dMSAARW = 152,
3395     oclImage2dArrayMSAARW = 153,
3396     oclImage2dMSAADepthRW = 154,
3397     oclImage2dArrayMSAADepthRW = 155,
3398     oclImage3dRW = 156,
3399     oclSampler = 157,
3400     oclEvent = 158,
3401     oclQueue = 159,
3402     oclReserveID = 160,
3403 
3404     objCObject = 161,
3405     objCTypeParam = 162,
3406     attributed = 163,
3407 
3408     oclIntelSubgroupAVCMcePayload = 164,
3409     oclIntelSubgroupAVCImePayload = 165,
3410     oclIntelSubgroupAVCRefPayload = 166,
3411     oclIntelSubgroupAVCSicPayload = 167,
3412     oclIntelSubgroupAVCMceResult = 168,
3413     oclIntelSubgroupAVCImeResult = 169,
3414     oclIntelSubgroupAVCRefResult = 170,
3415     oclIntelSubgroupAVCSicResult = 171,
3416     oclIntelSubgroupAVCImeResultSingleRefStreamout = 172,
3417     oclIntelSubgroupAVCImeResultDualRefStreamout = 173,
3418     oclIntelSubgroupAVCImeSingleRefStreamin = 174,
3419 
3420     oclIntelSubgroupAVCImeDualRefStreamin = 175,
3421 
3422     extVector = 176,
3423     atomic = 177
3424 }
3425 
3426 /**
3427  * Describes the calling convention of a function type
3428  */
3429 enum CXCallingConv
3430 {
3431     default_ = 0,
3432     c = 1,
3433     x86StdCall = 2,
3434     x86FastCall = 3,
3435     x86ThisCall = 4,
3436     x86Pascal = 5,
3437     aapcs = 6,
3438     aapcsVfp = 7,
3439     x86RegCall = 8,
3440     intelOclBicc = 9,
3441     win64 = 10,
3442     /* Alias for compatibility with older versions of API. */
3443     x8664Win64 = win64,
3444     x8664SysV = 11,
3445     x86VectorCall = 12,
3446     swift = 13,
3447     preserveMost = 14,
3448     preserveAll = 15,
3449     aArch64VectorCall = 16,
3450 
3451     invalid = 100,
3452     unexposed = 200
3453 }
3454 
3455 /**
3456  * The type of an element in the abstract syntax tree.
3457  *
3458  */
3459 struct CXType
3460 {
3461     CXTypeKind kind;
3462     void*[2] data;
3463 }
3464 
3465 /**
3466  * Retrieve the type of a CXCursor (if any).
3467  */
3468 CXType clang_getCursorType(CXCursor C);
3469 
3470 /**
3471  * Pretty-print the underlying type using the rules of the
3472  * language of the translation unit from which it came.
3473  *
3474  * If the type is invalid, an empty string is returned.
3475  */
3476 CXString clang_getTypeSpelling(CXType CT);
3477 
3478 /**
3479  * Retrieve the underlying type of a typedef declaration.
3480  *
3481  * If the cursor does not reference a typedef declaration, an invalid type is
3482  * returned.
3483  */
3484 CXType clang_getTypedefDeclUnderlyingType(CXCursor C);
3485 
3486 /**
3487  * Retrieve the integer type of an enum declaration.
3488  *
3489  * If the cursor does not reference an enum declaration, an invalid type is
3490  * returned.
3491  */
3492 CXType clang_getEnumDeclIntegerType(CXCursor C);
3493 
3494 /**
3495  * Retrieve the integer value of an enum constant declaration as a signed
3496  *  long long.
3497  *
3498  * If the cursor does not reference an enum constant declaration, LLONG_MIN is
3499  * returned. Since this is also potentially a valid constant value, the kind of
3500  * the cursor must be verified before calling this function.
3501  */
3502 long clang_getEnumConstantDeclValue(CXCursor C);
3503 
3504 /**
3505  * Retrieve the integer value of an enum constant declaration as an unsigned
3506  *  long long.
3507  *
3508  * If the cursor does not reference an enum constant declaration, ULLONG_MAX is
3509  * returned. Since this is also potentially a valid constant value, the kind of
3510  * the cursor must be verified before calling this function.
3511  */
3512 ulong clang_getEnumConstantDeclUnsignedValue(CXCursor C);
3513 
3514 /**
3515  * Retrieve the bit width of a bit field declaration as an integer.
3516  *
3517  * If a cursor that is not a bit field declaration is passed in, -1 is returned.
3518  */
3519 int clang_getFieldDeclBitWidth(CXCursor C);
3520 
3521 /**
3522  * Retrieve the number of non-variadic arguments associated with a given
3523  * cursor.
3524  *
3525  * The number of arguments can be determined for calls as well as for
3526  * declarations of functions or methods. For other cursors -1 is returned.
3527  */
3528 int clang_Cursor_getNumArguments(CXCursor C);
3529 
3530 /**
3531  * Retrieve the argument cursor of a function or method.
3532  *
3533  * The argument cursor can be determined for calls as well as for declarations
3534  * of functions or methods. For other cursors and for invalid indices, an
3535  * invalid cursor is returned.
3536  */
3537 CXCursor clang_Cursor_getArgument(CXCursor C, uint i);
3538 
3539 /**
3540  * Describes the kind of a template argument.
3541  *
3542  * See the definition of llvm::clang::TemplateArgument::ArgKind for full
3543  * element descriptions.
3544  */
3545 enum CXTemplateArgumentKind
3546 {
3547     null_ = 0,
3548     type = 1,
3549     declaration = 2,
3550     nullPtr = 3,
3551     integral = 4,
3552     template_ = 5,
3553     templateExpansion = 6,
3554     expression = 7,
3555     pack = 8,
3556     /* Indicates an error case, preventing the kind from being deduced. */
3557     invalid = 9
3558 }
3559 
3560 /**
3561  *Returns the number of template args of a function decl representing a
3562  * template specialization.
3563  *
3564  * If the argument cursor cannot be converted into a template function
3565  * declaration, -1 is returned.
3566  *
3567  * For example, for the following declaration and specialization:
3568  *   template <typename T, int kInt, bool kBool>
3569  *   void foo() { ... }
3570  *
3571  *   template <>
3572  *   void foo<float, -7, true>();
3573  *
3574  * The value 3 would be returned from this call.
3575  */
3576 int clang_Cursor_getNumTemplateArguments(CXCursor C);
3577 
3578 /**
3579  * Retrieve the kind of the I'th template argument of the CXCursor C.
3580  *
3581  * If the argument CXCursor does not represent a FunctionDecl, an invalid
3582  * template argument kind is returned.
3583  *
3584  * For example, for the following declaration and specialization:
3585  *   template <typename T, int kInt, bool kBool>
3586  *   void foo() { ... }
3587  *
3588  *   template <>
3589  *   void foo<float, -7, true>();
3590  *
3591  * For I = 0, 1, and 2, Type, Integral, and Integral will be returned,
3592  * respectively.
3593  */
3594 CXTemplateArgumentKind clang_Cursor_getTemplateArgumentKind(CXCursor C, uint I);
3595 
3596 /**
3597  * Retrieve a CXType representing the type of a TemplateArgument of a
3598  *  function decl representing a template specialization.
3599  *
3600  * If the argument CXCursor does not represent a FunctionDecl whose I'th
3601  * template argument has a kind of CXTemplateArgKind_Integral, an invalid type
3602  * is returned.
3603  *
3604  * For example, for the following declaration and specialization:
3605  *   template <typename T, int kInt, bool kBool>
3606  *   void foo() { ... }
3607  *
3608  *   template <>
3609  *   void foo<float, -7, true>();
3610  *
3611  * If called with I = 0, "float", will be returned.
3612  * Invalid types will be returned for I == 1 or 2.
3613  */
3614 CXType clang_Cursor_getTemplateArgumentType(CXCursor C, uint I);
3615 
3616 /**
3617  * Retrieve the value of an Integral TemplateArgument (of a function
3618  *  decl representing a template specialization) as a signed long long.
3619  *
3620  * It is undefined to call this function on a CXCursor that does not represent a
3621  * FunctionDecl or whose I'th template argument is not an integral value.
3622  *
3623  * For example, for the following declaration and specialization:
3624  *   template <typename T, int kInt, bool kBool>
3625  *   void foo() { ... }
3626  *
3627  *   template <>
3628  *   void foo<float, -7, true>();
3629  *
3630  * If called with I = 1 or 2, -7 or true will be returned, respectively.
3631  * For I == 0, this function's behavior is undefined.
3632  */
3633 long clang_Cursor_getTemplateArgumentValue(CXCursor C, uint I);
3634 
3635 /**
3636  * Retrieve the value of an Integral TemplateArgument (of a function
3637  *  decl representing a template specialization) as an unsigned long long.
3638  *
3639  * It is undefined to call this function on a CXCursor that does not represent a
3640  * FunctionDecl or whose I'th template argument is not an integral value.
3641  *
3642  * For example, for the following declaration and specialization:
3643  *   template <typename T, int kInt, bool kBool>
3644  *   void foo() { ... }
3645  *
3646  *   template <>
3647  *   void foo<float, 2147483649, true>();
3648  *
3649  * If called with I = 1 or 2, 2147483649 or true will be returned, respectively.
3650  * For I == 0, this function's behavior is undefined.
3651  */
3652 ulong clang_Cursor_getTemplateArgumentUnsignedValue(CXCursor C, uint I);
3653 
3654 /**
3655  * Determine whether two CXTypes represent the same type.
3656  *
3657  * \returns non-zero if the CXTypes represent the same type and
3658  *          zero otherwise.
3659  */
3660 uint clang_equalTypes(CXType A, CXType B);
3661 
3662 /**
3663  * Return the canonical type for a CXType.
3664  *
3665  * Clang's type system explicitly models typedefs and all the ways
3666  * a specific type can be represented.  The canonical type is the underlying
3667  * type with all the "sugar" removed.  For example, if 'T' is a typedef
3668  * for 'int', the canonical type for 'T' would be 'int'.
3669  */
3670 CXType clang_getCanonicalType(CXType T);
3671 
3672 /**
3673  * Determine whether a CXType has the "const" qualifier set,
3674  * without looking through typedefs that may have added "const" at a
3675  * different level.
3676  */
3677 uint clang_isConstQualifiedType(CXType T);
3678 
3679 /**
3680  * Determine whether a  CXCursor that is a macro, is
3681  * function like.
3682  */
3683 uint clang_Cursor_isMacroFunctionLike(CXCursor C);
3684 
3685 /**
3686  * Determine whether a  CXCursor that is a macro, is a
3687  * builtin one.
3688  */
3689 uint clang_Cursor_isMacroBuiltin(CXCursor C);
3690 
3691 /**
3692  * Determine whether a  CXCursor that is a function declaration, is an
3693  * inline declaration.
3694  */
3695 uint clang_Cursor_isFunctionInlined(CXCursor C);
3696 
3697 /**
3698  * Determine whether a CXType has the "volatile" qualifier set,
3699  * without looking through typedefs that may have added "volatile" at
3700  * a different level.
3701  */
3702 uint clang_isVolatileQualifiedType(CXType T);
3703 
3704 /**
3705  * Determine whether a CXType has the "restrict" qualifier set,
3706  * without looking through typedefs that may have added "restrict" at a
3707  * different level.
3708  */
3709 uint clang_isRestrictQualifiedType(CXType T);
3710 
3711 /**
3712  * Returns the address space of the given type.
3713  */
3714 uint clang_getAddressSpace(CXType T);
3715 
3716 /**
3717  * Returns the typedef name of the given type.
3718  */
3719 CXString clang_getTypedefName(CXType CT);
3720 
3721 /**
3722  * For pointer types, returns the type of the pointee.
3723  */
3724 CXType clang_getPointeeType(CXType T);
3725 
3726 /**
3727  * Return the cursor for the declaration of the given type.
3728  */
3729 CXCursor clang_getTypeDeclaration(CXType T);
3730 
3731 /**
3732  * Returns the Objective-C type encoding for the specified declaration.
3733  */
3734 CXString clang_getDeclObjCTypeEncoding(CXCursor C);
3735 
3736 /**
3737  * Returns the Objective-C type encoding for the specified CXType.
3738  */
3739 CXString clang_Type_getObjCEncoding(CXType type);
3740 
3741 /**
3742  * Retrieve the spelling of a given CXTypeKind.
3743  */
3744 CXString clang_getTypeKindSpelling(CXTypeKind K);
3745 
3746 /**
3747  * Retrieve the calling convention associated with a function type.
3748  *
3749  * If a non-function type is passed in, CXCallingConv_Invalid is returned.
3750  */
3751 CXCallingConv clang_getFunctionTypeCallingConv(CXType T);
3752 
3753 /**
3754  * Retrieve the return type associated with a function type.
3755  *
3756  * If a non-function type is passed in, an invalid type is returned.
3757  */
3758 CXType clang_getResultType(CXType T);
3759 
3760 /**
3761  * Retrieve the exception specification type associated with a function type.
3762  * This is a value of type CXCursor_ExceptionSpecificationKind.
3763  *
3764  * If a non-function type is passed in, an error code of -1 is returned.
3765  */
3766 int clang_getExceptionSpecificationType(CXType T);
3767 
3768 /**
3769  * Retrieve the number of non-variadic parameters associated with a
3770  * function type.
3771  *
3772  * If a non-function type is passed in, -1 is returned.
3773  */
3774 int clang_getNumArgTypes(CXType T);
3775 
3776 /**
3777  * Retrieve the type of a parameter of a function type.
3778  *
3779  * If a non-function type is passed in or the function does not have enough
3780  * parameters, an invalid type is returned.
3781  */
3782 CXType clang_getArgType(CXType T, uint i);
3783 
3784 /**
3785  * Retrieves the base type of the ObjCObjectType.
3786  *
3787  * If the type is not an ObjC object, an invalid type is returned.
3788  */
3789 CXType clang_Type_getObjCObjectBaseType(CXType T);
3790 
3791 /**
3792  * Retrieve the number of protocol references associated with an ObjC object/id.
3793  *
3794  * If the type is not an ObjC object, 0 is returned.
3795  */
3796 uint clang_Type_getNumObjCProtocolRefs(CXType T);
3797 
3798 /**
3799  * Retrieve the decl for a protocol reference for an ObjC object/id.
3800  *
3801  * If the type is not an ObjC object or there are not enough protocol
3802  * references, an invalid cursor is returned.
3803  */
3804 CXCursor clang_Type_getObjCProtocolDecl(CXType T, uint i);
3805 
3806 /**
3807  * Retrieve the number of type arguments associated with an ObjC object.
3808  *
3809  * If the type is not an ObjC object, 0 is returned.
3810  */
3811 uint clang_Type_getNumObjCTypeArgs(CXType T);
3812 
3813 /**
3814  * Retrieve a type argument associated with an ObjC object.
3815  *
3816  * If the type is not an ObjC or the index is not valid,
3817  * an invalid type is returned.
3818  */
3819 CXType clang_Type_getObjCTypeArg(CXType T, uint i);
3820 
3821 /**
3822  * Return 1 if the CXType is a variadic function type, and 0 otherwise.
3823  */
3824 uint clang_isFunctionTypeVariadic(CXType T);
3825 
3826 /**
3827  * Retrieve the return type associated with a given cursor.
3828  *
3829  * This only returns a valid type if the cursor refers to a function or method.
3830  */
3831 CXType clang_getCursorResultType(CXCursor C);
3832 
3833 /**
3834  * Retrieve the exception specification type associated with a given cursor.
3835  * This is a value of type CXCursor_ExceptionSpecificationKind.
3836  *
3837  * This only returns a valid result if the cursor refers to a function or
3838  * method.
3839  */
3840 int clang_getCursorExceptionSpecificationType(CXCursor C);
3841 
3842 /**
3843  * Return 1 if the CXType is a POD (plain old data) type, and 0
3844  *  otherwise.
3845  */
3846 uint clang_isPODType(CXType T);
3847 
3848 /**
3849  * Return the element type of an array, complex, or vector type.
3850  *
3851  * If a type is passed in that is not an array, complex, or vector type,
3852  * an invalid type is returned.
3853  */
3854 CXType clang_getElementType(CXType T);
3855 
3856 /**
3857  * Return the number of elements of an array or vector type.
3858  *
3859  * If a type is passed in that is not an array or vector type,
3860  * -1 is returned.
3861  */
3862 long clang_getNumElements(CXType T);
3863 
3864 /**
3865  * Return the element type of an array type.
3866  *
3867  * If a non-array type is passed in, an invalid type is returned.
3868  */
3869 CXType clang_getArrayElementType(CXType T);
3870 
3871 /**
3872  * Return the array size of a constant array.
3873  *
3874  * If a non-array type is passed in, -1 is returned.
3875  */
3876 long clang_getArraySize(CXType T);
3877 
3878 /**
3879  * Retrieve the type named by the qualified-id.
3880  *
3881  * If a non-elaborated type is passed in, an invalid type is returned.
3882  */
3883 CXType clang_Type_getNamedType(CXType T);
3884 
3885 /**
3886  * Determine if a typedef is 'transparent' tag.
3887  *
3888  * A typedef is considered 'transparent' if it shares a name and spelling
3889  * location with its underlying tag type, as is the case with the NS_ENUM macro.
3890  *
3891  * \returns non-zero if transparent and zero otherwise.
3892  */
3893 uint clang_Type_isTransparentTagTypedef(CXType T);
3894 
3895 enum CXTypeNullabilityKind
3896 {
3897     /**
3898      * Values of this type can never be null.
3899      */
3900     nonNull = 0,
3901     /**
3902      * Values of this type can be null.
3903      */
3904     nullable = 1,
3905     /**
3906      * Whether values of this type can be null is (explicitly)
3907      * unspecified. This captures a (fairly rare) case where we
3908      * can't conclude anything about the nullability of the type even
3909      * though it has been considered.
3910      */
3911     unspecified = 2,
3912     /**
3913      * Nullability is not applicable to this type.
3914      */
3915     invalid = 3,
3916 
3917     /**
3918      * Generally behaves like Nullable, except when used in a block parameter that
3919      * was imported into a swift async method. There, swift will assume that the
3920      * parameter can get null even if no error occured. _Nullable parameters are
3921      * assumed to only get null on error.
3922      */
3923     nullableResult = 4
3924 }
3925 
3926 /**
3927  * Retrieve the nullability kind of a pointer type.
3928  */
3929 CXTypeNullabilityKind clang_Type_getNullability(CXType T);
3930 
3931 /**
3932  * List the possible error codes for \c clang_Type_getSizeOf,
3933  *   \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
3934  *   \c clang_Cursor_getOffsetOf.
3935  *
3936  * A value of this enumeration type can be returned if the target type is not
3937  * a valid argument to sizeof, alignof or offsetof.
3938  */
3939 enum CXTypeLayoutError
3940 {
3941     /**
3942      * Type is of kind CXType_Invalid.
3943      */
3944     invalid = -1,
3945     /**
3946      * The type is an incomplete Type.
3947      */
3948     incomplete = -2,
3949     /**
3950      * The type is a dependent Type.
3951      */
3952     dependent = -3,
3953     /**
3954      * The type is not a constant size type.
3955      */
3956     notConstantSize = -4,
3957     /**
3958      * The Field name is not valid for this record.
3959      */
3960     invalidFieldName = -5,
3961     /**
3962      * The type is undeduced.
3963      */
3964     undeduced = -6
3965 }
3966 
3967 /**
3968  * Return the alignment of a type in bytes as per C++[expr.alignof]
3969  *   standard.
3970  *
3971  * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
3972  * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
3973  *   is returned.
3974  * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
3975  *   returned.
3976  * If the type declaration is not a constant size type,
3977  *   CXTypeLayoutError_NotConstantSize is returned.
3978  */
3979 long clang_Type_getAlignOf(CXType T);
3980 
3981 /**
3982  * Return the class type of an member pointer type.
3983  *
3984  * If a non-member-pointer type is passed in, an invalid type is returned.
3985  */
3986 CXType clang_Type_getClassType(CXType T);
3987 
3988 /**
3989  * Return the size of a type in bytes as per C++[expr.sizeof] standard.
3990  *
3991  * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
3992  * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
3993  *   is returned.
3994  * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
3995  *   returned.
3996  */
3997 long clang_Type_getSizeOf(CXType T);
3998 
3999 /**
4000  * Return the offset of a field named S in a record of type T in bits
4001  *   as it would be returned by __offsetof__ as per C++11[18.2p4]
4002  *
4003  * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid
4004  *   is returned.
4005  * If the field's type declaration is an incomplete type,
4006  *   CXTypeLayoutError_Incomplete is returned.
4007  * If the field's type declaration is a dependent type,
4008  *   CXTypeLayoutError_Dependent is returned.
4009  * If the field's name S is not found,
4010  *   CXTypeLayoutError_InvalidFieldName is returned.
4011  */
4012 long clang_Type_getOffsetOf(CXType T, const(char)* S);
4013 
4014 /**
4015  * Return the type that was modified by this attributed type.
4016  *
4017  * If the type is not an attributed type, an invalid type is returned.
4018  */
4019 CXType clang_Type_getModifiedType(CXType T);
4020 
4021 /**
4022  * Gets the type contained by this atomic type.
4023  *
4024  * If a non-atomic type is passed in, an invalid type is returned.
4025  */
4026 CXType clang_Type_getValueType(CXType CT);
4027 
4028 /**
4029  * Return the offset of the field represented by the Cursor.
4030  *
4031  * If the cursor is not a field declaration, -1 is returned.
4032  * If the cursor semantic parent is not a record field declaration,
4033  *   CXTypeLayoutError_Invalid is returned.
4034  * If the field's type declaration is an incomplete type,
4035  *   CXTypeLayoutError_Incomplete is returned.
4036  * If the field's type declaration is a dependent type,
4037  *   CXTypeLayoutError_Dependent is returned.
4038  * If the field's name S is not found,
4039  *   CXTypeLayoutError_InvalidFieldName is returned.
4040  */
4041 long clang_Cursor_getOffsetOfField(CXCursor C);
4042 
4043 /**
4044  * Determine whether the given cursor represents an anonymous
4045  * tag or namespace
4046  */
4047 uint clang_Cursor_isAnonymous(CXCursor C);
4048 
4049 /**
4050  * Determine whether the given cursor represents an anonymous record
4051  * declaration.
4052  */
4053 uint clang_Cursor_isAnonymousRecordDecl(CXCursor C);
4054 
4055 /**
4056  * Determine whether the given cursor represents an inline namespace
4057  * declaration.
4058  */
4059 uint clang_Cursor_isInlineNamespace(CXCursor C);
4060 
4061 enum CXRefQualifierKind
4062 {
4063     /** No ref-qualifier was provided. */
4064     none = 0,
4065     /** An lvalue ref-qualifier was provided (\c &). */
4066     lValue = 1,
4067     /** An rvalue ref-qualifier was provided (\c &&). */
4068     rValue = 2
4069 }
4070 
4071 /**
4072  * Returns the number of template arguments for given template
4073  * specialization, or -1 if type \c T is not a template specialization.
4074  */
4075 int clang_Type_getNumTemplateArguments(CXType T);
4076 
4077 /**
4078  * Returns the type template argument of a template class specialization
4079  * at given index.
4080  *
4081  * This function only returns template type arguments and does not handle
4082  * template template arguments or variadic packs.
4083  */
4084 CXType clang_Type_getTemplateArgumentAsType(CXType T, uint i);
4085 
4086 /**
4087  * Retrieve the ref-qualifier kind of a function or method.
4088  *
4089  * The ref-qualifier is returned for C++ functions or methods. For other types
4090  * or non-C++ declarations, CXRefQualifier_None is returned.
4091  */
4092 CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T);
4093 
4094 /**
4095  * Returns non-zero if the cursor specifies a Record member that is a
4096  *   bitfield.
4097  */
4098 uint clang_Cursor_isBitField(CXCursor C);
4099 
4100 /**
4101  * Returns 1 if the base class specified by the cursor with kind
4102  *   CX_CXXBaseSpecifier is virtual.
4103  */
4104 uint clang_isVirtualBase(CXCursor);
4105 
4106 /**
4107  * Represents the C++ access control level to a base class for a
4108  * cursor with kind CX_CXXBaseSpecifier.
4109  */
4110 enum CX_CXXAccessSpecifier
4111 {
4112     cxxInvalidAccessSpecifier = 0,
4113     cxxPublic = 1,
4114     cxxProtected = 2,
4115     cxxPrivate = 3
4116 }
4117 
4118 /**
4119  * Returns the access control level for the referenced object.
4120  *
4121  * If the cursor refers to a C++ declaration, its access control level within
4122  * its parent scope is returned. Otherwise, if the cursor refers to a base
4123  * specifier or access specifier, the specifier itself is returned.
4124  */
4125 CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);
4126 
4127 /**
4128  * Represents the storage classes as declared in the source. CX_SC_Invalid
4129  * was added for the case that the passed cursor in not a declaration.
4130  */
4131 enum CX_StorageClass
4132 {
4133     invalid = 0,
4134     none = 1,
4135     extern_ = 2,
4136     static_ = 3,
4137     privateExtern = 4,
4138     openCLWorkGroupLocal = 5,
4139     auto_ = 6,
4140     register = 7
4141 }
4142 
4143 /**
4144  * Returns the storage class for a function or variable declaration.
4145  *
4146  * If the passed in Cursor is not a function or variable declaration,
4147  * CX_SC_Invalid is returned else the storage class.
4148  */
4149 CX_StorageClass clang_Cursor_getStorageClass(CXCursor);
4150 
4151 /**
4152  * Determine the number of overloaded declarations referenced by a
4153  * \c CXCursor_OverloadedDeclRef cursor.
4154  *
4155  * \param cursor The cursor whose overloaded declarations are being queried.
4156  *
4157  * \returns The number of overloaded declarations referenced by \c cursor. If it
4158  * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
4159  */
4160 uint clang_getNumOverloadedDecls(CXCursor cursor);
4161 
4162 /**
4163  * Retrieve a cursor for one of the overloaded declarations referenced
4164  * by a \c CXCursor_OverloadedDeclRef cursor.
4165  *
4166  * \param cursor The cursor whose overloaded declarations are being queried.
4167  *
4168  * \param index The zero-based index into the set of overloaded declarations in
4169  * the cursor.
4170  *
4171  * \returns A cursor representing the declaration referenced by the given
4172  * \c cursor at the specified \c index. If the cursor does not have an
4173  * associated set of overloaded declarations, or if the index is out of bounds,
4174  * returns \c clang_getNullCursor();
4175  */
4176 CXCursor clang_getOverloadedDecl(CXCursor cursor, uint index);
4177 
4178 /**
4179  * @}
4180  */
4181 
4182 /**
4183  * \defgroup CINDEX_ATTRIBUTES Information for attributes
4184  *
4185  * @{
4186  */
4187 
4188 /**
4189  * For cursors representing an iboutletcollection attribute,
4190  *  this function returns the collection element type.
4191  *
4192  */
4193 CXType clang_getIBOutletCollectionType(CXCursor);
4194 
4195 /**
4196  * @}
4197  */
4198 
4199 /**
4200  * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors
4201  *
4202  * These routines provide the ability to traverse the abstract syntax tree
4203  * using cursors.
4204  *
4205  * @{
4206  */
4207 
4208 /**
4209  * Describes how the traversal of the children of a particular
4210  * cursor should proceed after visiting a particular child cursor.
4211  *
4212  * A value of this enumeration type should be returned by each
4213  * \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
4214  */
4215 enum CXChildVisitResult
4216 {
4217     /**
4218      * Terminates the cursor traversal.
4219      */
4220     break_ = 0,
4221     /**
4222      * Continues the cursor traversal with the next sibling of
4223      * the cursor just visited, without visiting its children.
4224      */
4225     continue_ = 1,
4226     /**
4227      * Recursively traverse the children of this cursor, using
4228      * the same visitor and client data.
4229      */
4230     recurse = 2
4231 }
4232 
4233 /**
4234  * Visitor invoked for each cursor found by a traversal.
4235  *
4236  * This visitor function will be invoked for each cursor found by
4237  * clang_visitCursorChildren(). Its first argument is the cursor being
4238  * visited, its second argument is the parent visitor for that cursor,
4239  * and its third argument is the client data provided to
4240  * clang_visitCursorChildren().
4241  *
4242  * The visitor should return one of the \c CXChildVisitResult values
4243  * to direct clang_visitCursorChildren().
4244  */
4245 alias CXCursorVisitor = CXChildVisitResult function(
4246     CXCursor cursor,
4247     CXCursor parent,
4248     CXClientData client_data);
4249 
4250 /**
4251  * Visit the children of a particular cursor.
4252  *
4253  * This function visits all the direct children of the given cursor,
4254  * invoking the given \p visitor function with the cursors of each
4255  * visited child. The traversal may be recursive, if the visitor returns
4256  * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
4257  * the visitor returns \c CXChildVisit_Break.
4258  *
4259  * \param parent the cursor whose child may be visited. All kinds of
4260  * cursors can be visited, including invalid cursors (which, by
4261  * definition, have no children).
4262  *
4263  * \param visitor the visitor function that will be invoked for each
4264  * child of \p parent.
4265  *
4266  * \param client_data pointer data supplied by the client, which will
4267  * be passed to the visitor each time it is invoked.
4268  *
4269  * \returns a non-zero value if the traversal was terminated
4270  * prematurely by the visitor returning \c CXChildVisit_Break.
4271  */
4272 uint clang_visitChildren(
4273     CXCursor parent,
4274     CXCursorVisitor visitor,
4275     CXClientData client_data);
4276 /**
4277  * Visitor invoked for each cursor found by a traversal.
4278  *
4279  * This visitor block will be invoked for each cursor found by
4280  * clang_visitChildrenWithBlock(). Its first argument is the cursor being
4281  * visited, its second argument is the parent visitor for that cursor.
4282  *
4283  * The visitor should return one of the \c CXChildVisitResult values
4284  * to direct clang_visitChildrenWithBlock().
4285  */
4286 
4287 /**
4288  * Visits the children of a cursor using the specified block.  Behaves
4289  * identically to clang_visitChildren() in all other respects.
4290  */
4291 
4292 /**
4293  * @}
4294  */
4295 
4296 /**
4297  * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST
4298  *
4299  * These routines provide the ability to determine references within and
4300  * across translation units, by providing the names of the entities referenced
4301  * by cursors, follow reference cursors to the declarations they reference,
4302  * and associate declarations with their definitions.
4303  *
4304  * @{
4305  */
4306 
4307 /**
4308  * Retrieve a Unified Symbol Resolution (USR) for the entity referenced
4309  * by the given cursor.
4310  *
4311  * A Unified Symbol Resolution (USR) is a string that identifies a particular
4312  * entity (function, class, variable, etc.) within a program. USRs can be
4313  * compared across translation units to determine, e.g., when references in
4314  * one translation refer to an entity defined in another translation unit.
4315  */
4316 CXString clang_getCursorUSR(CXCursor);
4317 
4318 /**
4319  * Construct a USR for a specified Objective-C class.
4320  */
4321 CXString clang_constructUSR_ObjCClass(const(char)* class_name);
4322 
4323 /**
4324  * Construct a USR for a specified Objective-C category.
4325  */
4326 CXString clang_constructUSR_ObjCCategory(
4327     const(char)* class_name,
4328     const(char)* category_name);
4329 
4330 /**
4331  * Construct a USR for a specified Objective-C protocol.
4332  */
4333 CXString clang_constructUSR_ObjCProtocol(const(char)* protocol_name);
4334 
4335 /**
4336  * Construct a USR for a specified Objective-C instance variable and
4337  *   the USR for its containing class.
4338  */
4339 CXString clang_constructUSR_ObjCIvar(const(char)* name, CXString classUSR);
4340 
4341 /**
4342  * Construct a USR for a specified Objective-C method and
4343  *   the USR for its containing class.
4344  */
4345 CXString clang_constructUSR_ObjCMethod(
4346     const(char)* name,
4347     uint isInstanceMethod,
4348     CXString classUSR);
4349 
4350 /**
4351  * Construct a USR for a specified Objective-C property and the USR
4352  *  for its containing class.
4353  */
4354 CXString clang_constructUSR_ObjCProperty(
4355     const(char)* property,
4356     CXString classUSR);
4357 
4358 /**
4359  * Retrieve a name for the entity referenced by this cursor.
4360  */
4361 CXString clang_getCursorSpelling(CXCursor);
4362 
4363 /**
4364  * Retrieve a range for a piece that forms the cursors spelling name.
4365  * Most of the times there is only one range for the complete spelling but for
4366  * Objective-C methods and Objective-C message expressions, there are multiple
4367  * pieces for each selector identifier.
4368  *
4369  * \param pieceIndex the index of the spelling name piece. If this is greater
4370  * than the actual number of pieces, it will return a NULL (invalid) range.
4371  *
4372  * \param options Reserved.
4373  */
4374 CXSourceRange clang_Cursor_getSpellingNameRange(
4375     CXCursor,
4376     uint pieceIndex,
4377     uint options);
4378 
4379 /**
4380  * Opaque pointer representing a policy that controls pretty printing
4381  * for \c clang_getCursorPrettyPrinted.
4382  */
4383 alias CXPrintingPolicy = void*;
4384 
4385 /**
4386  * Properties for the printing policy.
4387  *
4388  * See \c clang::PrintingPolicy for more information.
4389  */
4390 enum CXPrintingPolicyProperty
4391 {
4392     indentation = 0,
4393     suppressSpecifiers = 1,
4394     suppressTagKeyword = 2,
4395     includeTagDefinition = 3,
4396     suppressScope = 4,
4397     suppressUnwrittenScope = 5,
4398     suppressInitializers = 6,
4399     constantArraySizeAsWritten = 7,
4400     anonymousTagLocations = 8,
4401     suppressStrongLifetime = 9,
4402     suppressLifetimeQualifiers = 10,
4403     suppressTemplateArgsInCXXConstructors = 11,
4404     bool_ = 12,
4405     restrict = 13,
4406     alignof_ = 14,
4407     underscoreAlignof = 15,
4408     useVoidForZeroParams = 16,
4409     terseOutput = 17,
4410     polishForDeclaration = 18,
4411     half = 19,
4412     mswChar = 20,
4413     includeNewlines = 21,
4414     msvcFormatting = 22,
4415     constantsAsWritten = 23,
4416     suppressImplicitBase = 24,
4417     fullyQualifiedName = 25,
4418 
4419     lastProperty = fullyQualifiedName
4420 }
4421 
4422 /**
4423  * Get a property value for the given printing policy.
4424  */
4425 uint clang_PrintingPolicy_getProperty(
4426     CXPrintingPolicy Policy,
4427     CXPrintingPolicyProperty Property);
4428 
4429 /**
4430  * Set a property value for the given printing policy.
4431  */
4432 void clang_PrintingPolicy_setProperty(
4433     CXPrintingPolicy Policy,
4434     CXPrintingPolicyProperty Property,
4435     uint Value);
4436 
4437 /**
4438  * Retrieve the default policy for the cursor.
4439  *
4440  * The policy should be released after use with \c
4441  * clang_PrintingPolicy_dispose.
4442  */
4443 CXPrintingPolicy clang_getCursorPrintingPolicy(CXCursor);
4444 
4445 /**
4446  * Release a printing policy.
4447  */
4448 void clang_PrintingPolicy_dispose(CXPrintingPolicy Policy);
4449 
4450 /**
4451  * Pretty print declarations.
4452  *
4453  * \param Cursor The cursor representing a declaration.
4454  *
4455  * \param Policy The policy to control the entities being printed. If
4456  * NULL, a default policy is used.
4457  *
4458  * \returns The pretty printed declaration or the empty string for
4459  * other cursors.
4460  */
4461 CXString clang_getCursorPrettyPrinted(CXCursor Cursor, CXPrintingPolicy Policy);
4462 
4463 /**
4464  * Retrieve the display name for the entity referenced by this cursor.
4465  *
4466  * The display name contains extra information that helps identify the cursor,
4467  * such as the parameters of a function or template or the arguments of a
4468  * class template specialization.
4469  */
4470 CXString clang_getCursorDisplayName(CXCursor);
4471 
4472 /** For a cursor that is a reference, retrieve a cursor representing the
4473  * entity that it references.
4474  *
4475  * Reference cursors refer to other entities in the AST. For example, an
4476  * Objective-C superclass reference cursor refers to an Objective-C class.
4477  * This function produces the cursor for the Objective-C class from the
4478  * cursor for the superclass reference. If the input cursor is a declaration or
4479  * definition, it returns that declaration or definition unchanged.
4480  * Otherwise, returns the NULL cursor.
4481  */
4482 CXCursor clang_getCursorReferenced(CXCursor);
4483 
4484 /**
4485  *  For a cursor that is either a reference to or a declaration
4486  *  of some entity, retrieve a cursor that describes the definition of
4487  *  that entity.
4488  *
4489  *  Some entities can be declared multiple times within a translation
4490  *  unit, but only one of those declarations can also be a
4491  *  definition. For example, given:
4492  *
4493  *  \code
4494  *  int f(int, int);
4495  *  int g(int x, int y) { return f(x, y); }
4496  *  int f(int a, int b) { return a + b; }
4497  *  int f(int, int);
4498  *  \endcode
4499  *
4500  *  there are three declarations of the function "f", but only the
4501  *  second one is a definition. The clang_getCursorDefinition()
4502  *  function will take any cursor pointing to a declaration of "f"
4503  *  (the first or fourth lines of the example) or a cursor referenced
4504  *  that uses "f" (the call to "f' inside "g") and will return a
4505  *  declaration cursor pointing to the definition (the second "f"
4506  *  declaration).
4507  *
4508  *  If given a cursor for which there is no corresponding definition,
4509  *  e.g., because there is no definition of that entity within this
4510  *  translation unit, returns a NULL cursor.
4511  */
4512 CXCursor clang_getCursorDefinition(CXCursor);
4513 
4514 /**
4515  * Determine whether the declaration pointed to by this cursor
4516  * is also a definition of that entity.
4517  */
4518 uint clang_isCursorDefinition(CXCursor);
4519 
4520 /**
4521  * Retrieve the canonical cursor corresponding to the given cursor.
4522  *
4523  * In the C family of languages, many kinds of entities can be declared several
4524  * times within a single translation unit. For example, a structure type can
4525  * be forward-declared (possibly multiple times) and later defined:
4526  *
4527  * \code
4528  * struct X;
4529  * struct X;
4530  * struct X {
4531  *   int member;
4532  * };
4533  * \endcode
4534  *
4535  * The declarations and the definition of \c X are represented by three
4536  * different cursors, all of which are declarations of the same underlying
4537  * entity. One of these cursor is considered the "canonical" cursor, which
4538  * is effectively the representative for the underlying entity. One can
4539  * determine if two cursors are declarations of the same underlying entity by
4540  * comparing their canonical cursors.
4541  *
4542  * \returns The canonical cursor for the entity referred to by the given cursor.
4543  */
4544 CXCursor clang_getCanonicalCursor(CXCursor);
4545 
4546 /**
4547  * If the cursor points to a selector identifier in an Objective-C
4548  * method or message expression, this returns the selector index.
4549  *
4550  * After getting a cursor with #clang_getCursor, this can be called to
4551  * determine if the location points to a selector identifier.
4552  *
4553  * \returns The selector index if the cursor is an Objective-C method or message
4554  * expression and the cursor is pointing to a selector identifier, or -1
4555  * otherwise.
4556  */
4557 int clang_Cursor_getObjCSelectorIndex(CXCursor);
4558 
4559 /**
4560  * Given a cursor pointing to a C++ method call or an Objective-C
4561  * message, returns non-zero if the method/message is "dynamic", meaning:
4562  *
4563  * For a C++ method: the call is virtual.
4564  * For an Objective-C message: the receiver is an object instance, not 'super'
4565  * or a specific class.
4566  *
4567  * If the method/message is "static" or the cursor does not point to a
4568  * method/message, it will return zero.
4569  */
4570 int clang_Cursor_isDynamicCall(CXCursor C);
4571 
4572 /**
4573  * Given a cursor pointing to an Objective-C message or property
4574  * reference, or C++ method call, returns the CXType of the receiver.
4575  */
4576 CXType clang_Cursor_getReceiverType(CXCursor C);
4577 
4578 /**
4579  * Property attributes for a \c CXCursor_ObjCPropertyDecl.
4580  */
4581 enum CXObjCPropertyAttrKind
4582 {
4583     noattr = 0x00,
4584     readonly = 0x01,
4585     getter = 0x02,
4586     assign = 0x04,
4587     readwrite = 0x08,
4588     retain = 0x10,
4589     copy = 0x20,
4590     nonatomic = 0x40,
4591     setter = 0x80,
4592     atomic = 0x100,
4593     weak = 0x200,
4594     strong = 0x400,
4595     unsafeUnretained = 0x800,
4596     class_ = 0x1000
4597 }
4598 
4599 /**
4600  * Given a cursor that represents a property declaration, return the
4601  * associated property attributes. The bits are formed from
4602  * \c CXObjCPropertyAttrKind.
4603  *
4604  * \param reserved Reserved for future use, pass 0.
4605  */
4606 uint clang_Cursor_getObjCPropertyAttributes(CXCursor C, uint reserved);
4607 
4608 /**
4609  * Given a cursor that represents a property declaration, return the
4610  * name of the method that implements the getter.
4611  */
4612 CXString clang_Cursor_getObjCPropertyGetterName(CXCursor C);
4613 
4614 /**
4615  * Given a cursor that represents a property declaration, return the
4616  * name of the method that implements the setter, if any.
4617  */
4618 CXString clang_Cursor_getObjCPropertySetterName(CXCursor C);
4619 
4620 /**
4621  * 'Qualifiers' written next to the return and parameter types in
4622  * Objective-C method declarations.
4623  */
4624 enum CXObjCDeclQualifierKind
4625 {
4626     none = 0x0,
4627     in_ = 0x1,
4628     inout_ = 0x2,
4629     out_ = 0x4,
4630     bycopy = 0x8,
4631     byref = 0x10,
4632     oneway = 0x20
4633 }
4634 
4635 /**
4636  * Given a cursor that represents an Objective-C method or parameter
4637  * declaration, return the associated Objective-C qualifiers for the return
4638  * type or the parameter respectively. The bits are formed from
4639  * CXObjCDeclQualifierKind.
4640  */
4641 uint clang_Cursor_getObjCDeclQualifiers(CXCursor C);
4642 
4643 /**
4644  * Given a cursor that represents an Objective-C method or property
4645  * declaration, return non-zero if the declaration was affected by "\@optional".
4646  * Returns zero if the cursor is not such a declaration or it is "\@required".
4647  */
4648 uint clang_Cursor_isObjCOptional(CXCursor C);
4649 
4650 /**
4651  * Returns non-zero if the given cursor is a variadic function or method.
4652  */
4653 uint clang_Cursor_isVariadic(CXCursor C);
4654 
4655 /**
4656  * Returns non-zero if the given cursor points to a symbol marked with
4657  * external_source_symbol attribute.
4658  *
4659  * \param language If non-NULL, and the attribute is present, will be set to
4660  * the 'language' string from the attribute.
4661  *
4662  * \param definedIn If non-NULL, and the attribute is present, will be set to
4663  * the 'definedIn' string from the attribute.
4664  *
4665  * \param isGenerated If non-NULL, and the attribute is present, will be set to
4666  * non-zero if the 'generated_declaration' is set in the attribute.
4667  */
4668 uint clang_Cursor_isExternalSymbol(
4669     CXCursor C,
4670     CXString* language,
4671     CXString* definedIn,
4672     uint* isGenerated);
4673 
4674 /**
4675  * Given a cursor that represents a declaration, return the associated
4676  * comment's source range.  The range may include multiple consecutive comments
4677  * with whitespace in between.
4678  */
4679 CXSourceRange clang_Cursor_getCommentRange(CXCursor C);
4680 
4681 /**
4682  * Given a cursor that represents a declaration, return the associated
4683  * comment text, including comment markers.
4684  */
4685 CXString clang_Cursor_getRawCommentText(CXCursor C);
4686 
4687 /**
4688  * Given a cursor that represents a documentable entity (e.g.,
4689  * declaration), return the associated \paragraph; otherwise return the
4690  * first paragraph.
4691  */
4692 CXString clang_Cursor_getBriefCommentText(CXCursor C);
4693 
4694 /**
4695  * @}
4696  */
4697 
4698 /** \defgroup CINDEX_MANGLE Name Mangling API Functions
4699  *
4700  * @{
4701  */
4702 
4703 /**
4704  * Retrieve the CXString representing the mangled name of the cursor.
4705  */
4706 CXString clang_Cursor_getMangling(CXCursor);
4707 
4708 /**
4709  * Retrieve the CXStrings representing the mangled symbols of the C++
4710  * constructor or destructor at the cursor.
4711  */
4712 CXStringSet* clang_Cursor_getCXXManglings(CXCursor);
4713 
4714 /**
4715  * Retrieve the CXStrings representing the mangled symbols of the ObjC
4716  * class interface or implementation at the cursor.
4717  */
4718 CXStringSet* clang_Cursor_getObjCManglings(CXCursor);
4719 
4720 /**
4721  * @}
4722  */
4723 
4724 /**
4725  * \defgroup CINDEX_MODULE Module introspection
4726  *
4727  * The functions in this group provide access to information about modules.
4728  *
4729  * @{
4730  */
4731 
4732 alias CXModule = void*;
4733 
4734 /**
4735  * Given a CXCursor_ModuleImportDecl cursor, return the associated module.
4736  */
4737 CXModule clang_Cursor_getModule(CXCursor C);
4738 
4739 /**
4740  * Given a CXFile header file, return the module that contains it, if one
4741  * exists.
4742  */
4743 CXModule clang_getModuleForFile(CXTranslationUnit, CXFile);
4744 
4745 /**
4746  * \param Module a module object.
4747  *
4748  * \returns the module file where the provided module object came from.
4749  */
4750 CXFile clang_Module_getASTFile(CXModule Module);
4751 
4752 /**
4753  * \param Module a module object.
4754  *
4755  * \returns the parent of a sub-module or NULL if the given module is top-level,
4756  * e.g. for 'std.vector' it will return the 'std' module.
4757  */
4758 CXModule clang_Module_getParent(CXModule Module);
4759 
4760 /**
4761  * \param Module a module object.
4762  *
4763  * \returns the name of the module, e.g. for the 'std.vector' sub-module it
4764  * will return "vector".
4765  */
4766 CXString clang_Module_getName(CXModule Module);
4767 
4768 /**
4769  * \param Module a module object.
4770  *
4771  * \returns the full name of the module, e.g. "std.vector".
4772  */
4773 CXString clang_Module_getFullName(CXModule Module);
4774 
4775 /**
4776  * \param Module a module object.
4777  *
4778  * \returns non-zero if the module is a system one.
4779  */
4780 int clang_Module_isSystem(CXModule Module);
4781 
4782 /**
4783  * \param Module a module object.
4784  *
4785  * \returns the number of top level headers associated with this module.
4786  */
4787 uint clang_Module_getNumTopLevelHeaders(CXTranslationUnit, CXModule Module);
4788 
4789 /**
4790  * \param Module a module object.
4791  *
4792  * \param Index top level header index (zero-based).
4793  *
4794  * \returns the specified top level header associated with the module.
4795  */
4796 CXFile clang_Module_getTopLevelHeader(
4797     CXTranslationUnit,
4798     CXModule Module,
4799     uint Index);
4800 
4801 /**
4802  * @}
4803  */
4804 
4805 /**
4806  * \defgroup CINDEX_CPP C++ AST introspection
4807  *
4808  * The routines in this group provide access information in the ASTs specific
4809  * to C++ language features.
4810  *
4811  * @{
4812  */
4813 
4814 /**
4815  * Determine if a C++ constructor is a converting constructor.
4816  */
4817 uint clang_CXXConstructor_isConvertingConstructor(CXCursor C);
4818 
4819 /**
4820  * Determine if a C++ constructor is a copy constructor.
4821  */
4822 uint clang_CXXConstructor_isCopyConstructor(CXCursor C);
4823 
4824 /**
4825  * Determine if a C++ constructor is the default constructor.
4826  */
4827 uint clang_CXXConstructor_isDefaultConstructor(CXCursor C);
4828 
4829 /**
4830  * Determine if a C++ constructor is a move constructor.
4831  */
4832 uint clang_CXXConstructor_isMoveConstructor(CXCursor C);
4833 
4834 /**
4835  * Determine if a C++ field is declared 'mutable'.
4836  */
4837 uint clang_CXXField_isMutable(CXCursor C);
4838 
4839 /**
4840  * Determine if a C++ method is declared '= default'.
4841  */
4842 uint clang_CXXMethod_isDefaulted(CXCursor C);
4843 
4844 /**
4845  * Determine if a C++ member function or member function template is
4846  * pure virtual.
4847  */
4848 uint clang_CXXMethod_isPureVirtual(CXCursor C);
4849 
4850 /**
4851  * Determine if a C++ member function or member function template is
4852  * declared 'static'.
4853  */
4854 uint clang_CXXMethod_isStatic(CXCursor C);
4855 
4856 /**
4857  * Determine if a C++ member function or member function template is
4858  * explicitly declared 'virtual' or if it overrides a virtual method from
4859  * one of the base classes.
4860  */
4861 uint clang_CXXMethod_isVirtual(CXCursor C);
4862 
4863 /**
4864  * Determine if a C++ record is abstract, i.e. whether a class or struct
4865  * has a pure virtual member function.
4866  */
4867 uint clang_CXXRecord_isAbstract(CXCursor C);
4868 
4869 /**
4870  * Determine if an enum declaration refers to a scoped enum.
4871  */
4872 uint clang_EnumDecl_isScoped(CXCursor C);
4873 
4874 /**
4875  * Determine if a C++ member function or member function template is
4876  * declared 'const'.
4877  */
4878 uint clang_CXXMethod_isConst(CXCursor C);
4879 
4880 /**
4881  * Given a cursor that represents a template, determine
4882  * the cursor kind of the specializations would be generated by instantiating
4883  * the template.
4884  *
4885  * This routine can be used to determine what flavor of function template,
4886  * class template, or class template partial specialization is stored in the
4887  * cursor. For example, it can describe whether a class template cursor is
4888  * declared with "struct", "class" or "union".
4889  *
4890  * \param C The cursor to query. This cursor should represent a template
4891  * declaration.
4892  *
4893  * \returns The cursor kind of the specializations that would be generated
4894  * by instantiating the template \p C. If \p C is not a template, returns
4895  * \c CXCursor_NoDeclFound.
4896  */
4897 CXCursorKind clang_getTemplateCursorKind(CXCursor C);
4898 
4899 /**
4900  * Given a cursor that may represent a specialization or instantiation
4901  * of a template, retrieve the cursor that represents the template that it
4902  * specializes or from which it was instantiated.
4903  *
4904  * This routine determines the template involved both for explicit
4905  * specializations of templates and for implicit instantiations of the template,
4906  * both of which are referred to as "specializations". For a class template
4907  * specialization (e.g., \c std::vector<bool>), this routine will return
4908  * either the primary template (\c std::vector) or, if the specialization was
4909  * instantiated from a class template partial specialization, the class template
4910  * partial specialization. For a class template partial specialization and a
4911  * function template specialization (including instantiations), this
4912  * this routine will return the specialized template.
4913  *
4914  * For members of a class template (e.g., member functions, member classes, or
4915  * static data members), returns the specialized or instantiated member.
4916  * Although not strictly "templates" in the C++ language, members of class
4917  * templates have the same notions of specializations and instantiations that
4918  * templates do, so this routine treats them similarly.
4919  *
4920  * \param C A cursor that may be a specialization of a template or a member
4921  * of a template.
4922  *
4923  * \returns If the given cursor is a specialization or instantiation of a
4924  * template or a member thereof, the template or member that it specializes or
4925  * from which it was instantiated. Otherwise, returns a NULL cursor.
4926  */
4927 CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
4928 
4929 /**
4930  * Given a cursor that references something else, return the source range
4931  * covering that reference.
4932  *
4933  * \param C A cursor pointing to a member reference, a declaration reference, or
4934  * an operator call.
4935  * \param NameFlags A bitset with three independent flags:
4936  * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
4937  * CXNameRange_WantSinglePiece.
4938  * \param PieceIndex For contiguous names or when passing the flag
4939  * CXNameRange_WantSinglePiece, only one piece with index 0 is
4940  * available. When the CXNameRange_WantSinglePiece flag is not passed for a
4941  * non-contiguous names, this index can be used to retrieve the individual
4942  * pieces of the name. See also CXNameRange_WantSinglePiece.
4943  *
4944  * \returns The piece of the name pointed to by the given cursor. If there is no
4945  * name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
4946  */
4947 CXSourceRange clang_getCursorReferenceNameRange(
4948     CXCursor C,
4949     uint NameFlags,
4950     uint PieceIndex);
4951 
4952 enum CXNameRefFlags
4953 {
4954     /**
4955      * Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
4956      * range.
4957      */
4958     wantQualifier = 0x1,
4959 
4960     /**
4961      * Include the explicit template arguments, e.g. \<int> in x.f<int>,
4962      * in the range.
4963      */
4964     wantTemplateArgs = 0x2,
4965 
4966     /**
4967      * If the name is non-contiguous, return the full spanning range.
4968      *
4969      * Non-contiguous names occur in Objective-C when a selector with two or more
4970      * parameters is used, or in C++ when using an operator:
4971      * \code
4972      * [object doSomething:here withValue:there]; // Objective-C
4973      * return some_vector[1]; // C++
4974      * \endcode
4975      */
4976     wantSinglePiece = 0x4
4977 }
4978 
4979 /**
4980  * @}
4981  */
4982 
4983 /**
4984  * \defgroup CINDEX_LEX Token extraction and manipulation
4985  *
4986  * The routines in this group provide access to the tokens within a
4987  * translation unit, along with a semantic mapping of those tokens to
4988  * their corresponding cursors.
4989  *
4990  * @{
4991  */
4992 
4993 /**
4994  * Describes a kind of token.
4995  */
4996 enum CXTokenKind
4997 {
4998     /**
4999      * A token that contains some kind of punctuation.
5000      */
5001     punctuation = 0,
5002 
5003     /**
5004      * A language keyword.
5005      */
5006     keyword = 1,
5007 
5008     /**
5009      * An identifier (that is not a keyword).
5010      */
5011     identifier = 2,
5012 
5013     /**
5014      * A numeric, string, or character literal.
5015      */
5016     literal = 3,
5017 
5018     /**
5019      * A comment.
5020      */
5021     comment = 4
5022 }
5023 
5024 /**
5025  * Describes a single preprocessing token.
5026  */
5027 struct CXToken
5028 {
5029     uint[4] int_data;
5030     void* ptr_data;
5031 }
5032 
5033 /**
5034  * Get the raw lexical token starting with the given location.
5035  *
5036  * \param TU the translation unit whose text is being tokenized.
5037  *
5038  * \param Location the source location with which the token starts.
5039  *
5040  * \returns The token starting with the given location or NULL if no such token
5041  * exist. The returned pointer must be freed with clang_disposeTokens before the
5042  * translation unit is destroyed.
5043  */
5044 CXToken* clang_getToken(CXTranslationUnit TU, CXSourceLocation Location);
5045 
5046 /**
5047  * Determine the kind of the given token.
5048  */
5049 CXTokenKind clang_getTokenKind(CXToken);
5050 
5051 /**
5052  * Determine the spelling of the given token.
5053  *
5054  * The spelling of a token is the textual representation of that token, e.g.,
5055  * the text of an identifier or keyword.
5056  */
5057 CXString clang_getTokenSpelling(CXTranslationUnit, CXToken);
5058 
5059 /**
5060  * Retrieve the source location of the given token.
5061  */
5062 CXSourceLocation clang_getTokenLocation(CXTranslationUnit, CXToken);
5063 
5064 /**
5065  * Retrieve a source range that covers the given token.
5066  */
5067 CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);
5068 
5069 /**
5070  * Tokenize the source code described by the given range into raw
5071  * lexical tokens.
5072  *
5073  * \param TU the translation unit whose text is being tokenized.
5074  *
5075  * \param Range the source range in which text should be tokenized. All of the
5076  * tokens produced by tokenization will fall within this source range,
5077  *
5078  * \param Tokens this pointer will be set to point to the array of tokens
5079  * that occur within the given source range. The returned pointer must be
5080  * freed with clang_disposeTokens() before the translation unit is destroyed.
5081  *
5082  * \param NumTokens will be set to the number of tokens in the \c *Tokens
5083  * array.
5084  *
5085  */
5086 void clang_tokenize(
5087     CXTranslationUnit TU,
5088     CXSourceRange Range,
5089     CXToken** Tokens,
5090     uint* NumTokens);
5091 
5092 /**
5093  * Annotate the given set of tokens by providing cursors for each token
5094  * that can be mapped to a specific entity within the abstract syntax tree.
5095  *
5096  * This token-annotation routine is equivalent to invoking
5097  * clang_getCursor() for the source locations of each of the
5098  * tokens. The cursors provided are filtered, so that only those
5099  * cursors that have a direct correspondence to the token are
5100  * accepted. For example, given a function call \c f(x),
5101  * clang_getCursor() would provide the following cursors:
5102  *
5103  *   * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
5104  *   * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
5105  *   * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
5106  *
5107  * Only the first and last of these cursors will occur within the
5108  * annotate, since the tokens "f" and "x' directly refer to a function
5109  * and a variable, respectively, but the parentheses are just a small
5110  * part of the full syntax of the function call expression, which is
5111  * not provided as an annotation.
5112  *
5113  * \param TU the translation unit that owns the given tokens.
5114  *
5115  * \param Tokens the set of tokens to annotate.
5116  *
5117  * \param NumTokens the number of tokens in \p Tokens.
5118  *
5119  * \param Cursors an array of \p NumTokens cursors, whose contents will be
5120  * replaced with the cursors corresponding to each token.
5121  */
5122 void clang_annotateTokens(
5123     CXTranslationUnit TU,
5124     CXToken* Tokens,
5125     uint NumTokens,
5126     CXCursor* Cursors);
5127 
5128 /**
5129  * Free the given set of tokens.
5130  */
5131 void clang_disposeTokens(CXTranslationUnit TU, CXToken* Tokens, uint NumTokens);
5132 
5133 /**
5134  * @}
5135  */
5136 
5137 /**
5138  * \defgroup CINDEX_DEBUG Debugging facilities
5139  *
5140  * These routines are used for testing and debugging, only, and should not
5141  * be relied upon.
5142  *
5143  * @{
5144  */
5145 
5146 /* for debug/testing */
5147 CXString clang_getCursorKindSpelling(CXCursorKind Kind);
5148 void clang_getDefinitionSpellingAndExtent(
5149     CXCursor,
5150     const(char*)* startBuf,
5151     const(char*)* endBuf,
5152     uint* startLine,
5153     uint* startColumn,
5154     uint* endLine,
5155     uint* endColumn);
5156 void clang_enableStackTraces();
5157 void clang_executeOnThread(
5158     void function(void*) fn,
5159     void* user_data,
5160     uint stack_size);
5161 
5162 /**
5163  * @}
5164  */
5165 
5166 /**
5167  * \defgroup CINDEX_CODE_COMPLET Code completion
5168  *
5169  * Code completion involves taking an (incomplete) source file, along with
5170  * knowledge of where the user is actively editing that file, and suggesting
5171  * syntactically- and semantically-valid constructs that the user might want to
5172  * use at that particular point in the source code. These data structures and
5173  * routines provide support for code completion.
5174  *
5175  * @{
5176  */
5177 
5178 /**
5179  * A semantic string that describes a code-completion result.
5180  *
5181  * A semantic string that describes the formatting of a code-completion
5182  * result as a single "template" of text that should be inserted into the
5183  * source buffer when a particular code-completion result is selected.
5184  * Each semantic string is made up of some number of "chunks", each of which
5185  * contains some text along with a description of what that text means, e.g.,
5186  * the name of the entity being referenced, whether the text chunk is part of
5187  * the template, or whether it is a "placeholder" that the user should replace
5188  * with actual code,of a specific kind. See \c CXCompletionChunkKind for a
5189  * description of the different kinds of chunks.
5190  */
5191 alias CXCompletionString = void*;
5192 
5193 /**
5194  * A single result of code completion.
5195  */
5196 struct CXCompletionResult
5197 {
5198     /**
5199      * The kind of entity that this completion refers to.
5200      *
5201      * The cursor kind will be a macro, keyword, or a declaration (one of the
5202      * *Decl cursor kinds), describing the entity that the completion is
5203      * referring to.
5204      *
5205      * \todo In the future, we would like to provide a full cursor, to allow
5206      * the client to extract additional information from declaration.
5207      */
5208     CXCursorKind CursorKind;
5209 
5210     /**
5211      * The code-completion string that describes how to insert this
5212      * code-completion result into the editing buffer.
5213      */
5214     CXCompletionString CompletionString;
5215 }
5216 
5217 /**
5218  * Describes a single piece of text within a code-completion string.
5219  *
5220  * Each "chunk" within a code-completion string (\c CXCompletionString) is
5221  * either a piece of text with a specific "kind" that describes how that text
5222  * should be interpreted by the client or is another completion string.
5223  */
5224 enum CXCompletionChunkKind
5225 {
5226     /**
5227      * A code-completion string that describes "optional" text that
5228      * could be a part of the template (but is not required).
5229      *
5230      * The Optional chunk is the only kind of chunk that has a code-completion
5231      * string for its representation, which is accessible via
5232      * \c clang_getCompletionChunkCompletionString(). The code-completion string
5233      * describes an additional part of the template that is completely optional.
5234      * For example, optional chunks can be used to describe the placeholders for
5235      * arguments that match up with defaulted function parameters, e.g. given:
5236      *
5237      * \code
5238      * void f(int x, float y = 3.14, double z = 2.71828);
5239      * \endcode
5240      *
5241      * The code-completion string for this function would contain:
5242      *   - a TypedText chunk for "f".
5243      *   - a LeftParen chunk for "(".
5244      *   - a Placeholder chunk for "int x"
5245      *   - an Optional chunk containing the remaining defaulted arguments, e.g.,
5246      *       - a Comma chunk for ","
5247      *       - a Placeholder chunk for "float y"
5248      *       - an Optional chunk containing the last defaulted argument:
5249      *           - a Comma chunk for ","
5250      *           - a Placeholder chunk for "double z"
5251      *   - a RightParen chunk for ")"
5252      *
5253      * There are many ways to handle Optional chunks. Two simple approaches are:
5254      *   - Completely ignore optional chunks, in which case the template for the
5255      *     function "f" would only include the first parameter ("int x").
5256      *   - Fully expand all optional chunks, in which case the template for the
5257      *     function "f" would have all of the parameters.
5258      */
5259     optional = 0,
5260     /**
5261      * Text that a user would be expected to type to get this
5262      * code-completion result.
5263      *
5264      * There will be exactly one "typed text" chunk in a semantic string, which
5265      * will typically provide the spelling of a keyword or the name of a
5266      * declaration that could be used at the current code point. Clients are
5267      * expected to filter the code-completion results based on the text in this
5268      * chunk.
5269      */
5270     typedText = 1,
5271     /**
5272      * Text that should be inserted as part of a code-completion result.
5273      *
5274      * A "text" chunk represents text that is part of the template to be
5275      * inserted into user code should this particular code-completion result
5276      * be selected.
5277      */
5278     text = 2,
5279     /**
5280      * Placeholder text that should be replaced by the user.
5281      *
5282      * A "placeholder" chunk marks a place where the user should insert text
5283      * into the code-completion template. For example, placeholders might mark
5284      * the function parameters for a function declaration, to indicate that the
5285      * user should provide arguments for each of those parameters. The actual
5286      * text in a placeholder is a suggestion for the text to display before
5287      * the user replaces the placeholder with real code.
5288      */
5289     placeholder = 3,
5290     /**
5291      * Informative text that should be displayed but never inserted as
5292      * part of the template.
5293      *
5294      * An "informative" chunk contains annotations that can be displayed to
5295      * help the user decide whether a particular code-completion result is the
5296      * right option, but which is not part of the actual template to be inserted
5297      * by code completion.
5298      */
5299     informative = 4,
5300     /**
5301      * Text that describes the current parameter when code-completion is
5302      * referring to function call, message send, or template specialization.
5303      *
5304      * A "current parameter" chunk occurs when code-completion is providing
5305      * information about a parameter corresponding to the argument at the
5306      * code-completion point. For example, given a function
5307      *
5308      * \code
5309      * int add(int x, int y);
5310      * \endcode
5311      *
5312      * and the source code \c add(, where the code-completion point is after the
5313      * "(", the code-completion string will contain a "current parameter" chunk
5314      * for "int x", indicating that the current argument will initialize that
5315      * parameter. After typing further, to \c add(17, (where the code-completion
5316      * point is after the ","), the code-completion string will contain a
5317      * "current parameter" chunk to "int y".
5318      */
5319     currentParameter = 5,
5320     /**
5321      * A left parenthesis ('('), used to initiate a function call or
5322      * signal the beginning of a function parameter list.
5323      */
5324     leftParen = 6,
5325     /**
5326      * A right parenthesis (')'), used to finish a function call or
5327      * signal the end of a function parameter list.
5328      */
5329     rightParen = 7,
5330     /**
5331      * A left bracket ('[').
5332      */
5333     leftBracket = 8,
5334     /**
5335      * A right bracket (']').
5336      */
5337     rightBracket = 9,
5338     /**
5339      * A left brace ('{').
5340      */
5341     leftBrace = 10,
5342     /**
5343      * A right brace ('}').
5344      */
5345     rightBrace = 11,
5346     /**
5347      * A left angle bracket ('<').
5348      */
5349     leftAngle = 12,
5350     /**
5351      * A right angle bracket ('>').
5352      */
5353     rightAngle = 13,
5354     /**
5355      * A comma separator (',').
5356      */
5357     comma = 14,
5358     /**
5359      * Text that specifies the result type of a given result.
5360      *
5361      * This special kind of informative chunk is not meant to be inserted into
5362      * the text buffer. Rather, it is meant to illustrate the type that an
5363      * expression using the given completion string would have.
5364      */
5365     resultType = 15,
5366     /**
5367      * A colon (':').
5368      */
5369     colon = 16,
5370     /**
5371      * A semicolon (';').
5372      */
5373     semiColon = 17,
5374     /**
5375      * An '=' sign.
5376      */
5377     equal = 18,
5378     /**
5379      * Horizontal space (' ').
5380      */
5381     horizontalSpace = 19,
5382     /**
5383      * Vertical space ('\\n'), after which it is generally a good idea to
5384      * perform indentation.
5385      */
5386     verticalSpace = 20
5387 }
5388 
5389 /**
5390  * Determine the kind of a particular chunk within a completion string.
5391  *
5392  * \param completion_string the completion string to query.
5393  *
5394  * \param chunk_number the 0-based index of the chunk in the completion string.
5395  *
5396  * \returns the kind of the chunk at the index \c chunk_number.
5397  */
5398 CXCompletionChunkKind clang_getCompletionChunkKind(
5399     CXCompletionString completion_string,
5400     uint chunk_number);
5401 
5402 /**
5403  * Retrieve the text associated with a particular chunk within a
5404  * completion string.
5405  *
5406  * \param completion_string the completion string to query.
5407  *
5408  * \param chunk_number the 0-based index of the chunk in the completion string.
5409  *
5410  * \returns the text associated with the chunk at index \c chunk_number.
5411  */
5412 CXString clang_getCompletionChunkText(
5413     CXCompletionString completion_string,
5414     uint chunk_number);
5415 
5416 /**
5417  * Retrieve the completion string associated with a particular chunk
5418  * within a completion string.
5419  *
5420  * \param completion_string the completion string to query.
5421  *
5422  * \param chunk_number the 0-based index of the chunk in the completion string.
5423  *
5424  * \returns the completion string associated with the chunk at index
5425  * \c chunk_number.
5426  */
5427 CXCompletionString clang_getCompletionChunkCompletionString(
5428     CXCompletionString completion_string,
5429     uint chunk_number);
5430 
5431 /**
5432  * Retrieve the number of chunks in the given code-completion string.
5433  */
5434 uint clang_getNumCompletionChunks(CXCompletionString completion_string);
5435 
5436 /**
5437  * Determine the priority of this code completion.
5438  *
5439  * The priority of a code completion indicates how likely it is that this
5440  * particular completion is the completion that the user will select. The
5441  * priority is selected by various internal heuristics.
5442  *
5443  * \param completion_string The completion string to query.
5444  *
5445  * \returns The priority of this completion string. Smaller values indicate
5446  * higher-priority (more likely) completions.
5447  */
5448 uint clang_getCompletionPriority(CXCompletionString completion_string);
5449 
5450 /**
5451  * Determine the availability of the entity that this code-completion
5452  * string refers to.
5453  *
5454  * \param completion_string The completion string to query.
5455  *
5456  * \returns The availability of the completion string.
5457  */
5458 CXAvailabilityKind clang_getCompletionAvailability(
5459     CXCompletionString completion_string);
5460 
5461 /**
5462  * Retrieve the number of annotations associated with the given
5463  * completion string.
5464  *
5465  * \param completion_string the completion string to query.
5466  *
5467  * \returns the number of annotations associated with the given completion
5468  * string.
5469  */
5470 uint clang_getCompletionNumAnnotations(CXCompletionString completion_string);
5471 
5472 /**
5473  * Retrieve the annotation associated with the given completion string.
5474  *
5475  * \param completion_string the completion string to query.
5476  *
5477  * \param annotation_number the 0-based index of the annotation of the
5478  * completion string.
5479  *
5480  * \returns annotation string associated with the completion at index
5481  * \c annotation_number, or a NULL string if that annotation is not available.
5482  */
5483 CXString clang_getCompletionAnnotation(
5484     CXCompletionString completion_string,
5485     uint annotation_number);
5486 
5487 /**
5488  * Retrieve the parent context of the given completion string.
5489  *
5490  * The parent context of a completion string is the semantic parent of
5491  * the declaration (if any) that the code completion represents. For example,
5492  * a code completion for an Objective-C method would have the method's class
5493  * or protocol as its context.
5494  *
5495  * \param completion_string The code completion string whose parent is
5496  * being queried.
5497  *
5498  * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL.
5499  *
5500  * \returns The name of the completion parent, e.g., "NSObject" if
5501  * the completion string represents a method in the NSObject class.
5502  */
5503 CXString clang_getCompletionParent(
5504     CXCompletionString completion_string,
5505     CXCursorKind* kind);
5506 
5507 /**
5508  * Retrieve the brief documentation comment attached to the declaration
5509  * that corresponds to the given completion string.
5510  */
5511 CXString clang_getCompletionBriefComment(CXCompletionString completion_string);
5512 
5513 /**
5514  * Retrieve a completion string for an arbitrary declaration or macro
5515  * definition cursor.
5516  *
5517  * \param cursor The cursor to query.
5518  *
5519  * \returns A non-context-sensitive completion string for declaration and macro
5520  * definition cursors, or NULL for other kinds of cursors.
5521  */
5522 CXCompletionString clang_getCursorCompletionString(CXCursor cursor);
5523 
5524 /**
5525  * Contains the results of code-completion.
5526  *
5527  * This data structure contains the results of code completion, as
5528  * produced by \c clang_codeCompleteAt(). Its contents must be freed by
5529  * \c clang_disposeCodeCompleteResults.
5530  */
5531 struct CXCodeCompleteResults
5532 {
5533     /**
5534      * The code-completion results.
5535      */
5536     CXCompletionResult* Results;
5537 
5538     /**
5539      * The number of code-completion results stored in the
5540      * \c Results array.
5541      */
5542     uint NumResults;
5543 }
5544 
5545 /**
5546  * Retrieve the number of fix-its for the given completion index.
5547  *
5548  * Calling this makes sense only if CXCodeComplete_IncludeCompletionsWithFixIts
5549  * option was set.
5550  *
5551  * \param results The structure keeping all completion results
5552  *
5553  * \param completion_index The index of the completion
5554  *
5555  * \return The number of fix-its which must be applied before the completion at
5556  * completion_index can be applied
5557  */
5558 uint clang_getCompletionNumFixIts(
5559     CXCodeCompleteResults* results,
5560     uint completion_index);
5561 
5562 /**
5563  * Fix-its that *must* be applied before inserting the text for the
5564  * corresponding completion.
5565  *
5566  * By default, clang_codeCompleteAt() only returns completions with empty
5567  * fix-its. Extra completions with non-empty fix-its should be explicitly
5568  * requested by setting CXCodeComplete_IncludeCompletionsWithFixIts.
5569  *
5570  * For the clients to be able to compute position of the cursor after applying
5571  * fix-its, the following conditions are guaranteed to hold for
5572  * replacement_range of the stored fix-its:
5573  *  - Ranges in the fix-its are guaranteed to never contain the completion
5574  *  point (or identifier under completion point, if any) inside them, except
5575  *  at the start or at the end of the range.
5576  *  - If a fix-it range starts or ends with completion point (or starts or
5577  *  ends after the identifier under completion point), it will contain at
5578  *  least one character. It allows to unambiguously recompute completion
5579  *  point after applying the fix-it.
5580  *
5581  * The intuition is that provided fix-its change code around the identifier we
5582  * complete, but are not allowed to touch the identifier itself or the
5583  * completion point. One example of completions with corrections are the ones
5584  * replacing '.' with '->' and vice versa:
5585  *
5586  * std::unique_ptr<std::vector<int>> vec_ptr;
5587  * In 'vec_ptr.^', one of the completions is 'push_back', it requires
5588  * replacing '.' with '->'.
5589  * In 'vec_ptr->^', one of the completions is 'release', it requires
5590  * replacing '->' with '.'.
5591  *
5592  * \param results The structure keeping all completion results
5593  *
5594  * \param completion_index The index of the completion
5595  *
5596  * \param fixit_index The index of the fix-it for the completion at
5597  * completion_index
5598  *
5599  * \param replacement_range The fix-it range that must be replaced before the
5600  * completion at completion_index can be applied
5601  *
5602  * \returns The fix-it string that must replace the code at replacement_range
5603  * before the completion at completion_index can be applied
5604  */
5605 CXString clang_getCompletionFixIt(
5606     CXCodeCompleteResults* results,
5607     uint completion_index,
5608     uint fixit_index,
5609     CXSourceRange* replacement_range);
5610 
5611 /**
5612  * Flags that can be passed to \c clang_codeCompleteAt() to
5613  * modify its behavior.
5614  *
5615  * The enumerators in this enumeration can be bitwise-OR'd together to
5616  * provide multiple options to \c clang_codeCompleteAt().
5617  */
5618 enum CXCodeComplete_Flags
5619 {
5620     /**
5621      * Whether to include macros within the set of code
5622      * completions returned.
5623      */
5624     includeMacros = 0x01,
5625 
5626     /**
5627      * Whether to include code patterns for language constructs
5628      * within the set of code completions, e.g., for loops.
5629      */
5630     includeCodePatterns = 0x02,
5631 
5632     /**
5633      * Whether to include brief documentation within the set of code
5634      * completions returned.
5635      */
5636     includeBriefComments = 0x04,
5637 
5638     /**
5639      * Whether to speed up completion by omitting top- or namespace-level entities
5640      * defined in the preamble. There's no guarantee any particular entity is
5641      * omitted. This may be useful if the headers are indexed externally.
5642      */
5643     skipPreamble = 0x08,
5644 
5645     /**
5646      * Whether to include completions with small
5647      * fix-its, e.g. change '.' to '->' on member access, etc.
5648      */
5649     includeCompletionsWithFixIts = 0x10
5650 }
5651 
5652 /**
5653  * Bits that represent the context under which completion is occurring.
5654  *
5655  * The enumerators in this enumeration may be bitwise-OR'd together if multiple
5656  * contexts are occurring simultaneously.
5657  */
5658 enum CXCompletionContext
5659 {
5660     /**
5661      * The context for completions is unexposed, as only Clang results
5662      * should be included. (This is equivalent to having no context bits set.)
5663      */
5664     unexposed = 0,
5665 
5666     /**
5667      * Completions for any possible type should be included in the results.
5668      */
5669     anyType = 1 << 0,
5670 
5671     /**
5672      * Completions for any possible value (variables, function calls, etc.)
5673      * should be included in the results.
5674      */
5675     anyValue = 1 << 1,
5676     /**
5677      * Completions for values that resolve to an Objective-C object should
5678      * be included in the results.
5679      */
5680     objCObjectValue = 1 << 2,
5681     /**
5682      * Completions for values that resolve to an Objective-C selector
5683      * should be included in the results.
5684      */
5685     objCSelectorValue = 1 << 3,
5686     /**
5687      * Completions for values that resolve to a C++ class type should be
5688      * included in the results.
5689      */
5690     cxxClassTypeValue = 1 << 4,
5691 
5692     /**
5693      * Completions for fields of the member being accessed using the dot
5694      * operator should be included in the results.
5695      */
5696     dotMemberAccess = 1 << 5,
5697     /**
5698      * Completions for fields of the member being accessed using the arrow
5699      * operator should be included in the results.
5700      */
5701     arrowMemberAccess = 1 << 6,
5702     /**
5703      * Completions for properties of the Objective-C object being accessed
5704      * using the dot operator should be included in the results.
5705      */
5706     objCPropertyAccess = 1 << 7,
5707 
5708     /**
5709      * Completions for enum tags should be included in the results.
5710      */
5711     enumTag = 1 << 8,
5712     /**
5713      * Completions for union tags should be included in the results.
5714      */
5715     unionTag = 1 << 9,
5716     /**
5717      * Completions for struct tags should be included in the results.
5718      */
5719     structTag = 1 << 10,
5720 
5721     /**
5722      * Completions for C++ class names should be included in the results.
5723      */
5724     classTag = 1 << 11,
5725     /**
5726      * Completions for C++ namespaces and namespace aliases should be
5727      * included in the results.
5728      */
5729     namespace = 1 << 12,
5730     /**
5731      * Completions for C++ nested name specifiers should be included in
5732      * the results.
5733      */
5734     nestedNameSpecifier = 1 << 13,
5735 
5736     /**
5737      * Completions for Objective-C interfaces (classes) should be included
5738      * in the results.
5739      */
5740     objCInterface = 1 << 14,
5741     /**
5742      * Completions for Objective-C protocols should be included in
5743      * the results.
5744      */
5745     objCProtocol = 1 << 15,
5746     /**
5747      * Completions for Objective-C categories should be included in
5748      * the results.
5749      */
5750     objCCategory = 1 << 16,
5751     /**
5752      * Completions for Objective-C instance messages should be included
5753      * in the results.
5754      */
5755     objCInstanceMessage = 1 << 17,
5756     /**
5757      * Completions for Objective-C class messages should be included in
5758      * the results.
5759      */
5760     objCClassMessage = 1 << 18,
5761     /**
5762      * Completions for Objective-C selector names should be included in
5763      * the results.
5764      */
5765     objCSelectorName = 1 << 19,
5766 
5767     /**
5768      * Completions for preprocessor macro names should be included in
5769      * the results.
5770      */
5771     macroName = 1 << 20,
5772 
5773     /**
5774      * Natural language completions should be included in the results.
5775      */
5776     naturalLanguage = 1 << 21,
5777 
5778     /**
5779      * #include file completions should be included in the results.
5780      */
5781     includedFile = 1 << 22,
5782 
5783     /**
5784      * The current context is unknown, so set all contexts.
5785      */
5786     unknown = (1 << 23) - 1
5787 }
5788 
5789 /**
5790  * Returns a default set of code-completion options that can be
5791  * passed to\c clang_codeCompleteAt().
5792  */
5793 uint clang_defaultCodeCompleteOptions();
5794 
5795 /**
5796  * Perform code completion at a given location in a translation unit.
5797  *
5798  * This function performs code completion at a particular file, line, and
5799  * column within source code, providing results that suggest potential
5800  * code snippets based on the context of the completion. The basic model
5801  * for code completion is that Clang will parse a complete source file,
5802  * performing syntax checking up to the location where code-completion has
5803  * been requested. At that point, a special code-completion token is passed
5804  * to the parser, which recognizes this token and determines, based on the
5805  * current location in the C/Objective-C/C++ grammar and the state of
5806  * semantic analysis, what completions to provide. These completions are
5807  * returned via a new \c CXCodeCompleteResults structure.
5808  *
5809  * Code completion itself is meant to be triggered by the client when the
5810  * user types punctuation characters or whitespace, at which point the
5811  * code-completion location will coincide with the cursor. For example, if \c p
5812  * is a pointer, code-completion might be triggered after the "-" and then
5813  * after the ">" in \c p->. When the code-completion location is after the ">",
5814  * the completion results will provide, e.g., the members of the struct that
5815  * "p" points to. The client is responsible for placing the cursor at the
5816  * beginning of the token currently being typed, then filtering the results
5817  * based on the contents of the token. For example, when code-completing for
5818  * the expression \c p->get, the client should provide the location just after
5819  * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the
5820  * client can filter the results based on the current token text ("get"), only
5821  * showing those results that start with "get". The intent of this interface
5822  * is to separate the relatively high-latency acquisition of code-completion
5823  * results from the filtering of results on a per-character basis, which must
5824  * have a lower latency.
5825  *
5826  * \param TU The translation unit in which code-completion should
5827  * occur. The source files for this translation unit need not be
5828  * completely up-to-date (and the contents of those source files may
5829  * be overridden via \p unsaved_files). Cursors referring into the
5830  * translation unit may be invalidated by this invocation.
5831  *
5832  * \param complete_filename The name of the source file where code
5833  * completion should be performed. This filename may be any file
5834  * included in the translation unit.
5835  *
5836  * \param complete_line The line at which code-completion should occur.
5837  *
5838  * \param complete_column The column at which code-completion should occur.
5839  * Note that the column should point just after the syntactic construct that
5840  * initiated code completion, and not in the middle of a lexical token.
5841  *
5842  * \param unsaved_files the Files that have not yet been saved to disk
5843  * but may be required for parsing or code completion, including the
5844  * contents of those files.  The contents and name of these files (as
5845  * specified by CXUnsavedFile) are copied when necessary, so the
5846  * client only needs to guarantee their validity until the call to
5847  * this function returns.
5848  *
5849  * \param num_unsaved_files The number of unsaved file entries in \p
5850  * unsaved_files.
5851  *
5852  * \param options Extra options that control the behavior of code
5853  * completion, expressed as a bitwise OR of the enumerators of the
5854  * CXCodeComplete_Flags enumeration. The
5855  * \c clang_defaultCodeCompleteOptions() function returns a default set
5856  * of code-completion options.
5857  *
5858  * \returns If successful, a new \c CXCodeCompleteResults structure
5859  * containing code-completion results, which should eventually be
5860  * freed with \c clang_disposeCodeCompleteResults(). If code
5861  * completion fails, returns NULL.
5862  */
5863 CXCodeCompleteResults* clang_codeCompleteAt(
5864     CXTranslationUnit TU,
5865     const(char)* complete_filename,
5866     uint complete_line,
5867     uint complete_column,
5868     CXUnsavedFile* unsaved_files,
5869     uint num_unsaved_files,
5870     uint options);
5871 
5872 /**
5873  * Sort the code-completion results in case-insensitive alphabetical
5874  * order.
5875  *
5876  * \param Results The set of results to sort.
5877  * \param NumResults The number of results in \p Results.
5878  */
5879 void clang_sortCodeCompletionResults(
5880     CXCompletionResult* Results,
5881     uint NumResults);
5882 
5883 /**
5884  * Free the given set of code-completion results.
5885  */
5886 void clang_disposeCodeCompleteResults(CXCodeCompleteResults* Results);
5887 
5888 /**
5889  * Determine the number of diagnostics produced prior to the
5890  * location where code completion was performed.
5891  */
5892 uint clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults* Results);
5893 
5894 /**
5895  * Retrieve a diagnostic associated with the given code completion.
5896  *
5897  * \param Results the code completion results to query.
5898  * \param Index the zero-based diagnostic number to retrieve.
5899  *
5900  * \returns the requested diagnostic. This diagnostic must be freed
5901  * via a call to \c clang_disposeDiagnostic().
5902  */
5903 CXDiagnostic clang_codeCompleteGetDiagnostic(
5904     CXCodeCompleteResults* Results,
5905     uint Index);
5906 
5907 /**
5908  * Determines what completions are appropriate for the context
5909  * the given code completion.
5910  *
5911  * \param Results the code completion results to query
5912  *
5913  * \returns the kinds of completions that are appropriate for use
5914  * along with the given code completion results.
5915  */
5916 ulong clang_codeCompleteGetContexts(CXCodeCompleteResults* Results);
5917 
5918 /**
5919  * Returns the cursor kind for the container for the current code
5920  * completion context. The container is only guaranteed to be set for
5921  * contexts where a container exists (i.e. member accesses or Objective-C
5922  * message sends); if there is not a container, this function will return
5923  * CXCursor_InvalidCode.
5924  *
5925  * \param Results the code completion results to query
5926  *
5927  * \param IsIncomplete on return, this value will be false if Clang has complete
5928  * information about the container. If Clang does not have complete
5929  * information, this value will be true.
5930  *
5931  * \returns the container kind, or CXCursor_InvalidCode if there is not a
5932  * container
5933  */
5934 CXCursorKind clang_codeCompleteGetContainerKind(
5935     CXCodeCompleteResults* Results,
5936     uint* IsIncomplete);
5937 
5938 /**
5939  * Returns the USR for the container for the current code completion
5940  * context. If there is not a container for the current context, this
5941  * function will return the empty string.
5942  *
5943  * \param Results the code completion results to query
5944  *
5945  * \returns the USR for the container
5946  */
5947 CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults* Results);
5948 
5949 /**
5950  * Returns the currently-entered selector for an Objective-C message
5951  * send, formatted like "initWithFoo:bar:". Only guaranteed to return a
5952  * non-empty string for CXCompletionContext_ObjCInstanceMessage and
5953  * CXCompletionContext_ObjCClassMessage.
5954  *
5955  * \param Results the code completion results to query
5956  *
5957  * \returns the selector (or partial selector) that has been entered thus far
5958  * for an Objective-C message send.
5959  */
5960 CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults* Results);
5961 
5962 /**
5963  * @}
5964  */
5965 
5966 /**
5967  * \defgroup CINDEX_MISC Miscellaneous utility functions
5968  *
5969  * @{
5970  */
5971 
5972 /**
5973  * Return a version string, suitable for showing to a user, but not
5974  *        intended to be parsed (the format is not guaranteed to be stable).
5975  */
5976 CXString clang_getClangVersion();
5977 
5978 /**
5979  * Enable/disable crash recovery.
5980  *
5981  * \param isEnabled Flag to indicate if crash recovery is enabled.  A non-zero
5982  *        value enables crash recovery, while 0 disables it.
5983  */
5984 void clang_toggleCrashRecovery(uint isEnabled);
5985 
5986 /**
5987  * Visitor invoked for each file in a translation unit
5988  *        (used with clang_getInclusions()).
5989  *
5990  * This visitor function will be invoked by clang_getInclusions() for each
5991  * file included (either at the top-level or by \#include directives) within
5992  * a translation unit.  The first argument is the file being included, and
5993  * the second and third arguments provide the inclusion stack.  The
5994  * array is sorted in order of immediate inclusion.  For example,
5995  * the first element refers to the location that included 'included_file'.
5996  */
5997 alias CXInclusionVisitor = void function(
5998     CXFile included_file,
5999     CXSourceLocation* inclusion_stack,
6000     uint include_len,
6001     CXClientData client_data);
6002 
6003 /**
6004  * Visit the set of preprocessor inclusions in a translation unit.
6005  *   The visitor function is called with the provided data for every included
6006  *   file.  This does not include headers included by the PCH file (unless one
6007  *   is inspecting the inclusions in the PCH file itself).
6008  */
6009 void clang_getInclusions(
6010     CXTranslationUnit tu,
6011     CXInclusionVisitor visitor,
6012     CXClientData client_data);
6013 
6014 enum CXEvalResultKind
6015 {
6016     int_ = 1,
6017     float_ = 2,
6018     objCStrLiteral = 3,
6019     strLiteral = 4,
6020     cfStr = 5,
6021     other = 6,
6022 
6023     unExposed = 0
6024 }
6025 
6026 /**
6027  * Evaluation result of a cursor
6028  */
6029 alias CXEvalResult = void*;
6030 
6031 /**
6032  * If cursor is a statement declaration tries to evaluate the
6033  * statement and if its variable, tries to evaluate its initializer,
6034  * into its corresponding type.
6035  * If it's an expression, tries to evaluate the expression.
6036  */
6037 CXEvalResult clang_Cursor_Evaluate(CXCursor C);
6038 
6039 /**
6040  * Returns the kind of the evaluated result.
6041  */
6042 CXEvalResultKind clang_EvalResult_getKind(CXEvalResult E);
6043 
6044 /**
6045  * Returns the evaluation result as integer if the
6046  * kind is Int.
6047  */
6048 int clang_EvalResult_getAsInt(CXEvalResult E);
6049 
6050 /**
6051  * Returns the evaluation result as a long long integer if the
6052  * kind is Int. This prevents overflows that may happen if the result is
6053  * returned with clang_EvalResult_getAsInt.
6054  */
6055 long clang_EvalResult_getAsLongLong(CXEvalResult E);
6056 
6057 /**
6058  * Returns a non-zero value if the kind is Int and the evaluation
6059  * result resulted in an unsigned integer.
6060  */
6061 uint clang_EvalResult_isUnsignedInt(CXEvalResult E);
6062 
6063 /**
6064  * Returns the evaluation result as an unsigned integer if
6065  * the kind is Int and clang_EvalResult_isUnsignedInt is non-zero.
6066  */
6067 ulong clang_EvalResult_getAsUnsigned(CXEvalResult E);
6068 
6069 /**
6070  * Returns the evaluation result as double if the
6071  * kind is double.
6072  */
6073 double clang_EvalResult_getAsDouble(CXEvalResult E);
6074 
6075 /**
6076  * Returns the evaluation result as a constant string if the
6077  * kind is other than Int or float. User must not free this pointer,
6078  * instead call clang_EvalResult_dispose on the CXEvalResult returned
6079  * by clang_Cursor_Evaluate.
6080  */
6081 const(char)* clang_EvalResult_getAsStr(CXEvalResult E);
6082 
6083 /**
6084  * Disposes the created Eval memory.
6085  */
6086 void clang_EvalResult_dispose(CXEvalResult E);
6087 /**
6088  * @}
6089  */
6090 
6091 /** \defgroup CINDEX_REMAPPING Remapping functions
6092  *
6093  * @{
6094  */
6095 
6096 /**
6097  * A remapping of original source files and their translated files.
6098  */
6099 alias CXRemapping = void*;
6100 
6101 /**
6102  * Retrieve a remapping.
6103  *
6104  * \param path the path that contains metadata about remappings.
6105  *
6106  * \returns the requested remapping. This remapping must be freed
6107  * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
6108  */
6109 CXRemapping clang_getRemappings(const(char)* path);
6110 
6111 /**
6112  * Retrieve a remapping.
6113  *
6114  * \param filePaths pointer to an array of file paths containing remapping info.
6115  *
6116  * \param numFiles number of file paths.
6117  *
6118  * \returns the requested remapping. This remapping must be freed
6119  * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
6120  */
6121 CXRemapping clang_getRemappingsFromFileList(
6122     const(char*)* filePaths,
6123     uint numFiles);
6124 
6125 /**
6126  * Determine the number of remappings.
6127  */
6128 uint clang_remap_getNumFiles(CXRemapping);
6129 
6130 /**
6131  * Get the original and the associated filename from the remapping.
6132  *
6133  * \param original If non-NULL, will be set to the original filename.
6134  *
6135  * \param transformed If non-NULL, will be set to the filename that the original
6136  * is associated with.
6137  */
6138 void clang_remap_getFilenames(
6139     CXRemapping,
6140     uint index,
6141     CXString* original,
6142     CXString* transformed);
6143 
6144 /**
6145  * Dispose the remapping.
6146  */
6147 void clang_remap_dispose(CXRemapping);
6148 
6149 /**
6150  * @}
6151  */
6152 
6153 /** \defgroup CINDEX_HIGH Higher level API functions
6154  *
6155  * @{
6156  */
6157 
6158 enum CXVisitorResult
6159 {
6160     break_ = 0,
6161     continue_ = 1
6162 }
6163 
6164 struct CXCursorAndRangeVisitor
6165 {
6166     void* context;
6167     CXVisitorResult function(void* context, CXCursor, CXSourceRange) visit;
6168 }
6169 
6170 enum CXResult
6171 {
6172     /**
6173      * Function returned successfully.
6174      */
6175     success = 0,
6176     /**
6177      * One of the parameters was invalid for the function.
6178      */
6179     invalid = 1,
6180     /**
6181      * The function was terminated by a callback (e.g. it returned
6182      * CXVisit_Break)
6183      */
6184     visitBreak = 2
6185 }
6186 
6187 /**
6188  * Find references of a declaration in a specific file.
6189  *
6190  * \param cursor pointing to a declaration or a reference of one.
6191  *
6192  * \param file to search for references.
6193  *
6194  * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for
6195  * each reference found.
6196  * The CXSourceRange will point inside the file; if the reference is inside
6197  * a macro (and not a macro argument) the CXSourceRange will be invalid.
6198  *
6199  * \returns one of the CXResult enumerators.
6200  */
6201 CXResult clang_findReferencesInFile(
6202     CXCursor cursor,
6203     CXFile file,
6204     CXCursorAndRangeVisitor visitor);
6205 
6206 /**
6207  * Find #import/#include directives in a specific file.
6208  *
6209  * \param TU translation unit containing the file to query.
6210  *
6211  * \param file to search for #import/#include directives.
6212  *
6213  * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for
6214  * each directive found.
6215  *
6216  * \returns one of the CXResult enumerators.
6217  */
6218 CXResult clang_findIncludesInFile(
6219     CXTranslationUnit TU,
6220     CXFile file,
6221     CXCursorAndRangeVisitor visitor);
6222 
6223 /**
6224  * The client's data object that is associated with a CXFile.
6225  */
6226 alias CXIdxClientFile = void*;
6227 
6228 /**
6229  * The client's data object that is associated with a semantic entity.
6230  */
6231 alias CXIdxClientEntity = void*;
6232 
6233 /**
6234  * The client's data object that is associated with a semantic container
6235  * of entities.
6236  */
6237 alias CXIdxClientContainer = void*;
6238 
6239 /**
6240  * The client's data object that is associated with an AST file (PCH
6241  * or module).
6242  */
6243 alias CXIdxClientASTFile = void*;
6244 
6245 /**
6246  * Source location passed to index callbacks.
6247  */
6248 struct CXIdxLoc
6249 {
6250     void*[2] ptr_data;
6251     uint int_data;
6252 }
6253 
6254 /**
6255  * Data for ppIncludedFile callback.
6256  */
6257 struct CXIdxIncludedFileInfo
6258 {
6259     /**
6260      * Location of '#' in the \#include/\#import directive.
6261      */
6262     CXIdxLoc hashLoc;
6263     /**
6264      * Filename as written in the \#include/\#import directive.
6265      */
6266     const(char)* filename;
6267     /**
6268      * The actual file that the \#include/\#import directive resolved to.
6269      */
6270     CXFile file;
6271     int isImport;
6272     int isAngled;
6273     /**
6274      * Non-zero if the directive was automatically turned into a module
6275      * import.
6276      */
6277     int isModuleImport;
6278 }
6279 
6280 /**
6281  * Data for IndexerCallbacks#importedASTFile.
6282  */
6283 struct CXIdxImportedASTFileInfo
6284 {
6285     /**
6286      * Top level AST file containing the imported PCH, module or submodule.
6287      */
6288     CXFile file;
6289     /**
6290      * The imported module or NULL if the AST file is a PCH.
6291      */
6292     CXModule module_;
6293     /**
6294      * Location where the file is imported. Applicable only for modules.
6295      */
6296     CXIdxLoc loc;
6297     /**
6298      * Non-zero if an inclusion directive was automatically turned into
6299      * a module import. Applicable only for modules.
6300      */
6301     int isImplicit;
6302 }
6303 
6304 enum CXIdxEntityKind
6305 {
6306     unexposed = 0,
6307     typedef_ = 1,
6308     function_ = 2,
6309     variable = 3,
6310     field = 4,
6311     enumConstant = 5,
6312 
6313     objCClass = 6,
6314     objCProtocol = 7,
6315     objCCategory = 8,
6316 
6317     objCInstanceMethod = 9,
6318     objCClassMethod = 10,
6319     objCProperty = 11,
6320     objCIvar = 12,
6321 
6322     enum_ = 13,
6323     struct_ = 14,
6324     union_ = 15,
6325 
6326     cxxClass = 16,
6327     cxxNamespace = 17,
6328     cxxNamespaceAlias = 18,
6329     cxxStaticVariable = 19,
6330     cxxStaticMethod = 20,
6331     cxxInstanceMethod = 21,
6332     cxxConstructor = 22,
6333     cxxDestructor = 23,
6334     cxxConversionFunction = 24,
6335     cxxTypeAlias = 25,
6336     cxxInterface = 26
6337 }
6338 
6339 enum CXIdxEntityLanguage
6340 {
6341     none = 0,
6342     c = 1,
6343     objC = 2,
6344     cxx = 3,
6345     swift = 4
6346 }
6347 
6348 /**
6349  * Extra C++ template information for an entity. This can apply to:
6350  * CXIdxEntity_Function
6351  * CXIdxEntity_CXXClass
6352  * CXIdxEntity_CXXStaticMethod
6353  * CXIdxEntity_CXXInstanceMethod
6354  * CXIdxEntity_CXXConstructor
6355  * CXIdxEntity_CXXConversionFunction
6356  * CXIdxEntity_CXXTypeAlias
6357  */
6358 enum CXIdxEntityCXXTemplateKind
6359 {
6360     nonTemplate = 0,
6361     template_ = 1,
6362     templatePartialSpecialization = 2,
6363     templateSpecialization = 3
6364 }
6365 
6366 enum CXIdxAttrKind
6367 {
6368     unexposed = 0,
6369     ibAction = 1,
6370     ibOutlet = 2,
6371     ibOutletCollection = 3
6372 }
6373 
6374 struct CXIdxAttrInfo
6375 {
6376     CXIdxAttrKind kind;
6377     CXCursor cursor;
6378     CXIdxLoc loc;
6379 }
6380 
6381 struct CXIdxEntityInfo
6382 {
6383     CXIdxEntityKind kind;
6384     CXIdxEntityCXXTemplateKind templateKind;
6385     CXIdxEntityLanguage lang;
6386     const(char)* name;
6387     const(char)* USR;
6388     CXCursor cursor;
6389     const(CXIdxAttrInfo*)* attributes;
6390     uint numAttributes;
6391 }
6392 
6393 struct CXIdxContainerInfo
6394 {
6395     CXCursor cursor;
6396 }
6397 
6398 struct CXIdxIBOutletCollectionAttrInfo
6399 {
6400     const(CXIdxAttrInfo)* attrInfo;
6401     const(CXIdxEntityInfo)* objcClass;
6402     CXCursor classCursor;
6403     CXIdxLoc classLoc;
6404 }
6405 
6406 enum CXIdxDeclInfoFlags
6407 {
6408     skipped = 0x1
6409 }
6410 
6411 struct CXIdxDeclInfo
6412 {
6413     const(CXIdxEntityInfo)* entityInfo;
6414     CXCursor cursor;
6415     CXIdxLoc loc;
6416     const(CXIdxContainerInfo)* semanticContainer;
6417     /**
6418      * Generally same as #semanticContainer but can be different in
6419      * cases like out-of-line C++ member functions.
6420      */
6421     const(CXIdxContainerInfo)* lexicalContainer;
6422     int isRedeclaration;
6423     int isDefinition;
6424     int isContainer;
6425     const(CXIdxContainerInfo)* declAsContainer;
6426     /**
6427      * Whether the declaration exists in code or was created implicitly
6428      * by the compiler, e.g. implicit Objective-C methods for properties.
6429      */
6430     int isImplicit;
6431     const(CXIdxAttrInfo*)* attributes;
6432     uint numAttributes;
6433 
6434     uint flags;
6435 }
6436 
6437 enum CXIdxObjCContainerKind
6438 {
6439     forwardRef = 0,
6440     interface_ = 1,
6441     implementation = 2
6442 }
6443 
6444 struct CXIdxObjCContainerDeclInfo
6445 {
6446     const(CXIdxDeclInfo)* declInfo;
6447     CXIdxObjCContainerKind kind;
6448 }
6449 
6450 struct CXIdxBaseClassInfo
6451 {
6452     const(CXIdxEntityInfo)* base;
6453     CXCursor cursor;
6454     CXIdxLoc loc;
6455 }
6456 
6457 struct CXIdxObjCProtocolRefInfo
6458 {
6459     const(CXIdxEntityInfo)* protocol;
6460     CXCursor cursor;
6461     CXIdxLoc loc;
6462 }
6463 
6464 struct CXIdxObjCProtocolRefListInfo
6465 {
6466     const(CXIdxObjCProtocolRefInfo*)* protocols;
6467     uint numProtocols;
6468 }
6469 
6470 struct CXIdxObjCInterfaceDeclInfo
6471 {
6472     const(CXIdxObjCContainerDeclInfo)* containerInfo;
6473     const(CXIdxBaseClassInfo)* superInfo;
6474     const(CXIdxObjCProtocolRefListInfo)* protocols;
6475 }
6476 
6477 struct CXIdxObjCCategoryDeclInfo
6478 {
6479     const(CXIdxObjCContainerDeclInfo)* containerInfo;
6480     const(CXIdxEntityInfo)* objcClass;
6481     CXCursor classCursor;
6482     CXIdxLoc classLoc;
6483     const(CXIdxObjCProtocolRefListInfo)* protocols;
6484 }
6485 
6486 struct CXIdxObjCPropertyDeclInfo
6487 {
6488     const(CXIdxDeclInfo)* declInfo;
6489     const(CXIdxEntityInfo)* getter;
6490     const(CXIdxEntityInfo)* setter;
6491 }
6492 
6493 struct CXIdxCXXClassDeclInfo
6494 {
6495     const(CXIdxDeclInfo)* declInfo;
6496     const(CXIdxBaseClassInfo*)* bases;
6497     uint numBases;
6498 }
6499 
6500 /**
6501  * Data for IndexerCallbacks#indexEntityReference.
6502  *
6503  * This may be deprecated in a future version as this duplicates
6504  * the \c CXSymbolRole_Implicit bit in \c CXSymbolRole.
6505  */
6506 enum CXIdxEntityRefKind
6507 {
6508     /**
6509      * The entity is referenced directly in user's code.
6510      */
6511     direct = 1,
6512     /**
6513      * An implicit reference, e.g. a reference of an Objective-C method
6514      * via the dot syntax.
6515      */
6516     implicit = 2
6517 }
6518 
6519 /**
6520  * Roles that are attributed to symbol occurrences.
6521  *
6522  * Internal: this currently mirrors low 9 bits of clang::index::SymbolRole with
6523  * higher bits zeroed. These high bits may be exposed in the future.
6524  */
6525 enum CXSymbolRole
6526 {
6527     none = 0,
6528     declaration = 1 << 0,
6529     definition = 1 << 1,
6530     reference = 1 << 2,
6531     read = 1 << 3,
6532     write = 1 << 4,
6533     call = 1 << 5,
6534     dynamic = 1 << 6,
6535     addressOf = 1 << 7,
6536     implicit = 1 << 8
6537 }
6538 
6539 /**
6540  * Data for IndexerCallbacks#indexEntityReference.
6541  */
6542 struct CXIdxEntityRefInfo
6543 {
6544     CXIdxEntityRefKind kind;
6545     /**
6546      * Reference cursor.
6547      */
6548     CXCursor cursor;
6549     CXIdxLoc loc;
6550     /**
6551      * The entity that gets referenced.
6552      */
6553     const(CXIdxEntityInfo)* referencedEntity;
6554     /**
6555      * Immediate "parent" of the reference. For example:
6556      *
6557      * \code
6558      * Foo *var;
6559      * \endcode
6560      *
6561      * The parent of reference of type 'Foo' is the variable 'var'.
6562      * For references inside statement bodies of functions/methods,
6563      * the parentEntity will be the function/method.
6564      */
6565     const(CXIdxEntityInfo)* parentEntity;
6566     /**
6567      * Lexical container context of the reference.
6568      */
6569     const(CXIdxContainerInfo)* container;
6570     /**
6571      * Sets of symbol roles of the reference.
6572      */
6573     CXSymbolRole role;
6574 }
6575 
6576 /**
6577  * A group of callbacks used by #clang_indexSourceFile and
6578  * #clang_indexTranslationUnit.
6579  */
6580 struct IndexerCallbacks
6581 {
6582     /**
6583      * Called periodically to check whether indexing should be aborted.
6584      * Should return 0 to continue, and non-zero to abort.
6585      */
6586     int function(CXClientData client_data, void* reserved) abortQuery;
6587 
6588     /**
6589      * Called at the end of indexing; passes the complete diagnostic set.
6590      */
6591     void function(CXClientData client_data, CXDiagnosticSet, void* reserved) diagnostic;
6592 
6593     CXIdxClientFile function(
6594         CXClientData client_data,
6595         CXFile mainFile,
6596         void* reserved) enteredMainFile;
6597 
6598     /**
6599      * Called when a file gets \#included/\#imported.
6600      */
6601     CXIdxClientFile function(
6602         CXClientData client_data,
6603         const(CXIdxIncludedFileInfo)*) ppIncludedFile;
6604 
6605     /**
6606      * Called when a AST file (PCH or module) gets imported.
6607      *
6608      * AST files will not get indexed (there will not be callbacks to index all
6609      * the entities in an AST file). The recommended action is that, if the AST
6610      * file is not already indexed, to initiate a new indexing job specific to
6611      * the AST file.
6612      */
6613     CXIdxClientASTFile function(
6614         CXClientData client_data,
6615         const(CXIdxImportedASTFileInfo)*) importedASTFile;
6616 
6617     /**
6618      * Called at the beginning of indexing a translation unit.
6619      */
6620     CXIdxClientContainer function(
6621         CXClientData client_data,
6622         void* reserved) startedTranslationUnit;
6623 
6624     void function(CXClientData client_data, const(CXIdxDeclInfo)*) indexDeclaration;
6625 
6626     /**
6627      * Called to index a reference of an entity.
6628      */
6629     void function(
6630         CXClientData client_data,
6631         const(CXIdxEntityRefInfo)*) indexEntityReference;
6632 }
6633 
6634 int clang_index_isEntityObjCContainerKind(CXIdxEntityKind);
6635 const(CXIdxObjCContainerDeclInfo)* clang_index_getObjCContainerDeclInfo(
6636     const(CXIdxDeclInfo)*);
6637 
6638 const(CXIdxObjCInterfaceDeclInfo)* clang_index_getObjCInterfaceDeclInfo(
6639     const(CXIdxDeclInfo)*);
6640 
6641 const(CXIdxObjCCategoryDeclInfo)* clang_index_getObjCCategoryDeclInfo(
6642     const(CXIdxDeclInfo)*);
6643 
6644 const(CXIdxObjCProtocolRefListInfo)* clang_index_getObjCProtocolRefListInfo(
6645     const(CXIdxDeclInfo)*);
6646 
6647 const(CXIdxObjCPropertyDeclInfo)* clang_index_getObjCPropertyDeclInfo(
6648     const(CXIdxDeclInfo)*);
6649 
6650 const(CXIdxIBOutletCollectionAttrInfo)* clang_index_getIBOutletCollectionAttrInfo(
6651     const(CXIdxAttrInfo)*);
6652 
6653 const(CXIdxCXXClassDeclInfo)* clang_index_getCXXClassDeclInfo(
6654     const(CXIdxDeclInfo)*);
6655 
6656 /**
6657  * For retrieving a custom CXIdxClientContainer attached to a
6658  * container.
6659  */
6660 CXIdxClientContainer clang_index_getClientContainer(const(CXIdxContainerInfo)*);
6661 
6662 /**
6663  * For setting a custom CXIdxClientContainer attached to a
6664  * container.
6665  */
6666 void clang_index_setClientContainer(
6667     const(CXIdxContainerInfo)*,
6668     CXIdxClientContainer);
6669 
6670 /**
6671  * For retrieving a custom CXIdxClientEntity attached to an entity.
6672  */
6673 CXIdxClientEntity clang_index_getClientEntity(const(CXIdxEntityInfo)*);
6674 
6675 /**
6676  * For setting a custom CXIdxClientEntity attached to an entity.
6677  */
6678 void clang_index_setClientEntity(const(CXIdxEntityInfo)*, CXIdxClientEntity);
6679 
6680 /**
6681  * An indexing action/session, to be applied to one or multiple
6682  * translation units.
6683  */
6684 alias CXIndexAction = void*;
6685 
6686 /**
6687  * An indexing action/session, to be applied to one or multiple
6688  * translation units.
6689  *
6690  * \param CIdx The index object with which the index action will be associated.
6691  */
6692 CXIndexAction clang_IndexAction_create(CXIndex CIdx);
6693 
6694 /**
6695  * Destroy the given index action.
6696  *
6697  * The index action must not be destroyed until all of the translation units
6698  * created within that index action have been destroyed.
6699  */
6700 void clang_IndexAction_dispose(CXIndexAction);
6701 
6702 enum CXIndexOptFlags
6703 {
6704     /**
6705      * Used to indicate that no special indexing options are needed.
6706      */
6707     none = 0x0,
6708 
6709     /**
6710      * Used to indicate that IndexerCallbacks#indexEntityReference should
6711      * be invoked for only one reference of an entity per source file that does
6712      * not also include a declaration/definition of the entity.
6713      */
6714     suppressRedundantRefs = 0x1,
6715 
6716     /**
6717      * Function-local symbols should be indexed. If this is not set
6718      * function-local symbols will be ignored.
6719      */
6720     indexFunctionLocalSymbols = 0x2,
6721 
6722     /**
6723      * Implicit function/class template instantiations should be indexed.
6724      * If this is not set, implicit instantiations will be ignored.
6725      */
6726     indexImplicitTemplateInstantiations = 0x4,
6727 
6728     /**
6729      * Suppress all compiler warnings when parsing for indexing.
6730      */
6731     suppressWarnings = 0x8,
6732 
6733     /**
6734      * Skip a function/method body that was already parsed during an
6735      * indexing session associated with a \c CXIndexAction object.
6736      * Bodies in system headers are always skipped.
6737      */
6738     skipParsedBodiesInSession = 0x10
6739 }
6740 
6741 /**
6742  * Index the given source file and the translation unit corresponding
6743  * to that file via callbacks implemented through #IndexerCallbacks.
6744  *
6745  * \param client_data pointer data supplied by the client, which will
6746  * be passed to the invoked callbacks.
6747  *
6748  * \param index_callbacks Pointer to indexing callbacks that the client
6749  * implements.
6750  *
6751  * \param index_callbacks_size Size of #IndexerCallbacks structure that gets
6752  * passed in index_callbacks.
6753  *
6754  * \param index_options A bitmask of options that affects how indexing is
6755  * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags.
6756  *
6757  * \param[out] out_TU pointer to store a \c CXTranslationUnit that can be
6758  * reused after indexing is finished. Set to \c NULL if you do not require it.
6759  *
6760  * \returns 0 on success or if there were errors from which the compiler could
6761  * recover.  If there is a failure from which there is no recovery, returns
6762  * a non-zero \c CXErrorCode.
6763  *
6764  * The rest of the parameters are the same as #clang_parseTranslationUnit.
6765  */
6766 int clang_indexSourceFile(
6767     CXIndexAction,
6768     CXClientData client_data,
6769     IndexerCallbacks* index_callbacks,
6770     uint index_callbacks_size,
6771     uint index_options,
6772     const(char)* source_filename,
6773     const(char*)* command_line_args,
6774     int num_command_line_args,
6775     CXUnsavedFile* unsaved_files,
6776     uint num_unsaved_files,
6777     CXTranslationUnit* out_TU,
6778     uint TU_options);
6779 
6780 /**
6781  * Same as clang_indexSourceFile but requires a full command line
6782  * for \c command_line_args including argv[0]. This is useful if the standard
6783  * library paths are relative to the binary.
6784  */
6785 int clang_indexSourceFileFullArgv(
6786     CXIndexAction,
6787     CXClientData client_data,
6788     IndexerCallbacks* index_callbacks,
6789     uint index_callbacks_size,
6790     uint index_options,
6791     const(char)* source_filename,
6792     const(char*)* command_line_args,
6793     int num_command_line_args,
6794     CXUnsavedFile* unsaved_files,
6795     uint num_unsaved_files,
6796     CXTranslationUnit* out_TU,
6797     uint TU_options);
6798 
6799 /**
6800  * Index the given translation unit via callbacks implemented through
6801  * #IndexerCallbacks.
6802  *
6803  * The order of callback invocations is not guaranteed to be the same as
6804  * when indexing a source file. The high level order will be:
6805  *
6806  *   -Preprocessor callbacks invocations
6807  *   -Declaration/reference callbacks invocations
6808  *   -Diagnostic callback invocations
6809  *
6810  * The parameters are the same as #clang_indexSourceFile.
6811  *
6812  * \returns If there is a failure from which there is no recovery, returns
6813  * non-zero, otherwise returns 0.
6814  */
6815 int clang_indexTranslationUnit(
6816     CXIndexAction,
6817     CXClientData client_data,
6818     IndexerCallbacks* index_callbacks,
6819     uint index_callbacks_size,
6820     uint index_options,
6821     CXTranslationUnit);
6822 
6823 /**
6824  * Retrieve the CXIdxFile, file, line, column, and offset represented by
6825  * the given CXIdxLoc.
6826  *
6827  * If the location refers into a macro expansion, retrieves the
6828  * location of the macro expansion and if it refers into a macro argument
6829  * retrieves the location of the argument.
6830  */
6831 void clang_indexLoc_getFileLocation(
6832     CXIdxLoc loc,
6833     CXIdxClientFile* indexFile,
6834     CXFile* file,
6835     uint* line,
6836     uint* column,
6837     uint* offset);
6838 
6839 /**
6840  * Retrieve the CXSourceLocation represented by the given CXIdxLoc.
6841  */
6842 CXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc);
6843 
6844 /**
6845  * Visitor invoked for each field found by a traversal.
6846  *
6847  * This visitor function will be invoked for each field found by
6848  * \c clang_Type_visitFields. Its first argument is the cursor being
6849  * visited, its second argument is the client data provided to
6850  * \c clang_Type_visitFields.
6851  *
6852  * The visitor should return one of the \c CXVisitorResult values
6853  * to direct \c clang_Type_visitFields.
6854  */
6855 alias CXFieldVisitor = CXVisitorResult function(
6856     CXCursor C,
6857     CXClientData client_data);
6858 
6859 /**
6860  * Visit the fields of a particular type.
6861  *
6862  * This function visits all the direct fields of the given cursor,
6863  * invoking the given \p visitor function with the cursors of each
6864  * visited field. The traversal may be ended prematurely, if
6865  * the visitor returns \c CXFieldVisit_Break.
6866  *
6867  * \param T the record type whose field may be visited.
6868  *
6869  * \param visitor the visitor function that will be invoked for each
6870  * field of \p T.
6871  *
6872  * \param client_data pointer data supplied by the client, which will
6873  * be passed to the visitor each time it is invoked.
6874  *
6875  * \returns a non-zero value if the traversal was terminated
6876  * prematurely by the visitor returning \c CXFieldVisit_Break.
6877  */
6878 uint clang_Type_visitFields(
6879     CXType T,
6880     CXFieldVisitor visitor,
6881     CXClientData client_data);
6882 
6883 /**
6884  * @}
6885  */
6886 
6887 /**
6888  * @}
6889  */
6890