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