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