clang  9.0.0svn
Index.h
Go to the documentation of this file.
1 /*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\
2 |* *|
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
4 |* Exceptions. *|
5 |* See https://llvm.org/LICENSE.txt for license information. *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
7 |* *|
8 |*===----------------------------------------------------------------------===*|
9 |* *|
10 |* This header provides a public interface to a Clang library for extracting *|
11 |* high-level symbol information from source files without exposing the full *|
12 |* Clang C++ API. *|
13 |* *|
14 \*===----------------------------------------------------------------------===*/
15 
16 #ifndef LLVM_CLANG_C_INDEX_H
17 #define LLVM_CLANG_C_INDEX_H
18 
19 #include <time.h>
20 
21 #include "clang-c/Platform.h"
22 #include "clang-c/CXErrorCode.h"
23 #include "clang-c/CXString.h"
24 #include "clang-c/BuildSystem.h"
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 #define CINDEX_VERSION_MAJOR 0
35 #define CINDEX_VERSION_MINOR 59
36 
37 #define CINDEX_VERSION_ENCODE(major, minor) ( \
38  ((major) * 10000) \
39  + ((minor) * 1))
40 
41 #define CINDEX_VERSION CINDEX_VERSION_ENCODE( \
42  CINDEX_VERSION_MAJOR, \
43  CINDEX_VERSION_MINOR )
44 
45 #define CINDEX_VERSION_STRINGIZE_(major, minor) \
46  #major"."#minor
47 #define CINDEX_VERSION_STRINGIZE(major, minor) \
48  CINDEX_VERSION_STRINGIZE_(major, minor)
49 
50 #define CINDEX_VERSION_STRING CINDEX_VERSION_STRINGIZE( \
51  CINDEX_VERSION_MAJOR, \
52  CINDEX_VERSION_MINOR)
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 /** \defgroup CINDEX libclang: C Interface to Clang
59  *
60  * The C Interface to Clang provides a relatively small API that exposes
61  * facilities for parsing source code into an abstract syntax tree (AST),
62  * loading already-parsed ASTs, traversing the AST, associating
63  * physical source locations with elements within the AST, and other
64  * facilities that support Clang-based development tools.
65  *
66  * This C interface to Clang will never provide all of the information
67  * representation stored in Clang's C++ AST, nor should it: the intent is to
68  * maintain an API that is relatively stable from one release to the next,
69  * providing only the basic functionality needed to support development tools.
70  *
71  * To avoid namespace pollution, data types are prefixed with "CX" and
72  * functions are prefixed with "clang_".
73  *
74  * @{
75  */
76 
77 /**
78  * An "index" that consists of a set of translation units that would
79  * typically be linked together into an executable or library.
80  */
81 typedef void *CXIndex;
82 
83 /**
84  * An opaque type representing target information for a given translation
85  * unit.
86  */
87 typedef struct CXTargetInfoImpl *CXTargetInfo;
88 
89 /**
90  * A single translation unit, which resides in an index.
91  */
92 typedef struct CXTranslationUnitImpl *CXTranslationUnit;
93 
94 /**
95  * Opaque pointer representing client data that will be passed through
96  * to various callbacks and visitors.
97  */
98 typedef void *CXClientData;
99 
100 /**
101  * Provides the contents of a file that has not yet been saved to disk.
102  *
103  * Each CXUnsavedFile instance provides the name of a file on the
104  * system along with the current contents of that file that have not
105  * yet been saved to disk.
106  */
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  unsigned long 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  */
132  /**
133  * The entity is available.
134  */
136  /**
137  * The entity is available, but has been deprecated (and its use is
138  * not recommended).
139  */
141  /**
142  * The entity is not available; any use of it will be an error.
143  */
145  /**
146  * The entity is available, but not accessible; any use of it will be
147  * an error.
148  */
150 };
151 
152 /**
153  * Describes a version number of the form major.minor.subminor.
154  */
155 typedef struct CXVersion {
156  /**
157  * The major version number, e.g., the '10' in '10.7.3'. A negative
158  * value indicates that there is no version number at all.
159  */
160  int Major;
161  /**
162  * The minor version number, e.g., the '7' in '10.7.3'. This value
163  * will be negative if no minor version number was provided, e.g., for
164  * version '10'.
165  */
166  int Minor;
167  /**
168  * The subminor version number, e.g., the '3' in '10.7.3'. This value
169  * will be negative if no minor or subminor version number was provided,
170  * e.g., in version '10' or '10.7'.
171  */
172  int Subminor;
173 } CXVersion;
174 
175 /**
176  * Describes the exception specification of a cursor.
177  *
178  * A negative value indicates that the cursor is not a function declaration.
179  */
181  /**
182  * The cursor has no exception specification.
183  */
185 
186  /**
187  * The cursor has exception specification throw()
188  */
190 
191  /**
192  * The cursor has exception specification throw(T1, T2)
193  */
195 
196  /**
197  * The cursor has exception specification throw(...).
198  */
200 
201  /**
202  * The cursor has exception specification basic noexcept.
203  */
205 
206  /**
207  * The cursor has exception specification computed noexcept.
208  */
210 
211  /**
212  * The exception specification has not yet been evaluated.
213  */
215 
216  /**
217  * The exception specification has not yet been instantiated.
218  */
220 
221  /**
222  * The exception specification has not been parsed yet.
223  */
225 
226  /**
227  * The cursor has a __declspec(nothrow) exception specification.
228  */
230 };
231 
232 /**
233  * Provides a shared context for creating translation units.
234  *
235  * It provides two options:
236  *
237  * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
238  * declarations (when loading any new translation units). A "local" declaration
239  * is one that belongs in the translation unit itself and not in a precompiled
240  * header that was used by the translation unit. If zero, all declarations
241  * will be enumerated.
242  *
243  * Here is an example:
244  *
245  * \code
246  * // excludeDeclsFromPCH = 1, displayDiagnostics=1
247  * Idx = clang_createIndex(1, 1);
248  *
249  * // IndexTest.pch was produced with the following command:
250  * // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
251  * TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
252  *
253  * // This will load all the symbols from 'IndexTest.pch'
254  * clang_visitChildren(clang_getTranslationUnitCursor(TU),
255  * TranslationUnitVisitor, 0);
256  * clang_disposeTranslationUnit(TU);
257  *
258  * // This will load all the symbols from 'IndexTest.c', excluding symbols
259  * // from 'IndexTest.pch'.
260  * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
261  * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
262  * 0, 0);
263  * clang_visitChildren(clang_getTranslationUnitCursor(TU),
264  * TranslationUnitVisitor, 0);
265  * clang_disposeTranslationUnit(TU);
266  * \endcode
267  *
268  * This process of creating the 'pch', loading it separately, and using it (via
269  * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
270  * (which gives the indexer the same performance benefit as the compiler).
271  */
272 CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
273  int displayDiagnostics);
274 
275 /**
276  * Destroy the given index.
277  *
278  * The index must not be destroyed until all of the translation units created
279  * within that index have been destroyed.
280  */
281 CINDEX_LINKAGE void clang_disposeIndex(CXIndex index);
282 
283 typedef enum {
284  /**
285  * Used to indicate that no special CXIndex options are needed.
286  */
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  */
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  */
306 
307  /**
308  * Used to indicate that all threads that libclang creates should use
309  * background priority.
310  */
314 
316 
317 /**
318  * Sets general options associated with a CXIndex.
319  *
320  * For example:
321  * \code
322  * CXIndex idx = ...;
323  * clang_CXIndex_setGlobalOptions(idx,
324  * clang_CXIndex_getGlobalOptions(idx) |
325  * CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
326  * \endcode
327  *
328  * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.
329  */
330 CINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options);
331 
332 /**
333  * Gets the general options associated with a CXIndex.
334  *
335  * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that
336  * are associated with the given CXIndex object.
337  */
339 
340 /**
341  * Sets the invocation emission path option in a CXIndex.
342  *
343  * The invocation emission path specifies a path which will contain log
344  * files for certain libclang invocations. A null value (default) implies that
345  * libclang invocations are not logged..
346  */
347 CINDEX_LINKAGE void
348 clang_CXIndex_setInvocationEmissionPathOption(CXIndex, const char *Path);
349 
350 /**
351  * \defgroup CINDEX_FILES File manipulation routines
352  *
353  * @{
354  */
355 
356 /**
357  * A particular source file that is part of a translation unit.
358  */
359 typedef void *CXFile;
360 
361 /**
362  * Retrieve the complete file and path name of the given file.
363  */
365 
366 /**
367  * Retrieve the last modification time of the given file.
368  */
369 CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
370 
371 /**
372  * Uniquely identifies a CXFile, that refers to the same underlying file,
373  * across an indexing session.
374  */
375 typedef struct {
376  unsigned long long data[3];
378 
379 /**
380  * Retrieve the unique ID for the given \c file.
381  *
382  * \param file the file to get the ID for.
383  * \param outID stores the returned CXFileUniqueID.
384  * \returns If there was a failure getting the unique ID, returns non-zero,
385  * otherwise returns 0.
386 */
387 CINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID);
388 
389 /**
390  * Determine whether the given header is guarded against
391  * multiple inclusions, either with the conventional
392  * \#ifndef/\#define/\#endif macro guards or with \#pragma once.
393  */
394 CINDEX_LINKAGE unsigned
395 clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
396 
397 /**
398  * Retrieve a file handle within the given translation unit.
399  *
400  * \param tu the translation unit
401  *
402  * \param file_name the name of the file.
403  *
404  * \returns the file handle for the named file in the translation unit \p tu,
405  * or a NULL file handle if the file was not a part of this translation unit.
406  */
407 CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,
408  const char *file_name);
409 
410 /**
411  * Retrieve the buffer associated with the given file.
412  *
413  * \param tu the translation unit
414  *
415  * \param file the file for which to retrieve the buffer.
416  *
417  * \param size [out] if non-NULL, will be set to the size of the buffer.
418  *
419  * \returns a pointer to the buffer in memory that holds the contents of
420  * \p file, or a NULL pointer when the file is not loaded.
421  */
422 CINDEX_LINKAGE const char *clang_getFileContents(CXTranslationUnit tu,
423  CXFile file, size_t *size);
424 
425 /**
426  * Returns non-zero if the \c file1 and \c file2 point to the same file,
427  * or they are both NULL.
428  */
429 CINDEX_LINKAGE int clang_File_isEqual(CXFile file1, CXFile file2);
430 
431 /**
432  * Returns the real path name of \c file.
433  *
434  * An empty string may be returned. Use \c clang_getFileName() in that case.
435  */
437 
438 /**
439  * @}
440  */
441 
442 /**
443  * \defgroup CINDEX_LOCATIONS Physical source locations
444  *
445  * Clang represents physical source locations in its abstract syntax tree in
446  * great detail, with file, line, and column information for the majority of
447  * the tokens parsed in the source code. These data types and functions are
448  * used to represent source location information, either for a particular
449  * point in the program or for a range of points in the program, and extract
450  * specific location information from those data types.
451  *
452  * @{
453  */
454 
455 /**
456  * Identifies a specific source location within a translation
457  * unit.
458  *
459  * Use clang_getExpansionLocation() or clang_getSpellingLocation()
460  * to map a source location to a particular file, line, and column.
461  */
462 typedef struct {
463  const void *ptr_data[2];
464  unsigned int_data;
466 
467 /**
468  * Identifies a half-open character range in the source code.
469  *
470  * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
471  * starting and end locations from a source range, respectively.
472  */
473 typedef struct {
474  const void *ptr_data[2];
475  unsigned begin_int_data;
476  unsigned end_int_data;
477 } CXSourceRange;
478 
479 /**
480  * Retrieve a NULL (invalid) source location.
481  */
483 
484 /**
485  * Determine whether two source locations, which must refer into
486  * the same translation unit, refer to exactly the same point in the source
487  * code.
488  *
489  * \returns non-zero if the source locations refer to the same location, zero
490  * if they refer to different locations.
491  */
493  CXSourceLocation loc2);
494 
495 /**
496  * Retrieves the source location associated with a given file/line/column
497  * in a particular translation unit.
498  */
500  CXFile file,
501  unsigned line,
502  unsigned column);
503 /**
504  * Retrieves the source location associated with a given character offset
505  * in a particular translation unit.
506  */
508  CXFile file,
509  unsigned offset);
510 
511 /**
512  * Returns non-zero if the given source location is in a system header.
513  */
515 
516 /**
517  * Returns non-zero if the given source location is in the main file of
518  * the corresponding translation unit.
519  */
521 
522 /**
523  * Retrieve a NULL (invalid) source range.
524  */
526 
527 /**
528  * Retrieve a source range given the beginning and ending source
529  * locations.
530  */
532  CXSourceLocation end);
533 
534 /**
535  * Determine whether two ranges are equivalent.
536  *
537  * \returns non-zero if the ranges are the same, zero if they differ.
538  */
540  CXSourceRange range2);
541 
542 /**
543  * Returns non-zero if \p range is null.
544  */
546 
547 /**
548  * Retrieve the file, line, column, and offset represented by
549  * the given source location.
550  *
551  * If the location refers into a macro expansion, retrieves the
552  * location of the macro expansion.
553  *
554  * \param location the location within a source file that will be decomposed
555  * into its parts.
556  *
557  * \param file [out] if non-NULL, will be set to the file to which the given
558  * source location points.
559  *
560  * \param line [out] if non-NULL, will be set to the line to which the given
561  * source location points.
562  *
563  * \param column [out] if non-NULL, will be set to the column to which the given
564  * source location points.
565  *
566  * \param offset [out] if non-NULL, will be set to the offset into the
567  * buffer to which the given source location points.
568  */
570  CXFile *file,
571  unsigned *line,
572  unsigned *column,
573  unsigned *offset);
574 
575 /**
576  * Retrieve the file, line and column represented by the given source
577  * location, as specified in a # line directive.
578  *
579  * Example: given the following source code in a file somefile.c
580  *
581  * \code
582  * #123 "dummy.c" 1
583  *
584  * static int func(void)
585  * {
586  * return 0;
587  * }
588  * \endcode
589  *
590  * the location information returned by this function would be
591  *
592  * File: dummy.c Line: 124 Column: 12
593  *
594  * whereas clang_getExpansionLocation would have returned
595  *
596  * File: somefile.c Line: 3 Column: 12
597  *
598  * \param location the location within a source file that will be decomposed
599  * into its parts.
600  *
601  * \param filename [out] if non-NULL, will be set to the filename of the
602  * source location. Note that filenames returned will be for "virtual" files,
603  * which don't necessarily exist on the machine running clang - e.g. when
604  * parsing preprocessed output obtained from a different environment. If
605  * a non-NULL value is passed in, remember to dispose of the returned value
606  * using \c clang_disposeString() once you've finished with it. For an invalid
607  * source location, an empty string is returned.
608  *
609  * \param line [out] if non-NULL, will be set to the line number of the
610  * source location. For an invalid source location, zero is returned.
611  *
612  * \param column [out] if non-NULL, will be set to the column number of the
613  * source location. For an invalid source location, zero is returned.
614  */
616  CXString *filename,
617  unsigned *line,
618  unsigned *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  */
629  CXFile *file,
630  unsigned *line,
631  unsigned *column,
632  unsigned *offset);
633 
634 /**
635  * Retrieve the file, line, column, and offset represented by
636  * the given source location.
637  *
638  * If the location refers into a macro instantiation, return where the
639  * location was originally spelled in the source file.
640  *
641  * \param location the location within a source file that will be decomposed
642  * into its parts.
643  *
644  * \param file [out] if non-NULL, will be set to the file to which the given
645  * source location points.
646  *
647  * \param line [out] if non-NULL, will be set to the line to which the given
648  * source location points.
649  *
650  * \param column [out] if non-NULL, will be set to the column to which the given
651  * source location points.
652  *
653  * \param offset [out] if non-NULL, will be set to the offset into the
654  * buffer to which the given source location points.
655  */
657  CXFile *file,
658  unsigned *line,
659  unsigned *column,
660  unsigned *offset);
661 
662 /**
663  * Retrieve the file, line, column, and offset represented by
664  * the given source location.
665  *
666  * If the location refers into a macro expansion, return where the macro was
667  * expanded or where the macro argument was written, if the location points at
668  * a macro argument.
669  *
670  * \param location the location within a source file that will be decomposed
671  * into its parts.
672  *
673  * \param file [out] if non-NULL, will be set to the file to which the given
674  * source location points.
675  *
676  * \param line [out] if non-NULL, will be set to the line to which the given
677  * source location points.
678  *
679  * \param column [out] if non-NULL, will be set to the column to which the given
680  * source location points.
681  *
682  * \param offset [out] if non-NULL, will be set to the offset into the
683  * buffer to which the given source location points.
684  */
686  CXFile *file,
687  unsigned *line,
688  unsigned *column,
689  unsigned *offset);
690 
691 /**
692  * Retrieve a source location representing the first character within a
693  * source range.
694  */
696 
697 /**
698  * Retrieve a source location representing the last character within a
699  * source range.
700  */
702 
703 /**
704  * Identifies an array of ranges.
705  */
706 typedef struct {
707  /** The number of ranges in the \c ranges array. */
708  unsigned count;
709  /**
710  * An array of \c CXSourceRanges.
711  */
714 
715 /**
716  * Retrieve all ranges that were skipped by the preprocessor.
717  *
718  * The preprocessor will skip lines when they are surrounded by an
719  * if/ifdef/ifndef directive whose condition does not evaluate to true.
720  */
722  CXFile file);
723 
724 /**
725  * Retrieve all ranges from all files that were skipped by the
726  * preprocessor.
727  *
728  * The preprocessor will skip lines when they are surrounded by an
729  * if/ifdef/ifndef directive whose condition does not evaluate to true.
730  */
732 
733 /**
734  * Destroy the given \c CXSourceRangeList.
735  */
737 
738 /**
739  * @}
740  */
741 
742 /**
743  * \defgroup CINDEX_DIAG Diagnostic reporting
744  *
745  * @{
746  */
747 
748 /**
749  * Describes the severity of a particular diagnostic.
750  */
752  /**
753  * A diagnostic that has been suppressed, e.g., by a command-line
754  * option.
755  */
757 
758  /**
759  * This diagnostic is a note that should be attached to the
760  * previous (non-note) diagnostic.
761  */
763 
764  /**
765  * This diagnostic indicates suspicious code that may not be
766  * wrong.
767  */
769 
770  /**
771  * This diagnostic indicates that the code is ill-formed.
772  */
774 
775  /**
776  * This diagnostic indicates that the code is ill-formed such
777  * that future parser recovery is unlikely to produce useful
778  * results.
779  */
781 };
782 
783 /**
784  * A single diagnostic, containing the diagnostic's severity,
785  * location, text, source ranges, and fix-it hints.
786  */
787 typedef void *CXDiagnostic;
788 
789 /**
790  * A group of CXDiagnostics.
791  */
792 typedef void *CXDiagnosticSet;
793 
794 /**
795  * Determine the number of diagnostics in a CXDiagnosticSet.
796  */
797 CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags);
798 
799 /**
800  * Retrieve a diagnostic associated with the given CXDiagnosticSet.
801  *
802  * \param Diags the CXDiagnosticSet to query.
803  * \param Index the zero-based diagnostic number to retrieve.
804  *
805  * \returns the requested diagnostic. This diagnostic must be freed
806  * via a call to \c clang_disposeDiagnostic().
807  */
808 CINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,
809  unsigned Index);
810 
811 /**
812  * Describes the kind of error that occurred (if any) in a call to
813  * \c clang_loadDiagnostics.
814  */
816  /**
817  * Indicates that no error occurred.
818  */
820 
821  /**
822  * Indicates that an unknown error occurred while attempting to
823  * deserialize diagnostics.
824  */
826 
827  /**
828  * Indicates that the file containing the serialized diagnostics
829  * could not be opened.
830  */
832 
833  /**
834  * Indicates that the serialized diagnostics file is invalid or
835  * corrupt.
836  */
838 };
839 
840 /**
841  * Deserialize a set of diagnostics from a Clang diagnostics bitcode
842  * file.
843  *
844  * \param file The name of the file to deserialize.
845  * \param error A pointer to a enum value recording if there was a problem
846  * deserializing the diagnostics.
847  * \param errorString A pointer to a CXString for recording the error string
848  * if the file was not successfully loaded.
849  *
850  * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise. These
851  * diagnostics should be released using clang_disposeDiagnosticSet().
852  */
853 CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file,
854  enum CXLoadDiag_Error *error,
855  CXString *errorString);
856 
857 /**
858  * Release a CXDiagnosticSet and all of its contained diagnostics.
859  */
860 CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags);
861 
862 /**
863  * Retrieve the child diagnostics of a CXDiagnostic.
864  *
865  * This CXDiagnosticSet does not need to be released by
866  * clang_disposeDiagnosticSet.
867  */
868 CINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D);
869 
870 /**
871  * Determine the number of diagnostics produced for the given
872  * translation unit.
873  */
874 CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit);
875 
876 /**
877  * Retrieve a diagnostic associated with the given translation unit.
878  *
879  * \param Unit the translation unit to query.
880  * \param Index the zero-based diagnostic number to retrieve.
881  *
882  * \returns the requested diagnostic. This diagnostic must be freed
883  * via a call to \c clang_disposeDiagnostic().
884  */
885 CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,
886  unsigned Index);
887 
888 /**
889  * Retrieve the complete set of diagnostics associated with a
890  * translation unit.
891  *
892  * \param Unit the translation unit to query.
893  */
894 CINDEX_LINKAGE CXDiagnosticSet
895  clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);
896 
897 /**
898  * Destroy a diagnostic.
899  */
900 CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
901 
902 /**
903  * Options to control the display of diagnostics.
904  *
905  * The values in this enum are meant to be combined to customize the
906  * behavior of \c clang_formatDiagnostic().
907  */
909  /**
910  * Display the source-location information where the
911  * diagnostic was located.
912  *
913  * When set, diagnostics will be prefixed by the file, line, and
914  * (optionally) column to which the diagnostic refers. For example,
915  *
916  * \code
917  * test.c:28: warning: extra tokens at end of #endif directive
918  * \endcode
919  *
920  * This option corresponds to the clang flag \c -fshow-source-location.
921  */
923 
924  /**
925  * If displaying the source-location information of the
926  * diagnostic, also include the column number.
927  *
928  * This option corresponds to the clang flag \c -fshow-column.
929  */
931 
932  /**
933  * If displaying the source-location information of the
934  * diagnostic, also include information about source ranges in a
935  * machine-parsable format.
936  *
937  * This option corresponds to the clang flag
938  * \c -fdiagnostics-print-source-range-info.
939  */
941 
942  /**
943  * Display the option name associated with this diagnostic, if any.
944  *
945  * The option name displayed (e.g., -Wconversion) will be placed in brackets
946  * after the diagnostic text. This option corresponds to the clang flag
947  * \c -fdiagnostics-show-option.
948  */
950 
951  /**
952  * Display the category number associated with this diagnostic, if any.
953  *
954  * The category number is displayed within brackets after the diagnostic text.
955  * This option corresponds to the clang flag
956  * \c -fdiagnostics-show-category=id.
957  */
959 
960  /**
961  * Display the category name associated with this diagnostic, if any.
962  *
963  * The category name is displayed within brackets after the diagnostic text.
964  * This option corresponds to the clang flag
965  * \c -fdiagnostics-show-category=name.
966  */
968 };
969 
970 /**
971  * Format the given diagnostic in a manner that is suitable for display.
972  *
973  * This routine will format the given diagnostic to a string, rendering
974  * the diagnostic according to the various options given. The
975  * \c clang_defaultDiagnosticDisplayOptions() function returns the set of
976  * options that most closely mimics the behavior of the clang compiler.
977  *
978  * \param Diagnostic The diagnostic to print.
979  *
980  * \param Options A set of options that control the diagnostic display,
981  * created by combining \c CXDiagnosticDisplayOptions values.
982  *
983  * \returns A new string containing for formatted diagnostic.
984  */
985 CINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic,
986  unsigned Options);
987 
988 /**
989  * Retrieve the set of display options most similar to the
990  * default behavior of the clang compiler.
991  *
992  * \returns A set of display options suitable for use with \c
993  * clang_formatDiagnostic().
994  */
996 
997 /**
998  * Determine the severity of the given diagnostic.
999  */
1001 clang_getDiagnosticSeverity(CXDiagnostic);
1002 
1003 /**
1004  * Retrieve the source location of the given diagnostic.
1005  *
1006  * This location is where Clang would print the caret ('^') when
1007  * displaying the diagnostic on the command line.
1008  */
1010 
1011 /**
1012  * Retrieve the text of the given diagnostic.
1013  */
1015 
1016 /**
1017  * Retrieve the name of the command-line option that enabled this
1018  * diagnostic.
1019  *
1020  * \param Diag The diagnostic to be queried.
1021  *
1022  * \param Disable If non-NULL, will be set to the option that disables this
1023  * diagnostic (if any).
1024  *
1025  * \returns A string that contains the command-line option used to enable this
1026  * warning, such as "-Wconversion" or "-pedantic".
1027  */
1029  CXString *Disable);
1030 
1031 /**
1032  * Retrieve the category number for this diagnostic.
1033  *
1034  * Diagnostics can be categorized into groups along with other, related
1035  * diagnostics (e.g., diagnostics under the same warning flag). This routine
1036  * retrieves the category number for the given diagnostic.
1037  *
1038  * \returns The number of the category that contains this diagnostic, or zero
1039  * if this diagnostic is uncategorized.
1040  */
1041 CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
1042 
1043 /**
1044  * Retrieve the name of a particular diagnostic category. This
1045  * is now deprecated. Use clang_getDiagnosticCategoryText()
1046  * instead.
1047  *
1048  * \param Category A diagnostic category number, as returned by
1049  * \c clang_getDiagnosticCategory().
1050  *
1051  * \returns The name of the given diagnostic category.
1052  */
1055 
1056 /**
1057  * Retrieve the diagnostic category text for a given diagnostic.
1058  *
1059  * \returns The text of the given diagnostic category.
1060  */
1062 
1063 /**
1064  * Determine the number of source ranges associated with the given
1065  * diagnostic.
1066  */
1067 CINDEX_LINKAGE unsigned 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 CINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic,
1083  unsigned Range);
1084 
1085 /**
1086  * Determine the number of fix-it hints associated with the
1087  * given diagnostic.
1088  */
1089 CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
1090 
1091 /**
1092  * Retrieve the replacement information for a given fix-it.
1093  *
1094  * Fix-its are described in terms of a source range whose contents
1095  * should be replaced by a string. This approach generalizes over
1096  * three kinds of operations: removal of source code (the range covers
1097  * the code to be removed and the replacement string is empty),
1098  * replacement of source code (the range covers the code to be
1099  * replaced and the replacement string provides the new code), and
1100  * insertion (both the start and end of the range point at the
1101  * insertion location, and the replacement string provides the text to
1102  * insert).
1103  *
1104  * \param Diagnostic The diagnostic whose fix-its are being queried.
1105  *
1106  * \param FixIt The zero-based index of the fix-it.
1107  *
1108  * \param ReplacementRange The source range whose contents will be
1109  * replaced with the returned replacement string. Note that source
1110  * ranges are half-open ranges [a, b), so the source code should be
1111  * replaced from a and up to (but not including) b.
1112  *
1113  * \returns A string containing text that should be replace the source
1114  * code indicated by the \c ReplacementRange.
1115  */
1116 CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic,
1117  unsigned 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  */
1138 clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
1139 
1140 /**
1141  * Return the CXTranslationUnit for a given source file and the provided
1142  * command line arguments one would pass to the compiler.
1143  *
1144  * Note: The 'source_filename' argument is optional. If the caller provides a
1145  * NULL pointer, the name of the source file is expected to reside in the
1146  * specified command line arguments.
1147  *
1148  * Note: When encountered in 'clang_command_line_args', the following options
1149  * are ignored:
1150  *
1151  * '-c'
1152  * '-emit-ast'
1153  * '-fsyntax-only'
1154  * '-o <output file>' (both '-o' and '<output file>' are ignored)
1155  *
1156  * \param CIdx The index object with which the translation unit will be
1157  * associated.
1158  *
1159  * \param source_filename The name of the source file to load, or NULL if the
1160  * source file is included in \p clang_command_line_args.
1161  *
1162  * \param num_clang_command_line_args The number of command-line arguments in
1163  * \p clang_command_line_args.
1164  *
1165  * \param clang_command_line_args The command-line arguments that would be
1166  * passed to the \c clang executable if it were being invoked out-of-process.
1167  * These command-line options will be parsed and will affect how the translation
1168  * unit is parsed. Note that the following options are ignored: '-c',
1169  * '-emit-ast', '-fsyntax-only' (which is the default), and '-o <output file>'.
1170  *
1171  * \param num_unsaved_files the number of unsaved file entries in \p
1172  * unsaved_files.
1173  *
1174  * \param unsaved_files the files that have not yet been saved to disk
1175  * but may be required for code completion, including the contents of
1176  * those files. The contents and name of these files (as specified by
1177  * CXUnsavedFile) are copied when necessary, so the client only needs to
1178  * guarantee their validity until the call to this function returns.
1179  */
1181  CXIndex CIdx,
1182  const char *source_filename,
1183  int num_clang_command_line_args,
1184  const char * const *clang_command_line_args,
1185  unsigned num_unsaved_files,
1186  struct CXUnsavedFile *unsaved_files);
1187 
1188 /**
1189  * Same as \c clang_createTranslationUnit2, but returns
1190  * the \c CXTranslationUnit instead of an error code. In case of an error this
1191  * routine returns a \c NULL \c CXTranslationUnit, without further detailed
1192  * error codes.
1193  */
1195  CXIndex CIdx,
1196  const char *ast_filename);
1197 
1198 /**
1199  * Create a translation unit from an AST file (\c -emit-ast).
1200  *
1201  * \param[out] out_TU A non-NULL pointer to store the created
1202  * \c CXTranslationUnit.
1203  *
1204  * \returns Zero on success, otherwise returns an error code.
1205  */
1207  CXIndex CIdx,
1208  const char *ast_filename,
1209  CXTranslationUnit *out_TU);
1210 
1211 /**
1212  * Flags that control the creation of translation units.
1213  *
1214  * The enumerators in this enumeration type are meant to be bitwise
1215  * ORed together to specify which options should be used when
1216  * constructing the translation unit.
1217  */
1219  /**
1220  * Used to indicate that no special translation-unit options are
1221  * needed.
1222  */
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  */
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  */
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  */
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  */
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  */
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  */
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  */
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  */
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  */
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  */
1327 
1328  /**
1329  * Sets the preprocessor in a mode for parsing a single file only.
1330  */
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  */
1340 
1341  /**
1342  * Used to indicate that attributed types should be included in CXType.
1343  */
1345 
1346  /**
1347  * Used to indicate that implicit attributes should be visited.
1348  */
1350 
1351  /**
1352  * Used to indicate that non-errors from included files should be ignored.
1353  *
1354  * If set, clang_getDiagnosticSetFromTU() will not report e.g. warnings from
1355  * included files anymore. This speeds up clang_getDiagnosticSetFromTU() for
1356  * the case where these warnings are not of interest, as for an IDE for
1357  * example, which typically shows only the diagnostics in the main file.
1358  */
1360 };
1361 
1362 /**
1363  * Returns the set of flags that is suitable for parsing a translation
1364  * unit that is being edited.
1365  *
1366  * The set of flags returned provide options for \c clang_parseTranslationUnit()
1367  * to indicate that the translation unit is likely to be reparsed many times,
1368  * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
1369  * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
1370  * set contains an unspecified set of optimizations (e.g., the precompiled
1371  * preamble) geared toward improving the performance of these routines. The
1372  * set of optimizations enabled may change from one version to the next.
1373  */
1375 
1376 /**
1377  * Same as \c clang_parseTranslationUnit2, but returns
1378  * the \c CXTranslationUnit instead of an error code. In case of an error this
1379  * routine returns a \c NULL \c CXTranslationUnit, without further detailed
1380  * error codes.
1381  */
1382 CINDEX_LINKAGE CXTranslationUnit
1383 clang_parseTranslationUnit(CXIndex CIdx,
1384  const char *source_filename,
1385  const char *const *command_line_args,
1386  int num_command_line_args,
1387  struct CXUnsavedFile *unsaved_files,
1388  unsigned num_unsaved_files,
1389  unsigned options);
1390 
1391 /**
1392  * Parse the given source file and the translation unit corresponding
1393  * to that file.
1394  *
1395  * This routine is the main entry point for the Clang C API, providing the
1396  * ability to parse a source file into a translation unit that can then be
1397  * queried by other functions in the API. This routine accepts a set of
1398  * command-line arguments so that the compilation can be configured in the same
1399  * way that the compiler is configured on the command line.
1400  *
1401  * \param CIdx The index object with which the translation unit will be
1402  * associated.
1403  *
1404  * \param source_filename The name of the source file to load, or NULL if the
1405  * source file is included in \c command_line_args.
1406  *
1407  * \param command_line_args The command-line arguments that would be
1408  * passed to the \c clang executable if it were being invoked out-of-process.
1409  * These command-line options will be parsed and will affect how the translation
1410  * unit is parsed. Note that the following options are ignored: '-c',
1411  * '-emit-ast', '-fsyntax-only' (which is the default), and '-o <output file>'.
1412  *
1413  * \param num_command_line_args The number of command-line arguments in
1414  * \c command_line_args.
1415  *
1416  * \param unsaved_files the files that have not yet been saved to disk
1417  * but may be required for parsing, including the contents of
1418  * those files. The contents and name of these files (as specified by
1419  * CXUnsavedFile) are copied when necessary, so the client only needs to
1420  * guarantee their validity until the call to this function returns.
1421  *
1422  * \param num_unsaved_files the number of unsaved file entries in \p
1423  * unsaved_files.
1424  *
1425  * \param options A bitmask of options that affects how the translation unit
1426  * is managed but not its compilation. This should be a bitwise OR of the
1427  * CXTranslationUnit_XXX flags.
1428  *
1429  * \param[out] out_TU A non-NULL pointer to store the created
1430  * \c CXTranslationUnit, describing the parsed code and containing any
1431  * diagnostics produced by the compiler.
1432  *
1433  * \returns Zero on success, otherwise returns an error code.
1434  */
1436 clang_parseTranslationUnit2(CXIndex CIdx,
1437  const char *source_filename,
1438  const char *const *command_line_args,
1439  int num_command_line_args,
1440  struct CXUnsavedFile *unsaved_files,
1441  unsigned num_unsaved_files,
1442  unsigned options,
1443  CXTranslationUnit *out_TU);
1444 
1445 /**
1446  * Same as clang_parseTranslationUnit2 but requires a full command line
1447  * for \c command_line_args including argv[0]. This is useful if the standard
1448  * library paths are relative to the binary.
1449  */
1451  CXIndex CIdx, const char *source_filename,
1452  const char *const *command_line_args, int num_command_line_args,
1453  struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
1454  unsigned options, CXTranslationUnit *out_TU);
1455 
1456 /**
1457  * Flags that control how translation units are saved.
1458  *
1459  * The enumerators in this enumeration type are meant to be bitwise
1460  * ORed together to specify which options should be used when
1461  * saving the translation unit.
1462  */
1464  /**
1465  * Used to indicate that no special saving options are needed.
1466  */
1468 };
1469 
1470 /**
1471  * Returns the set of flags that is suitable for saving a translation
1472  * unit.
1473  *
1474  * The set of flags returned provide options for
1475  * \c clang_saveTranslationUnit() by default. The returned flag
1476  * set contains an unspecified set of options that save translation units with
1477  * the most commonly-requested data.
1478  */
1479 CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU);
1480 
1481 /**
1482  * Describes the kind of error that occurred (if any) in a call to
1483  * \c clang_saveTranslationUnit().
1484  */
1486  /**
1487  * Indicates that no error occurred while saving a translation unit.
1488  */
1490 
1491  /**
1492  * Indicates that an unknown error occurred while attempting to save
1493  * the file.
1494  *
1495  * This error typically indicates that file I/O failed when attempting to
1496  * write the file.
1497  */
1499 
1500  /**
1501  * Indicates that errors during translation prevented this attempt
1502  * to save the translation unit.
1503  *
1504  * Errors that prevent the translation unit from being saved can be
1505  * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
1506  */
1508 
1509  /**
1510  * Indicates that the translation unit to be saved was somehow
1511  * invalid (e.g., NULL).
1512  */
1514 };
1515 
1516 /**
1517  * Saves a translation unit into a serialized representation of
1518  * that translation unit on disk.
1519  *
1520  * Any translation unit that was parsed without error can be saved
1521  * into a file. The translation unit can then be deserialized into a
1522  * new \c CXTranslationUnit with \c clang_createTranslationUnit() or,
1523  * if it is an incomplete translation unit that corresponds to a
1524  * header, used as a precompiled header when parsing other translation
1525  * units.
1526  *
1527  * \param TU The translation unit to save.
1528  *
1529  * \param FileName The file to which the translation unit will be saved.
1530  *
1531  * \param options A bitmask of options that affects how the translation unit
1532  * is saved. This should be a bitwise OR of the
1533  * CXSaveTranslationUnit_XXX flags.
1534  *
1535  * \returns A value that will match one of the enumerators of the CXSaveError
1536  * enumeration. Zero (CXSaveError_None) indicates that the translation unit was
1537  * saved successfully, while a non-zero value indicates that a problem occurred.
1538  */
1539 CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU,
1540  const char *FileName,
1541  unsigned options);
1542 
1543 /**
1544  * Suspend a translation unit in order to free memory associated with it.
1545  *
1546  * A suspended translation unit uses significantly less memory but on the other
1547  * side does not support any other calls than \c clang_reparseTranslationUnit
1548  * to resume it or \c clang_disposeTranslationUnit to dispose it completely.
1549  */
1550 CINDEX_LINKAGE unsigned clang_suspendTranslationUnit(CXTranslationUnit);
1551 
1552 /**
1553  * Destroy the specified CXTranslationUnit object.
1554  */
1555 CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
1556 
1557 /**
1558  * Flags that control the reparsing of translation units.
1559  *
1560  * The enumerators in this enumeration type are meant to be bitwise
1561  * ORed together to specify which options should be used when
1562  * reparsing the translation unit.
1563  */
1565  /**
1566  * Used to indicate that no special reparsing options are needed.
1567  */
1569 };
1570 
1571 /**
1572  * Returns the set of flags that is suitable for reparsing a translation
1573  * unit.
1574  *
1575  * The set of flags returned provide options for
1576  * \c clang_reparseTranslationUnit() by default. The returned flag
1577  * set contains an unspecified set of optimizations geared toward common uses
1578  * of reparsing. The set of optimizations enabled may change from one version
1579  * to the next.
1580  */
1581 CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
1582 
1583 /**
1584  * Reparse the source files that produced this translation unit.
1585  *
1586  * This routine can be used to re-parse the source files that originally
1587  * created the given translation unit, for example because those source files
1588  * have changed (either on disk or as passed via \p unsaved_files). The
1589  * source code will be reparsed with the same command-line options as it
1590  * was originally parsed.
1591  *
1592  * Reparsing a translation unit invalidates all cursors and source locations
1593  * that refer into that translation unit. This makes reparsing a translation
1594  * unit semantically equivalent to destroying the translation unit and then
1595  * creating a new translation unit with the same command-line arguments.
1596  * However, it may be more efficient to reparse a translation
1597  * unit using this routine.
1598  *
1599  * \param TU The translation unit whose contents will be re-parsed. The
1600  * translation unit must originally have been built with
1601  * \c clang_createTranslationUnitFromSourceFile().
1602  *
1603  * \param num_unsaved_files The number of unsaved file entries in \p
1604  * unsaved_files.
1605  *
1606  * \param unsaved_files The files that have not yet been saved to disk
1607  * but may be required for parsing, including the contents of
1608  * those files. The contents and name of these files (as specified by
1609  * CXUnsavedFile) are copied when necessary, so the client only needs to
1610  * guarantee their validity until the call to this function returns.
1611  *
1612  * \param options A bitset of options composed of the flags in CXReparse_Flags.
1613  * The function \c clang_defaultReparseOptions() produces a default set of
1614  * options recommended for most uses, based on the translation unit.
1615  *
1616  * \returns 0 if the sources could be reparsed. A non-zero error code will be
1617  * returned if reparsing was impossible, such that the translation unit is
1618  * invalid. In such cases, the only valid call for \c TU is
1619  * \c clang_disposeTranslationUnit(TU). The error codes returned by this
1620  * routine are described by the \c CXErrorCode enum.
1621  */
1622 CINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU,
1623  unsigned num_unsaved_files,
1624  struct CXUnsavedFile *unsaved_files,
1625  unsigned options);
1626 
1627 /**
1628  * Categorizes how memory is being used by a translation unit.
1629  */
1648 
1651 };
1652 
1653 /**
1654  * Returns the human-readable null-terminated C string that represents
1655  * the name of the memory category. This string should never be freed.
1656  */
1659 
1660 typedef struct CXTUResourceUsageEntry {
1661  /* The memory usage category. */
1663  /* Amount of resources used.
1664  The units will depend on the resource kind. */
1665  unsigned long amount;
1667 
1668 /**
1669  * The memory usage of a CXTranslationUnit, broken into categories.
1670  */
1671 typedef struct CXTUResourceUsage {
1672  /* Private data member, used for queries. */
1673  void *data;
1674 
1675  /* The number of entries in the 'entries' array. */
1676  unsigned numEntries;
1677 
1678  /* An array of key-value pairs, representing the breakdown of memory
1679  usage. */
1681 
1683 
1684 /**
1685  * Return the memory usage of a translation unit. This object
1686  * should be released with clang_disposeCXTUResourceUsage().
1687  */
1689 
1691 
1692 /**
1693  * Get target information for this translation unit.
1694  *
1695  * The CXTargetInfo object cannot outlive the CXTranslationUnit object.
1696  */
1697 CINDEX_LINKAGE CXTargetInfo
1698 clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit);
1699 
1700 /**
1701  * Destroy the CXTargetInfo object.
1702  */
1703 CINDEX_LINKAGE void
1704 clang_TargetInfo_dispose(CXTargetInfo Info);
1705 
1706 /**
1707  * Get the normalized target triple as a string.
1708  *
1709  * Returns the empty string in case of any error.
1710  */
1712 clang_TargetInfo_getTriple(CXTargetInfo Info);
1713 
1714 /**
1715  * Get the pointer width of the target in bits.
1716  *
1717  * Returns -1 in case of error.
1718  */
1719 CINDEX_LINKAGE int
1720 clang_TargetInfo_getPointerWidth(CXTargetInfo Info);
1721 
1722 /**
1723  * @}
1724  */
1725 
1726 /**
1727  * Describes the kind of entity that a cursor refers to.
1728  */
1730  /* Declarations */
1731  /**
1732  * A declaration whose specific kind is not exposed via this
1733  * interface.
1734  *
1735  * Unexposed declarations have the same operations as any other kind
1736  * of declaration; one can extract their location information,
1737  * spelling, find their definitions, etc. However, the specific kind
1738  * of the declaration is not reported.
1739  */
1741  /** A C or C++ struct. */
1743  /** A C or C++ union. */
1745  /** A C++ class. */
1747  /** An enumeration. */
1749  /**
1750  * A field (in C) or non-static data member (in C++) in a
1751  * struct, union, or C++ class.
1752  */
1754  /** An enumerator constant. */
1756  /** A function. */
1758  /** A variable. */
1760  /** A function or method parameter. */
1762  /** An Objective-C \@interface. */
1764  /** An Objective-C \@interface for a category. */
1766  /** An Objective-C \@protocol declaration. */
1768  /** An Objective-C \@property declaration. */
1770  /** An Objective-C instance variable. */
1772  /** An Objective-C instance method. */
1774  /** An Objective-C class method. */
1776  /** An Objective-C \@implementation. */
1778  /** An Objective-C \@implementation for a category. */
1780  /** A typedef. */
1782  /** A C++ class method. */
1784  /** A C++ namespace. */
1786  /** A linkage specification, e.g. 'extern "C"'. */
1788  /** A C++ constructor. */
1790  /** A C++ destructor. */
1792  /** A C++ conversion function. */
1794  /** A C++ template type parameter. */
1796  /** A C++ non-type template parameter. */
1798  /** A C++ template template parameter. */
1800  /** A C++ function template. */
1802  /** A C++ class template. */
1804  /** A C++ class template partial specialization. */
1806  /** A C++ namespace alias declaration. */
1808  /** A C++ using directive. */
1810  /** A C++ using declaration. */
1812  /** A C++ alias declaration */
1814  /** An Objective-C \@synthesize definition. */
1816  /** An Objective-C \@dynamic definition. */
1818  /** An access specifier. */
1820 
1823 
1824  /* References */
1825  CXCursor_FirstRef = 40, /* Decl references */
1829  /**
1830  * A reference to a type declaration.
1831  *
1832  * A type reference occurs anywhere where a type is named but not
1833  * declared. For example, given:
1834  *
1835  * \code
1836  * typedef unsigned size_type;
1837  * size_type size;
1838  * \endcode
1839  *
1840  * The typedef is a declaration of size_type (CXCursor_TypedefDecl),
1841  * while the type of the variable "size" is referenced. The cursor
1842  * referenced by the type of size is the typedef for size_type.
1843  */
1846  /**
1847  * A reference to a class template, function template, template
1848  * template parameter, or class template partial specialization.
1849  */
1851  /**
1852  * A reference to a namespace or namespace alias.
1853  */
1855  /**
1856  * A reference to a member of a struct, union, or class that occurs in
1857  * some non-expression context, e.g., a designated initializer.
1858  */
1860  /**
1861  * A reference to a labeled statement.
1862  *
1863  * This cursor kind is used to describe the jump to "start_over" in the
1864  * goto statement in the following example:
1865  *
1866  * \code
1867  * start_over:
1868  * ++counter;
1869  *
1870  * goto start_over;
1871  * \endcode
1872  *
1873  * A label reference cursor refers to a label statement.
1874  */
1876 
1877  /**
1878  * A reference to a set of overloaded functions or function templates
1879  * that has not yet been resolved to a specific function or function template.
1880  *
1881  * An overloaded declaration reference cursor occurs in C++ templates where
1882  * a dependent name refers to a function. For example:
1883  *
1884  * \code
1885  * template<typename T> void swap(T&, T&);
1886  *
1887  * struct X { ... };
1888  * void swap(X&, X&);
1889  *
1890  * template<typename T>
1891  * void reverse(T* first, T* last) {
1892  * while (first < last - 1) {
1893  * swap(*first, *--last);
1894  * ++first;
1895  * }
1896  * }
1897  *
1898  * struct Y { };
1899  * void swap(Y&, Y&);
1900  * \endcode
1901  *
1902  * Here, the identifier "swap" is associated with an overloaded declaration
1903  * reference. In the template definition, "swap" refers to either of the two
1904  * "swap" functions declared above, so both results will be available. At
1905  * instantiation time, "swap" may also refer to other functions found via
1906  * argument-dependent lookup (e.g., the "swap" function at the end of the
1907  * example).
1908  *
1909  * The functions \c clang_getNumOverloadedDecls() and
1910  * \c clang_getOverloadedDecl() can be used to retrieve the definitions
1911  * referenced by this cursor.
1912  */
1914 
1915  /**
1916  * A reference to a variable that occurs in some non-expression
1917  * context, e.g., a C++ lambda capture list.
1918  */
1920 
1922 
1923  /* Error conditions */
1930 
1931  /* Expressions */
1933 
1934  /**
1935  * An expression whose specific kind is not exposed via this
1936  * interface.
1937  *
1938  * Unexposed expressions have the same operations as any other kind
1939  * of expression; one can extract their location information,
1940  * spelling, children, etc. However, the specific kind of the
1941  * expression is not reported.
1942  */
1944 
1945  /**
1946  * An expression that refers to some value declaration, such
1947  * as a function, variable, or enumerator.
1948  */
1950 
1951  /**
1952  * An expression that refers to a member of a struct, union,
1953  * class, Objective-C class, etc.
1954  */
1956 
1957  /** An expression that calls a function. */
1959 
1960  /** An expression that sends a message to an Objective-C
1961  object or class. */
1963 
1964  /** An expression that represents a block literal. */
1966 
1967  /** An integer literal.
1968  */
1970 
1971  /** A floating point number literal.
1972  */
1974 
1975  /** An imaginary number literal.
1976  */
1978 
1979  /** A string literal.
1980  */
1982 
1983  /** A character literal.
1984  */
1986 
1987  /** A parenthesized expression, e.g. "(1)".
1988  *
1989  * This AST node is only formed if full location information is requested.
1990  */
1992 
1993  /** This represents the unary-expression's (except sizeof and
1994  * alignof).
1995  */
1997 
1998  /** [C99 6.5.2.1] Array Subscripting.
1999  */
2001 
2002  /** A builtin binary operation expression such as "x + y" or
2003  * "x <= y".
2004  */
2006 
2007  /** Compound assignment such as "+=".
2008  */
2010 
2011  /** The ?: ternary operator.
2012  */
2014 
2015  /** An explicit cast in C (C99 6.5.4) or a C-style cast in C++
2016  * (C++ [expr.cast]), which uses the syntax (Type)expr.
2017  *
2018  * For example: (int)f.
2019  */
2021 
2022  /** [C99 6.5.2.5]
2023  */
2025 
2026  /** Describes an C or C++ initializer list.
2027  */
2029 
2030  /** The GNU address of label extension, representing &&label.
2031  */
2033 
2034  /** This is the GNU Statement Expression extension: ({int X=4; X;})
2035  */
2037 
2038  /** Represents a C11 generic selection.
2039  */
2041 
2042  /** Implements the GNU __null extension, which is a name for a null
2043  * pointer constant that has integral type (e.g., int or long) and is the same
2044  * size and alignment as a pointer.
2045  *
2046  * The __null extension is typically only used by system headers, which define
2047  * NULL as __null in C++ rather than using 0 (which is an integer that may not
2048  * match the size of a pointer).
2049  */
2051 
2052  /** C++'s static_cast<> expression.
2053  */
2055 
2056  /** C++'s dynamic_cast<> expression.
2057  */
2059 
2060  /** C++'s reinterpret_cast<> expression.
2061  */
2063 
2064  /** C++'s const_cast<> expression.
2065  */
2067 
2068  /** Represents an explicit C++ type conversion that uses "functional"
2069  * notion (C++ [expr.type.conv]).
2070  *
2071  * Example:
2072  * \code
2073  * x = int(0.5);
2074  * \endcode
2075  */
2077 
2078  /** A C++ typeid expression (C++ [expr.typeid]).
2079  */
2081 
2082  /** [C++ 2.13.5] C++ Boolean Literal.
2083  */
2085 
2086  /** [C++0x 2.14.7] C++ Pointer Literal.
2087  */
2089 
2090  /** Represents the "this" expression in C++
2091  */
2093 
2094  /** [C++ 15] C++ Throw Expression.
2095  *
2096  * This handles 'throw' and 'throw' assignment-expression. When
2097  * assignment-expression isn't present, Op will be null.
2098  */
2100 
2101  /** A new expression for memory allocation and constructor calls, e.g:
2102  * "new CXXNewExpr(foo)".
2103  */
2105 
2106  /** A delete expression for memory deallocation and destructor calls,
2107  * e.g. "delete[] pArray".
2108  */
2110 
2111  /** A unary expression. (noexcept, sizeof, or other traits)
2112  */
2114 
2115  /** An Objective-C string literal i.e. @"foo".
2116  */
2118 
2119  /** An Objective-C \@encode expression.
2120  */
2122 
2123  /** An Objective-C \@selector expression.
2124  */
2126 
2127  /** An Objective-C \@protocol expression.
2128  */
2130 
2131  /** An Objective-C "bridged" cast expression, which casts between
2132  * Objective-C pointers and C pointers, transferring ownership in the process.
2133  *
2134  * \code
2135  * NSString *str = (__bridge_transfer NSString *)CFCreateString();
2136  * \endcode
2137  */
2139 
2140  /** Represents a C++0x pack expansion that produces a sequence of
2141  * expressions.
2142  *
2143  * A pack expansion expression contains a pattern (which itself is an
2144  * expression) followed by an ellipsis. For example:
2145  *
2146  * \code
2147  * template<typename F, typename ...Types>
2148  * void forward(F f, Types &&...args) {
2149  * f(static_cast<Types&&>(args)...);
2150  * }
2151  * \endcode
2152  */
2154 
2155  /** Represents an expression that computes the length of a parameter
2156  * pack.
2157  *
2158  * \code
2159  * template<typename ...Types>
2160  * struct count {
2161  * static const unsigned value = sizeof...(Types);
2162  * };
2163  * \endcode
2164  */
2166 
2167  /* Represents a C++ lambda expression that produces a local function
2168  * object.
2169  *
2170  * \code
2171  * void abssort(float *x, unsigned N) {
2172  * std::sort(x, x + N,
2173  * [](float a, float b) {
2174  * return std::abs(a) < std::abs(b);
2175  * });
2176  * }
2177  * \endcode
2178  */
2180 
2181  /** Objective-c Boolean Literal.
2182  */
2184 
2185  /** Represents the "self" expression in an Objective-C method.
2186  */
2188 
2189  /** OpenMP 4.0 [2.4, Array Section].
2190  */
2192 
2193  /** Represents an @available(...) check.
2194  */
2196 
2197  /**
2198  * Fixed point literal
2199  */
2201 
2203 
2204  /* Statements */
2206  /**
2207  * A statement whose specific kind is not exposed via this
2208  * interface.
2209  *
2210  * Unexposed statements have the same operations as any other kind of
2211  * statement; one can extract their location information, spelling,
2212  * children, etc. However, the specific kind of the statement is not
2213  * reported.
2214  */
2216 
2217  /** A labelled statement in a function.
2218  *
2219  * This cursor kind is used to describe the "start_over:" label statement in
2220  * the following example:
2221  *
2222  * \code
2223  * start_over:
2224  * ++counter;
2225  * \endcode
2226  *
2227  */
2229 
2230  /** A group of statements like { stmt stmt }.
2231  *
2232  * This cursor kind is used to describe compound statements, e.g. function
2233  * bodies.
2234  */
2236 
2237  /** A case statement.
2238  */
2240 
2241  /** A default statement.
2242  */
2244 
2245  /** An if statement
2246  */
2248 
2249  /** A switch statement.
2250  */
2252 
2253  /** A while statement.
2254  */
2256 
2257  /** A do statement.
2258  */
2260 
2261  /** A for statement.
2262  */
2264 
2265  /** A goto statement.
2266  */
2268 
2269  /** An indirect goto statement.
2270  */
2272 
2273  /** A continue statement.
2274  */
2276 
2277  /** A break statement.
2278  */
2280 
2281  /** A return statement.
2282  */
2284 
2285  /** A GCC inline assembly statement extension.
2286  */
2289 
2290  /** Objective-C's overall \@try-\@catch-\@finally statement.
2291  */
2293 
2294  /** Objective-C's \@catch statement.
2295  */
2297 
2298  /** Objective-C's \@finally statement.
2299  */
2301 
2302  /** Objective-C's \@throw statement.
2303  */
2305 
2306  /** Objective-C's \@synchronized statement.
2307  */
2309 
2310  /** Objective-C's autorelease pool statement.
2311  */
2313 
2314  /** Objective-C's collection statement.
2315  */
2317 
2318  /** C++'s catch statement.
2319  */
2321 
2322  /** C++'s try statement.
2323  */
2325 
2326  /** C++'s for (* : *) statement.
2327  */
2329 
2330  /** Windows Structured Exception Handling's try statement.
2331  */
2333 
2334  /** Windows Structured Exception Handling's except statement.
2335  */
2337 
2338  /** Windows Structured Exception Handling's finally statement.
2339  */
2341 
2342  /** A MS inline assembly statement extension.
2343  */
2345 
2346  /** The null statement ";": C99 6.8.3p3.
2347  *
2348  * This cursor kind is used to describe the null statement.
2349  */
2351 
2352  /** Adaptor class for mixing declarations with statements and
2353  * expressions.
2354  */
2356 
2357  /** OpenMP parallel directive.
2358  */
2360 
2361  /** OpenMP SIMD directive.
2362  */
2364 
2365  /** OpenMP for directive.
2366  */
2368 
2369  /** OpenMP sections directive.
2370  */
2372 
2373  /** OpenMP section directive.
2374  */
2376 
2377  /** OpenMP single directive.
2378  */
2380 
2381  /** OpenMP parallel for directive.
2382  */
2384 
2385  /** OpenMP parallel sections directive.
2386  */
2388 
2389  /** OpenMP task directive.
2390  */
2392 
2393  /** OpenMP master directive.
2394  */
2396 
2397  /** OpenMP critical directive.
2398  */
2400 
2401  /** OpenMP taskyield directive.
2402  */
2404 
2405  /** OpenMP barrier directive.
2406  */
2408 
2409  /** OpenMP taskwait directive.
2410  */
2412 
2413  /** OpenMP flush directive.
2414  */
2416 
2417  /** Windows Structured Exception Handling's leave statement.
2418  */
2420 
2421  /** OpenMP ordered directive.
2422  */
2424 
2425  /** OpenMP atomic directive.
2426  */
2428 
2429  /** OpenMP for SIMD directive.
2430  */
2432 
2433  /** OpenMP parallel for SIMD directive.
2434  */
2436 
2437  /** OpenMP target directive.
2438  */
2440 
2441  /** OpenMP teams directive.
2442  */
2444 
2445  /** OpenMP taskgroup directive.
2446  */
2448 
2449  /** OpenMP cancellation point directive.
2450  */
2452 
2453  /** OpenMP cancel directive.
2454  */
2456 
2457  /** OpenMP target data directive.
2458  */
2460 
2461  /** OpenMP taskloop directive.
2462  */
2464 
2465  /** OpenMP taskloop simd directive.
2466  */
2468 
2469  /** OpenMP distribute directive.
2470  */
2472 
2473  /** OpenMP target enter data directive.
2474  */
2476 
2477  /** OpenMP target exit data directive.
2478  */
2480 
2481  /** OpenMP target parallel directive.
2482  */
2484 
2485  /** OpenMP target parallel for directive.
2486  */
2488 
2489  /** OpenMP target update directive.
2490  */
2492 
2493  /** OpenMP distribute parallel for directive.
2494  */
2496 
2497  /** OpenMP distribute parallel for simd directive.
2498  */
2500 
2501  /** OpenMP distribute simd directive.
2502  */
2504 
2505  /** OpenMP target parallel for simd directive.
2506  */
2508 
2509  /** OpenMP target simd directive.
2510  */
2512 
2513  /** OpenMP teams distribute directive.
2514  */
2516 
2517  /** OpenMP teams distribute simd directive.
2518  */
2520 
2521  /** OpenMP teams distribute parallel for simd directive.
2522  */
2524 
2525  /** OpenMP teams distribute parallel for directive.
2526  */
2528 
2529  /** OpenMP target teams directive.
2530  */
2532 
2533  /** OpenMP target teams distribute directive.
2534  */
2536 
2537  /** OpenMP target teams distribute parallel for directive.
2538  */
2540 
2541  /** OpenMP target teams distribute parallel for simd directive.
2542  */
2544 
2545  /** OpenMP target teams distribute simd directive.
2546  */
2548 
2550 
2551  /**
2552  * Cursor that represents the translation unit itself.
2553  *
2554  * The translation unit cursor exists primarily to act as the root
2555  * cursor for traversing the contents of a translation unit.
2556  */
2558 
2559  /* Attributes */
2561  /**
2562  * An attribute whose specific kind is not exposed via this
2563  * interface.
2564  */
2566 
2609 
2610  /* Preprocessing */
2618 
2619  /* Extra Declarations */
2620  /**
2621  * A module import declaration.
2622  */
2625  /**
2626  * A static_assert or _Static_assert node
2627  */
2629  /**
2630  * a friend declaration.
2631  */
2635 
2636  /**
2637  * A code completion overload candidate.
2638  */
2640 };
2641 
2642 /**
2643  * A cursor representing some element in the abstract syntax tree for
2644  * a translation unit.
2645  *
2646  * The cursor abstraction unifies the different kinds of entities in a
2647  * program--declaration, statements, expressions, references to declarations,
2648  * etc.--under a single "cursor" abstraction with a common set of operations.
2649  * Common operation for a cursor include: getting the physical location in
2650  * a source file where the cursor points, getting the name associated with a
2651  * cursor, and retrieving cursors for any child nodes of a particular cursor.
2652  *
2653  * Cursors can be produced in two specific ways.
2654  * clang_getTranslationUnitCursor() produces a cursor for a translation unit,
2655  * from which one can use clang_visitChildren() to explore the rest of the
2656  * translation unit. clang_getCursor() maps from a physical source location
2657  * to the entity that resides at that location, allowing one to map from the
2658  * source code into the AST.
2659  */
2660 typedef struct {
2662  int xdata;
2663  const void *data[3];
2664 } CXCursor;
2665 
2666 /**
2667  * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations
2668  *
2669  * @{
2670  */
2671 
2672 /**
2673  * Retrieve the NULL cursor, which represents no entity.
2674  */
2676 
2677 /**
2678  * Retrieve the cursor that represents the given translation unit.
2679  *
2680  * The translation unit cursor can be used to start traversing the
2681  * various declarations within the given translation unit.
2682  */
2684 
2685 /**
2686  * Determine whether two cursors are equivalent.
2687  */
2689 
2690 /**
2691  * Returns non-zero if \p cursor is null.
2692  */
2694 
2695 /**
2696  * Compute a hash value for the given cursor.
2697  */
2699 
2700 /**
2701  * Retrieve the kind of the given cursor.
2702  */
2704 
2705 /**
2706  * Determine whether the given cursor kind represents a declaration.
2707  */
2709 
2710 /**
2711  * Determine whether the given declaration is invalid.
2712  *
2713  * A declaration is invalid if it could not be parsed successfully.
2714  *
2715  * \returns non-zero if the cursor represents a declaration and it is
2716  * invalid, otherwise NULL.
2717  */
2719 
2720 /**
2721  * Determine whether the given cursor kind represents a simple
2722  * reference.
2723  *
2724  * Note that other kinds of cursors (such as expressions) can also refer to
2725  * other cursors. Use clang_getCursorReferenced() to determine whether a
2726  * particular cursor refers to another entity.
2727  */
2729 
2730 /**
2731  * Determine whether the given cursor kind represents an expression.
2732  */
2734 
2735 /**
2736  * Determine whether the given cursor kind represents a statement.
2737  */
2739 
2740 /**
2741  * Determine whether the given cursor kind represents an attribute.
2742  */
2744 
2745 /**
2746  * Determine whether the given cursor has any attributes.
2747  */
2749 
2750 /**
2751  * Determine whether the given cursor kind represents an invalid
2752  * cursor.
2753  */
2755 
2756 /**
2757  * Determine whether the given cursor kind represents a translation
2758  * unit.
2759  */
2761 
2762 /***
2763  * Determine whether the given cursor represents a preprocessing
2764  * element, such as a preprocessor directive or macro instantiation.
2765  */
2767 
2768 /***
2769  * Determine whether the given cursor represents a currently
2770  * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
2771  */
2773 
2774 /**
2775  * Describe the linkage of the entity referred to by a cursor.
2776  */
2778  /** This value indicates that no linkage information is available
2779  * for a provided CXCursor. */
2781  /**
2782  * This is the linkage for variables, parameters, and so on that
2783  * have automatic storage. This covers normal (non-extern) local variables.
2784  */
2786  /** This is the linkage for static variables and static functions. */
2788  /** This is the linkage for entities with external linkage that live
2789  * in C++ anonymous namespaces.*/
2791  /** This is the linkage for entities with true, external linkage. */
2793 };
2794 
2795 /**
2796  * Determine the linkage of the entity referred to by a given cursor.
2797  */
2799 
2801  /** This value indicates that no visibility information is available
2802  * for a provided CXCursor. */
2804 
2805  /** Symbol not seen by the linker. */
2807  /** Symbol seen by the linker but resolves to a symbol inside this object. */
2809  /** Symbol seen by the linker and acts like a normal symbol. */
2811 };
2812 
2813 /**
2814  * Describe the visibility of the entity referred to by a cursor.
2815  *
2816  * This returns the default visibility if not explicitly specified by
2817  * a visibility attribute. The default visibility may be changed by
2818  * commandline arguments.
2819  *
2820  * \param cursor The cursor to query.
2821  *
2822  * \returns The visibility of the cursor.
2823  */
2825 
2826 /**
2827  * Determine the availability of the entity that this cursor refers to,
2828  * taking the current target platform into account.
2829  *
2830  * \param cursor The cursor to query.
2831  *
2832  * \returns The availability of the cursor.
2833  */
2836 
2837 /**
2838  * Describes the availability of a given entity on a particular platform, e.g.,
2839  * a particular class might only be available on Mac OS 10.7 or newer.
2840  */
2841 typedef struct CXPlatformAvailability {
2842  /**
2843  * A string that describes the platform for which this structure
2844  * provides availability information.
2845  *
2846  * Possible values are "ios" or "macos".
2847  */
2849  /**
2850  * The version number in which this entity was introduced.
2851  */
2853  /**
2854  * The version number in which this entity was deprecated (but is
2855  * still available).
2856  */
2858  /**
2859  * The version number in which this entity was obsoleted, and therefore
2860  * is no longer available.
2861  */
2863  /**
2864  * Whether the entity is unconditionally unavailable on this platform.
2865  */
2867  /**
2868  * An optional message to provide to a user of this API, e.g., to
2869  * suggest replacement APIs.
2870  */
2873 
2874 /**
2875  * Determine the availability of the entity that this cursor refers to
2876  * on any platforms for which availability information is known.
2877  *
2878  * \param cursor The cursor to query.
2879  *
2880  * \param always_deprecated If non-NULL, will be set to indicate whether the
2881  * entity is deprecated on all platforms.
2882  *
2883  * \param deprecated_message If non-NULL, will be set to the message text
2884  * provided along with the unconditional deprecation of this entity. The client
2885  * is responsible for deallocating this string.
2886  *
2887  * \param always_unavailable If non-NULL, will be set to indicate whether the
2888  * entity is unavailable on all platforms.
2889  *
2890  * \param unavailable_message If non-NULL, will be set to the message text
2891  * provided along with the unconditional unavailability of this entity. The
2892  * client is responsible for deallocating this string.
2893  *
2894  * \param availability If non-NULL, an array of CXPlatformAvailability instances
2895  * that will be populated with platform availability information, up to either
2896  * the number of platforms for which availability information is available (as
2897  * returned by this function) or \c availability_size, whichever is smaller.
2898  *
2899  * \param availability_size The number of elements available in the
2900  * \c availability array.
2901  *
2902  * \returns The number of platforms (N) for which availability information is
2903  * available (which is unrelated to \c availability_size).
2904  *
2905  * Note that the client is responsible for calling
2906  * \c clang_disposeCXPlatformAvailability to free each of the
2907  * platform-availability structures returned. There are
2908  * \c min(N, availability_size) such structures.
2909  */
2910 CINDEX_LINKAGE int
2912  int *always_deprecated,
2913  CXString *deprecated_message,
2914  int *always_unavailable,
2915  CXString *unavailable_message,
2916  CXPlatformAvailability *availability,
2917  int availability_size);
2918 
2919 /**
2920  * Free the memory associated with a \c CXPlatformAvailability structure.
2921  */
2922 CINDEX_LINKAGE void
2924 
2925 /**
2926  * Describe the "language" of the entity referred to by a cursor.
2927  */
2933 };
2934 
2935 /**
2936  * Determine the "language" of the entity referred to by a given cursor.
2937  */
2939 
2940 /**
2941  * Describe the "thread-local storage (TLS) kind" of the declaration
2942  * referred to by a cursor.
2943  */
2948 };
2949 
2950 /**
2951  * Determine the "thread-local storage (TLS) kind" of the declaration
2952  * referred to by a cursor.
2953  */
2955 
2956 /**
2957  * Returns the translation unit that a cursor originated from.
2958  */
2960 
2961 /**
2962  * A fast container representing a set of CXCursors.
2963  */
2964 typedef struct CXCursorSetImpl *CXCursorSet;
2965 
2966 /**
2967  * Creates an empty CXCursorSet.
2968  */
2969 CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void);
2970 
2971 /**
2972  * Disposes a CXCursorSet and releases its associated memory.
2973  */
2974 CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset);
2975 
2976 /**
2977  * Queries a CXCursorSet to see if it contains a specific CXCursor.
2978  *
2979  * \returns non-zero if the set contains the specified cursor.
2980 */
2981 CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset,
2982  CXCursor cursor);
2983 
2984 /**
2985  * Inserts a CXCursor into a CXCursorSet.
2986  *
2987  * \returns zero if the CXCursor was already in the set, and non-zero otherwise.
2988 */
2989 CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,
2990  CXCursor cursor);
2991 
2992 /**
2993  * Determine the semantic parent of the given cursor.
2994  *
2995  * The semantic parent of a cursor is the cursor that semantically contains
2996  * the given \p cursor. For many declarations, the lexical and semantic parents
2997  * are equivalent (the lexical parent is returned by
2998  * \c clang_getCursorLexicalParent()). They diverge when declarations or
2999  * definitions are provided out-of-line. For example:
3000  *
3001  * \code
3002  * class C {
3003  * void f();
3004  * };
3005  *
3006  * void C::f() { }
3007  * \endcode
3008  *
3009  * In the out-of-line definition of \c C::f, the semantic parent is
3010  * the class \c C, of which this function is a member. The lexical parent is
3011  * the place where the declaration actually occurs in the source code; in this
3012  * case, the definition occurs in the translation unit. In general, the
3013  * lexical parent for a given entity can change without affecting the semantics
3014  * of the program, and the lexical parent of different declarations of the
3015  * same entity may be different. Changing the semantic parent of a declaration,
3016  * on the other hand, can have a major impact on semantics, and redeclarations
3017  * of a particular entity should all have the same semantic context.
3018  *
3019  * In the example above, both declarations of \c C::f have \c C as their
3020  * semantic context, while the lexical context of the first \c C::f is \c C
3021  * and the lexical context of the second \c C::f is the translation unit.
3022  *
3023  * For global declarations, the semantic parent is the translation unit.
3024  */
3026 
3027 /**
3028  * Determine the lexical parent of the given cursor.
3029  *
3030  * The lexical parent of a cursor is the cursor in which the given \p cursor
3031  * was actually written. For many declarations, the lexical and semantic parents
3032  * are equivalent (the semantic parent is returned by
3033  * \c clang_getCursorSemanticParent()). They diverge when declarations or
3034  * definitions are provided out-of-line. For example:
3035  *
3036  * \code
3037  * class C {
3038  * void f();
3039  * };
3040  *
3041  * void C::f() { }
3042  * \endcode
3043  *
3044  * In the out-of-line definition of \c C::f, the semantic parent is
3045  * the class \c C, of which this function is a member. The lexical parent is
3046  * the place where the declaration actually occurs in the source code; in this
3047  * case, the definition occurs in the translation unit. In general, the
3048  * lexical parent for a given entity can change without affecting the semantics
3049  * of the program, and the lexical parent of different declarations of the
3050  * same entity may be different. Changing the semantic parent of a declaration,
3051  * on the other hand, can have a major impact on semantics, and redeclarations
3052  * of a particular entity should all have the same semantic context.
3053  *
3054  * In the example above, both declarations of \c C::f have \c C as their
3055  * semantic context, while the lexical context of the first \c C::f is \c C
3056  * and the lexical context of the second \c C::f is the translation unit.
3057  *
3058  * For declarations written in the global scope, the lexical parent is
3059  * the translation unit.
3060  */
3062 
3063 /**
3064  * Determine the set of methods that are overridden by the given
3065  * method.
3066  *
3067  * In both Objective-C and C++, a method (aka virtual member function,
3068  * in C++) can override a virtual method in a base class. For
3069  * Objective-C, a method is said to override any method in the class's
3070  * base class, its protocols, or its categories' protocols, that has the same
3071  * selector and is of the same kind (class or instance).
3072  * If no such method exists, the search continues to the class's superclass,
3073  * its protocols, and its categories, and so on. A method from an Objective-C
3074  * implementation is considered to override the same methods as its
3075  * corresponding method in the interface.
3076  *
3077  * For C++, a virtual member function overrides any virtual member
3078  * function with the same signature that occurs in its base
3079  * classes. With multiple inheritance, a virtual member function can
3080  * override several virtual member functions coming from different
3081  * base classes.
3082  *
3083  * In all cases, this function determines the immediate overridden
3084  * method, rather than all of the overridden methods. For example, if
3085  * a method is originally declared in a class A, then overridden in B
3086  * (which in inherits from A) and also in C (which inherited from B),
3087  * then the only overridden method returned from this function when
3088  * invoked on C's method will be B's method. The client may then
3089  * invoke this function again, given the previously-found overridden
3090  * methods, to map out the complete method-override set.
3091  *
3092  * \param cursor A cursor representing an Objective-C or C++
3093  * method. This routine will compute the set of methods that this
3094  * method overrides.
3095  *
3096  * \param overridden A pointer whose pointee will be replaced with a
3097  * pointer to an array of cursors, representing the set of overridden
3098  * methods. If there are no overridden methods, the pointee will be
3099  * set to NULL. The pointee must be freed via a call to
3100  * \c clang_disposeOverriddenCursors().
3101  *
3102  * \param num_overridden A pointer to the number of overridden
3103  * functions, will be set to the number of overridden functions in the
3104  * array pointed to by \p overridden.
3105  */
3107  CXCursor **overridden,
3108  unsigned *num_overridden);
3109 
3110 /**
3111  * Free the set of overridden cursors returned by \c
3112  * clang_getOverriddenCursors().
3113  */
3115 
3116 /**
3117  * Retrieve the file that is included by the given inclusion directive
3118  * cursor.
3119  */
3121 
3122 /**
3123  * @}
3124  */
3125 
3126 /**
3127  * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code
3128  *
3129  * Cursors represent a location within the Abstract Syntax Tree (AST). These
3130  * routines help map between cursors and the physical locations where the
3131  * described entities occur in the source code. The mapping is provided in
3132  * both directions, so one can map from source code to the AST and back.
3133  *
3134  * @{
3135  */
3136 
3137 /**
3138  * Map a source location to the cursor that describes the entity at that
3139  * location in the source code.
3140  *
3141  * clang_getCursor() maps an arbitrary source location within a translation
3142  * unit down to the most specific cursor that describes the entity at that
3143  * location. For example, given an expression \c x + y, invoking
3144  * clang_getCursor() with a source location pointing to "x" will return the
3145  * cursor for "x"; similarly for "y". If the cursor points anywhere between
3146  * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
3147  * will return a cursor referring to the "+" expression.
3148  *
3149  * \returns a cursor representing the entity at the given source location, or
3150  * a NULL cursor if no such entity can be found.
3151  */
3153 
3154 /**
3155  * Retrieve the physical location of the source constructor referenced
3156  * by the given cursor.
3157  *
3158  * The location of a declaration is typically the location of the name of that
3159  * declaration, where the name of that declaration would occur if it is
3160  * unnamed, or some keyword that introduces that particular declaration.
3161  * The location of a reference is where that reference occurs within the
3162  * source code.
3163  */
3165 
3166 /**
3167  * Retrieve the physical extent of the source construct referenced by
3168  * the given cursor.
3169  *
3170  * The extent of a cursor starts with the file/line/column pointing at the
3171  * first character within the source construct that the cursor refers to and
3172  * ends with the last character within that source construct. For a
3173  * declaration, the extent covers the declaration itself. For a reference,
3174  * the extent covers the location of the reference (e.g., where the referenced
3175  * entity was actually used).
3176  */
3178 
3179 /**
3180  * @}
3181  */
3182 
3183 /**
3184  * \defgroup CINDEX_TYPES Type information for CXCursors
3185  *
3186  * @{
3187  */
3188 
3189 /**
3190  * Describes the kind of type
3191  */
3193  /**
3194  * Represents an invalid type (e.g., where no type is available).
3195  */
3197 
3198  /**
3199  * A type whose specific kind is not exposed via this
3200  * interface.
3201  */
3203 
3204  /* Builtin types */
3244 
3264 
3265  /**
3266  * Represents a type that was referred to using an elaborated type keyword.
3267  *
3268  * E.g., struct S, or via a qualified name, e.g., N::M::type, or both.
3269  */
3271 
3272  /* OpenCL PipeType. */
3274 
3275  /* OpenCL builtin types. */
3316 
3320 
3332 
3334 
3336 };
3337 
3338 /**
3339  * Describes the calling convention of a function type
3340  */
3353  /* Alias for compatibility with older versions of API. */
3361 
3364 };
3365 
3366 /**
3367  * The type of an element in the abstract syntax tree.
3368  *
3369  */
3370 typedef struct {
3372  void *data[2];
3373 } CXType;
3374 
3375 /**
3376  * Retrieve the type of a CXCursor (if any).
3377  */
3379 
3380 /**
3381  * Pretty-print the underlying type using the rules of the
3382  * language of the translation unit from which it came.
3383  *
3384  * If the type is invalid, an empty string is returned.
3385  */
3387 
3388 /**
3389  * Retrieve the underlying type of a typedef declaration.
3390  *
3391  * If the cursor does not reference a typedef declaration, an invalid type is
3392  * returned.
3393  */
3395 
3396 /**
3397  * Retrieve the integer type of an enum declaration.
3398  *
3399  * If the cursor does not reference an enum declaration, an invalid type is
3400  * returned.
3401  */
3403 
3404 /**
3405  * Retrieve the integer value of an enum constant declaration as a signed
3406  * long long.
3407  *
3408  * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned.
3409  * Since this is also potentially a valid constant value, the kind of the cursor
3410  * must be verified before calling this function.
3411  */
3413 
3414 /**
3415  * Retrieve the integer value of an enum constant declaration as an unsigned
3416  * long long.
3417  *
3418  * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned.
3419  * Since this is also potentially a valid constant value, the kind of the cursor
3420  * must be verified before calling this function.
3421  */
3423 
3424 /**
3425  * Retrieve the bit width of a bit field declaration as an integer.
3426  *
3427  * If a cursor that is not a bit field declaration is passed in, -1 is returned.
3428  */
3430 
3431 /**
3432  * Retrieve the number of non-variadic arguments associated with a given
3433  * cursor.
3434  *
3435  * The number of arguments can be determined for calls as well as for
3436  * declarations of functions or methods. For other cursors -1 is returned.
3437  */
3439 
3440 /**
3441  * Retrieve the argument cursor of a function or method.
3442  *
3443  * The argument cursor can be determined for calls as well as for declarations
3444  * of functions or methods. For other cursors and for invalid indices, an
3445  * invalid cursor is returned.
3446  */
3448 
3449 /**
3450  * Describes the kind of a template argument.
3451  *
3452  * See the definition of llvm::clang::TemplateArgument::ArgKind for full
3453  * element descriptions.
3454  */
3465  /* Indicates an error case, preventing the kind from being deduced. */
3467 };
3468 
3469 /**
3470  *Returns the number of template args of a function decl representing a
3471  * template specialization.
3472  *
3473  * If the argument cursor cannot be converted into a template function
3474  * declaration, -1 is returned.
3475  *
3476  * For example, for the following declaration and specialization:
3477  * template <typename T, int kInt, bool kBool>
3478  * void foo() { ... }
3479  *
3480  * template <>
3481  * void foo<float, -7, true>();
3482  *
3483  * The value 3 would be returned from this call.
3484  */
3486 
3487 /**
3488  * Retrieve the kind of the I'th template argument of the CXCursor C.
3489  *
3490  * If the argument CXCursor does not represent a FunctionDecl, an invalid
3491  * template argument kind is returned.
3492  *
3493  * For example, for the following declaration and specialization:
3494  * template <typename T, int kInt, bool kBool>
3495  * void foo() { ... }
3496  *
3497  * template <>
3498  * void foo<float, -7, true>();
3499  *
3500  * For I = 0, 1, and 2, Type, Integral, and Integral will be returned,
3501  * respectively.
3502  */
3504  CXCursor C, unsigned I);
3505 
3506 /**
3507  * Retrieve a CXType representing the type of a TemplateArgument of a
3508  * function decl representing a template specialization.
3509  *
3510  * If the argument CXCursor does not represent a FunctionDecl whose I'th
3511  * template argument has a kind of CXTemplateArgKind_Integral, an invalid type
3512  * is returned.
3513  *
3514  * For example, for the following declaration and specialization:
3515  * template <typename T, int kInt, bool kBool>
3516  * void foo() { ... }
3517  *
3518  * template <>
3519  * void foo<float, -7, true>();
3520  *
3521  * If called with I = 0, "float", will be returned.
3522  * Invalid types will be returned for I == 1 or 2.
3523  */
3525  unsigned I);
3526 
3527 /**
3528  * Retrieve the value of an Integral TemplateArgument (of a function
3529  * decl representing a template specialization) as a signed long long.
3530  *
3531  * It is undefined to call this function on a CXCursor that does not represent a
3532  * FunctionDecl or whose I'th template argument is not an integral value.
3533  *
3534  * For example, for the following declaration and specialization:
3535  * template <typename T, int kInt, bool kBool>
3536  * void foo() { ... }
3537  *
3538  * template <>
3539  * void foo<float, -7, true>();
3540  *
3541  * If called with I = 1 or 2, -7 or true will be returned, respectively.
3542  * For I == 0, this function's behavior is undefined.
3543  */
3545  unsigned I);
3546 
3547 /**
3548  * Retrieve the value of an Integral TemplateArgument (of a function
3549  * decl representing a template specialization) as an unsigned long long.
3550  *
3551  * It is undefined to call this function on a CXCursor that does not represent a
3552  * FunctionDecl or whose I'th template argument is not an integral value.
3553  *
3554  * For example, for the following declaration and specialization:
3555  * template <typename T, int kInt, bool kBool>
3556  * void foo() { ... }
3557  *
3558  * template <>
3559  * void foo<float, 2147483649, true>();
3560  *
3561  * If called with I = 1 or 2, 2147483649 or true will be returned, respectively.
3562  * For I == 0, this function's behavior is undefined.
3563  */
3565  CXCursor C, unsigned I);
3566 
3567 /**
3568  * Determine whether two CXTypes represent the same type.
3569  *
3570  * \returns non-zero if the CXTypes represent the same type and
3571  * zero otherwise.
3572  */
3574 
3575 /**
3576  * Return the canonical type for a CXType.
3577  *
3578  * Clang's type system explicitly models typedefs and all the ways
3579  * a specific type can be represented. The canonical type is the underlying
3580  * type with all the "sugar" removed. For example, if 'T' is a typedef
3581  * for 'int', the canonical type for 'T' would be 'int'.
3582  */
3584 
3585 /**
3586  * Determine whether a CXType has the "const" qualifier set,
3587  * without looking through typedefs that may have added "const" at a
3588  * different level.
3589  */
3591 
3592 /**
3593  * Determine whether a CXCursor that is a macro, is
3594  * function like.
3595  */
3597 
3598 /**
3599  * Determine whether a CXCursor that is a macro, is a
3600  * builtin one.
3601  */
3603 
3604 /**
3605  * Determine whether a CXCursor that is a function declaration, is an
3606  * inline declaration.
3607  */
3609 
3610 /**
3611  * Determine whether a CXType has the "volatile" qualifier set,
3612  * without looking through typedefs that may have added "volatile" at
3613  * a different level.
3614  */
3616 
3617 /**
3618  * Determine whether a CXType has the "restrict" qualifier set,
3619  * without looking through typedefs that may have added "restrict" at a
3620  * different level.
3621  */
3623 
3624 /**
3625  * Returns the address space of the given type.
3626  */
3628 
3629 /**
3630  * Returns the typedef name of the given type.
3631  */
3633 
3634 /**
3635  * For pointer types, returns the type of the pointee.
3636  */
3638 
3639 /**
3640  * Return the cursor for the declaration of the given type.
3641  */
3643 
3644 /**
3645  * Returns the Objective-C type encoding for the specified declaration.
3646  */
3648 
3649 /**
3650  * Returns the Objective-C type encoding for the specified CXType.
3651  */
3653 
3654 /**
3655  * Retrieve the spelling of a given CXTypeKind.
3656  */
3658 
3659 /**
3660  * Retrieve the calling convention associated with a function type.
3661  *
3662  * If a non-function type is passed in, CXCallingConv_Invalid is returned.
3663  */
3665 
3666 /**
3667  * Retrieve the return type associated with a function type.
3668  *
3669  * If a non-function type is passed in, an invalid type is returned.
3670  */
3672 
3673 /**
3674  * Retrieve the exception specification type associated with a function type.
3675  * This is a value of type CXCursor_ExceptionSpecificationKind.
3676  *
3677  * If a non-function type is passed in, an error code of -1 is returned.
3678  */
3680 
3681 /**
3682  * Retrieve the number of non-variadic parameters associated with a
3683  * function type.
3684  *
3685  * If a non-function type is passed in, -1 is returned.
3686  */
3688 
3689 /**
3690  * Retrieve the type of a parameter of a function type.
3691  *
3692  * If a non-function type is passed in or the function does not have enough
3693  * parameters, an invalid type is returned.
3694  */
3696 
3697 /**
3698  * Retrieves the base type of the ObjCObjectType.
3699  *
3700  * If the type is not an ObjC object, an invalid type is returned.
3701  */
3703 
3704 /**
3705  * Retrieve the number of protocol references associated with an ObjC object/id.
3706  *
3707  * If the type is not an ObjC object, 0 is returned.
3708  */
3710 
3711 /**
3712  * Retrieve the decl for a protocol reference for an ObjC object/id.
3713  *
3714  * If the type is not an ObjC object or there are not enough protocol
3715  * references, an invalid cursor is returned.
3716  */
3718 
3719 /**
3720  * Retreive the number of type arguments associated with an ObjC object.
3721  *
3722  * If the type is not an ObjC object, 0 is returned.
3723  */
3725 
3726 /**
3727  * Retrieve a type argument associated with an ObjC object.
3728  *
3729  * If the type is not an ObjC or the index is not valid,
3730  * an invalid type is returned.
3731  */
3733 
3734 /**
3735  * Return 1 if the CXType is a variadic function type, and 0 otherwise.
3736  */
3738 
3739 /**
3740  * Retrieve the return type associated with a given cursor.
3741  *
3742  * This only returns a valid type if the cursor refers to a function or method.
3743  */
3745 
3746 /**
3747  * Retrieve the exception specification type associated with a given cursor.
3748  * This is a value of type CXCursor_ExceptionSpecificationKind.
3749  *
3750  * This only returns a valid result if the cursor refers to a function or method.
3751  */
3753 
3754 /**
3755  * Return 1 if the CXType is a POD (plain old data) type, and 0
3756  * otherwise.
3757  */
3759 
3760 /**
3761  * Return the element type of an array, complex, or vector type.
3762  *
3763  * If a type is passed in that is not an array, complex, or vector type,
3764  * an invalid type is returned.
3765  */
3767 
3768 /**
3769  * Return the number of elements of an array or vector type.
3770  *
3771  * If a type is passed in that is not an array or vector type,
3772  * -1 is returned.
3773  */
3775 
3776 /**
3777  * Return the element type of an array type.
3778  *
3779  * If a non-array type is passed in, an invalid type is returned.
3780  */
3782 
3783 /**
3784  * Return the array size of a constant array.
3785  *
3786  * If a non-array type is passed in, -1 is returned.
3787  */
3789 
3790 /**
3791  * Retrieve the type named by the qualified-id.
3792  *
3793  * If a non-elaborated type is passed in, an invalid type is returned.
3794  */
3796 
3797 /**
3798  * Determine if a typedef is 'transparent' tag.
3799  *
3800  * A typedef is considered 'transparent' if it shares a name and spelling
3801  * location with its underlying tag type, as is the case with the NS_ENUM macro.
3802  *
3803  * \returns non-zero if transparent and zero otherwise.
3804  */
3806 
3808  /**
3809  * Values of this type can never be null.
3810  */
3812  /**
3813  * Values of this type can be null.
3814  */
3816  /**
3817  * Whether values of this type can be null is (explicitly)
3818  * unspecified. This captures a (fairly rare) case where we
3819  * can't conclude anything about the nullability of the type even
3820  * though it has been considered.
3821  */
3823  /**
3824  * Nullability is not applicable to this type.
3825  */
3827 };
3828 
3829 /**
3830  * Retrieve the nullability kind of a pointer type.
3831  */
3833 
3834 /**
3835  * List the possible error codes for \c clang_Type_getSizeOf,
3836  * \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
3837  * \c clang_Cursor_getOffsetOf.
3838  *
3839  * A value of this enumeration type can be returned if the target type is not
3840  * a valid argument to sizeof, alignof or offsetof.
3841  */
3843  /**
3844  * Type is of kind CXType_Invalid.
3845  */
3847  /**
3848  * The type is an incomplete Type.
3849  */
3851  /**
3852  * The type is a dependent Type.
3853  */
3855  /**
3856  * The type is not a constant size type.
3857  */
3859  /**
3860  * The Field name is not valid for this record.
3861  */
3863  /**
3864  * The type is undeduced.
3865  */
3867 };
3868 
3869 /**
3870  * Return the alignment of a type in bytes as per C++[expr.alignof]
3871  * standard.
3872  *
3873  * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
3874  * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
3875  * is returned.
3876  * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
3877  * returned.
3878  * If the type declaration is not a constant size type,
3879  * CXTypeLayoutError_NotConstantSize is returned.
3880  */
3882 
3883 /**
3884  * Return the class type of an member pointer type.
3885  *
3886  * If a non-member-pointer type is passed in, an invalid type is returned.
3887  */
3889 
3890 /**
3891  * Return the size of a type in bytes as per C++[expr.sizeof] standard.
3892  *
3893  * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
3894  * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
3895  * is returned.
3896  * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
3897  * returned.
3898  */
3900 
3901 /**
3902  * Return the offset of a field named S in a record of type T in bits
3903  * as it would be returned by __offsetof__ as per C++11[18.2p4]
3904  *
3905  * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid
3906  * is returned.
3907  * If the field's type declaration is an incomplete type,
3908  * CXTypeLayoutError_Incomplete is returned.
3909  * If the field's type declaration is a dependent type,
3910  * CXTypeLayoutError_Dependent is returned.
3911  * If the field's name S is not found,
3912  * CXTypeLayoutError_InvalidFieldName is returned.
3913  */
3914 CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S);
3915 
3916 /**
3917  * Return the type that was modified by this attributed type.
3918  *
3919  * If the type is not an attributed type, an invalid type is returned.
3920  */
3922 
3923 /**
3924  * Return the offset of the field represented by the Cursor.
3925  *
3926  * If the cursor is not a field declaration, -1 is returned.
3927  * If the cursor semantic parent is not a record field declaration,
3928  * CXTypeLayoutError_Invalid is returned.
3929  * If the field's type declaration is an incomplete type,
3930  * CXTypeLayoutError_Incomplete is returned.
3931  * If the field's type declaration is a dependent type,
3932  * CXTypeLayoutError_Dependent is returned.
3933  * If the field's name S is not found,
3934  * CXTypeLayoutError_InvalidFieldName is returned.
3935  */
3937 
3938 /**
3939  * Determine whether the given cursor represents an anonymous
3940  * tag or namespace
3941  */
3943 
3944 /**
3945  * Determine whether the given cursor represents an anonymous record
3946  * declaration.
3947  */
3949 
3950 /**
3951  * Determine whether the given cursor represents an inline namespace
3952  * declaration.
3953  */
3955 
3957  /** No ref-qualifier was provided. */
3959  /** An lvalue ref-qualifier was provided (\c &). */
3961  /** An rvalue ref-qualifier was provided (\c &&). */
3963 };
3964 
3965 /**
3966  * Returns the number of template arguments for given template
3967  * specialization, or -1 if type \c T is not a template specialization.
3968  */
3970 
3971 /**
3972  * Returns the type template argument of a template class specialization
3973  * at given index.
3974  *
3975  * This function only returns template type arguments and does not handle
3976  * template template arguments or variadic packs.
3977  */
3979 
3980 /**
3981  * Retrieve the ref-qualifier kind of a function or method.
3982  *
3983  * The ref-qualifier is returned for C++ functions or methods. For other types
3984  * or non-C++ declarations, CXRefQualifier_None is returned.
3985  */
3987 
3988 /**
3989  * Returns non-zero if the cursor specifies a Record member that is a
3990  * bitfield.
3991  */
3993 
3994 /**
3995  * Returns 1 if the base class specified by the cursor with kind
3996  * CX_CXXBaseSpecifier is virtual.
3997  */
3999 
4000 /**
4001  * Represents the C++ access control level to a base class for a
4002  * cursor with kind CX_CXXBaseSpecifier.
4003  */
4009 };
4010 
4011 /**
4012  * Returns the access control level for the referenced object.
4013  *
4014  * If the cursor refers to a C++ declaration, its access control level within its
4015  * parent scope is returned. Otherwise, if the cursor refers to a base specifier or
4016  * access specifier, the specifier itself is returned.
4017  */
4019 
4020 /**
4021  * Represents the storage classes as declared in the source. CX_SC_Invalid
4022  * was added for the case that the passed cursor in not a declaration.
4023  */
4033 };
4034 
4035 /**
4036  * Returns the storage class for a function or variable declaration.
4037  *
4038  * If the passed in Cursor is not a function or variable declaration,
4039  * CX_SC_Invalid is returned else the storage class.
4040  */
4042 
4043 /**
4044  * Determine the number of overloaded declarations referenced by a
4045  * \c CXCursor_OverloadedDeclRef cursor.
4046  *
4047  * \param cursor The cursor whose overloaded declarations are being queried.
4048  *
4049  * \returns The number of overloaded declarations referenced by \c cursor. If it
4050  * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
4051  */
4053 
4054 /**
4055  * Retrieve a cursor for one of the overloaded declarations referenced
4056  * by a \c CXCursor_OverloadedDeclRef cursor.
4057  *
4058  * \param cursor The cursor whose overloaded declarations are being queried.
4059  *
4060  * \param index The zero-based index into the set of overloaded declarations in
4061  * the cursor.
4062  *
4063  * \returns A cursor representing the declaration referenced by the given
4064  * \c cursor at the specified \c index. If the cursor does not have an
4065  * associated set of overloaded declarations, or if the index is out of bounds,
4066  * returns \c clang_getNullCursor();
4067  */
4069  unsigned index);
4070 
4071 /**
4072  * @}
4073  */
4074 
4075 /**
4076  * \defgroup CINDEX_ATTRIBUTES Information for attributes
4077  *
4078  * @{
4079  */
4080 
4081 /**
4082  * For cursors representing an iboutletcollection attribute,
4083  * this function returns the collection element type.
4084  *
4085  */
4087 
4088 /**
4089  * @}
4090  */
4091 
4092 /**
4093  * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors
4094  *
4095  * These routines provide the ability to traverse the abstract syntax tree
4096  * using cursors.
4097  *
4098  * @{
4099  */
4100 
4101 /**
4102  * Describes how the traversal of the children of a particular
4103  * cursor should proceed after visiting a particular child cursor.
4104  *
4105  * A value of this enumeration type should be returned by each
4106  * \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
4107  */
4109  /**
4110  * Terminates the cursor traversal.
4111  */
4113  /**
4114  * Continues the cursor traversal with the next sibling of
4115  * the cursor just visited, without visiting its children.
4116  */
4118  /**
4119  * Recursively traverse the children of this cursor, using
4120  * the same visitor and client data.
4121  */
4123 };
4124 
4125 /**
4126  * Visitor invoked for each cursor found by a traversal.
4127  *
4128  * This visitor function will be invoked for each cursor found by
4129  * clang_visitCursorChildren(). Its first argument is the cursor being
4130  * visited, its second argument is the parent visitor for that cursor,
4131  * and its third argument is the client data provided to
4132  * clang_visitCursorChildren().
4133  *
4134  * The visitor should return one of the \c CXChildVisitResult values
4135  * to direct clang_visitCursorChildren().
4136  */
4138  CXCursor parent,
4139  CXClientData client_data);
4140 
4141 /**
4142  * Visit the children of a particular cursor.
4143  *
4144  * This function visits all the direct children of the given cursor,
4145  * invoking the given \p visitor function with the cursors of each
4146  * visited child. The traversal may be recursive, if the visitor returns
4147  * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
4148  * the visitor returns \c CXChildVisit_Break.
4149  *
4150  * \param parent the cursor whose child may be visited. All kinds of
4151  * cursors can be visited, including invalid cursors (which, by
4152  * definition, have no children).
4153  *
4154  * \param visitor the visitor function that will be invoked for each
4155  * child of \p parent.
4156  *
4157  * \param client_data pointer data supplied by the client, which will
4158  * be passed to the visitor each time it is invoked.
4159  *
4160  * \returns a non-zero value if the traversal was terminated
4161  * prematurely by the visitor returning \c CXChildVisit_Break.
4162  */
4164  CXCursorVisitor visitor,
4165  CXClientData client_data);
4166 #ifdef __has_feature
4167 # if __has_feature(blocks)
4168 /**
4169  * Visitor invoked for each cursor found by a traversal.
4170  *
4171  * This visitor block will be invoked for each cursor found by
4172  * clang_visitChildrenWithBlock(). Its first argument is the cursor being
4173  * visited, its second argument is the parent visitor for that cursor.
4174  *
4175  * The visitor should return one of the \c CXChildVisitResult values
4176  * to direct clang_visitChildrenWithBlock().
4177  */
4178 typedef enum CXChildVisitResult
4179  (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent);
4180 
4181 /**
4182  * Visits the children of a cursor using the specified block. Behaves
4183  * identically to clang_visitChildren() in all other respects.
4184  */
4185 CINDEX_LINKAGE unsigned clang_visitChildrenWithBlock(CXCursor parent,
4186  CXCursorVisitorBlock block);
4187 # endif
4188 #endif
4189 
4190 /**
4191  * @}
4192  */
4193 
4194 /**
4195  * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST
4196  *
4197  * These routines provide the ability to determine references within and
4198  * across translation units, by providing the names of the entities referenced
4199  * by cursors, follow reference cursors to the declarations they reference,
4200  * and associate declarations with their definitions.
4201  *
4202  * @{
4203  */
4204 
4205 /**
4206  * Retrieve a Unified Symbol Resolution (USR) for the entity referenced
4207  * by the given cursor.
4208  *
4209  * A Unified Symbol Resolution (USR) is a string that identifies a particular
4210  * entity (function, class, variable, etc.) within a program. USRs can be
4211  * compared across translation units to determine, e.g., when references in
4212  * one translation refer to an entity defined in another translation unit.
4213  */
4215 
4216 /**
4217  * Construct a USR for a specified Objective-C class.
4218  */
4219 CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);
4220 
4221 /**
4222  * Construct a USR for a specified Objective-C category.
4223  */
4225  clang_constructUSR_ObjCCategory(const char *class_name,
4226  const char *category_name);
4227 
4228 /**
4229  * Construct a USR for a specified Objective-C protocol.
4230  */
4232  clang_constructUSR_ObjCProtocol(const char *protocol_name);
4233 
4234 /**
4235  * Construct a USR for a specified Objective-C instance variable and
4236  * the USR for its containing class.
4237  */
4239  CXString classUSR);
4240 
4241 /**
4242  * Construct a USR for a specified Objective-C method and
4243  * the USR for its containing class.
4244  */
4246  unsigned isInstanceMethod,
4247  CXString classUSR);
4248 
4249 /**
4250  * Construct a USR for a specified Objective-C property and the USR
4251  * for its containing class.
4252  */
4254  CXString classUSR);
4255 
4256 /**
4257  * Retrieve a name for the entity referenced by this cursor.
4258  */
4260 
4261 /**
4262  * Retrieve a range for a piece that forms the cursors spelling name.
4263  * Most of the times there is only one range for the complete spelling but for
4264  * Objective-C methods and Objective-C message expressions, there are multiple
4265  * pieces for each selector identifier.
4266  *
4267  * \param pieceIndex the index of the spelling name piece. If this is greater
4268  * than the actual number of pieces, it will return a NULL (invalid) range.
4269  *
4270  * \param options Reserved.
4271  */
4273  unsigned pieceIndex,
4274  unsigned options);
4275 
4276 /**
4277  * Opaque pointer representing a policy that controls pretty printing
4278  * for \c clang_getCursorPrettyPrinted.
4279  */
4280 typedef void *CXPrintingPolicy;
4281 
4282 /**
4283  * Properties for the printing policy.
4284  *
4285  * See \c clang::PrintingPolicy for more information.
4286  */
4314 
4316 };
4317 
4318 /**
4319  * Get a property value for the given printing policy.
4320  */
4321 CINDEX_LINKAGE unsigned
4322 clang_PrintingPolicy_getProperty(CXPrintingPolicy Policy,
4323  enum CXPrintingPolicyProperty Property);
4324 
4325 /**
4326  * Set a property value for the given printing policy.
4327  */
4328 CINDEX_LINKAGE void clang_PrintingPolicy_setProperty(CXPrintingPolicy Policy,
4329  enum CXPrintingPolicyProperty Property,
4330  unsigned Value);
4331 
4332 /**
4333  * Retrieve the default policy for the cursor.
4334  *
4335  * The policy should be released after use with \c
4336  * clang_PrintingPolicy_dispose.
4337  */
4339 
4340 /**
4341  * Release a printing policy.
4342  */
4343 CINDEX_LINKAGE void clang_PrintingPolicy_dispose(CXPrintingPolicy Policy);
4344 
4345 /**
4346  * Pretty print declarations.
4347  *
4348  * \param Cursor The cursor representing a declaration.
4349  *
4350  * \param Policy The policy to control the entities being printed. If
4351  * NULL, a default policy is used.
4352  *
4353  * \returns The pretty printed declaration or the empty string for
4354  * other cursors.
4355  */
4357  CXPrintingPolicy Policy);
4358 
4359 /**
4360  * Retrieve the display name for the entity referenced by this cursor.
4361  *
4362  * The display name contains extra information that helps identify the cursor,
4363  * such as the parameters of a function or template or the arguments of a
4364  * class template specialization.
4365  */
4367 
4368 /** For a cursor that is a reference, retrieve a cursor representing the
4369  * entity that it references.
4370  *
4371  * Reference cursors refer to other entities in the AST. For example, an
4372  * Objective-C superclass reference cursor refers to an Objective-C class.
4373  * This function produces the cursor for the Objective-C class from the
4374  * cursor for the superclass reference. If the input cursor is a declaration or
4375  * definition, it returns that declaration or definition unchanged.
4376  * Otherwise, returns the NULL cursor.
4377  */
4379 
4380 /**
4381  * For a cursor that is either a reference to or a declaration
4382  * of some entity, retrieve a cursor that describes the definition of
4383  * that entity.
4384  *
4385  * Some entities can be declared multiple times within a translation
4386  * unit, but only one of those declarations can also be a
4387  * definition. For example, given:
4388  *
4389  * \code
4390  * int f(int, int);
4391  * int g(int x, int y) { return f(x, y); }
4392  * int f(int a, int b) { return a + b; }
4393  * int f(int, int);
4394  * \endcode
4395  *
4396  * there are three declarations of the function "f", but only the
4397  * second one is a definition. The clang_getCursorDefinition()
4398  * function will take any cursor pointing to a declaration of "f"
4399  * (the first or fourth lines of the example) or a cursor referenced
4400  * that uses "f" (the call to "f' inside "g") and will return a
4401  * declaration cursor pointing to the definition (the second "f"
4402  * declaration).
4403  *
4404  * If given a cursor for which there is no corresponding definition,
4405  * e.g., because there is no definition of that entity within this
4406  * translation unit, returns a NULL cursor.
4407  */
4409 
4410 /**
4411  * Determine whether the declaration pointed to by this cursor
4412  * is also a definition of that entity.
4413  */
4415 
4416 /**
4417  * Retrieve the canonical cursor corresponding to the given cursor.
4418  *
4419  * In the C family of languages, many kinds of entities can be declared several
4420  * times within a single translation unit. For example, a structure type can
4421  * be forward-declared (possibly multiple times) and later defined:
4422  *
4423  * \code
4424  * struct X;
4425  * struct X;
4426  * struct X {
4427  * int member;
4428  * };
4429  * \endcode
4430  *
4431  * The declarations and the definition of \c X are represented by three
4432  * different cursors, all of which are declarations of the same underlying
4433  * entity. One of these cursor is considered the "canonical" cursor, which
4434  * is effectively the representative for the underlying entity. One can
4435  * determine if two cursors are declarations of the same underlying entity by
4436  * comparing their canonical cursors.
4437  *
4438  * \returns The canonical cursor for the entity referred to by the given cursor.
4439  */
4441 
4442 /**
4443  * If the cursor points to a selector identifier in an Objective-C
4444  * method or message expression, this returns the selector index.
4445  *
4446  * After getting a cursor with #clang_getCursor, this can be called to
4447  * determine if the location points to a selector identifier.
4448  *
4449  * \returns The selector index if the cursor is an Objective-C method or message
4450  * expression and the cursor is pointing to a selector identifier, or -1
4451  * otherwise.
4452  */
4454 
4455 /**
4456  * Given a cursor pointing to a C++ method call or an Objective-C
4457  * message, returns non-zero if the method/message is "dynamic", meaning:
4458  *
4459  * For a C++ method: the call is virtual.
4460  * For an Objective-C message: the receiver is an object instance, not 'super'
4461  * or a specific class.
4462  *
4463  * If the method/message is "static" or the cursor does not point to a
4464  * method/message, it will return zero.
4465  */
4467 
4468 /**
4469  * Given a cursor pointing to an Objective-C message or property
4470  * reference, or C++ method call, returns the CXType of the receiver.
4471  */
4473 
4474 /**
4475  * Property attributes for a \c CXCursor_ObjCPropertyDecl.
4476  */
4477 typedef enum {
4493 
4494 /**
4495  * Given a cursor that represents a property declaration, return the
4496  * associated property attributes. The bits are formed from
4497  * \c CXObjCPropertyAttrKind.
4498  *
4499  * \param reserved Reserved for future use, pass 0.
4500  */
4502  unsigned reserved);
4503 
4504 /**
4505  * Given a cursor that represents a property declaration, return the
4506  * name of the method that implements the getter.
4507  */
4509 
4510 /**
4511  * Given a cursor that represents a property declaration, return the
4512  * name of the method that implements the setter, if any.
4513  */
4515 
4516 /**
4517  * 'Qualifiers' written next to the return and parameter types in
4518  * Objective-C method declarations.
4519  */
4520 typedef enum {
4529 
4530 /**
4531  * Given a cursor that represents an Objective-C method or parameter
4532  * declaration, return the associated Objective-C qualifiers for the return
4533  * type or the parameter respectively. The bits are formed from
4534  * CXObjCDeclQualifierKind.
4535  */
4537 
4538 /**
4539  * Given a cursor that represents an Objective-C method or property
4540  * declaration, return non-zero if the declaration was affected by "\@optional".
4541  * Returns zero if the cursor is not such a declaration or it is "\@required".
4542  */
4544 
4545 /**
4546  * Returns non-zero if the given cursor is a variadic function or method.
4547  */
4549 
4550 /**
4551  * Returns non-zero if the given cursor points to a symbol marked with
4552  * external_source_symbol attribute.
4553  *
4554  * \param language If non-NULL, and the attribute is present, will be set to
4555  * the 'language' string from the attribute.
4556  *
4557  * \param definedIn If non-NULL, and the attribute is present, will be set to
4558  * the 'definedIn' string from the attribute.
4559  *
4560  * \param isGenerated If non-NULL, and the attribute is present, will be set to
4561  * non-zero if the 'generated_declaration' is set in the attribute.
4562  */
4564  CXString *language, CXString *definedIn,
4565  unsigned *isGenerated);
4566 
4567 /**
4568  * Given a cursor that represents a declaration, return the associated
4569  * comment's source range. The range may include multiple consecutive comments
4570  * with whitespace in between.
4571  */
4573 
4574 /**
4575  * Given a cursor that represents a declaration, return the associated
4576  * comment text, including comment markers.
4577  */
4579 
4580 /**
4581  * Given a cursor that represents a documentable entity (e.g.,
4582  * declaration), return the associated \paragraph; otherwise return the
4583  * first paragraph.
4584  */
4586 
4587 /**
4588  * @}
4589  */
4590 
4591 /** \defgroup CINDEX_MANGLE Name Mangling API Functions
4592  *
4593  * @{
4594  */
4595 
4596 /**
4597  * Retrieve the CXString representing the mangled name of the cursor.
4598  */
4600 
4601 /**
4602  * Retrieve the CXStrings representing the mangled symbols of the C++
4603  * constructor or destructor at the cursor.
4604  */
4606 
4607 /**
4608  * Retrieve the CXStrings representing the mangled symbols of the ObjC
4609  * class interface or implementation at the cursor.
4610  */
4612 
4613 /**
4614  * @}
4615  */
4616 
4617 /**
4618  * \defgroup CINDEX_MODULE Module introspection
4619  *
4620  * The functions in this group provide access to information about modules.
4621  *
4622  * @{
4623  */
4624 
4625 typedef void *CXModule;
4626 
4627 /**
4628  * Given a CXCursor_ModuleImportDecl cursor, return the associated module.
4629  */
4631 
4632 /**
4633  * Given a CXFile header file, return the module that contains it, if one
4634  * exists.
4635  */
4636 CINDEX_LINKAGE CXModule clang_getModuleForFile(CXTranslationUnit, CXFile);
4637 
4638 /**
4639  * \param Module a module object.
4640  *
4641  * \returns the module file where the provided module object came from.
4642  */
4643 CINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module);
4644 
4645 /**
4646  * \param Module a module object.
4647  *
4648  * \returns the parent of a sub-module or NULL if the given module is top-level,
4649  * e.g. for 'std.vector' it will return the 'std' module.
4650  */
4651 CINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module);
4652 
4653 /**
4654  * \param Module a module object.
4655  *
4656  * \returns the name of the module, e.g. for the 'std.vector' sub-module it
4657  * will return "vector".
4658  */
4660 
4661 /**
4662  * \param Module a module object.
4663  *
4664  * \returns the full name of the module, e.g. "std.vector".
4665  */
4667 
4668 /**
4669  * \param Module a module object.
4670  *
4671  * \returns non-zero if the module is a system one.
4672  */
4673 CINDEX_LINKAGE int clang_Module_isSystem(CXModule Module);
4674 
4675 /**
4676  * \param Module a module object.
4677  *
4678  * \returns the number of top level headers associated with this module.
4679  */
4680 CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit,
4681  CXModule Module);
4682 
4683 /**
4684  * \param Module a module object.
4685  *
4686  * \param Index top level header index (zero-based).
4687  *
4688  * \returns the specified top level header associated with the module.
4689  */
4691 CXFile clang_Module_getTopLevelHeader(CXTranslationUnit,
4692  CXModule Module, unsigned Index);
4693 
4694 /**
4695  * @}
4696  */
4697 
4698 /**
4699  * \defgroup CINDEX_CPP C++ AST introspection
4700  *
4701  * The routines in this group provide access information in the ASTs specific
4702  * to C++ language features.
4703  *
4704  * @{
4705  */
4706 
4707 /**
4708  * Determine if a C++ constructor is a converting constructor.
4709  */
4711 
4712 /**
4713  * Determine if a C++ constructor is a copy constructor.
4714  */
4716 
4717 /**
4718  * Determine if a C++ constructor is the default constructor.
4719  */
4721 
4722 /**
4723  * Determine if a C++ constructor is a move constructor.
4724  */
4726 
4727 /**
4728  * Determine if a C++ field is declared 'mutable'.
4729  */
4731 
4732 /**
4733  * Determine if a C++ method is declared '= default'.
4734  */
4736 
4737 /**
4738  * Determine if a C++ member function or member function template is
4739  * pure virtual.
4740  */
4742 
4743 /**
4744  * Determine if a C++ member function or member function template is
4745  * declared 'static'.
4746  */
4748 
4749 /**
4750  * Determine if a C++ member function or member function template is
4751  * explicitly declared 'virtual' or if it overrides a virtual method from
4752  * one of the base classes.
4753  */
4755 
4756 /**
4757  * Determine if a C++ record is abstract, i.e. whether a class or struct
4758  * has a pure virtual member function.
4759  */
4761 
4762 /**
4763  * Determine if an enum declaration refers to a scoped enum.
4764  */
4766 
4767 /**
4768  * Determine if a C++ member function or member function template is
4769  * declared 'const'.
4770  */
4772 
4773 /**
4774  * Given a cursor that represents a template, determine
4775  * the cursor kind of the specializations would be generated by instantiating
4776  * the template.
4777  *
4778  * This routine can be used to determine what flavor of function template,
4779  * class template, or class template partial specialization is stored in the
4780  * cursor. For example, it can describe whether a class template cursor is
4781  * declared with "struct", "class" or "union".
4782  *
4783  * \param C The cursor to query. This cursor should represent a template
4784  * declaration.
4785  *
4786  * \returns The cursor kind of the specializations that would be generated
4787  * by instantiating the template \p C. If \p C is not a template, returns
4788  * \c CXCursor_NoDeclFound.
4789  */
4791 
4792 /**
4793  * Given a cursor that may represent a specialization or instantiation
4794  * of a template, retrieve the cursor that represents the template that it
4795  * specializes or from which it was instantiated.
4796  *
4797  * This routine determines the template involved both for explicit
4798  * specializations of templates and for implicit instantiations of the template,
4799  * both of which are referred to as "specializations". For a class template
4800  * specialization (e.g., \c std::vector<bool>), this routine will return
4801  * either the primary template (\c std::vector) or, if the specialization was
4802  * instantiated from a class template partial specialization, the class template
4803  * partial specialization. For a class template partial specialization and a
4804  * function template specialization (including instantiations), this
4805  * this routine will return the specialized template.
4806  *
4807  * For members of a class template (e.g., member functions, member classes, or
4808  * static data members), returns the specialized or instantiated member.
4809  * Although not strictly "templates" in the C++ language, members of class
4810  * templates have the same notions of specializations and instantiations that
4811  * templates do, so this routine treats them similarly.
4812  *
4813  * \param C A cursor that may be a specialization of a template or a member
4814  * of a template.
4815  *
4816  * \returns If the given cursor is a specialization or instantiation of a
4817  * template or a member thereof, the template or member that it specializes or
4818  * from which it was instantiated. Otherwise, returns a NULL cursor.
4819  */
4821 
4822 /**
4823  * Given a cursor that references something else, return the source range
4824  * covering that reference.
4825  *
4826  * \param C A cursor pointing to a member reference, a declaration reference, or
4827  * an operator call.
4828  * \param NameFlags A bitset with three independent flags:
4829  * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
4830  * CXNameRange_WantSinglePiece.
4831  * \param PieceIndex For contiguous names or when passing the flag
4832  * CXNameRange_WantSinglePiece, only one piece with index 0 is
4833  * available. When the CXNameRange_WantSinglePiece flag is not passed for a
4834  * non-contiguous names, this index can be used to retrieve the individual
4835  * pieces of the name. See also CXNameRange_WantSinglePiece.
4836  *
4837  * \returns The piece of the name pointed to by the given cursor. If there is no
4838  * name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
4839  */
4841  unsigned NameFlags,
4842  unsigned PieceIndex);
4843 
4845  /**
4846  * Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
4847  * range.
4848  */
4850 
4851  /**
4852  * Include the explicit template arguments, e.g. <int> in x.f<int>,
4853  * in the range.
4854  */
4856 
4857  /**
4858  * If the name is non-contiguous, return the full spanning range.
4859  *
4860  * Non-contiguous names occur in Objective-C when a selector with two or more
4861  * parameters is used, or in C++ when using an operator:
4862  * \code
4863  * [object doSomething:here withValue:there]; // Objective-C
4864  * return some_vector[1]; // C++
4865  * \endcode
4866  */
4868 };
4869 
4870 /**
4871  * @}
4872  */
4873 
4874 /**
4875  * \defgroup CINDEX_LEX Token extraction and manipulation
4876  *
4877  * The routines in this group provide access to the tokens within a
4878  * translation unit, along with a semantic mapping of those tokens to
4879  * their corresponding cursors.
4880  *
4881  * @{
4882  */
4883 
4884 /**
4885  * Describes a kind of token.
4886  */
4887 typedef enum CXTokenKind {
4888  /**
4889  * A token that contains some kind of punctuation.
4890  */
4892 
4893  /**
4894  * A language keyword.
4895  */
4897 
4898  /**
4899  * An identifier (that is not a keyword).
4900  */
4902 
4903  /**
4904  * A numeric, string, or character literal.
4905  */
4907 
4908  /**
4909  * A comment.
4910  */
4912 } CXTokenKind;
4913 
4914 /**
4915  * Describes a single preprocessing token.
4916  */
4917 typedef struct {
4918  unsigned int_data[4];
4919  void *ptr_data;
4920 } CXToken;
4921 
4922 /**
4923  * Get the raw lexical token starting with the given location.
4924  *
4925  * \param TU the translation unit whose text is being tokenized.
4926  *
4927  * \param Location the source location with which the token starts.
4928  *
4929  * \returns The token starting with the given location or NULL if no such token
4930  * exist. The returned pointer must be freed with clang_disposeTokens before the
4931  * translation unit is destroyed.
4932  */
4933 CINDEX_LINKAGE CXToken *clang_getToken(CXTranslationUnit TU,
4934  CXSourceLocation Location);
4935 
4936 /**
4937  * Determine the kind of the given token.
4938  */
4940 
4941 /**
4942  * Determine the spelling of the given token.
4943  *
4944  * The spelling of a token is the textual representation of that token, e.g.,
4945  * the text of an identifier or keyword.
4946  */
4948 
4949 /**
4950  * Retrieve the source location of the given token.
4951  */
4953  CXToken);
4954 
4955 /**
4956  * Retrieve a source range that covers the given token.
4957  */
4959 
4960 /**
4961  * Tokenize the source code described by the given range into raw
4962  * lexical tokens.
4963  *
4964  * \param TU the translation unit whose text is being tokenized.
4965  *
4966  * \param Range the source range in which text should be tokenized. All of the
4967  * tokens produced by tokenization will fall within this source range,
4968  *
4969  * \param Tokens this pointer will be set to point to the array of tokens
4970  * that occur within the given source range. The returned pointer must be
4971  * freed with clang_disposeTokens() before the translation unit is destroyed.
4972  *
4973  * \param NumTokens will be set to the number of tokens in the \c *Tokens
4974  * array.
4975  *
4976  */
4977 CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
4978  CXToken **Tokens, unsigned *NumTokens);
4979 
4980 /**
4981  * Annotate the given set of tokens by providing cursors for each token
4982  * that can be mapped to a specific entity within the abstract syntax tree.
4983  *
4984  * This token-annotation routine is equivalent to invoking
4985  * clang_getCursor() for the source locations of each of the
4986  * tokens. The cursors provided are filtered, so that only those
4987  * cursors that have a direct correspondence to the token are
4988  * accepted. For example, given a function call \c f(x),
4989  * clang_getCursor() would provide the following cursors:
4990  *
4991  * * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
4992  * * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
4993  * * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
4994  *
4995  * Only the first and last of these cursors will occur within the
4996  * annotate, since the tokens "f" and "x' directly refer to a function
4997  * and a variable, respectively, but the parentheses are just a small
4998  * part of the full syntax of the function call expression, which is
4999  * not provided as an annotation.
5000  *
5001  * \param TU the translation unit that owns the given tokens.
5002  *
5003  * \param Tokens the set of tokens to annotate.
5004  *
5005  * \param NumTokens the number of tokens in \p Tokens.
5006  *
5007  * \param Cursors an array of \p NumTokens cursors, whose contents will be
5008  * replaced with the cursors corresponding to each token.
5009  */
5010 CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU,
5011  CXToken *Tokens, unsigned NumTokens,
5012  CXCursor *Cursors);
5013 
5014 /**
5015  * Free the given set of tokens.
5016  */
5017 CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
5018  CXToken *Tokens, unsigned NumTokens);
5019 
5020 /**
5021  * @}
5022  */
5023 
5024 /**
5025  * \defgroup CINDEX_DEBUG Debugging facilities
5026  *
5027  * These routines are used for testing and debugging, only, and should not
5028  * be relied upon.
5029  *
5030  * @{
5031  */
5032 
5033 /* for debug/testing */
5036  const char **startBuf,
5037  const char **endBuf,
5038  unsigned *startLine,
5039  unsigned *startColumn,
5040  unsigned *endLine,
5041  unsigned *endColumn);
5043 CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data,
5044  unsigned stack_size);
5045 
5046 /**
5047  * @}
5048  */
5049 
5050 /**
5051  * \defgroup CINDEX_CODE_COMPLET Code completion
5052  *
5053  * Code completion involves taking an (incomplete) source file, along with
5054  * knowledge of where the user is actively editing that file, and suggesting
5055  * syntactically- and semantically-valid constructs that the user might want to
5056  * use at that particular point in the source code. These data structures and
5057  * routines provide support for code completion.
5058  *
5059  * @{
5060  */
5061 
5062 /**
5063  * A semantic string that describes a code-completion result.
5064  *
5065  * A semantic string that describes the formatting of a code-completion
5066  * result as a single "template" of text that should be inserted into the
5067  * source buffer when a particular code-completion result is selected.
5068  * Each semantic string is made up of some number of "chunks", each of which
5069  * contains some text along with a description of what that text means, e.g.,
5070  * the name of the entity being referenced, whether the text chunk is part of
5071  * the template, or whether it is a "placeholder" that the user should replace
5072  * with actual code,of a specific kind. See \c CXCompletionChunkKind for a
5073  * description of the different kinds of chunks.
5074  */
5075 typedef void *CXCompletionString;
5076 
5077 /**
5078  * A single result of code completion.
5079  */
5080 typedef struct {
5081  /**
5082  * The kind of entity that this completion refers to.
5083  *
5084  * The cursor kind will be a macro, keyword, or a declaration (one of the
5085  * *Decl cursor kinds), describing the entity that the completion is
5086  * referring to.
5087  *
5088  * \todo In the future, we would like to provide a full cursor, to allow
5089  * the client to extract additional information from declaration.
5090  */
5091  enum CXCursorKind CursorKind;
5092 
5093  /**
5094  * The code-completion string that describes how to insert this
5095  * code-completion result into the editing buffer.
5096  */
5097  CXCompletionString CompletionString;
5099 
5100 /**
5101  * Describes a single piece of text within a code-completion string.
5102  *
5103  * Each "chunk" within a code-completion string (\c CXCompletionString) is
5104  * either a piece of text with a specific "kind" that describes how that text
5105  * should be interpreted by the client or is another completion string.
5106  */
5108  /**
5109  * A code-completion string that describes "optional" text that
5110  * could be a part of the template (but is not required).
5111  *
5112  * The Optional chunk is the only kind of chunk that has a code-completion
5113  * string for its representation, which is accessible via
5114  * \c clang_getCompletionChunkCompletionString(). The code-completion string
5115  * describes an additional part of the template that is completely optional.
5116  * For example, optional chunks can be used to describe the placeholders for
5117  * arguments that match up with defaulted function parameters, e.g. given:
5118  *
5119  * \code
5120  * void f(int x, float y = 3.14, double z = 2.71828);
5121  * \endcode
5122  *
5123  * The code-completion string for this function would contain:
5124  * - a TypedText chunk for "f".
5125  * - a LeftParen chunk for "(".
5126  * - a Placeholder chunk for "int x"
5127  * - an Optional chunk containing the remaining defaulted arguments, e.g.,
5128  * - a Comma chunk for ","
5129  * - a Placeholder chunk for "float y"
5130  * - an Optional chunk containing the last defaulted argument:
5131  * - a Comma chunk for ","
5132  * - a Placeholder chunk for "double z"
5133  * - a RightParen chunk for ")"
5134  *
5135  * There are many ways to handle Optional chunks. Two simple approaches are:
5136  * - Completely ignore optional chunks, in which case the template for the
5137  * function "f" would only include the first parameter ("int x").
5138  * - Fully expand all optional chunks, in which case the template for the
5139  * function "f" would have all of the parameters.
5140  */
5142  /**
5143  * Text that a user would be expected to type to get this
5144  * code-completion result.
5145  *
5146  * There will be exactly one "typed text" chunk in a semantic string, which
5147  * will typically provide the spelling of a keyword or the name of a
5148  * declaration that could be used at the current code point. Clients are
5149  * expected to filter the code-completion results based on the text in this
5150  * chunk.
5151  */
5153  /**
5154  * Text that should be inserted as part of a code-completion result.
5155  *
5156  * A "text" chunk represents text that is part of the template to be
5157  * inserted into user code should this particular code-completion result
5158  * be selected.
5159  */
5161  /**
5162  * Placeholder text that should be replaced by the user.
5163  *
5164  * A "placeholder" chunk marks a place where the user should insert text
5165  * into the code-completion template. For example, placeholders might mark
5166  * the function parameters for a function declaration, to indicate that the
5167  * user should provide arguments for each of those parameters. The actual
5168  * text in a placeholder is a suggestion for the text to display before
5169  * the user replaces the placeholder with real code.
5170  */
5172  /**
5173  * Informative text that should be displayed but never inserted as
5174  * part of the template.
5175  *
5176  * An "informative" chunk contains annotations that can be displayed to
5177  * help the user decide whether a particular code-completion result is the
5178  * right option, but which is not part of the actual template to be inserted
5179  * by code completion.
5180  */
5182  /**
5183  * Text that describes the current parameter when code-completion is
5184  * referring to function call, message send, or template specialization.
5185  *
5186  * A "current parameter" chunk occurs when code-completion is providing
5187  * information about a parameter corresponding to the argument at the
5188  * code-completion point. For example, given a function
5189  *
5190  * \code
5191  * int add(int x, int y);
5192  * \endcode
5193  *
5194  * and the source code \c add(, where the code-completion point is after the
5195  * "(", the code-completion string will contain a "current parameter" chunk
5196  * for "int x", indicating that the current argument will initialize that
5197  * parameter. After typing further, to \c add(17, (where the code-completion
5198  * point is after the ","), the code-completion string will contain a
5199  * "current parameter" chunk to "int y".
5200  */
5202  /**
5203  * A left parenthesis ('('), used to initiate a function call or
5204  * signal the beginning of a function parameter list.
5205  */
5207  /**
5208  * A right parenthesis (')'), used to finish a function call or
5209  * signal the end of a function parameter list.
5210  */
5212  /**
5213  * A left bracket ('[').
5214  */
5216  /**
5217  * A right bracket (']').
5218  */
5220  /**
5221  * A left brace ('{').
5222  */
5224  /**
5225  * A right brace ('}').
5226  */
5228  /**
5229  * A left angle bracket ('<').
5230  */
5232  /**
5233  * A right angle bracket ('>').
5234  */
5236  /**
5237  * A comma separator (',').
5238  */
5240  /**
5241  * Text that specifies the result type of a given result.
5242  *
5243  * This special kind of informative chunk is not meant to be inserted into
5244  * the text buffer. Rather, it is meant to illustrate the type that an
5245  * expression using the given completion string would have.
5246  */
5248  /**
5249  * A colon (':').
5250  */
5252  /**
5253  * A semicolon (';').
5254  */
5256  /**
5257  * An '=' sign.
5258  */
5260  /**
5261  * Horizontal space (' ').
5262  */
5264  /**
5265  * Vertical space ('\\n'), after which it is generally a good idea to
5266  * perform indentation.
5267  */
5269 };
5270 
5271 /**
5272  * Determine the kind of a particular chunk within a completion string.
5273  *
5274  * \param completion_string the completion string to query.
5275  *
5276  * \param chunk_number the 0-based index of the chunk in the completion string.
5277  *
5278  * \returns the kind of the chunk at the index \c chunk_number.
5279  */
5281 clang_getCompletionChunkKind(CXCompletionString completion_string,
5282  unsigned chunk_number);
5283 
5284 /**
5285  * Retrieve the text associated with a particular chunk within a
5286  * completion string.
5287  *
5288  * \param completion_string the completion string to query.
5289  *
5290  * \param chunk_number the 0-based index of the chunk in the completion string.
5291  *
5292  * \returns the text associated with the chunk at index \c chunk_number.
5293  */
5295 clang_getCompletionChunkText(CXCompletionString completion_string,
5296  unsigned chunk_number);
5297 
5298 /**
5299  * Retrieve the completion string associated with a particular chunk
5300  * within a completion string.
5301  *
5302  * \param completion_string the completion string to query.
5303  *
5304  * \param chunk_number the 0-based index of the chunk in the completion string.
5305  *
5306  * \returns the completion string associated with the chunk at index
5307  * \c chunk_number.
5308  */
5309 CINDEX_LINKAGE CXCompletionString
5310 clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
5311  unsigned chunk_number);
5312 
5313 /**
5314  * Retrieve the number of chunks in the given code-completion string.
5315  */
5316 CINDEX_LINKAGE unsigned
5317 clang_getNumCompletionChunks(CXCompletionString completion_string);
5318 
5319 /**
5320  * Determine the priority of this code completion.
5321  *
5322  * The priority of a code completion indicates how likely it is that this
5323  * particular completion is the completion that the user will select. The
5324  * priority is selected by various internal heuristics.
5325  *
5326  * \param completion_string The completion string to query.
5327  *
5328  * \returns The priority of this completion string. Smaller values indicate
5329  * higher-priority (more likely) completions.
5330  */
5331 CINDEX_LINKAGE unsigned
5332 clang_getCompletionPriority(CXCompletionString completion_string);
5333 
5334 /**
5335  * Determine the availability of the entity that this code-completion
5336  * string refers to.
5337  *
5338  * \param completion_string The completion string to query.
5339  *
5340  * \returns The availability of the completion string.
5341  */
5343 clang_getCompletionAvailability(CXCompletionString completion_string);
5344 
5345 /**
5346  * Retrieve the number of annotations associated with the given
5347  * completion string.
5348  *
5349  * \param completion_string the completion string to query.
5350  *
5351  * \returns the number of annotations associated with the given completion
5352  * string.
5353  */
5354 CINDEX_LINKAGE unsigned
5355 clang_getCompletionNumAnnotations(CXCompletionString completion_string);
5356 
5357 /**
5358  * Retrieve the annotation associated with the given completion string.
5359  *
5360  * \param completion_string the completion string to query.
5361  *
5362  * \param annotation_number the 0-based index of the annotation of the
5363  * completion string.
5364  *
5365  * \returns annotation string associated with the completion at index
5366  * \c annotation_number, or a NULL string if that annotation is not available.
5367  */
5369 clang_getCompletionAnnotation(CXCompletionString completion_string,
5370  unsigned annotation_number);
5371 
5372 /**
5373  * Retrieve the parent context of the given completion string.
5374  *
5375  * The parent context of a completion string is the semantic parent of
5376  * the declaration (if any) that the code completion represents. For example,
5377  * a code completion for an Objective-C method would have the method's class
5378  * or protocol as its context.
5379  *
5380  * \param completion_string The code completion string whose parent is
5381  * being queried.
5382  *
5383  * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL.
5384  *
5385  * \returns The name of the completion parent, e.g., "NSObject" if
5386  * the completion string represents a method in the NSObject class.
5387  */
5389 clang_getCompletionParent(CXCompletionString completion_string,
5390  enum CXCursorKind *kind);
5391 
5392 /**
5393  * Retrieve the brief documentation comment attached to the declaration
5394  * that corresponds to the given completion string.
5395  */
5397 clang_getCompletionBriefComment(CXCompletionString completion_string);
5398 
5399 /**
5400  * Retrieve a completion string for an arbitrary declaration or macro
5401  * definition cursor.
5402  *
5403  * \param cursor The cursor to query.
5404  *
5405  * \returns A non-context-sensitive completion string for declaration and macro
5406  * definition cursors, or NULL for other kinds of cursors.
5407  */
5408 CINDEX_LINKAGE CXCompletionString
5410 
5411 /**
5412  * Contains the results of code-completion.
5413  *
5414  * This data structure contains the results of code completion, as
5415  * produced by \c clang_codeCompleteAt(). Its contents must be freed by
5416  * \c clang_disposeCodeCompleteResults.
5417  */
5418 typedef struct {
5419  /**
5420  * The code-completion results.
5421  */
5423 
5424  /**
5425  * The number of code-completion results stored in the
5426  * \c Results array.
5427  */
5428  unsigned NumResults;
5430 
5431 /**
5432  * Retrieve the number of fix-its for the given completion index.
5433  *
5434  * Calling this makes sense only if CXCodeComplete_IncludeCompletionsWithFixIts
5435  * option was set.
5436  *
5437  * \param results The structure keeping all completion results
5438  *
5439  * \param completion_index The index of the completion
5440  *
5441  * \return The number of fix-its which must be applied before the completion at
5442  * completion_index can be applied
5443  */
5444 CINDEX_LINKAGE unsigned
5446  unsigned completion_index);
5447 
5448 /**
5449  * Fix-its that *must* be applied before inserting the text for the
5450  * corresponding completion.
5451  *
5452  * By default, clang_codeCompleteAt() only returns completions with empty
5453  * fix-its. Extra completions with non-empty fix-its should be explicitly
5454  * requested by setting CXCodeComplete_IncludeCompletionsWithFixIts.
5455  *
5456  * For the clients to be able to compute position of the cursor after applying
5457  * fix-its, the following conditions are guaranteed to hold for
5458  * replacement_range of the stored fix-its:
5459  * - Ranges in the fix-its are guaranteed to never contain the completion
5460  * point (or identifier under completion point, if any) inside them, except
5461  * at the start or at the end of the range.
5462  * - If a fix-it range starts or ends with completion point (or starts or
5463  * ends after the identifier under completion point), it will contain at
5464  * least one character. It allows to unambiguously recompute completion
5465  * point after applying the fix-it.
5466  *
5467  * The intuition is that provided fix-its change code around the identifier we
5468  * complete, but are not allowed to touch the identifier itself or the
5469  * completion point. One example of completions with corrections are the ones
5470  * replacing '.' with '->' and vice versa:
5471  *
5472  * std::unique_ptr<std::vector<int>> vec_ptr;
5473  * In 'vec_ptr.^', one of the completions is 'push_back', it requires
5474  * replacing '.' with '->'.
5475  * In 'vec_ptr->^', one of the completions is 'release', it requires
5476  * replacing '->' with '.'.
5477  *
5478  * \param results The structure keeping all completion results
5479  *
5480  * \param completion_index The index of the completion
5481  *
5482  * \param fixit_index The index of the fix-it for the completion at
5483  * completion_index
5484  *
5485  * \param replacement_range The fix-it range that must be replaced before the
5486  * completion at completion_index can be applied
5487  *
5488  * \returns The fix-it string that must replace the code at replacement_range
5489  * before the completion at completion_index can be applied
5490  */
5492  CXCodeCompleteResults *results, unsigned completion_index,
5493  unsigned fixit_index, CXSourceRange *replacement_range);
5494 
5495 /**
5496  * Flags that can be passed to \c clang_codeCompleteAt() to
5497  * modify its behavior.
5498  *
5499  * The enumerators in this enumeration can be bitwise-OR'd together to
5500  * provide multiple options to \c clang_codeCompleteAt().
5501  */
5503  /**
5504  * Whether to include macros within the set of code
5505  * completions returned.
5506  */
5508 
5509  /**
5510  * Whether to include code patterns for language constructs
5511  * within the set of code completions, e.g., for loops.
5512  */
5514 
5515  /**
5516  * Whether to include brief documentation within the set of code
5517  * completions returned.
5518  */
5520 
5521  /**
5522  * Whether to speed up completion by omitting top- or namespace-level entities
5523  * defined in the preamble. There's no guarantee any particular entity is
5524  * omitted. This may be useful if the headers are indexed externally.
5525  */
5527 
5528  /**
5529  * Whether to include completions with small
5530  * fix-its, e.g. change '.' to '->' on member access, etc.
5531  */
5533 };
5534 
5535 /**
5536  * Bits that represent the context under which completion is occurring.
5537  *
5538  * The enumerators in this enumeration may be bitwise-OR'd together if multiple
5539  * contexts are occurring simultaneously.
5540  */
5542  /**
5543  * The context for completions is unexposed, as only Clang results
5544  * should be included. (This is equivalent to having no context bits set.)
5545  */
5547 
5548  /**
5549  * Completions for any possible type should be included in the results.
5550  */
5552 
5553  /**
5554  * Completions for any possible value (variables, function calls, etc.)
5555  * should be included in the results.
5556  */
5558  /**
5559  * Completions for values that resolve to an Objective-C object should
5560  * be included in the results.
5561  */
5563  /**
5564  * Completions for values that resolve to an Objective-C selector
5565  * should be included in the results.
5566  */
5568  /**
5569  * Completions for values that resolve to a C++ class type should be
5570  * included in the results.
5571  */
5573 
5574  /**
5575  * Completions for fields of the member being accessed using the dot
5576  * operator should be included in the results.
5577  */
5579  /**
5580  * Completions for fields of the member being accessed using the arrow
5581  * operator should be included in the results.
5582  */
5584  /**
5585  * Completions for properties of the Objective-C object being accessed
5586  * using the dot operator should be included in the results.
5587  */
5589 
5590  /**
5591  * Completions for enum tags should be included in the results.
5592  */
5594  /**
5595  * Completions for union tags should be included in the results.
5596  */
5598  /**
5599  * Completions for struct tags should be included in the results.
5600  */
5602 
5603  /**
5604  * Completions for C++ class names should be included in the results.
5605  */
5607  /**
5608  * Completions for C++ namespaces and namespace aliases should be
5609  * included in the results.
5610  */
5612  /**
5613  * Completions for C++ nested name specifiers should be included in
5614  * the results.
5615  */
5617 
5618  /**
5619  * Completions for Objective-C interfaces (classes) should be included
5620  * in the results.
5621  */
5623  /**
5624  * Completions for Objective-C protocols should be included in
5625  * the results.
5626  */
5628  /**
5629  * Completions for Objective-C categories should be included in
5630  * the results.
5631  */
5633  /**
5634  * Completions for Objective-C instance messages should be included
5635  * in the results.
5636  */
5638  /**
5639  * Completions for Objective-C class messages should be included in
5640  * the results.
5641  */
5643  /**
5644  * Completions for Objective-C selector names should be included in
5645  * the results.
5646  */
5648 
5649  /**
5650  * Completions for preprocessor macro names should be included in
5651  * the results.
5652  */
5654 
5655  /**
5656  * Natural language completions should be included in the results.
5657  */
5659 
5660  /**
5661  * #include file completions should be included in the results.
5662  */