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