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 57
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 /**
228  * Provides a shared context for creating translation units.
229  *
230  * It provides two options:
231  *
232  * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
233  * declarations (when loading any new translation units). A "local" declaration
234  * is one that belongs in the translation unit itself and not in a precompiled
235  * header that was used by the translation unit. If zero, all declarations
236  * will be enumerated.
237  *
238  * Here is an example:
239  *
240  * \code
241  * // excludeDeclsFromPCH = 1, displayDiagnostics=1
242  * Idx = clang_createIndex(1, 1);
243  *
244  * // IndexTest.pch was produced with the following command:
245  * // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
246  * TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
247  *
248  * // This will load all the symbols from 'IndexTest.pch'
249  * clang_visitChildren(clang_getTranslationUnitCursor(TU),
250  * TranslationUnitVisitor, 0);
251  * clang_disposeTranslationUnit(TU);
252  *
253  * // This will load all the symbols from 'IndexTest.c', excluding symbols
254  * // from 'IndexTest.pch'.
255  * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
256  * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
257  * 0, 0);
258  * clang_visitChildren(clang_getTranslationUnitCursor(TU),
259  * TranslationUnitVisitor, 0);
260  * clang_disposeTranslationUnit(TU);
261  * \endcode
262  *
263  * This process of creating the 'pch', loading it separately, and using it (via
264  * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
265  * (which gives the indexer the same performance benefit as the compiler).
266  */
267 CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
268  int displayDiagnostics);
269 
270 /**
271  * Destroy the given index.
272  *
273  * The index must not be destroyed until all of the translation units created
274  * within that index have been destroyed.
275  */
276 CINDEX_LINKAGE void clang_disposeIndex(CXIndex index);
277 
278 typedef enum {
279  /**
280  * Used to indicate that no special CXIndex options are needed.
281  */
283 
284  /**
285  * Used to indicate that threads that libclang creates for indexing
286  * purposes should use background priority.
287  *
288  * Affects #clang_indexSourceFile, #clang_indexTranslationUnit,
289  * #clang_parseTranslationUnit, #clang_saveTranslationUnit.
290  */
292 
293  /**
294  * Used to indicate that threads that libclang creates for editing
295  * purposes should use background priority.
296  *
297  * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt,
298  * #clang_annotateTokens
299  */
301 
302  /**
303  * Used to indicate that all threads that libclang creates should use
304  * background priority.
305  */
309 
311 
312 /**
313  * Sets general options associated with a CXIndex.
314  *
315  * For example:
316  * \code
317  * CXIndex idx = ...;
318  * clang_CXIndex_setGlobalOptions(idx,
319  * clang_CXIndex_getGlobalOptions(idx) |
320  * CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
321  * \endcode
322  *
323  * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.
324  */
325 CINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options);
326 
327 /**
328  * Gets the general options associated with a CXIndex.
329  *
330  * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that
331  * are associated with the given CXIndex object.
332  */
334 
335 /**
336  * Sets the invocation emission path option in a CXIndex.
337  *
338  * The invocation emission path specifies a path which will contain log
339  * files for certain libclang invocations. A null value (default) implies that
340  * libclang invocations are not logged..
341  */
342 CINDEX_LINKAGE void
343 clang_CXIndex_setInvocationEmissionPathOption(CXIndex, const char *Path);
344 
345 /**
346  * \defgroup CINDEX_FILES File manipulation routines
347  *
348  * @{
349  */
350 
351 /**
352  * A particular source file that is part of a translation unit.
353  */
354 typedef void *CXFile;
355 
356 /**
357  * Retrieve the complete file and path name of the given file.
358  */
360 
361 /**
362  * Retrieve the last modification time of the given file.
363  */
364 CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
365 
366 /**
367  * Uniquely identifies a CXFile, that refers to the same underlying file,
368  * across an indexing session.
369  */
370 typedef struct {
371  unsigned long long data[3];
373 
374 /**
375  * Retrieve the unique ID for the given \c file.
376  *
377  * \param file the file to get the ID for.
378  * \param outID stores the returned CXFileUniqueID.
379  * \returns If there was a failure getting the unique ID, returns non-zero,
380  * otherwise returns 0.
381 */
382 CINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID);
383 
384 /**
385  * Determine whether the given header is guarded against
386  * multiple inclusions, either with the conventional
387  * \#ifndef/\#define/\#endif macro guards or with \#pragma once.
388  */
389 CINDEX_LINKAGE unsigned
390 clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
391 
392 /**
393  * Retrieve a file handle within the given translation unit.
394  *
395  * \param tu the translation unit
396  *
397  * \param file_name the name of the file.
398  *
399  * \returns the file handle for the named file in the translation unit \p tu,
400  * or a NULL file handle if the file was not a part of this translation unit.
401  */
402 CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,
403  const char *file_name);
404 
405 /**
406  * Retrieve the buffer associated with the given file.
407  *
408  * \param tu the translation unit
409  *
410  * \param file the file for which to retrieve the buffer.
411  *
412  * \param size [out] if non-NULL, will be set to the size of the buffer.
413  *
414  * \returns a pointer to the buffer in memory that holds the contents of
415  * \p file, or a NULL pointer when the file is not loaded.
416  */
417 CINDEX_LINKAGE const char *clang_getFileContents(CXTranslationUnit tu,
418  CXFile file, size_t *size);
419 
420 /**
421  * Returns non-zero if the \c file1 and \c file2 point to the same file,
422  * or they are both NULL.
423  */
424 CINDEX_LINKAGE int clang_File_isEqual(CXFile file1, CXFile file2);
425 
426 /**
427  * Returns the real path name of \c file.
428  *
429  * An empty string may be returned. Use \c clang_getFileName() in that case.
430  */
432 
433 /**
434  * @}
435  */
436 
437 /**
438  * \defgroup CINDEX_LOCATIONS Physical source locations
439  *
440  * Clang represents physical source locations in its abstract syntax tree in
441  * great detail, with file, line, and column information for the majority of
442  * the tokens parsed in the source code. These data types and functions are
443  * used to represent source location information, either for a particular
444  * point in the program or for a range of points in the program, and extract
445  * specific location information from those data types.
446  *
447  * @{
448  */
449 
450 /**
451  * Identifies a specific source location within a translation
452  * unit.
453  *
454  * Use clang_getExpansionLocation() or clang_getSpellingLocation()
455  * to map a source location to a particular file, line, and column.
456  */
457 typedef struct {
458  const void *ptr_data[2];
459  unsigned int_data;
461 
462 /**
463  * Identifies a half-open character range in the source code.
464  *
465  * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
466  * starting and end locations from a source range, respectively.
467  */
468 typedef struct {
469  const void *ptr_data[2];
470  unsigned begin_int_data;
471  unsigned end_int_data;
472 } CXSourceRange;
473 
474 /**
475  * Retrieve a NULL (invalid) source location.
476  */
478 
479 /**
480  * Determine whether two source locations, which must refer into
481  * the same translation unit, refer to exactly the same point in the source
482  * code.
483  *
484  * \returns non-zero if the source locations refer to the same location, zero
485  * if they refer to different locations.
486  */
488  CXSourceLocation loc2);
489 
490 /**
491  * Retrieves the source location associated with a given file/line/column
492  * in a particular translation unit.
493  */
495  CXFile file,
496  unsigned line,
497  unsigned column);
498 /**
499  * Retrieves the source location associated with a given character offset
500  * in a particular translation unit.
501  */
503  CXFile file,
504  unsigned offset);
505 
506 /**
507  * Returns non-zero if the given source location is in a system header.
508  */
510 
511 /**
512  * Returns non-zero if the given source location is in the main file of
513  * the corresponding translation unit.
514  */
516 
517 /**
518  * Retrieve a NULL (invalid) source range.
519  */
521 
522 /**
523  * Retrieve a source range given the beginning and ending source
524  * locations.
525  */
527  CXSourceLocation end);
528 
529 /**
530  * Determine whether two ranges are equivalent.
531  *
532  * \returns non-zero if the ranges are the same, zero if they differ.
533  */
535  CXSourceRange range2);
536 
537 /**
538  * Returns non-zero if \p range is null.
539  */
541 
542 /**
543  * Retrieve the file, line, column, and offset represented by
544  * the given source location.
545  *
546  * If the location refers into a macro expansion, retrieves the
547  * location of the macro expansion.
548  *
549  * \param location the location within a source file that will be decomposed
550  * into its parts.
551  *
552  * \param file [out] if non-NULL, will be set to the file to which the given
553  * source location points.
554  *
555  * \param line [out] if non-NULL, will be set to the line to which the given
556  * source location points.
557  *
558  * \param column [out] if non-NULL, will be set to the column to which the given
559  * source location points.
560  *
561  * \param offset [out] if non-NULL, will be set to the offset into the
562  * buffer to which the given source location points.
563  */
565  CXFile *file,
566  unsigned *line,
567  unsigned *column,
568  unsigned *offset);
569 
570 /**
571  * Retrieve the file, line and column represented by the given source
572  * location, as specified in a # line directive.
573  *
574  * Example: given the following source code in a file somefile.c
575  *
576  * \code
577  * #123 "dummy.c" 1
578  *
579  * static int func(void)
580  * {
581  * return 0;
582  * }
583  * \endcode
584  *
585  * the location information returned by this function would be
586  *
587  * File: dummy.c Line: 124 Column: 12
588  *
589  * whereas clang_getExpansionLocation would have returned
590  *
591  * File: somefile.c Line: 3 Column: 12
592  *
593  * \param location the location within a source file that will be decomposed
594  * into its parts.
595  *
596  * \param filename [out] if non-NULL, will be set to the filename of the
597  * source location. Note that filenames returned will be for "virtual" files,
598  * which don't necessarily exist on the machine running clang - e.g. when
599  * parsing preprocessed output obtained from a different environment. If
600  * a non-NULL value is passed in, remember to dispose of the returned value
601  * using \c clang_disposeString() once you've finished with it. For an invalid
602  * source location, an empty string is returned.
603  *
604  * \param line [out] if non-NULL, will be set to the line number of the
605  * source location. For an invalid source location, zero is returned.
606  *
607  * \param column [out] if non-NULL, will be set to the column number of the
608  * source location. For an invalid source location, zero is returned.
609  */
611  CXString *filename,
612  unsigned *line,
613  unsigned *column);
614 
615 /**
616  * Legacy API to retrieve the file, line, column, and offset represented
617  * by the given source location.
618  *
619  * This interface has been replaced by the newer interface
620  * #clang_getExpansionLocation(). See that interface's documentation for
621  * details.
622  */
624  CXFile *file,
625  unsigned *line,
626  unsigned *column,
627  unsigned *offset);
628 
629 /**
630  * Retrieve the file, line, column, and offset represented by
631  * the given source location.
632  *
633  * If the location refers into a macro instantiation, return where the
634  * location was originally spelled in the source file.
635  *
636  * \param location the location within a source file that will be decomposed
637  * into its parts.
638  *
639  * \param file [out] if non-NULL, will be set to the file to which the given
640  * source location points.
641  *
642  * \param line [out] if non-NULL, will be set to the line to which the given
643  * source location points.
644  *
645  * \param column [out] if non-NULL, will be set to the column to which the given
646  * source location points.
647  *
648  * \param offset [out] if non-NULL, will be set to the offset into the
649  * buffer to which the given source location points.
650  */
652  CXFile *file,
653  unsigned *line,
654  unsigned *column,
655  unsigned *offset);
656 
657 /**
658  * Retrieve the file, line, column, and offset represented by
659  * the given source location.
660  *
661  * If the location refers into a macro expansion, return where the macro was
662  * expanded or where the macro argument was written, if the location points at
663  * a macro argument.
664  *
665  * \param location the location within a source file that will be decomposed
666  * into its parts.
667  *
668  * \param file [out] if non-NULL, will be set to the file to which the given
669  * source location points.
670  *
671  * \param line [out] if non-NULL, will be set to the line to which the given
672  * source location points.
673  *
674  * \param column [out] if non-NULL, will be set to the column to which the given
675  * source location points.
676  *
677  * \param offset [out] if non-NULL, will be set to the offset into the
678  * buffer to which the given source location points.
679  */
681  CXFile *file,
682  unsigned *line,
683  unsigned *column,
684  unsigned *offset);
685 
686 /**
687  * Retrieve a source location representing the first character within a
688  * source range.
689  */
691 
692 /**
693  * Retrieve a source location representing the last character within a
694  * source range.
695  */
697 
698 /**
699  * Identifies an array of ranges.
700  */
701 typedef struct {
702  /** The number of ranges in the \c ranges array. */
703  unsigned count;
704  /**
705  * An array of \c CXSourceRanges.
706  */
709 
710 /**
711  * Retrieve all ranges that were skipped by the preprocessor.
712  *
713  * The preprocessor will skip lines when they are surrounded by an
714  * if/ifdef/ifndef directive whose condition does not evaluate to true.
715  */
717  CXFile file);
718 
719 /**
720  * Retrieve all ranges from all files that were skipped by the
721  * preprocessor.
722  *
723  * The preprocessor will skip lines when they are surrounded by an
724  * if/ifdef/ifndef directive whose condition does not evaluate to true.
725  */
727 
728 /**
729  * Destroy the given \c CXSourceRangeList.
730  */
732 
733 /**
734  * @}
735  */
736 
737 /**
738  * \defgroup CINDEX_DIAG Diagnostic reporting
739  *
740  * @{
741  */
742 
743 /**
744  * Describes the severity of a particular diagnostic.
745  */
747  /**
748  * A diagnostic that has been suppressed, e.g., by a command-line
749  * option.
750  */
752 
753  /**
754  * This diagnostic is a note that should be attached to the
755  * previous (non-note) diagnostic.
756  */
758 
759  /**
760  * This diagnostic indicates suspicious code that may not be
761  * wrong.
762  */
764 
765  /**
766  * This diagnostic indicates that the code is ill-formed.
767  */
769 
770  /**
771  * This diagnostic indicates that the code is ill-formed such
772  * that future parser recovery is unlikely to produce useful
773  * results.
774  */
776 };
777 
778 /**
779  * A single diagnostic, containing the diagnostic's severity,
780  * location, text, source ranges, and fix-it hints.
781  */
782 typedef void *CXDiagnostic;
783 
784 /**
785  * A group of CXDiagnostics.
786  */
787 typedef void *CXDiagnosticSet;
788 
789 /**
790  * Determine the number of diagnostics in a CXDiagnosticSet.
791  */
792 CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags);
793 
794 /**
795  * Retrieve a diagnostic associated with the given CXDiagnosticSet.
796  *
797  * \param Diags the CXDiagnosticSet to query.
798  * \param Index the zero-based diagnostic number to retrieve.
799  *
800  * \returns the requested diagnostic. This diagnostic must be freed
801  * via a call to \c clang_disposeDiagnostic().
802  */
803 CINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,
804  unsigned Index);
805 
806 /**
807  * Describes the kind of error that occurred (if any) in a call to
808  * \c clang_loadDiagnostics.
809  */
811  /**
812  * Indicates that no error occurred.
813  */
815 
816  /**
817  * Indicates that an unknown error occurred while attempting to
818  * deserialize diagnostics.
819  */
821 
822  /**
823  * Indicates that the file containing the serialized diagnostics
824  * could not be opened.
825  */
827 
828  /**
829  * Indicates that the serialized diagnostics file is invalid or
830  * corrupt.
831  */
833 };
834 
835 /**
836  * Deserialize a set of diagnostics from a Clang diagnostics bitcode
837  * file.
838  *
839  * \param file The name of the file to deserialize.
840  * \param error A pointer to a enum value recording if there was a problem
841  * deserializing the diagnostics.
842  * \param errorString A pointer to a CXString for recording the error string
843  * if the file was not successfully loaded.
844  *
845  * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise. These
846  * diagnostics should be released using clang_disposeDiagnosticSet().
847  */
848 CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file,
849  enum CXLoadDiag_Error *error,
850  CXString *errorString);
851 
852 /**
853  * Release a CXDiagnosticSet and all of its contained diagnostics.
854  */
855 CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags);
856 
857 /**
858  * Retrieve the child diagnostics of a CXDiagnostic.
859  *
860  * This CXDiagnosticSet does not need to be released by
861  * clang_disposeDiagnosticSet.
862  */
863 CINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D);
864 
865 /**
866  * Determine the number of diagnostics produced for the given
867  * translation unit.
868  */
869 CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit);
870 
871 /**
872  * Retrieve a diagnostic associated with the given translation unit.
873  *
874  * \param Unit the translation unit to query.
875  * \param Index the zero-based diagnostic number to retrieve.
876  *
877  * \returns the requested diagnostic. This diagnostic must be freed
878  * via a call to \c clang_disposeDiagnostic().
879  */
880 CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,
881  unsigned Index);
882 
883 /**
884  * Retrieve the complete set of diagnostics associated with a
885  * translation unit.
886  *
887  * \param Unit the translation unit to query.
888  */
889 CINDEX_LINKAGE CXDiagnosticSet
890  clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);
891 
892 /**
893  * Destroy a diagnostic.
894  */
895 CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
896 
897 /**
898  * Options to control the display of diagnostics.
899  *
900  * The values in this enum are meant to be combined to customize the
901  * behavior of \c clang_formatDiagnostic().
902  */
904  /**
905  * Display the source-location information where the
906  * diagnostic was located.
907  *
908  * When set, diagnostics will be prefixed by the file, line, and
909  * (optionally) column to which the diagnostic refers. For example,
910  *
911  * \code
912  * test.c:28: warning: extra tokens at end of #endif directive
913  * \endcode
914  *
915  * This option corresponds to the clang flag \c -fshow-source-location.
916  */
918 
919  /**
920  * If displaying the source-location information of the
921  * diagnostic, also include the column number.
922  *
923  * This option corresponds to the clang flag \c -fshow-column.
924  */
926 
927  /**
928  * If displaying the source-location information of the
929  * diagnostic, also include information about source ranges in a
930  * machine-parsable format.
931  *
932  * This option corresponds to the clang flag
933  * \c -fdiagnostics-print-source-range-info.
934  */
936 
937  /**
938  * Display the option name associated with this diagnostic, if any.
939  *
940  * The option name displayed (e.g., -Wconversion) will be placed in brackets
941  * after the diagnostic text. This option corresponds to the clang flag
942  * \c -fdiagnostics-show-option.
943  */
945 
946  /**
947  * Display the category number associated with this diagnostic, if any.
948  *
949  * The category number is displayed within brackets after the diagnostic text.
950  * This option corresponds to the clang flag
951  * \c -fdiagnostics-show-category=id.
952  */
954 
955  /**
956  * Display the category name associated with this diagnostic, if any.
957  *
958  * The category name is displayed within brackets after the diagnostic text.
959  * This option corresponds to the clang flag
960  * \c -fdiagnostics-show-category=name.
961  */
963 };
964 
965 /**
966  * Format the given diagnostic in a manner that is suitable for display.
967  *
968  * This routine will format the given diagnostic to a string, rendering
969  * the diagnostic according to the various options given. The
970  * \c clang_defaultDiagnosticDisplayOptions() function returns the set of
971  * options that most closely mimics the behavior of the clang compiler.
972  *
973  * \param Diagnostic The diagnostic to print.
974  *
975  * \param Options A set of options that control the diagnostic display,
976  * created by combining \c CXDiagnosticDisplayOptions values.
977  *
978  * \returns A new string containing for formatted diagnostic.
979  */
980 CINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic,
981  unsigned Options);
982 
983 /**
984  * Retrieve the set of display options most similar to the
985  * default behavior of the clang compiler.
986  *
987  * \returns A set of display options suitable for use with \c
988  * clang_formatDiagnostic().
989  */
991 
992 /**
993  * Determine the severity of the given diagnostic.
994  */
996 clang_getDiagnosticSeverity(CXDiagnostic);
997 
998 /**
999  * Retrieve the source location of the given diagnostic.
1000  *
1001  * This location is where Clang would print the caret ('^') when
1002  * displaying the diagnostic on the command line.
1003  */
1005 
1006 /**
1007  * Retrieve the text of the given diagnostic.
1008  */
1010 
1011 /**
1012  * Retrieve the name of the command-line option that enabled this
1013  * diagnostic.
1014  *
1015  * \param Diag The diagnostic to be queried.
1016  *
1017  * \param Disable If non-NULL, will be set to the option that disables this
1018  * diagnostic (if any).
1019  *
1020  * \returns A string that contains the command-line option used to enable this
1021  * warning, such as "-Wconversion" or "-pedantic".
1022  */
1024  CXString *Disable);
1025 
1026 /**
1027  * Retrieve the category number for this diagnostic.
1028  *
1029  * Diagnostics can be categorized into groups along with other, related
1030  * diagnostics (e.g., diagnostics under the same warning flag). This routine
1031  * retrieves the category number for the given diagnostic.
1032  *
1033  * \returns The number of the category that contains this diagnostic, or zero
1034  * if this diagnostic is uncategorized.
1035  */
1036 CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
1037 
1038 /**
1039  * Retrieve the name of a particular diagnostic category. This
1040  * is now deprecated. Use clang_getDiagnosticCategoryText()
1041  * instead.
1042  *
1043  * \param Category A diagnostic category number, as returned by
1044  * \c clang_getDiagnosticCategory().
1045  *
1046  * \returns The name of the given diagnostic category.
1047  */
1050 
1051 /**
1052  * Retrieve the diagnostic category text for a given diagnostic.
1053  *
1054  * \returns The text of the given diagnostic category.
1055  */
1057 
1058 /**
1059  * Determine the number of source ranges associated with the given
1060  * diagnostic.
1061  */
1062 CINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic);
1063 
1064 /**
1065  * Retrieve a source range associated with the diagnostic.
1066  *
1067  * A diagnostic's source ranges highlight important elements in the source
1068  * code. On the command line, Clang displays source ranges by
1069  * underlining them with '~' characters.
1070  *
1071  * \param Diagnostic the diagnostic whose range is being extracted.
1072  *
1073  * \param Range the zero-based index specifying which range to
1074  *
1075  * \returns the requested source range.
1076  */
1077 CINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic,
1078  unsigned Range);
1079 
1080 /**
1081  * Determine the number of fix-it hints associated with the
1082  * given diagnostic.
1083  */
1084 CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
1085 
1086 /**
1087  * Retrieve the replacement information for a given fix-it.
1088  *
1089  * Fix-its are described in terms of a source range whose contents
1090  * should be replaced by a string. This approach generalizes over
1091  * three kinds of operations: removal of source code (the range covers
1092  * the code to be removed and the replacement string is empty),
1093  * replacement of source code (the range covers the code to be
1094  * replaced and the replacement string provides the new code), and
1095  * insertion (both the start and end of the range point at the
1096  * insertion location, and the replacement string provides the text to
1097  * insert).
1098  *
1099  * \param Diagnostic The diagnostic whose fix-its are being queried.
1100  *
1101  * \param FixIt The zero-based index of the fix-it.
1102  *
1103  * \param ReplacementRange The source range whose contents will be
1104  * replaced with the returned replacement string. Note that source
1105  * ranges are half-open ranges [a, b), so the source code should be
1106  * replaced from a and up to (but not including) b.
1107  *
1108  * \returns A string containing text that should be replace the source
1109  * code indicated by the \c ReplacementRange.
1110  */
1111 CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic,
1112  unsigned FixIt,
1113  CXSourceRange *ReplacementRange);
1114 
1115 /**
1116  * @}
1117  */
1118 
1119 /**
1120  * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation
1121  *
1122  * The routines in this group provide the ability to create and destroy
1123  * translation units from files, either by parsing the contents of the files or
1124  * by reading in a serialized representation of a translation unit.
1125  *
1126  * @{
1127  */
1128 
1129 /**
1130  * Get the original translation unit source file name.
1131  */
1133 clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
1134 
1135 /**
1136  * Return the CXTranslationUnit for a given source file and the provided
1137  * command line arguments one would pass to the compiler.
1138  *
1139  * Note: The 'source_filename' argument is optional. If the caller provides a
1140  * NULL pointer, the name of the source file is expected to reside in the
1141  * specified command line arguments.
1142  *
1143  * Note: When encountered in 'clang_command_line_args', the following options
1144  * are ignored:
1145  *
1146  * '-c'
1147  * '-emit-ast'
1148  * '-fsyntax-only'
1149  * '-o <output file>' (both '-o' and '<output file>' are ignored)
1150  *
1151  * \param CIdx The index object with which the translation unit will be
1152  * associated.
1153  *
1154  * \param source_filename The name of the source file to load, or NULL if the
1155  * source file is included in \p clang_command_line_args.
1156  *
1157  * \param num_clang_command_line_args The number of command-line arguments in
1158  * \p clang_command_line_args.
1159  *
1160  * \param clang_command_line_args The command-line arguments that would be
1161  * passed to the \c clang executable if it were being invoked out-of-process.
1162  * These command-line options will be parsed and will affect how the translation
1163  * unit is parsed. Note that the following options are ignored: '-c',
1164  * '-emit-ast', '-fsyntax-only' (which is the default), and '-o <output file>'.
1165  *
1166  * \param num_unsaved_files the number of unsaved file entries in \p
1167  * unsaved_files.
1168  *
1169  * \param unsaved_files the files that have not yet been saved to disk
1170  * but may be required for code completion, including the contents of
1171  * those files. The contents and name of these files (as specified by
1172  * CXUnsavedFile) are copied when necessary, so the client only needs to
1173  * guarantee their validity until the call to this function returns.
1174  */
1176  CXIndex CIdx,
1177  const char *source_filename,
1178  int num_clang_command_line_args,
1179  const char * const *clang_command_line_args,
1180  unsigned num_unsaved_files,
1181  struct CXUnsavedFile *unsaved_files);
1182 
1183 /**
1184  * Same as \c clang_createTranslationUnit2, but returns
1185  * the \c CXTranslationUnit instead of an error code. In case of an error this
1186  * routine returns a \c NULL \c CXTranslationUnit, without further detailed
1187  * error codes.
1188  */
1190  CXIndex CIdx,
1191  const char *ast_filename);
1192 
1193 /**
1194  * Create a translation unit from an AST file (\c -emit-ast).
1195  *
1196  * \param[out] out_TU A non-NULL pointer to store the created
1197  * \c CXTranslationUnit.
1198  *
1199  * \returns Zero on success, otherwise returns an error code.
1200  */
1202  CXIndex CIdx,
1203  const char *ast_filename,
1204  CXTranslationUnit *out_TU);
1205 
1206 /**
1207  * Flags that control the creation of translation units.
1208  *
1209  * The enumerators in this enumeration type are meant to be bitwise
1210  * ORed together to specify which options should be used when
1211  * constructing the translation unit.
1212  */
1214  /**
1215  * Used to indicate that no special translation-unit options are
1216  * needed.
1217  */
1219 
1220  /**
1221  * Used to indicate that the parser should construct a "detailed"
1222  * preprocessing record, including all macro definitions and instantiations.
1223  *
1224  * Constructing a detailed preprocessing record requires more memory
1225  * and time to parse, since the information contained in the record
1226  * is usually not retained. However, it can be useful for
1227  * applications that require more detailed information about the
1228  * behavior of the preprocessor.
1229  */
1231 
1232  /**
1233  * Used to indicate that the translation unit is incomplete.
1234  *
1235  * When a translation unit is considered "incomplete", semantic
1236  * analysis that is typically performed at the end of the
1237  * translation unit will be suppressed. For example, this suppresses
1238  * the completion of tentative declarations in C and of
1239  * instantiation of implicitly-instantiation function templates in
1240  * C++. This option is typically used when parsing a header with the
1241  * intent of producing a precompiled header.
1242  */
1244 
1245  /**
1246  * Used to indicate that the translation unit should be built with an
1247  * implicit precompiled header for the preamble.
1248  *
1249  * An implicit precompiled header is used as an optimization when a
1250  * particular translation unit is likely to be reparsed many times
1251  * when the sources aren't changing that often. In this case, an
1252  * implicit precompiled header will be built containing all of the
1253  * initial includes at the top of the main file (what we refer to as
1254  * the "preamble" of the file). In subsequent parses, if the
1255  * preamble or the files in it have not changed, \c
1256  * clang_reparseTranslationUnit() will re-use the implicit
1257  * precompiled header to improve parsing performance.
1258  */
1260 
1261  /**
1262  * Used to indicate that the translation unit should cache some
1263  * code-completion results with each reparse of the source file.
1264  *
1265  * Caching of code-completion results is a performance optimization that
1266  * introduces some overhead to reparsing but improves the performance of
1267  * code-completion operations.
1268  */
1270 
1271  /**
1272  * Used to indicate that the translation unit will be serialized with
1273  * \c clang_saveTranslationUnit.
1274  *
1275  * This option is typically used when parsing a header with the intent of
1276  * producing a precompiled header.
1277  */
1279 
1280  /**
1281  * DEPRECATED: Enabled chained precompiled preambles in C++.
1282  *
1283  * Note: this is a *temporary* option that is available only while
1284  * we are testing C++ precompiled preamble support. It is deprecated.
1285  */
1287 
1288  /**
1289  * Used to indicate that function/method bodies should be skipped while
1290  * parsing.
1291  *
1292  * This option can be used to search for declarations/definitions while
1293  * ignoring the usages.
1294  */
1296 
1297  /**
1298  * Used to indicate that brief documentation comments should be
1299  * included into the set of code completions returned from this translation
1300  * unit.
1301  */
1303 
1304  /**
1305  * Used to indicate that the precompiled preamble should be created on
1306  * the first parse. Otherwise it will be created on the first reparse. This
1307  * trades runtime on the first parse (serializing the preamble takes time) for
1308  * reduced runtime on the second parse (can now reuse the preamble).
1309  */
1311 
1312  /**
1313  * Do not stop processing when fatal errors are encountered.
1314  *
1315  * When fatal errors are encountered while parsing a translation unit,
1316  * semantic analysis is typically stopped early when compiling code. A common
1317  * source for fatal errors are unresolvable include files. For the
1318  * purposes of an IDE, this is undesirable behavior and as much information
1319  * as possible should be reported. Use this flag to enable this behavior.
1320  */
1322 
1323  /**
1324  * Sets the preprocessor in a mode for parsing a single file only.
1325  */
1327 
1328  /**
1329  * Used in combination with CXTranslationUnit_SkipFunctionBodies to
1330  * constrain the skipping of function bodies to the preamble.
1331  *
1332  * The function bodies of the main file are not skipped.
1333  */
1335 
1336  /**
1337  * Used to indicate that attributed types should be included in CXType.
1338  */
1340 
1341  /**
1342  * Used to indicate that implicit attributes should be visited.
1343  */
1345 };
1346 
1347 /**
1348  * Returns the set of flags that is suitable for parsing a translation
1349  * unit that is being edited.
1350  *
1351  * The set of flags returned provide options for \c clang_parseTranslationUnit()
1352  * to indicate that the translation unit is likely to be reparsed many times,
1353  * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
1354  * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
1355  * set contains an unspecified set of optimizations (e.g., the precompiled
1356  * preamble) geared toward improving the performance of these routines. The
1357  * set of optimizations enabled may change from one version to the next.
1358  */
1360 
1361 /**
1362  * Same as \c clang_parseTranslationUnit2, but returns
1363  * the \c CXTranslationUnit instead of an error code. In case of an error this
1364  * routine returns a \c NULL \c CXTranslationUnit, without further detailed
1365  * error codes.
1366  */
1367 CINDEX_LINKAGE CXTranslationUnit
1368 clang_parseTranslationUnit(CXIndex CIdx,
1369  const char *source_filename,
1370  const char *const *command_line_args,
1371  int num_command_line_args,
1372  struct CXUnsavedFile *unsaved_files,
1373  unsigned num_unsaved_files,
1374  unsigned options);
1375 
1376 /**
1377  * Parse the given source file and the translation unit corresponding
1378  * to that file.
1379  *
1380  * This routine is the main entry point for the Clang C API, providing the
1381  * ability to parse a source file into a translation unit that can then be
1382  * queried by other functions in the API. This routine accepts a set of
1383  * command-line arguments so that the compilation can be configured in the same
1384  * way that the compiler is configured on the command line.
1385  *
1386  * \param CIdx The index object with which the translation unit will be
1387  * associated.
1388  *
1389  * \param source_filename The name of the source file to load, or NULL if the
1390  * source file is included in \c command_line_args.
1391  *
1392  * \param command_line_args The command-line arguments that would be
1393  * passed to the \c clang executable if it were being invoked out-of-process.
1394  * These command-line options will be parsed and will affect how the translation
1395  * unit is parsed. Note that the following options are ignored: '-c',
1396  * '-emit-ast', '-fsyntax-only' (which is the default), and '-o <output file>'.
1397  *
1398  * \param num_command_line_args The number of command-line arguments in
1399  * \c command_line_args.
1400  *
1401  * \param unsaved_files the files that have not yet been saved to disk
1402  * but may be required for parsing, including the contents of
1403  * those files. The contents and name of these files (as specified by
1404  * CXUnsavedFile) are copied when necessary, so the client only needs to
1405  * guarantee their validity until the call to this function returns.
1406  *
1407  * \param num_unsaved_files the number of unsaved file entries in \p
1408  * unsaved_files.
1409  *
1410  * \param options A bitmask of options that affects how the translation unit
1411  * is managed but not its compilation. This should be a bitwise OR of the
1412  * CXTranslationUnit_XXX flags.
1413  *
1414  * \param[out] out_TU A non-NULL pointer to store the created
1415  * \c CXTranslationUnit, describing the parsed code and containing any
1416  * diagnostics produced by the compiler.
1417  *
1418  * \returns Zero on success, otherwise returns an error code.
1419  */
1421 clang_parseTranslationUnit2(CXIndex CIdx,
1422  const char *source_filename,
1423  const char *const *command_line_args,
1424  int num_command_line_args,
1425  struct CXUnsavedFile *unsaved_files,
1426  unsigned num_unsaved_files,
1427  unsigned options,
1428  CXTranslationUnit *out_TU);
1429 
1430 /**
1431  * Same as clang_parseTranslationUnit2 but requires a full command line
1432  * for \c command_line_args including argv[0]. This is useful if the standard
1433  * library paths are relative to the binary.
1434  */
1436  CXIndex CIdx, const char *source_filename,
1437  const char *const *command_line_args, int num_command_line_args,
1438  struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
1439  unsigned options, CXTranslationUnit *out_TU);
1440 
1441 /**
1442  * Flags that control how translation units are saved.
1443  *
1444  * The enumerators in this enumeration type are meant to be bitwise
1445  * ORed together to specify which options should be used when
1446  * saving the translation unit.
1447  */
1449  /**
1450  * Used to indicate that no special saving options are needed.
1451  */
1453 };
1454 
1455 /**
1456  * Returns the set of flags that is suitable for saving a translation
1457  * unit.
1458  *
1459  * The set of flags returned provide options for
1460  * \c clang_saveTranslationUnit() by default. The returned flag
1461  * set contains an unspecified set of options that save translation units with
1462  * the most commonly-requested data.
1463  */
1464 CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU);
1465 
1466 /**
1467  * Describes the kind of error that occurred (if any) in a call to
1468  * \c clang_saveTranslationUnit().
1469  */
1471  /**
1472  * Indicates that no error occurred while saving a translation unit.
1473  */
1475 
1476  /**
1477  * Indicates that an unknown error occurred while attempting to save
1478  * the file.
1479  *
1480  * This error typically indicates that file I/O failed when attempting to
1481  * write the file.
1482  */
1484 
1485  /**
1486  * Indicates that errors during translation prevented this attempt
1487  * to save the translation unit.
1488  *
1489  * Errors that prevent the translation unit from being saved can be
1490  * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
1491  */
1493 
1494  /**
1495  * Indicates that the translation unit to be saved was somehow
1496  * invalid (e.g., NULL).
1497  */
1499 };
1500 
1501 /**
1502  * Saves a translation unit into a serialized representation of
1503  * that translation unit on disk.
1504  *
1505  * Any translation unit that was parsed without error can be saved
1506  * into a file. The translation unit can then be deserialized into a
1507  * new \c CXTranslationUnit with \c clang_createTranslationUnit() or,
1508  * if it is an incomplete translation unit that corresponds to a
1509  * header, used as a precompiled header when parsing other translation
1510  * units.
1511  *
1512  * \param TU The translation unit to save.
1513  *
1514  * \param FileName The file to which the translation unit will be saved.
1515  *
1516  * \param options A bitmask of options that affects how the translation unit
1517  * is saved. This should be a bitwise OR of the
1518  * CXSaveTranslationUnit_XXX flags.
1519  *
1520  * \returns A value that will match one of the enumerators of the CXSaveError
1521  * enumeration. Zero (CXSaveError_None) indicates that the translation unit was
1522  * saved successfully, while a non-zero value indicates that a problem occurred.
1523  */
1524 CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU,
1525  const char *FileName,
1526  unsigned options);
1527 
1528 /**
1529  * Suspend a translation unit in order to free memory associated with it.
1530  *
1531  * A suspended translation unit uses significantly less memory but on the other
1532  * side does not support any other calls than \c clang_reparseTranslationUnit
1533  * to resume it or \c clang_disposeTranslationUnit to dispose it completely.
1534  */
1535 CINDEX_LINKAGE unsigned clang_suspendTranslationUnit(CXTranslationUnit);
1536 
1537 /**
1538  * Destroy the specified CXTranslationUnit object.
1539  */
1540 CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
1541 
1542 /**
1543  * Flags that control the reparsing of translation units.
1544  *
1545  * The enumerators in this enumeration type are meant to be bitwise
1546  * ORed together to specify which options should be used when
1547  * reparsing the translation unit.
1548  */
1550  /**
1551  * Used to indicate that no special reparsing options are needed.
1552  */
1554 };
1555 
1556 /**
1557  * Returns the set of flags that is suitable for reparsing a translation
1558  * unit.
1559  *
1560  * The set of flags returned provide options for
1561  * \c clang_reparseTranslationUnit() by default. The returned flag
1562  * set contains an unspecified set of optimizations geared toward common uses
1563  * of reparsing. The set of optimizations enabled may change from one version
1564  * to the next.
1565  */
1566 CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
1567 
1568 /**
1569  * Reparse the source files that produced this translation unit.
1570  *
1571  * This routine can be used to re-parse the source files that originally
1572  * created the given translation unit, for example because those source files
1573  * have changed (either on disk or as passed via \p unsaved_files). The
1574  * source code will be reparsed with the same command-line options as it
1575  * was originally parsed.
1576  *
1577  * Reparsing a translation unit invalidates all cursors and source locations
1578  * that refer into that translation unit. This makes reparsing a translation
1579  * unit semantically equivalent to destroying the translation unit and then
1580  * creating a new translation unit with the same command-line arguments.
1581  * However, it may be more efficient to reparse a translation
1582  * unit using this routine.
1583  *
1584  * \param TU The translation unit whose contents will be re-parsed. The
1585  * translation unit must originally have been built with
1586  * \c clang_createTranslationUnitFromSourceFile().
1587  *
1588  * \param num_unsaved_files The number of unsaved file entries in \p
1589  * unsaved_files.
1590  *
1591  * \param unsaved_files The files that have not yet been saved to disk
1592  * but may be required for parsing, including the contents of
1593  * those files. The contents and name of these files (as specified by
1594  * CXUnsavedFile) are copied when necessary, so the client only needs to
1595  * guarantee their validity until the call to this function returns.
1596  *
1597  * \param options A bitset of options composed of the flags in CXReparse_Flags.
1598  * The function \c clang_defaultReparseOptions() produces a default set of
1599  * options recommended for most uses, based on the translation unit.
1600  *
1601  * \returns 0 if the sources could be reparsed. A non-zero error code will be
1602  * returned if reparsing was impossible, such that the translation unit is
1603  * invalid. In such cases, the only valid call for \c TU is
1604  * \c clang_disposeTranslationUnit(TU). The error codes returned by this
1605  * routine are described by the \c CXErrorCode enum.
1606  */
1607 CINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU,
1608  unsigned num_unsaved_files,
1609  struct CXUnsavedFile *unsaved_files,
1610  unsigned options);
1611 
1612 /**
1613  * Categorizes how memory is being used by a translation unit.
1614  */
1633 
1636 };
1637 
1638 /**
1639  * Returns the human-readable null-terminated C string that represents
1640  * the name of the memory category. This string should never be freed.
1641  */
1644 
1645 typedef struct CXTUResourceUsageEntry {
1646  /* The memory usage category. */
1648  /* Amount of resources used.
1649  The units will depend on the resource kind. */
1650  unsigned long amount;
1652 
1653 /**
1654  * The memory usage of a CXTranslationUnit, broken into categories.
1655  */
1656 typedef struct CXTUResourceUsage {
1657  /* Private data member, used for queries. */
1658  void *data;
1659 
1660  /* The number of entries in the 'entries' array. */
1661  unsigned numEntries;
1662 
1663  /* An array of key-value pairs, representing the breakdown of memory
1664  usage. */
1666 
1668 
1669 /**
1670  * Return the memory usage of a translation unit. This object
1671  * should be released with clang_disposeCXTUResourceUsage().
1672  */
1674 
1676 
1677 /**
1678  * Get target information for this translation unit.
1679  *
1680  * The CXTargetInfo object cannot outlive the CXTranslationUnit object.
1681  */
1682 CINDEX_LINKAGE CXTargetInfo
1683 clang_getTranslationUnitTargetInfo(CXTranslationUnit CTUnit);
1684 
1685 /**
1686  * Destroy the CXTargetInfo object.
1687  */
1688 CINDEX_LINKAGE void
1689 clang_TargetInfo_dispose(CXTargetInfo Info);
1690 
1691 /**
1692  * Get the normalized target triple as a string.
1693  *
1694  * Returns the empty string in case of any error.
1695  */
1697 clang_TargetInfo_getTriple(CXTargetInfo Info);
1698 
1699 /**
1700  * Get the pointer width of the target in bits.
1701  *
1702  * Returns -1 in case of error.
1703  */
1704 CINDEX_LINKAGE int
1705 clang_TargetInfo_getPointerWidth(CXTargetInfo Info);
1706 
1707 /**
1708  * @}
1709  */
1710 
1711 /**
1712  * Describes the kind of entity that a cursor refers to.
1713  */
1715  /* Declarations */
1716  /**
1717  * A declaration whose specific kind is not exposed via this
1718  * interface.
1719  *
1720  * Unexposed declarations have the same operations as any other kind
1721  * of declaration; one can extract their location information,
1722  * spelling, find their definitions, etc. However, the specific kind
1723  * of the declaration is not reported.
1724  */
1726  /** A C or C++ struct. */
1728  /** A C or C++ union. */
1730  /** A C++ class. */
1732  /** An enumeration. */
1734  /**
1735  * A field (in C) or non-static data member (in C++) in a
1736  * struct, union, or C++ class.
1737  */
1739  /** An enumerator constant. */
1741  /** A function. */
1743  /** A variable. */
1745  /** A function or method parameter. */
1747  /** An Objective-C \@interface. */
1749  /** An Objective-C \@interface for a category. */
1751  /** An Objective-C \@protocol declaration. */
1753  /** An Objective-C \@property declaration. */
1755  /** An Objective-C instance variable. */
1757  /** An Objective-C instance method. */
1759  /** An Objective-C class method. */
1761  /** An Objective-C \@implementation. */
1763  /** An Objective-C \@implementation for a category. */
1765  /** A typedef. */
1767  /** A C++ class method. */
1769  /** A C++ namespace. */
1771  /** A linkage specification, e.g. 'extern "C"'. */
1773  /** A C++ constructor. */
1775  /** A C++ destructor. */
1777  /** A C++ conversion function. */
1779  /** A C++ template type parameter. */
1781  /** A C++ non-type template parameter. */
1783  /** A C++ template template parameter. */
1785  /** A C++ function template. */
1787  /** A C++ class template. */
1789  /** A C++ class template partial specialization. */
1791  /** A C++ namespace alias declaration. */
1793  /** A C++ using directive. */
1795  /** A C++ using declaration. */
1797  /** A C++ alias declaration */
1799  /** An Objective-C \@synthesize definition. */
1801  /** An Objective-C \@dynamic definition. */
1803  /** An access specifier. */
1805 
1808 
1809  /* References */
1810  CXCursor_FirstRef = 40, /* Decl references */
1814  /**
1815  * A reference to a type declaration.
1816  *
1817  * A type reference occurs anywhere where a type is named but not
1818  * declared. For example, given:
1819  *
1820  * \code
1821  * typedef unsigned size_type;
1822  * size_type size;
1823  * \endcode
1824  *
1825  * The typedef is a declaration of size_type (CXCursor_TypedefDecl),
1826  * while the type of the variable "size" is referenced. The cursor
1827  * referenced by the type of size is the typedef for size_type.
1828  */
1831  /**
1832  * A reference to a class template, function template, template
1833  * template parameter, or class template partial specialization.
1834  */
1836  /**
1837  * A reference to a namespace or namespace alias.
1838  */
1840  /**
1841  * A reference to a member of a struct, union, or class that occurs in
1842  * some non-expression context, e.g., a designated initializer.
1843  */
1845  /**
1846  * A reference to a labeled statement.
1847  *
1848  * This cursor kind is used to describe the jump to "start_over" in the
1849  * goto statement in the following example:
1850  *
1851  * \code
1852  * start_over:
1853  * ++counter;
1854  *
1855  * goto start_over;
1856  * \endcode
1857  *
1858  * A label reference cursor refers to a label statement.
1859  */
1861 
1862  /**
1863  * A reference to a set of overloaded functions or function templates
1864  * that has not yet been resolved to a specific function or function template.
1865  *
1866  * An overloaded declaration reference cursor occurs in C++ templates where
1867  * a dependent name refers to a function. For example:
1868  *
1869  * \code
1870  * template<typename T> void swap(T&, T&);
1871  *
1872  * struct X { ... };
1873  * void swap(X&, X&);
1874  *
1875  * template<typename T>
1876  * void reverse(T* first, T* last) {
1877  * while (first < last - 1) {
1878  * swap(*first, *--last);
1879  * ++first;
1880  * }
1881  * }
1882  *
1883  * struct Y { };
1884  * void swap(Y&, Y&);
1885  * \endcode
1886  *
1887  * Here, the identifier "swap" is associated with an overloaded declaration
1888  * reference. In the template definition, "swap" refers to either of the two
1889  * "swap" functions declared above, so both results will be available. At
1890  * instantiation time, "swap" may also refer to other functions found via
1891  * argument-dependent lookup (e.g., the "swap" function at the end of the
1892  * example).
1893  *
1894  * The functions \c clang_getNumOverloadedDecls() and
1895  * \c clang_getOverloadedDecl() can be used to retrieve the definitions
1896  * referenced by this cursor.
1897  */
1899 
1900  /**
1901  * A reference to a variable that occurs in some non-expression
1902  * context, e.g., a C++ lambda capture list.
1903  */
1905 
1907 
1908  /* Error conditions */
1915 
1916  /* Expressions */
1918 
1919  /**
1920  * An expression whose specific kind is not exposed via this
1921  * interface.
1922  *
1923  * Unexposed expressions have the same operations as any other kind
1924  * of expression; one can extract their location information,
1925  * spelling, children, etc. However, the specific kind of the
1926  * expression is not reported.
1927  */
1929 
1930  /**
1931  * An expression that refers to some value declaration, such
1932  * as a function, variable, or enumerator.
1933  */
1935 
1936  /**
1937  * An expression that refers to a member of a struct, union,
1938  * class, Objective-C class, etc.
1939  */
1941 
1942  /** An expression that calls a function. */
1944 
1945  /** An expression that sends a message to an Objective-C
1946  object or class. */
1948 
1949  /** An expression that represents a block literal. */
1951 
1952  /** An integer literal.
1953  */
1955 
1956  /** A floating point number literal.
1957  */
1959 
1960  /** An imaginary number literal.
1961  */
1963 
1964  /** A string literal.
1965  */
1967 
1968  /** A character literal.
1969  */
1971 
1972  /** A parenthesized expression, e.g. "(1)".
1973  *
1974  * This AST node is only formed if full location information is requested.
1975  */
1977 
1978  /** This represents the unary-expression's (except sizeof and
1979  * alignof).
1980  */
1982 
1983  /** [C99 6.5.2.1] Array Subscripting.
1984  */
1986 
1987  /** A builtin binary operation expression such as "x + y" or
1988  * "x <= y".
1989  */
1991 
1992  /** Compound assignment such as "+=".
1993  */
1995 
1996  /** The ?: ternary operator.
1997  */
1999 
2000  /** An explicit cast in C (C99 6.5.4) or a C-style cast in C++
2001  * (C++ [expr.cast]), which uses the syntax (Type)expr.
2002  *
2003  * For example: (int)f.
2004  */
2006 
2007  /** [C99 6.5.2.5]
2008  */
2010 
2011  /** Describes an C or C++ initializer list.
2012  */
2014 
2015  /** The GNU address of label extension, representing &&label.
2016  */
2018 
2019  /** This is the GNU Statement Expression extension: ({int X=4; X;})
2020  */
2022 
2023  /** Represents a C11 generic selection.
2024  */
2026 
2027  /** Implements the GNU __null extension, which is a name for a null
2028  * pointer constant that has integral type (e.g., int or long) and is the same
2029  * size and alignment as a pointer.
2030  *
2031  * The __null extension is typically only used by system headers, which define
2032  * NULL as __null in C++ rather than using 0 (which is an integer that may not
2033  * match the size of a pointer).
2034  */
2036 
2037  /** C++'s static_cast<> expression.
2038  */
2040 
2041  /** C++'s dynamic_cast<> expression.
2042  */
2044 
2045  /** C++'s reinterpret_cast<> expression.
2046  */
2048 
2049  /** C++'s const_cast<> expression.
2050  */
2052 
2053  /** Represents an explicit C++ type conversion that uses "functional"
2054  * notion (C++ [expr.type.conv]).
2055  *
2056  * Example:
2057  * \code
2058  * x = int(0.5);
2059  * \endcode
2060  */
2062 
2063  /** A C++ typeid expression (C++ [expr.typeid]).
2064  */
2066 
2067  /** [C++ 2.13.5] C++ Boolean Literal.
2068  */
2070 
2071  /** [C++0x 2.14.7] C++ Pointer Literal.
2072  */
2074 
2075  /** Represents the "this" expression in C++
2076  */
2078 
2079  /** [C++ 15] C++ Throw Expression.
2080  *
2081  * This handles 'throw' and 'throw' assignment-expression. When
2082  * assignment-expression isn't present, Op will be null.
2083  */
2085 
2086  /** A new expression for memory allocation and constructor calls, e.g:
2087  * "new CXXNewExpr(foo)".
2088  */
2090 
2091  /** A delete expression for memory deallocation and destructor calls,
2092  * e.g. "delete[] pArray".
2093  */
2095 
2096  /** A unary expression. (noexcept, sizeof, or other traits)
2097  */
2099 
2100  /** An Objective-C string literal i.e. @"foo".
2101  */
2103 
2104  /** An Objective-C \@encode expression.
2105  */
2107 
2108  /** An Objective-C \@selector expression.
2109  */
2111 
2112  /** An Objective-C \@protocol expression.
2113  */
2115 
2116  /** An Objective-C "bridged" cast expression, which casts between
2117  * Objective-C pointers and C pointers, transferring ownership in the process.
2118  *
2119  * \code
2120  * NSString *str = (__bridge_transfer NSString *)CFCreateString();
2121  * \endcode
2122  */
2124 
2125  /** Represents a C++0x pack expansion that produces a sequence of
2126  * expressions.
2127  *
2128  * A pack expansion expression contains a pattern (which itself is an
2129  * expression) followed by an ellipsis. For example:
2130  *
2131  * \code
2132  * template<typename F, typename ...Types>
2133  * void forward(F f, Types &&...args) {
2134  * f(static_cast<Types&&>(args)...);
2135  * }
2136  * \endcode
2137  */
2139 
2140  /** Represents an expression that computes the length of a parameter
2141  * pack.
2142  *
2143  * \code
2144  * template<typename ...Types>
2145  * struct count {
2146  * static const unsigned value = sizeof...(Types);
2147  * };
2148  * \endcode
2149  */
2151 
2152  /* Represents a C++ lambda expression that produces a local function
2153  * object.
2154  *
2155  * \code
2156  * void abssort(float *x, unsigned N) {
2157  * std::sort(x, x + N,
2158  * [](float a, float b) {
2159  * return std::abs(a) < std::abs(b);
2160  * });
2161  * }
2162  * \endcode
2163  */
2165 
2166  /** Objective-c Boolean Literal.
2167  */
2169 
2170  /** Represents the "self" expression in an Objective-C method.
2171  */
2173 
2174  /** OpenMP 4.0 [2.4, Array Section].
2175  */
2177 
2178  /** Represents an @available(...) check.
2179  */
2181 
2182  /**
2183  * Fixed point literal
2184  */
2186 
2188 
2189  /* Statements */
2191  /**
2192  * A statement whose specific kind is not exposed via this
2193  * interface.
2194  *
2195  * Unexposed statements have the same operations as any other kind of
2196  * statement; one can extract their location information, spelling,
2197  * children, etc. However, the specific kind of the statement is not
2198  * reported.
2199  */
2201 
2202  /** A labelled statement in a function.
2203  *
2204  * This cursor kind is used to describe the "start_over:" label statement in
2205  * the following example:
2206  *
2207  * \code
2208  * start_over:
2209  * ++counter;
2210  * \endcode
2211  *
2212  */
2214 
2215  /** A group of statements like { stmt stmt }.
2216  *
2217  * This cursor kind is used to describe compound statements, e.g. function
2218  * bodies.
2219  */
2221 
2222  /** A case statement.
2223  */
2225 
2226  /** A default statement.
2227  */
2229 
2230  /** An if statement
2231  */
2233 
2234  /** A switch statement.
2235  */
2237 
2238  /** A while statement.
2239  */
2241 
2242  /** A do statement.
2243  */
2245 
2246  /** A for statement.
2247  */
2249 
2250  /** A goto statement.
2251  */
2253 
2254  /** An indirect goto statement.
2255  */
2257 
2258  /** A continue statement.
2259  */
2261 
2262  /** A break statement.
2263  */
2265 
2266  /** A return statement.
2267  */
2269 
2270  /** A GCC inline assembly statement extension.
2271  */
2274 
2275  /** Objective-C's overall \@try-\@catch-\@finally statement.
2276  */
2278 
2279  /** Objective-C's \@catch statement.
2280  */
2282 
2283  /** Objective-C's \@finally statement.
2284  */
2286 
2287  /** Objective-C's \@throw statement.
2288  */
2290 
2291  /** Objective-C's \@synchronized statement.
2292  */
2294 
2295  /** Objective-C's autorelease pool statement.
2296  */
2298 
2299  /** Objective-C's collection statement.
2300  */
2302 
2303  /** C++'s catch statement.
2304  */
2306 
2307  /** C++'s try statement.
2308  */
2310 
2311  /** C++'s for (* : *) statement.
2312  */
2314 
2315  /** Windows Structured Exception Handling's try statement.
2316  */
2318 
2319  /** Windows Structured Exception Handling's except statement.
2320  */
2322 
2323  /** Windows Structured Exception Handling's finally statement.
2324  */
2326 
2327  /** A MS inline assembly statement extension.
2328  */
2330 
2331  /** The null statement ";": C99 6.8.3p3.
2332  *
2333  * This cursor kind is used to describe the null statement.
2334  */
2336 
2337  /** Adaptor class for mixing declarations with statements and
2338  * expressions.
2339  */
2341 
2342  /** OpenMP parallel directive.
2343  */
2345 
2346  /** OpenMP SIMD directive.
2347  */
2349 
2350  /** OpenMP for directive.
2351  */
2353 
2354  /** OpenMP sections directive.
2355  */
2357 
2358  /** OpenMP section directive.
2359  */
2361 
2362  /** OpenMP single directive.
2363  */
2365 
2366  /** OpenMP parallel for directive.
2367  */
2369 
2370  /** OpenMP parallel sections directive.
2371  */
2373 
2374  /** OpenMP task directive.
2375  */
2377 
2378  /** OpenMP master directive.
2379  */
2381 
2382  /** OpenMP critical directive.
2383  */
2385 
2386  /** OpenMP taskyield directive.
2387  */
2389 
2390  /** OpenMP barrier directive.
2391  */
2393 
2394  /** OpenMP taskwait directive.
2395  */
2397 
2398  /** OpenMP flush directive.
2399  */
2401 
2402  /** Windows Structured Exception Handling's leave statement.
2403  */
2405 
2406  /** OpenMP ordered directive.
2407  */
2409 
2410  /** OpenMP atomic directive.
2411  */
2413 
2414  /** OpenMP for SIMD directive.
2415  */
2417 
2418  /** OpenMP parallel for SIMD directive.
2419  */
2421 
2422  /** OpenMP target directive.
2423  */
2425 
2426  /** OpenMP teams directive.
2427  */
2429 
2430  /** OpenMP taskgroup directive.
2431  */
2433 
2434  /** OpenMP cancellation point directive.
2435  */
2437 
2438  /** OpenMP cancel directive.
2439  */
2441 
2442  /** OpenMP target data directive.
2443  */
2445 
2446  /** OpenMP taskloop directive.
2447  */
2449 
2450  /** OpenMP taskloop simd directive.
2451  */
2453 
2454  /** OpenMP distribute directive.
2455  */
2457 
2458  /** OpenMP target enter data directive.
2459  */
2461 
2462  /** OpenMP target exit data directive.
2463  */
2465 
2466  /** OpenMP target parallel directive.
2467  */
2469 
2470  /** OpenMP target parallel for directive.
2471  */
2473 
2474  /** OpenMP target update directive.
2475  */
2477 
2478  /** OpenMP distribute parallel for directive.
2479  */
2481 
2482  /** OpenMP distribute parallel for simd directive.
2483  */
2485 
2486  /** OpenMP distribute simd directive.
2487  */
2489 
2490  /** OpenMP target parallel for simd directive.
2491  */
2493 
2494  /** OpenMP target simd directive.
2495  */
2497 
2498  /** OpenMP teams distribute directive.
2499  */
2501 
2502  /** OpenMP teams distribute simd directive.
2503  */
2505 
2506  /** OpenMP teams distribute parallel for simd directive.
2507  */
2509 
2510  /** OpenMP teams distribute parallel for directive.
2511  */
2513 
2514  /** OpenMP target teams directive.
2515  */
2517 
2518  /** OpenMP target teams distribute directive.
2519  */
2521 
2522  /** OpenMP target teams distribute parallel for directive.
2523  */
2525 
2526  /** OpenMP target teams distribute parallel for simd directive.
2527  */
2529 
2530  /** OpenMP target teams distribute simd directive.
2531  */
2533 
2535 
2536  /**
2537  * Cursor that represents the translation unit itself.
2538  *
2539  * The translation unit cursor exists primarily to act as the root
2540  * cursor for traversing the contents of a translation unit.
2541  */
2543 
2544  /* Attributes */
2546  /**
2547  * An attribute whose specific kind is not exposed via this
2548  * interface.
2549  */
2551 
2594 
2595  /* Preprocessing */
2603 
2604  /* Extra Declarations */
2605  /**
2606  * A module import declaration.
2607  */
2610  /**
2611  * A static_assert or _Static_assert node
2612  */
2614  /**
2615  * a friend declaration.
2616  */
2620 
2621  /**
2622  * A code completion overload candidate.
2623  */
2625 };
2626 
2627 /**
2628  * A cursor representing some element in the abstract syntax tree for
2629  * a translation unit.
2630  *
2631  * The cursor abstraction unifies the different kinds of entities in a
2632  * program--declaration, statements, expressions, references to declarations,
2633  * etc.--under a single "cursor" abstraction with a common set of operations.
2634  * Common operation for a cursor include: getting the physical location in
2635  * a source file where the cursor points, getting the name associated with a
2636  * cursor, and retrieving cursors for any child nodes of a particular cursor.
2637  *
2638  * Cursors can be produced in two specific ways.
2639  * clang_getTranslationUnitCursor() produces a cursor for a translation unit,
2640  * from which one can use clang_visitChildren() to explore the rest of the
2641  * translation unit. clang_getCursor() maps from a physical source location
2642  * to the entity that resides at that location, allowing one to map from the
2643  * source code into the AST.
2644  */
2645 typedef struct {
2647  int xdata;
2648  const void *data[3];
2649 } CXCursor;
2650 
2651 /**
2652  * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations
2653  *
2654  * @{
2655  */
2656 
2657 /**
2658  * Retrieve the NULL cursor, which represents no entity.
2659  */
2661 
2662 /**
2663  * Retrieve the cursor that represents the given translation unit.
2664  *
2665  * The translation unit cursor can be used to start traversing the
2666  * various declarations within the given translation unit.
2667  */
2669 
2670 /**
2671  * Determine whether two cursors are equivalent.
2672  */
2674 
2675 /**
2676  * Returns non-zero if \p cursor is null.
2677  */
2679 
2680 /**
2681  * Compute a hash value for the given cursor.
2682  */
2684 
2685 /**
2686  * Retrieve the kind of the given cursor.
2687  */
2689 
2690 /**
2691  * Determine whether the given cursor kind represents a declaration.
2692  */
2694 
2695 /**
2696  * Determine whether the given declaration is invalid.
2697  *
2698  * A declaration is invalid if it could not be parsed successfully.
2699  *
2700  * \returns non-zero if the cursor represents a declaration and it is
2701  * invalid, otherwise NULL.
2702  */
2704 
2705 /**
2706  * Determine whether the given cursor kind represents a simple
2707  * reference.
2708  *
2709  * Note that other kinds of cursors (such as expressions) can also refer to
2710  * other cursors. Use clang_getCursorReferenced() to determine whether a
2711  * particular cursor refers to another entity.
2712  */
2714 
2715 /**
2716  * Determine whether the given cursor kind represents an expression.
2717  */
2719 
2720 /**
2721  * Determine whether the given cursor kind represents a statement.
2722  */
2724 
2725 /**
2726  * Determine whether the given cursor kind represents an attribute.
2727  */
2729 
2730 /**
2731  * Determine whether the given cursor has any attributes.
2732  */
2734 
2735 /**
2736  * Determine whether the given cursor kind represents an invalid
2737  * cursor.
2738  */
2740 
2741 /**
2742  * Determine whether the given cursor kind represents a translation
2743  * unit.
2744  */
2746 
2747 /***
2748  * Determine whether the given cursor represents a preprocessing
2749  * element, such as a preprocessor directive or macro instantiation.
2750  */
2752 
2753 /***
2754  * Determine whether the given cursor represents a currently
2755  * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
2756  */
2758 
2759 /**
2760  * Describe the linkage of the entity referred to by a cursor.
2761  */
2763  /** This value indicates that no linkage information is available
2764  * for a provided CXCursor. */
2766  /**
2767  * This is the linkage for variables, parameters, and so on that
2768  * have automatic storage. This covers normal (non-extern) local variables.
2769  */
2771  /** This is the linkage for static variables and static functions. */
2773  /** This is the linkage for entities with external linkage that live
2774  * in C++ anonymous namespaces.*/
2776  /** This is the linkage for entities with true, external linkage. */
2778 };
2779 
2780 /**
2781  * Determine the linkage of the entity referred to by a given cursor.
2782  */
2784 
2786  /** This value indicates that no visibility information is available
2787  * for a provided CXCursor. */
2789 
2790  /** Symbol not seen by the linker. */
2792  /** Symbol seen by the linker but resolves to a symbol inside this object. */
2794  /** Symbol seen by the linker and acts like a normal symbol. */
2796 };
2797 
2798 /**
2799  * Describe the visibility of the entity referred to by a cursor.
2800  *
2801  * This returns the default visibility if not explicitly specified by
2802  * a visibility attribute. The default visibility may be changed by
2803  * commandline arguments.
2804  *
2805  * \param cursor The cursor to query.
2806  *
2807  * \returns The visibility of the cursor.
2808  */
2810 
2811 /**
2812  * Determine the availability of the entity that this cursor refers to,
2813  * taking the current target platform into account.
2814  *
2815  * \param cursor The cursor to query.
2816  *
2817  * \returns The availability of the cursor.
2818  */
2821 
2822 /**
2823  * Describes the availability of a given entity on a particular platform, e.g.,
2824  * a particular class might only be available on Mac OS 10.7 or newer.
2825  */
2826 typedef struct CXPlatformAvailability {
2827  /**
2828  * A string that describes the platform for which this structure
2829  * provides availability information.
2830  *
2831  * Possible values are "ios" or "macos".
2832  */
2834  /**
2835  * The version number in which this entity was introduced.
2836  */
2838  /**
2839  * The version number in which this entity was deprecated (but is
2840  * still available).
2841  */
2843  /**
2844  * The version number in which this entity was obsoleted, and therefore
2845  * is no longer available.
2846  */
2848  /**
2849  * Whether the entity is unconditionally unavailable on this platform.
2850  */
2852  /**
2853  * An optional message to provide to a user of this API, e.g., to
2854  * suggest replacement APIs.
2855  */
2858 
2859 /**
2860  * Determine the availability of the entity that this cursor refers to
2861  * on any platforms for which availability information is known.
2862  *
2863  * \param cursor The cursor to query.
2864  *
2865  * \param always_deprecated If non-NULL, will be set to indicate whether the
2866  * entity is deprecated on all platforms.
2867  *
2868  * \param deprecated_message If non-NULL, will be set to the message text
2869  * provided along with the unconditional deprecation of this entity. The client
2870  * is responsible for deallocating this string.
2871  *
2872  * \param always_unavailable If non-NULL, will be set to indicate whether the
2873  * entity is unavailable on all platforms.
2874  *
2875  * \param unavailable_message If non-NULL, will be set to the message text
2876  * provided along with the unconditional unavailability of this entity. The
2877  * client is responsible for deallocating this string.
2878  *
2879  * \param availability If non-NULL, an array of CXPlatformAvailability instances
2880  * that will be populated with platform availability information, up to either
2881  * the number of platforms for which availability information is available (as
2882  * returned by this function) or \c availability_size, whichever is smaller.
2883  *
2884  * \param availability_size The number of elements available in the
2885  * \c availability array.
2886  *
2887  * \returns The number of platforms (N) for which availability information is
2888  * available (which is unrelated to \c availability_size).
2889  *
2890  * Note that the client is responsible for calling
2891  * \c clang_disposeCXPlatformAvailability to free each of the
2892  * platform-availability structures returned. There are
2893  * \c min(N, availability_size) such structures.
2894  */
2895 CINDEX_LINKAGE int
2897  int *always_deprecated,
2898  CXString *deprecated_message,
2899  int *always_unavailable,
2900  CXString *unavailable_message,
2901  CXPlatformAvailability *availability,
2902  int availability_size);
2903 
2904 /**
2905  * Free the memory associated with a \c CXPlatformAvailability structure.
2906  */
2907 CINDEX_LINKAGE void
2909 
2910 /**
2911  * Describe the "language" of the entity referred to by a cursor.
2912  */
2918 };
2919 
2920 /**
2921  * Determine the "language" of the entity referred to by a given cursor.
2922  */
2924 
2925 /**
2926  * Describe the "thread-local storage (TLS) kind" of the declaration
2927  * referred to by a cursor.
2928  */
2933 };
2934 
2935 /**
2936  * Determine the "thread-local storage (TLS) kind" of the declaration
2937  * referred to by a cursor.
2938  */
2940 
2941 /**
2942  * Returns the translation unit that a cursor originated from.
2943  */
2945 
2946 /**
2947  * A fast container representing a set of CXCursors.
2948  */
2949 typedef struct CXCursorSetImpl *CXCursorSet;
2950 
2951 /**
2952  * Creates an empty CXCursorSet.
2953  */
2954 CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void);
2955 
2956 /**
2957  * Disposes a CXCursorSet and releases its associated memory.
2958  */
2959 CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset);
2960 
2961 /**
2962  * Queries a CXCursorSet to see if it contains a specific CXCursor.
2963  *
2964  * \returns non-zero if the set contains the specified cursor.
2965 */
2966 CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset,
2967  CXCursor cursor);
2968 
2969 /**
2970  * Inserts a CXCursor into a CXCursorSet.
2971  *
2972  * \returns zero if the CXCursor was already in the set, and non-zero otherwise.
2973 */
2974 CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,
2975  CXCursor cursor);
2976 
2977 /**
2978  * Determine the semantic parent of the given cursor.
2979  *
2980  * The semantic parent of a cursor is the cursor that semantically contains
2981  * the given \p cursor. For many declarations, the lexical and semantic parents
2982  * are equivalent (the lexical parent is returned by
2983  * \c clang_getCursorLexicalParent()). They diverge when declarations or
2984  * definitions are provided out-of-line. For example:
2985  *
2986  * \code
2987  * class C {
2988  * void f();
2989  * };
2990  *
2991  * void C::f() { }
2992  * \endcode
2993  *
2994  * In the out-of-line definition of \c C::f, the semantic parent is
2995  * the class \c C, of which this function is a member. The lexical parent is
2996  * the place where the declaration actually occurs in the source code; in this
2997  * case, the definition occurs in the translation unit. In general, the
2998  * lexical parent for a given entity can change without affecting the semantics
2999  * of the program, and the lexical parent of different declarations of the
3000  * same entity may be different. Changing the semantic parent of a declaration,
3001  * on the other hand, can have a major impact on semantics, and redeclarations
3002  * of a particular entity should all have the same semantic context.
3003  *
3004  * In the example above, both declarations of \c C::f have \c C as their
3005  * semantic context, while the lexical context of the first \c C::f is \c C
3006  * and the lexical context of the second \c C::f is the translation unit.
3007  *
3008  * For global declarations, the semantic parent is the translation unit.
3009  */
3011 
3012 /**
3013  * Determine the lexical parent of the given cursor.
3014  *
3015  * The lexical parent of a cursor is the cursor in which the given \p cursor
3016  * was actually written. For many declarations, the lexical and semantic parents
3017  * are equivalent (the semantic parent is returned by
3018  * \c clang_getCursorSemanticParent()). They diverge when declarations or
3019  * definitions are provided out-of-line. For example:
3020  *
3021  * \code
3022  * class C {
3023  * void f();
3024  * };
3025  *
3026  * void C::f() { }
3027  * \endcode
3028  *
3029  * In the out-of-line definition of \c C::f, the semantic parent is
3030  * the class \c C, of which this function is a member. The lexical parent is
3031  * the place where the declaration actually occurs in the source code; in this
3032  * case, the definition occurs in the translation unit. In general, the
3033  * lexical parent for a given entity can change without affecting the semantics
3034  * of the program, and the lexical parent of different declarations of the
3035  * same entity may be different. Changing the semantic parent of a declaration,
3036  * on the other hand, can have a major impact on semantics, and redeclarations
3037  * of a particular entity should all have the same semantic context.
3038  *
3039  * In the example above, both declarations of \c C::f have \c C as their
3040  * semantic context, while the lexical context of the first \c C::f is \c C
3041  * and the lexical context of the second \c C::f is the translation unit.
3042  *
3043  * For declarations written in the global scope, the lexical parent is
3044  * the translation unit.
3045  */
3047 
3048 /**
3049  * Determine the set of methods that are overridden by the given
3050  * method.
3051  *
3052  * In both Objective-C and C++, a method (aka virtual member function,
3053  * in C++) can override a virtual method in a base class. For
3054  * Objective-C, a method is said to override any method in the class's
3055  * base class, its protocols, or its categories' protocols, that has the same
3056  * selector and is of the same kind (class or instance).
3057  * If no such method exists, the search continues to the class's superclass,
3058  * its protocols, and its categories, and so on. A method from an Objective-C
3059  * implementation is considered to override the same methods as its
3060  * corresponding method in the interface.
3061  *
3062  * For C++, a virtual member function overrides any virtual member
3063  * function with the same signature that occurs in its base
3064  * classes. With multiple inheritance, a virtual member function can
3065  * override several virtual member functions coming from different
3066  * base classes.
3067  *
3068  * In all cases, this function determines the immediate overridden
3069  * method, rather than all of the overridden methods. For example, if
3070  * a method is originally declared in a class A, then overridden in B
3071  * (which in inherits from A) and also in C (which inherited from B),
3072  * then the only overridden method returned from this function when
3073  * invoked on C's method will be B's method. The client may then
3074  * invoke this function again, given the previously-found overridden
3075  * methods, to map out the complete method-override set.
3076  *
3077  * \param cursor A cursor representing an Objective-C or C++
3078  * method. This routine will compute the set of methods that this
3079  * method overrides.
3080  *
3081  * \param overridden A pointer whose pointee will be replaced with a
3082  * pointer to an array of cursors, representing the set of overridden
3083  * methods. If there are no overridden methods, the pointee will be
3084  * set to NULL. The pointee must be freed via a call to
3085  * \c clang_disposeOverriddenCursors().
3086  *
3087  * \param num_overridden A pointer to the number of overridden
3088  * functions, will be set to the number of overridden functions in the
3089  * array pointed to by \p overridden.
3090  */
3092  CXCursor **overridden,
3093  unsigned *num_overridden);
3094 
3095 /**
3096  * Free the set of overridden cursors returned by \c
3097  * clang_getOverriddenCursors().
3098  */
3100 
3101 /**
3102  * Retrieve the file that is included by the given inclusion directive
3103  * cursor.
3104  */
3106 
3107 /**
3108  * @}
3109  */
3110 
3111 /**
3112  * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code
3113  *
3114  * Cursors represent a location within the Abstract Syntax Tree (AST). These
3115  * routines help map between cursors and the physical locations where the
3116  * described entities occur in the source code. The mapping is provided in
3117  * both directions, so one can map from source code to the AST and back.
3118  *
3119  * @{
3120  */
3121 
3122 /**
3123  * Map a source location to the cursor that describes the entity at that
3124  * location in the source code.
3125  *
3126  * clang_getCursor() maps an arbitrary source location within a translation
3127  * unit down to the most specific cursor that describes the entity at that
3128  * location. For example, given an expression \c x + y, invoking
3129  * clang_getCursor() with a source location pointing to "x" will return the
3130  * cursor for "x"; similarly for "y". If the cursor points anywhere between
3131  * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
3132  * will return a cursor referring to the "+" expression.
3133  *
3134  * \returns a cursor representing the entity at the given source location, or
3135  * a NULL cursor if no such entity can be found.
3136  */
3138 
3139 /**
3140  * Retrieve the physical location of the source constructor referenced
3141  * by the given cursor.
3142  *
3143  * The location of a declaration is typically the location of the name of that
3144  * declaration, where the name of that declaration would occur if it is
3145  * unnamed, or some keyword that introduces that particular declaration.
3146  * The location of a reference is where that reference occurs within the
3147  * source code.
3148  */
3150 
3151 /**
3152  * Retrieve the physical extent of the source construct referenced by
3153  * the given cursor.
3154  *
3155  * The extent of a cursor starts with the file/line/column pointing at the
3156  * first character within the source construct that the cursor refers to and
3157  * ends with the last character within that source construct. For a
3158  * declaration, the extent covers the declaration itself. For a reference,
3159  * the extent covers the location of the reference (e.g., where the referenced
3160  * entity was actually used).
3161  */
3163 
3164 /**
3165  * @}
3166  */
3167 
3168 /**
3169  * \defgroup CINDEX_TYPES Type information for CXCursors
3170  *
3171  * @{
3172  */
3173 
3174 /**
3175  * Describes the kind of type
3176  */
3178  /**
3179  * Represents an invalid type (e.g., where no type is available).
3180  */
3182 
3183  /**
3184  * A type whose specific kind is not exposed via this
3185  * interface.
3186  */
3188 
3189  /* Builtin types */
3229 
3249 
3250  /**
3251  * Represents a type that was referred to using an elaborated type keyword.
3252  *
3253  * E.g., struct S, or via a qualified name, e.g., N::M::type, or both.
3254  */
3256 
3257  /* OpenCL PipeType. */
3259 
3260  /* OpenCL builtin types. */
3301 
3305 
3317 
3319 
3321 };
3322 
3323 /**
3324  * Describes the calling convention of a function type
3325  */
3338  /* Alias for compatibility with older versions of API. */
3346 
3349 };
3350 
3351 /**
3352  * The type of an element in the abstract syntax tree.
3353  *
3354  */
3355 typedef struct {
3357  void *data[2];
3358 } CXType;
3359 
3360 /**
3361  * Retrieve the type of a CXCursor (if any).
3362  */
3364 
3365 /**
3366  * Pretty-print the underlying type using the rules of the
3367  * language of the translation unit from which it came.
3368  *
3369  * If the type is invalid, an empty string is returned.
3370  */
3372 
3373 /**
3374  * Retrieve the underlying type of a typedef declaration.
3375  *
3376  * If the cursor does not reference a typedef declaration, an invalid type is
3377  * returned.
3378  */
3380 
3381 /**
3382  * Retrieve the integer type of an enum declaration.
3383  *
3384  * If the cursor does not reference an enum declaration, an invalid type is
3385  * returned.
3386  */
3388 
3389 /**
3390  * Retrieve the integer value of an enum constant declaration as a signed
3391  * long long.
3392  *
3393  * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned.
3394  * Since this is also potentially a valid constant value, the kind of the cursor
3395  * must be verified before calling this function.
3396  */
3398 
3399 /**
3400  * Retrieve the integer value of an enum constant declaration as an unsigned
3401  * long long.
3402  *
3403  * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned.
3404  * Since this is also potentially a valid constant value, the kind of the cursor
3405  * must be verified before calling this function.
3406  */
3408 
3409 /**
3410  * Retrieve the bit width of a bit field declaration as an integer.
3411  *
3412  * If a cursor that is not a bit field declaration is passed in, -1 is returned.
3413  */
3415 
3416 /**
3417  * Retrieve the number of non-variadic arguments associated with a given
3418  * cursor.
3419  *
3420  * The number of arguments can be determined for calls as well as for
3421  * declarations of functions or methods. For other cursors -1 is returned.
3422  */
3424 
3425 /**
3426  * Retrieve the argument cursor of a function or method.
3427  *
3428  * The argument cursor can be determined for calls as well as for declarations
3429  * of functions or methods. For other cursors and for invalid indices, an
3430  * invalid cursor is returned.
3431  */
3433 
3434 /**
3435  * Describes the kind of a template argument.
3436  *
3437  * See the definition of llvm::clang::TemplateArgument::ArgKind for full
3438  * element descriptions.
3439  */
3450  /* Indicates an error case, preventing the kind from being deduced. */
3452 };
3453 
3454 /**
3455  *Returns the number of template args of a function decl representing a
3456  * template specialization.
3457  *
3458  * If the argument cursor cannot be converted into a template function
3459  * declaration, -1 is returned.
3460  *
3461  * For example, for the following declaration and specialization:
3462  * template <typename T, int kInt, bool kBool>
3463  * void foo() { ... }
3464  *
3465  * template <>
3466  * void foo<float, -7, true>();
3467  *
3468  * The value 3 would be returned from this call.
3469  */
3471 
3472 /**
3473  * Retrieve the kind of the I'th template argument of the CXCursor C.
3474  *
3475  * If the argument CXCursor does not represent a FunctionDecl, an invalid
3476  * template argument kind is returned.
3477  *
3478  * For example, for the following declaration and specialization:
3479  * template <typename T, int kInt, bool kBool>
3480  * void foo() { ... }
3481  *
3482  * template <>
3483  * void foo<float, -7, true>();
3484  *
3485  * For I = 0, 1, and 2, Type, Integral, and Integral will be returned,
3486  * respectively.
3487  */
3489  CXCursor C, unsigned I);
3490 
3491 /**
3492  * Retrieve a CXType representing the type of a TemplateArgument of a
3493  * function decl representing a template specialization.
3494  *
3495  * If the argument CXCursor does not represent a FunctionDecl whose I'th
3496  * template argument has a kind of CXTemplateArgKind_Integral, an invalid type
3497  * is returned.
3498  *
3499  * For example, for the following declaration and specialization:
3500  * template <typename T, int kInt, bool kBool>
3501  * void foo() { ... }
3502  *
3503  * template <>
3504  * void foo<float, -7, true>();
3505  *
3506  * If called with I = 0, "float", will be returned.
3507  * Invalid types will be returned for I == 1 or 2.
3508  */
3510  unsigned I);
3511 
3512 /**
3513  * Retrieve the value of an Integral TemplateArgument (of a function
3514  * decl representing a template specialization) as a signed long long.
3515  *
3516  * It is undefined to call this function on a CXCursor that does not represent a
3517  * FunctionDecl or whose I'th template argument is not an integral value.
3518  *
3519  * For example, for the following declaration and specialization:
3520  * template <typename T, int kInt, bool kBool>
3521  * void foo() { ... }
3522  *
3523  * template <>
3524  * void foo<float, -7, true>();
3525  *
3526  * If called with I = 1 or 2, -7 or true will be returned, respectively.
3527  * For I == 0, this function's behavior is undefined.
3528  */
3530  unsigned I);
3531 
3532 /**
3533  * Retrieve the value of an Integral TemplateArgument (of a function
3534  * decl representing a template specialization) as an unsigned long long.
3535  *
3536  * It is undefined to call this function on a CXCursor that does not represent a
3537  * FunctionDecl or whose I'th template argument is not an integral value.
3538  *
3539  * For example, for the following declaration and specialization:
3540  * template <typename T, int kInt, bool kBool>
3541  * void foo() { ... }
3542  *
3543  * template <>
3544  * void foo<float, 2147483649, true>();
3545  *
3546  * If called with I = 1 or 2, 2147483649 or true will be returned, respectively.
3547  * For I == 0, this function's behavior is undefined.
3548  */
3550  CXCursor C, unsigned I);
3551 
3552 /**
3553  * Determine whether two CXTypes represent the same type.
3554  *
3555  * \returns non-zero if the CXTypes represent the same type and
3556  * zero otherwise.
3557  */
3559 
3560 /**
3561  * Return the canonical type for a CXType.
3562  *
3563  * Clang's type system explicitly models typedefs and all the ways
3564  * a specific type can be represented. The canonical type is the underlying
3565  * type with all the "sugar" removed. For example, if 'T' is a typedef
3566  * for 'int', the canonical type for 'T' would be 'int'.
3567  */
3569 
3570 /**
3571  * Determine whether a CXType has the "const" qualifier set,
3572  * without looking through typedefs that may have added "const" at a
3573  * different level.
3574  */
3576 
3577 /**
3578  * Determine whether a CXCursor that is a macro, is
3579  * function like.
3580  */
3582 
3583 /**
3584  * Determine whether a CXCursor that is a macro, is a
3585  * builtin one.
3586  */
3588 
3589 /**
3590  * Determine whether a CXCursor that is a function declaration, is an
3591  * inline declaration.
3592  */
3594 
3595 /**
3596  * Determine whether a CXType has the "volatile" qualifier set,
3597  * without looking through typedefs that may have added "volatile" at
3598  * a different level.
3599  */
3601 
3602 /**
3603  * Determine whether a CXType has the "restrict" qualifier set,
3604  * without looking through typedefs that may have added "restrict" at a
3605  * different level.
3606  */
3608 
3609 /**
3610  * Returns the address space of the given type.
3611  */
3613 
3614 /**
3615  * Returns the typedef name of the given type.
3616  */
3618 
3619 /**
3620  * For pointer types, returns the type of the pointee.
3621  */
3623 
3624 /**
3625  * Return the cursor for the declaration of the given type.
3626  */
3628 
3629 /**
3630  * Returns the Objective-C type encoding for the specified declaration.
3631  */
3633 
3634 /**
3635  * Returns the Objective-C type encoding for the specified CXType.
3636  */
3638 
3639 /**
3640  * Retrieve the spelling of a given CXTypeKind.
3641  */
3643 
3644 /**
3645  * Retrieve the calling convention associated with a function type.
3646  *
3647  * If a non-function type is passed in, CXCallingConv_Invalid is returned.
3648  */
3650 
3651 /**
3652  * Retrieve the return type associated with a function type.
3653  *
3654  * If a non-function type is passed in, an invalid type is returned.
3655  */
3657 
3658 /**
3659  * Retrieve the exception specification type associated with a function type.
3660  * This is a value of type CXCursor_ExceptionSpecificationKind.
3661  *
3662  * If a non-function type is passed in, an error code of -1 is returned.
3663  */
3665 
3666 /**
3667  * Retrieve the number of non-variadic parameters associated with a
3668  * function type.
3669  *
3670  * If a non-function type is passed in, -1 is returned.
3671  */
3673 
3674 /**
3675  * Retrieve the type of a parameter of a function type.
3676  *
3677  * If a non-function type is passed in or the function does not have enough
3678  * parameters, an invalid type is returned.
3679  */
3681 
3682 /**
3683  * Retrieves the base type of the ObjCObjectType.
3684  *
3685  * If the type is not an ObjC object, an invalid type is returned.
3686  */
3688 
3689 /**
3690  * Retrieve the number of protocol references associated with an ObjC object/id.
3691  *
3692  * If the type is not an ObjC object, 0 is returned.
3693  */
3695 
3696 /**
3697  * Retrieve the decl for a protocol reference for an ObjC object/id.
3698  *
3699  * If the type is not an ObjC object or there are not enough protocol
3700  * references, an invalid cursor is returned.
3701  */
3703 
3704 /**
3705  * Retreive the number of type arguments associated with an ObjC object.
3706  *
3707  * If the type is not an ObjC object, 0 is returned.
3708  */
3710 
3711 /**
3712  * Retrieve a type argument associated with an ObjC object.
3713  *
3714  * If the type is not an ObjC or the index is not valid,
3715  * an invalid type is returned.
3716  */
3718 
3719 /**
3720  * Return 1 if the CXType is a variadic function type, and 0 otherwise.
3721  */
3723 
3724 /**
3725  * Retrieve the return type associated with a given cursor.
3726  *
3727  * This only returns a valid type if the cursor refers to a function or method.
3728  */
3730 
3731 /**
3732  * Retrieve the exception specification type associated with a given cursor.
3733  * This is a value of type CXCursor_ExceptionSpecificationKind.
3734  *
3735  * This only returns a valid result if the cursor refers to a function or method.
3736  */
3738 
3739 /**
3740  * Return 1 if the CXType is a POD (plain old data) type, and 0
3741  * otherwise.
3742  */
3744 
3745 /**
3746  * Return the element type of an array, complex, or vector type.
3747  *
3748  * If a type is passed in that is not an array, complex, or vector type,
3749  * an invalid type is returned.
3750  */
3752 
3753 /**
3754  * Return the number of elements of an array or vector type.
3755  *
3756  * If a type is passed in that is not an array or vector type,
3757  * -1 is returned.
3758  */
3760 
3761 /**
3762  * Return the element type of an array type.
3763  *
3764  * If a non-array type is passed in, an invalid type is returned.
3765  */
3767 
3768 /**
3769  * Return the array size of a constant array.
3770  *
3771  * If a non-array type is passed in, -1 is returned.
3772  */
3774 
3775 /**
3776  * Retrieve the type named by the qualified-id.
3777  *
3778  * If a non-elaborated type is passed in, an invalid type is returned.
3779  */
3781 
3782 /**
3783  * Determine if a typedef is 'transparent' tag.
3784  *
3785  * A typedef is considered 'transparent' if it shares a name and spelling
3786  * location with its underlying tag type, as is the case with the NS_ENUM macro.
3787  *
3788  * \returns non-zero if transparent and zero otherwise.
3789  */
3791 
3793  /**
3794  * Values of this type can never be null.
3795  */
3797  /**
3798  * Values of this type can be null.
3799  */
3801  /**
3802  * Whether values of this type can be null is (explicitly)
3803  * unspecified. This captures a (fairly rare) case where we
3804  * can't conclude anything about the nullability of the type even
3805  * though it has been considered.
3806  */
3808  /**
3809  * Nullability is not applicable to this type.
3810  */
3812 };
3813 
3814 /**
3815  * Retrieve the nullability kind of a pointer type.
3816  */
3818 
3819 /**
3820  * List the possible error codes for \c clang_Type_getSizeOf,
3821  * \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
3822  * \c clang_Cursor_getOffsetOf.
3823  *
3824  * A value of this enumeration type can be returned if the target type is not
3825  * a valid argument to sizeof, alignof or offsetof.
3826  */
3828  /**
3829  * Type is of kind CXType_Invalid.
3830  */
3832  /**
3833  * The type is an incomplete Type.
3834  */
3836  /**
3837  * The type is a dependent Type.
3838  */
3840  /**
3841  * The type is not a constant size type.
3842  */
3844  /**
3845  * The Field name is not valid for this record.
3846  */
3848  /**
3849  * The type is undeduced.
3850  */
3852 };
3853 
3854 /**
3855  * Return the alignment of a type in bytes as per C++[expr.alignof]
3856  * standard.
3857  *
3858  * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
3859  * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
3860  * is returned.
3861  * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
3862  * returned.
3863  * If the type declaration is not a constant size type,
3864  * CXTypeLayoutError_NotConstantSize is returned.
3865  */
3867 
3868 /**
3869  * Return the class type of an member pointer type.
3870  *
3871  * If a non-member-pointer type is passed in, an invalid type is returned.
3872  */
3874 
3875 /**
3876  * Return the size of a type in bytes as per C++[expr.sizeof] standard.
3877  *
3878  * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
3879  * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
3880  * is returned.
3881  * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
3882  * returned.
3883  */
3885 
3886 /**
3887  * Return the offset of a field named S in a record of type T in bits
3888  * as it would be returned by __offsetof__ as per C++11[18.2p4]
3889  *
3890  * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid
3891  * is returned.
3892  * If the field's type declaration is an incomplete type,
3893  * CXTypeLayoutError_Incomplete is returned.
3894  * If the field's type declaration is a dependent type,
3895  * CXTypeLayoutError_Dependent is returned.
3896  * If the field's name S is not found,
3897  * CXTypeLayoutError_InvalidFieldName is returned.
3898  */
3899 CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S);
3900 
3901 /**
3902  * Return the type that was modified by this attributed type.
3903  *
3904  * If the type is not an attributed type, an invalid type is returned.
3905  */
3907 
3908 /**
3909  * Return the offset of the field represented by the Cursor.
3910  *
3911  * If the cursor is not a field declaration, -1 is returned.
3912  * If the cursor semantic parent is not a record field declaration,
3913  * CXTypeLayoutError_Invalid is returned.
3914  * If the field's type declaration is an incomplete type,
3915  * CXTypeLayoutError_Incomplete is returned.
3916  * If the field's type declaration is a dependent type,
3917  * CXTypeLayoutError_Dependent is returned.
3918  * If the field's name S is not found,
3919  * CXTypeLayoutError_InvalidFieldName is returned.
3920  */
3922 
3923 /**
3924  * Determine whether the given cursor represents an anonymous
3925  * tag or namespace
3926  */
3928 
3929 /**
3930  * Determine whether the given cursor represents an anonymous record
3931  * declaration.
3932  */
3934 
3935 /**
3936  * Determine whether the given cursor represents an inline namespace
3937  * declaration.
3938  */
3940 
3942  /** No ref-qualifier was provided. */
3944  /** An lvalue ref-qualifier was provided (\c &). */
3946  /** An rvalue ref-qualifier was provided (\c &&). */
3948 };
3949 
3950 /**
3951  * Returns the number of template arguments for given template
3952  * specialization, or -1 if type \c T is not a template specialization.
3953  */
3955 
3956 /**
3957  * Returns the type template argument of a template class specialization
3958  * at given index.
3959  *
3960  * This function only returns template type arguments and does not handle
3961  * template template arguments or variadic packs.
3962  */
3964 
3965 /**
3966  * Retrieve the ref-qualifier kind of a function or method.
3967  *
3968  * The ref-qualifier is returned for C++ functions or methods. For other types
3969  * or non-C++ declarations, CXRefQualifier_None is returned.
3970  */
3972 
3973 /**
3974  * Returns non-zero if the cursor specifies a Record member that is a
3975  * bitfield.
3976  */
3978 
3979 /**
3980  * Returns 1 if the base class specified by the cursor with kind
3981  * CX_CXXBaseSpecifier is virtual.
3982  */
3984 
3985 /**
3986  * Represents the C++ access control level to a base class for a
3987  * cursor with kind CX_CXXBaseSpecifier.
3988  */
3994 };
3995 
3996 /**
3997  * Returns the access control level for the referenced object.
3998  *
3999  * If the cursor refers to a C++ declaration, its access control level within its
4000  * parent scope is returned. Otherwise, if the cursor refers to a base specifier or
4001  * access specifier, the specifier itself is returned.
4002  */
4004 
4005 /**
4006  * Represents the storage classes as declared in the source. CX_SC_Invalid
4007  * was added for the case that the passed cursor in not a declaration.
4008  */
4018 };
4019 
4020 /**
4021  * Returns the storage class for a function or variable declaration.
4022  *
4023  * If the passed in Cursor is not a function or variable declaration,
4024  * CX_SC_Invalid is returned else the storage class.
4025  */
4027 
4028 /**
4029  * Determine the number of overloaded declarations referenced by a
4030  * \c CXCursor_OverloadedDeclRef cursor.
4031  *
4032  * \param cursor The cursor whose overloaded declarations are being queried.
4033  *
4034  * \returns The number of overloaded declarations referenced by \c cursor. If it
4035  * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
4036  */
4038 
4039 /**
4040  * Retrieve a cursor for one of the overloaded declarations referenced
4041  * by a \c CXCursor_OverloadedDeclRef cursor.
4042  *
4043  * \param cursor The cursor whose overloaded declarations are being queried.
4044  *
4045  * \param index The zero-based index into the set of overloaded declarations in
4046  * the cursor.
4047  *
4048  * \returns A cursor representing the declaration referenced by the given
4049  * \c cursor at the specified \c index. If the cursor does not have an
4050  * associated set of overloaded declarations, or if the index is out of bounds,
4051  * returns \c clang_getNullCursor();
4052  */
4054  unsigned index);
4055 
4056 /**
4057  * @}
4058  */
4059 
4060 /**
4061  * \defgroup CINDEX_ATTRIBUTES Information for attributes
4062  *
4063  * @{
4064  */
4065 
4066 /**
4067  * For cursors representing an iboutletcollection attribute,
4068  * this function returns the collection element type.
4069  *
4070  */
4072 
4073 /**
4074  * @}
4075  */
4076 
4077 /**
4078  * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors
4079  *
4080  * These routines provide the ability to traverse the abstract syntax tree
4081  * using cursors.
4082  *
4083  * @{
4084  */
4085 
4086 /**
4087  * Describes how the traversal of the children of a particular
4088  * cursor should proceed after visiting a particular child cursor.
4089  *
4090  * A value of this enumeration type should be returned by each
4091  * \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
4092  */
4094  /**
4095  * Terminates the cursor traversal.
4096  */
4098  /**
4099  * Continues the cursor traversal with the next sibling of
4100  * the cursor just visited, without visiting its children.
4101  */
4103  /**
4104  * Recursively traverse the children of this cursor, using
4105  * the same visitor and client data.
4106  */
4108 };
4109 
4110 /**
4111  * Visitor invoked for each cursor found by a traversal.
4112  *
4113  * This visitor function will be invoked for each cursor found by
4114  * clang_visitCursorChildren(). Its first argument is the cursor being
4115  * visited, its second argument is the parent visitor for that cursor,
4116  * and its third argument is the client data provided to
4117  * clang_visitCursorChildren().
4118  *
4119  * The visitor should return one of the \c CXChildVisitResult values
4120  * to direct clang_visitCursorChildren().
4121  */
4123  CXCursor parent,
4124  CXClientData client_data);
4125 
4126 /**
4127  * Visit the children of a particular cursor.
4128  *
4129  * This function visits all the direct children of the given cursor,
4130  * invoking the given \p visitor function with the cursors of each
4131  * visited child. The traversal may be recursive, if the visitor returns
4132  * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
4133  * the visitor returns \c CXChildVisit_Break.
4134  *
4135  * \param parent the cursor whose child may be visited. All kinds of
4136  * cursors can be visited, including invalid cursors (which, by
4137  * definition, have no children).
4138  *
4139  * \param visitor the visitor function that will be invoked for each
4140  * child of \p parent.
4141  *
4142  * \param client_data pointer data supplied by the client, which will
4143  * be passed to the visitor each time it is invoked.
4144  *
4145  * \returns a non-zero value if the traversal was terminated
4146  * prematurely by the visitor returning \c CXChildVisit_Break.
4147  */
4149  CXCursorVisitor visitor,
4150  CXClientData client_data);
4151 #ifdef __has_feature
4152 # if __has_feature(blocks)
4153 /**
4154  * Visitor invoked for each cursor found by a traversal.
4155  *
4156  * This visitor block will be invoked for each cursor found by
4157  * clang_visitChildrenWithBlock(). Its first argument is the cursor being
4158  * visited, its second argument is the parent visitor for that cursor.
4159  *
4160  * The visitor should return one of the \c CXChildVisitResult values
4161  * to direct clang_visitChildrenWithBlock().
4162  */
4163 typedef enum CXChildVisitResult
4164  (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent);
4165 
4166 /**
4167  * Visits the children of a cursor using the specified block. Behaves
4168  * identically to clang_visitChildren() in all other respects.
4169  */
4170 CINDEX_LINKAGE unsigned clang_visitChildrenWithBlock(CXCursor parent,
4171  CXCursorVisitorBlock block);
4172 # endif
4173 #endif
4174 
4175 /**
4176  * @}
4177  */
4178 
4179 /**
4180  * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST
4181  *
4182  * These routines provide the ability to determine references within and
4183  * across translation units, by providing the names of the entities referenced
4184  * by cursors, follow reference cursors to the declarations they reference,
4185  * and associate declarations with their definitions.
4186  *
4187  * @{
4188  */
4189 
4190 /**
4191  * Retrieve a Unified Symbol Resolution (USR) for the entity referenced
4192  * by the given cursor.
4193  *
4194  * A Unified Symbol Resolution (USR) is a string that identifies a particular
4195  * entity (function, class, variable, etc.) within a program. USRs can be
4196  * compared across translation units to determine, e.g., when references in
4197  * one translation refer to an entity defined in another translation unit.
4198  */
4200 
4201 /**
4202  * Construct a USR for a specified Objective-C class.
4203  */
4204 CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);
4205 
4206 /**
4207  * Construct a USR for a specified Objective-C category.
4208  */
4210  clang_constructUSR_ObjCCategory(const char *class_name,
4211  const char *category_name);
4212 
4213 /**
4214  * Construct a USR for a specified Objective-C protocol.
4215  */
4217  clang_constructUSR_ObjCProtocol(const char *protocol_name);
4218 
4219 /**
4220  * Construct a USR for a specified Objective-C instance variable and
4221  * the USR for its containing class.
4222  */
4224  CXString classUSR);
4225 
4226 /**
4227  * Construct a USR for a specified Objective-C method and
4228  * the USR for its containing class.
4229  */
4231  unsigned isInstanceMethod,
4232  CXString classUSR);
4233 
4234 /**
4235  * Construct a USR for a specified Objective-C property and the USR
4236  * for its containing class.
4237  */
4239  CXString classUSR);
4240 
4241 /**
4242  * Retrieve a name for the entity referenced by this cursor.
4243  */
4245 
4246 /**
4247  * Retrieve a range for a piece that forms the cursors spelling name.
4248  * Most of the times there is only one range for the complete spelling but for
4249  * Objective-C methods and Objective-C message expressions, there are multiple
4250  * pieces for each selector identifier.
4251  *
4252  * \param pieceIndex the index of the spelling name piece. If this is greater
4253  * than the actual number of pieces, it will return a NULL (invalid) range.
4254  *
4255  * \param options Reserved.
4256  */
4258  unsigned pieceIndex,
4259  unsigned options);
4260 
4261 /**
4262  * Opaque pointer representing a policy that controls pretty printing
4263  * for \c clang_getCursorPrettyPrinted.
4264  */
4265 typedef void *CXPrintingPolicy;
4266 
4267 /**
4268  * Properties for the printing policy.
4269  *
4270  * See \c clang::PrintingPolicy for more information.
4271  */
4299 
4301 };
4302 
4303 /**
4304  * Get a property value for the given printing policy.
4305  */
4306 CINDEX_LINKAGE unsigned
4307 clang_PrintingPolicy_getProperty(CXPrintingPolicy Policy,
4308  enum CXPrintingPolicyProperty Property);
4309 
4310 /**
4311  * Set a property value for the given printing policy.
4312  */
4313 CINDEX_LINKAGE void clang_PrintingPolicy_setProperty(CXPrintingPolicy Policy,
4314  enum CXPrintingPolicyProperty Property,
4315  unsigned Value);
4316 
4317 /**
4318  * Retrieve the default policy for the cursor.
4319  *
4320  * The policy should be released after use with \c
4321  * clang_PrintingPolicy_dispose.
4322  */
4324 
4325 /**
4326  * Release a printing policy.
4327  */
4328 CINDEX_LINKAGE void clang_PrintingPolicy_dispose(CXPrintingPolicy Policy);
4329 
4330 /**
4331  * Pretty print declarations.
4332  *
4333  * \param Cursor The cursor representing a declaration.
4334  *
4335  * \param Policy The policy to control the entities being printed. If
4336  * NULL, a default policy is used.
4337  *
4338  * \returns The pretty printed declaration or the empty string for
4339  * other cursors.
4340  */
4342  CXPrintingPolicy Policy);
4343 
4344 /**
4345  * Retrieve the display name for the entity referenced by this cursor.
4346  *
4347  * The display name contains extra information that helps identify the cursor,
4348  * such as the parameters of a function or template or the arguments of a
4349  * class template specialization.
4350  */
4352 
4353 /** For a cursor that is a reference, retrieve a cursor representing the
4354  * entity that it references.
4355  *
4356  * Reference cursors refer to other entities in the AST. For example, an
4357  * Objective-C superclass reference cursor refers to an Objective-C class.
4358  * This function produces the cursor for the Objective-C class from the
4359  * cursor for the superclass reference. If the input cursor is a declaration or
4360  * definition, it returns that declaration or definition unchanged.
4361  * Otherwise, returns the NULL cursor.
4362  */
4364 
4365 /**
4366  * For a cursor that is either a reference to or a declaration
4367  * of some entity, retrieve a cursor that describes the definition of
4368  * that entity.
4369  *
4370  * Some entities can be declared multiple times within a translation
4371  * unit, but only one of those declarations can also be a
4372  * definition. For example, given:
4373  *
4374  * \code
4375  * int f(int, int);
4376  * int g(int x, int y) { return f(x, y); }
4377  * int f(int a, int b) { return a + b; }
4378  * int f(int, int);
4379  * \endcode
4380  *
4381  * there are three declarations of the function "f", but only the
4382  * second one is a definition. The clang_getCursorDefinition()
4383  * function will take any cursor pointing to a declaration of "f"
4384  * (the first or fourth lines of the example) or a cursor referenced
4385  * that uses "f" (the call to "f' inside "g") and will return a
4386  * declaration cursor pointing to the definition (the second "f"
4387  * declaration).
4388  *
4389  * If given a cursor for which there is no corresponding definition,
4390  * e.g., because there is no definition of that entity within this
4391  * translation unit, returns a NULL cursor.
4392  */
4394 
4395 /**
4396  * Determine whether the declaration pointed to by this cursor
4397  * is also a definition of that entity.
4398  */
4400 
4401 /**
4402  * Retrieve the canonical cursor corresponding to the given cursor.
4403  *
4404  * In the C family of languages, many kinds of entities can be declared several
4405  * times within a single translation unit. For example, a structure type can
4406  * be forward-declared (possibly multiple times) and later defined:
4407  *
4408  * \code
4409  * struct X;
4410  * struct X;
4411  * struct X {
4412  * int member;
4413  * };
4414  * \endcode
4415  *
4416  * The declarations and the definition of \c X are represented by three
4417  * different cursors, all of which are declarations of the same underlying
4418  * entity. One of these cursor is considered the "canonical" cursor, which
4419  * is effectively the representative for the underlying entity. One can
4420  * determine if two cursors are declarations of the same underlying entity by
4421  * comparing their canonical cursors.
4422  *
4423  * \returns The canonical cursor for the entity referred to by the given cursor.
4424  */
4426 
4427 /**
4428  * If the cursor points to a selector identifier in an Objective-C
4429  * method or message expression, this returns the selector index.
4430  *
4431  * After getting a cursor with #clang_getCursor, this can be called to
4432  * determine if the location points to a selector identifier.
4433  *
4434  * \returns The selector index if the cursor is an Objective-C method or message
4435  * expression and the cursor is pointing to a selector identifier, or -1
4436  * otherwise.
4437  */
4439 
4440 /**
4441  * Given a cursor pointing to a C++ method call or an Objective-C
4442  * message, returns non-zero if the method/message is "dynamic", meaning:
4443  *
4444  * For a C++ method: the call is virtual.
4445  * For an Objective-C message: the receiver is an object instance, not 'super'
4446  * or a specific class.
4447  *
4448  * If the method/message is "static" or the cursor does not point to a
4449  * method/message, it will return zero.
4450  */
4452 
4453 /**
4454  * Given a cursor pointing to an Objective-C message or property
4455  * reference, or C++ method call, returns the CXType of the receiver.
4456  */
4458 
4459 /**
4460  * Property attributes for a \c CXCursor_ObjCPropertyDecl.
4461  */
4462 typedef enum {
4478 
4479 /**
4480  * Given a cursor that represents a property declaration, return the
4481  * associated property attributes. The bits are formed from
4482  * \c CXObjCPropertyAttrKind.
4483  *
4484  * \param reserved Reserved for future use, pass 0.
4485  */
4487  unsigned reserved);
4488 
4489 /**
4490  * Given a cursor that represents a property declaration, return the
4491  * name of the method that implements the getter.
4492  */
4494 
4495 /**
4496  * Given a cursor that represents a property declaration, return the
4497  * name of the method that implements the setter, if any.
4498  */
4500 
4501 /**
4502  * 'Qualifiers' written next to the return and parameter types in
4503  * Objective-C method declarations.
4504  */
4505 typedef enum {
4514 
4515 /**
4516  * Given a cursor that represents an Objective-C method or parameter
4517  * declaration, return the associated Objective-C qualifiers for the return
4518  * type or the parameter respectively. The bits are formed from
4519  * CXObjCDeclQualifierKind.
4520  */
4522 
4523 /**
4524  * Given a cursor that represents an Objective-C method or property
4525  * declaration, return non-zero if the declaration was affected by "\@optional".
4526  * Returns zero if the cursor is not such a declaration or it is "\@required".
4527  */
4529 
4530 /**
4531  * Returns non-zero if the given cursor is a variadic function or method.
4532  */
4534 
4535 /**
4536  * Returns non-zero if the given cursor points to a symbol marked with
4537  * external_source_symbol attribute.
4538  *
4539  * \param language If non-NULL, and the attribute is present, will be set to
4540  * the 'language' string from the attribute.
4541  *
4542  * \param definedIn If non-NULL, and the attribute is present, will be set to
4543  * the 'definedIn' string from the attribute.
4544  *
4545  * \param isGenerated If non-NULL, and the attribute is present, will be set to
4546  * non-zero if the 'generated_declaration' is set in the attribute.
4547  */
4549  CXString *language, CXString *definedIn,
4550  unsigned *isGenerated);
4551 
4552 /**
4553  * Given a cursor that represents a declaration, return the associated
4554  * comment's source range. The range may include multiple consecutive comments
4555  * with whitespace in between.
4556  */
4558 
4559 /**
4560  * Given a cursor that represents a declaration, return the associated
4561  * comment text, including comment markers.
4562  */
4564 
4565 /**
4566  * Given a cursor that represents a documentable entity (e.g.,
4567  * declaration), return the associated \paragraph; otherwise return the
4568  * first paragraph.
4569  */
4571 
4572 /**
4573  * @}
4574  */
4575 
4576 /** \defgroup CINDEX_MANGLE Name Mangling API Functions
4577  *
4578  * @{
4579  */
4580 
4581 /**
4582  * Retrieve the CXString representing the mangled name of the cursor.
4583  */
4585 
4586 /**
4587  * Retrieve the CXStrings representing the mangled symbols of the C++
4588  * constructor or destructor at the cursor.
4589  */
4591 
4592 /**
4593  * Retrieve the CXStrings representing the mangled symbols of the ObjC
4594  * class interface or implementation at the cursor.
4595  */
4597 
4598 /**
4599  * @}
4600  */
4601 
4602 /**
4603  * \defgroup CINDEX_MODULE Module introspection
4604  *
4605  * The functions in this group provide access to information about modules.
4606  *
4607  * @{
4608  */
4609 
4610 typedef void *CXModule;
4611 
4612 /**
4613  * Given a CXCursor_ModuleImportDecl cursor, return the associated module.
4614  */
4616 
4617 /**
4618  * Given a CXFile header file, return the module that contains it, if one
4619  * exists.
4620  */
4621 CINDEX_LINKAGE CXModule clang_getModuleForFile(CXTranslationUnit, CXFile);
4622 
4623 /**
4624  * \param Module a module object.
4625  *
4626  * \returns the module file where the provided module object came from.
4627  */
4628 CINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module);
4629 
4630 /**
4631  * \param Module a module object.
4632  *
4633  * \returns the parent of a sub-module or NULL if the given module is top-level,
4634  * e.g. for 'std.vector' it will return the 'std' module.
4635  */
4636 CINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module);
4637 
4638 /**
4639  * \param Module a module object.
4640  *
4641  * \returns the name of the module, e.g. for the 'std.vector' sub-module it
4642  * will return "vector".
4643  */
4645 
4646 /**
4647  * \param Module a module object.
4648  *
4649  * \returns the full name of the module, e.g. "std.vector".
4650  */
4652 
4653 /**
4654  * \param Module a module object.
4655  *
4656  * \returns non-zero if the module is a system one.
4657  */
4658 CINDEX_LINKAGE int clang_Module_isSystem(CXModule Module);
4659 
4660 /**
4661  * \param Module a module object.
4662  *
4663  * \returns the number of top level headers associated with this module.
4664  */
4665 CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit,
4666  CXModule Module);
4667 
4668 /**
4669  * \param Module a module object.
4670  *
4671  * \param Index top level header index (zero-based).
4672  *
4673  * \returns the specified top level header associated with the module.
4674  */
4676 CXFile clang_Module_getTopLevelHeader(CXTranslationUnit,
4677  CXModule Module, unsigned Index);
4678 
4679 /**
4680  * @}
4681  */
4682 
4683 /**
4684  * \defgroup CINDEX_CPP C++ AST introspection
4685  *
4686  * The routines in this group provide access information in the ASTs specific
4687  * to C++ language features.
4688  *
4689  * @{
4690  */
4691 
4692 /**
4693  * Determine if a C++ constructor is a converting constructor.
4694  */
4696 
4697 /**
4698  * Determine if a C++ constructor is a copy constructor.
4699  */
4701 
4702 /**
4703  * Determine if a C++ constructor is the default constructor.
4704  */
4706 
4707 /**
4708  * Determine if a C++ constructor is a move constructor.
4709  */
4711 
4712 /**
4713  * Determine if a C++ field is declared 'mutable'.
4714  */
4716 
4717 /**
4718  * Determine if a C++ method is declared '= default'.
4719  */
4721 
4722 /**
4723  * Determine if a C++ member function or member function template is
4724  * pure virtual.
4725  */
4727 
4728 /**
4729  * Determine if a C++ member function or member function template is
4730  * declared 'static'.
4731  */
4733 
4734 /**
4735  * Determine if a C++ member function or member function template is
4736  * explicitly declared 'virtual' or if it overrides a virtual method from
4737  * one of the base classes.
4738  */
4740 
4741 /**
4742  * Determine if a C++ record is abstract, i.e. whether a class or struct
4743  * has a pure virtual member function.
4744  */
4746 
4747 /**
4748  * Determine if an enum declaration refers to a scoped enum.
4749  */
4751 
4752 /**
4753  * Determine if a C++ member function or member function template is
4754  * declared 'const'.
4755  */
4757 
4758 /**
4759  * Given a cursor that represents a template, determine
4760  * the cursor kind of the specializations would be generated by instantiating
4761  * the template.
4762  *
4763  * This routine can be used to determine what flavor of function template,
4764  * class template, or class template partial specialization is stored in the
4765  * cursor. For example, it can describe whether a class template cursor is
4766  * declared with "struct", "class" or "union".
4767  *
4768  * \param C The cursor to query. This cursor should represent a template
4769  * declaration.
4770  *
4771  * \returns The cursor kind of the specializations that would be generated
4772  * by instantiating the template \p C. If \p C is not a template, returns
4773  * \c CXCursor_NoDeclFound.
4774  */
4776 
4777 /**
4778  * Given a cursor that may represent a specialization or instantiation
4779  * of a template, retrieve the cursor that represents the template that it
4780  * specializes or from which it was instantiated.
4781  *
4782  * This routine determines the template involved both for explicit
4783  * specializations of templates and for implicit instantiations of the template,
4784  * both of which are referred to as "specializations". For a class template
4785  * specialization (e.g., \c std::vector<bool>), this routine will return
4786  * either the primary template (\c std::vector) or, if the specialization was
4787  * instantiated from a class template partial specialization, the class template
4788  * partial specialization. For a class template partial specialization and a
4789  * function template specialization (including instantiations), this
4790  * this routine will return the specialized template.
4791  *
4792  * For members of a class template (e.g., member functions, member classes, or
4793  * static data members), returns the specialized or instantiated member.
4794  * Although not strictly "templates" in the C++ language, members of class
4795  * templates have the same notions of specializations and instantiations that
4796  * templates do, so this routine treats them similarly.
4797  *
4798  * \param C A cursor that may be a specialization of a template or a member
4799  * of a template.
4800  *
4801  * \returns If the given cursor is a specialization or instantiation of a
4802  * template or a member thereof, the template or member that it specializes or
4803  * from which it was instantiated. Otherwise, returns a NULL cursor.
4804  */
4806 
4807 /**
4808  * Given a cursor that references something else, return the source range
4809  * covering that reference.
4810  *
4811  * \param C A cursor pointing to a member reference, a declaration reference, or
4812  * an operator call.
4813  * \param NameFlags A bitset with three independent flags:
4814  * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
4815  * CXNameRange_WantSinglePiece.
4816  * \param PieceIndex For contiguous names or when passing the flag
4817  * CXNameRange_WantSinglePiece, only one piece with index 0 is
4818  * available. When the CXNameRange_WantSinglePiece flag is not passed for a
4819  * non-contiguous names, this index can be used to retrieve the individual
4820  * pieces of the name. See also CXNameRange_WantSinglePiece.
4821  *
4822  * \returns The piece of the name pointed to by the given cursor. If there is no
4823  * name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
4824  */
4826  unsigned NameFlags,
4827  unsigned PieceIndex);
4828 
4830  /**
4831  * Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
4832  * range.
4833  */
4835 
4836  /**
4837  * Include the explicit template arguments, e.g. <int> in x.f<int>,
4838  * in the range.
4839  */
4841 
4842  /**
4843  * If the name is non-contiguous, return the full spanning range.
4844  *
4845  * Non-contiguous names occur in Objective-C when a selector with two or more
4846  * parameters is used, or in C++ when using an operator:
4847  * \code
4848  * [object doSomething:here withValue:there]; // Objective-C
4849  * return some_vector[1]; // C++
4850  * \endcode
4851  */
4853 };
4854 
4855 /**
4856  * @}
4857  */
4858 
4859 /**
4860  * \defgroup CINDEX_LEX Token extraction and manipulation
4861  *
4862  * The routines in this group provide access to the tokens within a
4863  * translation unit, along with a semantic mapping of those tokens to
4864  * their corresponding cursors.
4865  *
4866  * @{
4867  */
4868 
4869 /**
4870  * Describes a kind of token.
4871  */
4872 typedef enum CXTokenKind {
4873  /**
4874  * A token that contains some kind of punctuation.
4875  */
4877 
4878  /**
4879  * A language keyword.
4880  */
4882 
4883  /**
4884  * An identifier (that is not a keyword).
4885  */
4887 
4888  /**
4889  * A numeric, string, or character literal.
4890  */
4892 
4893  /**
4894  * A comment.
4895  */
4897 } CXTokenKind;
4898 
4899 /**
4900  * Describes a single preprocessing token.
4901  */
4902 typedef struct {
4903  unsigned int_data[4];
4904  void *ptr_data;
4905 } CXToken;
4906 
4907 /**
4908  * Get the raw lexical token starting with the given location.
4909  *
4910  * \param TU the translation unit whose text is being tokenized.
4911  *
4912  * \param Location the source location with which the token starts.
4913  *
4914  * \returns The token starting with the given location or NULL if no such token
4915  * exist. The returned pointer must be freed with clang_disposeTokens before the
4916  * translation unit is destroyed.
4917  */
4918 CINDEX_LINKAGE CXToken *clang_getToken(CXTranslationUnit TU,
4919  CXSourceLocation Location);
4920 
4921 /**
4922  * Determine the kind of the given token.
4923  */
4925 
4926 /**
4927  * Determine the spelling of the given token.
4928  *
4929  * The spelling of a token is the textual representation of that token, e.g.,
4930  * the text of an identifier or keyword.
4931  */
4933 
4934 /**
4935  * Retrieve the source location of the given token.
4936  */
4938  CXToken);
4939 
4940 /**
4941  * Retrieve a source range that covers the given token.
4942  */
4944 
4945 /**
4946  * Tokenize the source code described by the given range into raw
4947  * lexical tokens.
4948  *
4949  * \param TU the translation unit whose text is being tokenized.
4950  *
4951  * \param Range the source range in which text should be tokenized. All of the
4952  * tokens produced by tokenization will fall within this source range,
4953  *
4954  * \param Tokens this pointer will be set to point to the array of tokens
4955  * that occur within the given source range. The returned pointer must be
4956  * freed with clang_disposeTokens() before the translation unit is destroyed.
4957  *
4958  * \param NumTokens will be set to the number of tokens in the \c *Tokens
4959  * array.
4960  *
4961  */
4962 CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
4963  CXToken **Tokens, unsigned *NumTokens);
4964 
4965 /**
4966  * Annotate the given set of tokens by providing cursors for each token
4967  * that can be mapped to a specific entity within the abstract syntax tree.
4968  *
4969  * This token-annotation routine is equivalent to invoking
4970  * clang_getCursor() for the source locations of each of the
4971  * tokens. The cursors provided are filtered, so that only those
4972  * cursors that have a direct correspondence to the token are
4973  * accepted. For example, given a function call \c f(x),
4974  * clang_getCursor() would provide the following cursors:
4975  *
4976  * * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
4977  * * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
4978  * * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
4979  *
4980  * Only the first and last of these cursors will occur within the
4981  * annotate, since the tokens "f" and "x' directly refer to a function
4982  * and a variable, respectively, but the parentheses are just a small
4983  * part of the full syntax of the function call expression, which is
4984  * not provided as an annotation.
4985  *
4986  * \param TU the translation unit that owns the given tokens.
4987  *
4988  * \param Tokens the set of tokens to annotate.
4989  *
4990  * \param NumTokens the number of tokens in \p Tokens.
4991  *
4992  * \param Cursors an array of \p NumTokens cursors, whose contents will be
4993  * replaced with the cursors corresponding to each token.
4994  */
4995 CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU,
4996  CXToken *Tokens, unsigned NumTokens,
4997  CXCursor *Cursors);
4998 
4999 /**
5000  * Free the given set of tokens.
5001  */
5002 CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
5003  CXToken *Tokens, unsigned NumTokens);
5004 
5005 /**
5006  * @}
5007  */
5008 
5009 /**
5010  * \defgroup CINDEX_DEBUG Debugging facilities
5011  *
5012  * These routines are used for testing and debugging, only, and should not
5013  * be relied upon.
5014  *
5015  * @{
5016  */
5017 
5018 /* for debug/testing */
5021  const char **startBuf,
5022  const char **endBuf,
5023  unsigned *startLine,
5024  unsigned *startColumn,
5025  unsigned *endLine,
5026  unsigned *endColumn);
5028 CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data,
5029  unsigned stack_size);
5030 
5031 /**
5032  * @}
5033  */
5034 
5035 /**
5036  * \defgroup CINDEX_CODE_COMPLET Code completion
5037  *
5038  * Code completion involves taking an (incomplete) source file, along with
5039  * knowledge of where the user is actively editing that file, and suggesting
5040  * syntactically- and semantically-valid constructs that the user might want to
5041  * use at that particular point in the source code. These data structures and
5042  * routines provide support for code completion.
5043  *
5044  * @{
5045  */
5046 
5047 /**
5048  * A semantic string that describes a code-completion result.
5049  *
5050  * A semantic string that describes the formatting of a code-completion
5051  * result as a single "template" of text that should be inserted into the
5052  * source buffer when a particular code-completion result is selected.
5053  * Each semantic string is made up of some number of "chunks", each of which
5054  * contains some text along with a description of what that text means, e.g.,
5055  * the name of the entity being referenced, whether the text chunk is part of
5056  * the template, or whether it is a "placeholder" that the user should replace
5057  * with actual code,of a specific kind. See \c CXCompletionChunkKind for a
5058  * description of the different kinds of chunks.
5059  */
5060 typedef void *CXCompletionString;
5061 
5062 /**
5063  * A single result of code completion.
5064  */
5065 typedef struct {
5066  /**
5067  * The kind of entity that this completion refers to.
5068  *
5069  * The cursor kind will be a macro, keyword, or a declaration (one of the
5070  * *Decl cursor kinds), describing the entity that the completion is
5071  * referring to.
5072  *
5073  * \todo In the future, we would like to provide a full cursor, to allow
5074  * the client to extract additional information from declaration.
5075  */
5076  enum CXCursorKind CursorKind;
5077 
5078  /**
5079  * The code-completion string that describes how to insert this
5080  * code-completion result into the editing buffer.
5081  */
5082  CXCompletionString CompletionString;
5084 
5085 /**
5086  * Describes a single piece of text within a code-completion string.
5087  *
5088  * Each "chunk" within a code-completion string (\c CXCompletionString) is
5089  * either a piece of text with a specific "kind" that describes how that text
5090  * should be interpreted by the client or is another completion string.
5091  */
5093  /**
5094  * A code-completion string that describes "optional" text that
5095  * could be a part of the template (but is not required).
5096  *
5097  * The Optional chunk is the only kind of chunk that has a code-completion
5098  * string for its representation, which is accessible via
5099  * \c clang_getCompletionChunkCompletionString(). The code-completion string
5100  * describes an additional part of the template that is completely optional.
5101  * For example, optional chunks can be used to describe the placeholders for
5102  * arguments that match up with defaulted function parameters, e.g. given:
5103  *
5104  * \code
5105  * void f(int x, float y = 3.14, double z = 2.71828);
5106  * \endcode
5107  *
5108  * The code-completion string for this function would contain:
5109  * - a TypedText chunk for "f".
5110  * - a LeftParen chunk for "(".
5111  * - a Placeholder chunk for "int x"
5112  * - an Optional chunk containing the remaining defaulted arguments, e.g.,
5113  * - a Comma chunk for ","
5114  * - a Placeholder chunk for "float y"
5115  * - an Optional chunk containing the last defaulted argument:
5116  * - a Comma chunk for ","
5117  * - a Placeholder chunk for "double z"
5118  * - a RightParen chunk for ")"
5119  *
5120  * There are many ways to handle Optional chunks. Two simple approaches are:
5121  * - Completely ignore optional chunks, in which case the template for the
5122  * function "f" would only include the first parameter ("int x").
5123  * - Fully expand all optional chunks, in which case the template for the
5124  * function "f" would have all of the parameters.
5125  */
5127  /**
5128  * Text that a user would be expected to type to get this
5129  * code-completion result.
5130  *
5131  * There will be exactly one "typed text" chunk in a semantic string, which
5132  * will typically provide the spelling of a keyword or the name of a
5133  * declaration that could be used at the current code point. Clients are
5134  * expected to filter the code-completion results based on the text in this
5135  * chunk.
5136  */
5138  /**
5139  * Text that should be inserted as part of a code-completion result.
5140  *
5141  * A "text" chunk represents text that is part of the template to be
5142  * inserted into user code should this particular code-completion result
5143  * be selected.
5144  */
5146  /**
5147  * Placeholder text that should be replaced by the user.
5148  *
5149  * A "placeholder" chunk marks a place where the user should insert text
5150  * into the code-completion template. For example, placeholders might mark
5151  * the function parameters for a function declaration, to indicate that the
5152  * user should provide arguments for each of those parameters. The actual
5153  * text in a placeholder is a suggestion for the text to display before
5154  * the user replaces the placeholder with real code.
5155  */
5157  /**
5158  * Informative text that should be displayed but never inserted as
5159  * part of the template.
5160  *
5161  * An "informative" chunk contains annotations that can be displayed to
5162  * help the user decide whether a particular code-completion result is the
5163  * right option, but which is not part of the actual template to be inserted
5164  * by code completion.
5165  */
5167  /**
5168  * Text that describes the current parameter when code-completion is
5169  * referring to function call, message send, or template specialization.
5170  *
5171  * A "current parameter" chunk occurs when code-completion is providing
5172  * information about a parameter corresponding to the argument at the
5173  * code-completion point. For example, given a function
5174  *
5175  * \code
5176  * int add(int x, int y);
5177  * \endcode
5178  *
5179  * and the source code \c add(, where the code-completion point is after the
5180  * "(", the code-completion string will contain a "current parameter" chunk
5181  * for "int x", indicating that the current argument will initialize that
5182  * parameter. After typing further, to \c add(17, (where the code-completion
5183  * point is after the ","), the code-completion string will contain a
5184  * "current parameter" chunk to "int y".
5185  */
5187  /**
5188  * A left parenthesis ('('), used to initiate a function call or
5189  * signal the beginning of a function parameter list.
5190  */
5192  /**
5193  * A right parenthesis (')'), used to finish a function call or
5194  * signal the end of a function parameter list.
5195  */
5197  /**
5198  * A left bracket ('[').
5199  */
5201  /**
5202  * A right bracket (']').
5203  */
5205  /**
5206  * A left brace ('{').
5207  */
5209  /**
5210  * A right brace ('}').
5211  */
5213  /**
5214  * A left angle bracket ('<').
5215  */
5217  /**
5218  * A right angle bracket ('>').
5219  */
5221  /**
5222  * A comma separator (',').
5223  */
5225  /**
5226  * Text that specifies the result type of a given result.
5227  *
5228  * This special kind of informative chunk is not meant to be inserted into
5229  * the text buffer. Rather, it is meant to illustrate the type that an
5230  * expression using the given completion string would have.
5231  */
5233  /**
5234  * A colon (':').
5235  */
5237  /**
5238  * A semicolon (';').
5239  */
5241  /**
5242  * An '=' sign.
5243  */
5245  /**
5246  * Horizontal space (' ').
5247  */
5249  /**
5250  * Vertical space ('\\n'), after which it is generally a good idea to
5251  * perform indentation.
5252  */
5254 };
5255 
5256 /**
5257  * Determine the kind of a particular chunk within a completion string.
5258  *
5259  * \param completion_string the completion string to query.
5260  *
5261  * \param chunk_number the 0-based index of the chunk in the completion string.
5262  *
5263  * \returns the kind of the chunk at the index \c chunk_number.
5264  */
5266 clang_getCompletionChunkKind(CXCompletionString completion_string,
5267  unsigned chunk_number);
5268 
5269 /**
5270  * Retrieve the text associated with a particular chunk within a
5271  * completion string.
5272  *
5273  * \param completion_string the completion string to query.
5274  *
5275  * \param chunk_number the 0-based index of the chunk in the completion string.
5276  *
5277  * \returns the text associated with the chunk at index \c chunk_number.
5278  */
5280 clang_getCompletionChunkText(CXCompletionString completion_string,
5281  unsigned chunk_number);
5282 
5283 /**
5284  * Retrieve the completion string associated with a particular chunk
5285  * within a completion string.
5286  *
5287  * \param completion_string the completion string to query.
5288  *
5289  * \param chunk_number the 0-based index of the chunk in the completion string.
5290  *
5291  * \returns the completion string associated with the chunk at index
5292  * \c chunk_number.
5293  */
5294 CINDEX_LINKAGE CXCompletionString
5295 clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
5296  unsigned chunk_number);
5297 
5298 /**
5299  * Retrieve the number of chunks in the given code-completion string.
5300  */
5301 CINDEX_LINKAGE unsigned
5302 clang_getNumCompletionChunks(CXCompletionString completion_string);
5303 
5304 /**
5305  * Determine the priority of this code completion.
5306  *
5307  * The priority of a code completion indicates how likely it is that this
5308  * particular completion is the completion that the user will select. The
5309  * priority is selected by various internal heuristics.
5310  *
5311  * \param completion_string The completion string to query.
5312  *
5313  * \returns The priority of this completion string. Smaller values indicate
5314  * higher-priority (more likely) completions.
5315  */
5316 CINDEX_LINKAGE unsigned
5317 clang_getCompletionPriority(CXCompletionString completion_string);
5318 
5319 /**
5320  * Determine the availability of the entity that this code-completion
5321  * string refers to.
5322  *
5323  * \param completion_string The completion string to query.
5324  *
5325  * \returns The availability of the completion string.
5326  */
5328 clang_getCompletionAvailability(CXCompletionString completion_string);
5329 
5330 /**
5331  * Retrieve the number of annotations associated with the given
5332  * completion string.
5333  *
5334  * \param completion_string the completion string to query.
5335  *
5336  * \returns the number of annotations associated with the given completion
5337  * string.
5338  */
5339 CINDEX_LINKAGE unsigned
5340 clang_getCompletionNumAnnotations(CXCompletionString completion_string);
5341 
5342 /**
5343  * Retrieve the annotation associated with the given completion string.
5344  *
5345  * \param completion_string the completion string to query.
5346  *
5347  * \param annotation_number the 0-based index of the annotation of the
5348  * completion string.
5349  *
5350  * \returns annotation string associated with the completion at index
5351  * \c annotation_number, or a NULL string if that annotation is not available.
5352  */
5354 clang_getCompletionAnnotation(CXCompletionString completion_string,
5355  unsigned annotation_number);
5356 
5357 /**
5358  * Retrieve the parent context of the given completion string.
5359  *
5360  * The parent context of a completion string is the semantic parent of
5361  * the declaration (if any) that the code completion represents. For example,
5362  * a code completion for an Objective-C method would have the method's class
5363  * or protocol as its context.
5364  *
5365  * \param completion_string The code completion string whose parent is
5366  * being queried.
5367  *
5368  * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL.
5369  *
5370  * \returns The name of the completion parent, e.g., "NSObject" if
5371  * the completion string represents a method in the NSObject class.
5372  */
5374 clang_getCompletionParent(CXCompletionString completion_string,
5375  enum CXCursorKind *kind);
5376 
5377 /**
5378  * Retrieve the brief documentation comment attached to the declaration
5379  * that corresponds to the given completion string.
5380  */
5382 clang_getCompletionBriefComment(CXCompletionString completion_string);
5383 
5384 /**
5385  * Retrieve a completion string for an arbitrary declaration or macro
5386  * definition cursor.
5387  *
5388  * \param cursor The cursor to query.
5389  *
5390  * \returns A non-context-sensitive completion string for declaration and macro
5391  * definition cursors, or NULL for other kinds of cursors.
5392  */
5393 CINDEX_LINKAGE CXCompletionString
5395 
5396 /**
5397  * Contains the results of code-completion.
5398  *
5399  * This data structure contains the results of code completion, as
5400  * produced by \c clang_codeCompleteAt(). Its contents must be freed by
5401  * \c clang_disposeCodeCompleteResults.
5402  */
5403 typedef struct {
5404  /**
5405  * The code-completion results.
5406  */
5408 
5409  /**
5410  * The number of code-completion results stored in the
5411  * \c Results array.
5412  */
5413  unsigned NumResults;
5415 
5416 /**
5417  * Retrieve the number of fix-its for the given completion index.
5418  *
5419  * Calling this makes sense only if CXCodeComplete_IncludeCompletionsWithFixIts
5420  * option was set.
5421  *
5422  * \param results The structure keeping all completion results
5423  *
5424  * \param completion_index The index of the completion
5425  *
5426  * \return The number of fix-its which must be applied before the completion at
5427  * completion_index can be applied
5428  */
5429 CINDEX_LINKAGE unsigned
5431  unsigned completion_index);
5432 
5433 /**
5434  * Fix-its that *must* be applied before inserting the text for the
5435  * corresponding completion.
5436  *
5437  * By default, clang_codeCompleteAt() only returns completions with empty
5438  * fix-its. Extra completions with non-empty fix-its should be explicitly
5439  * requested by setting CXCodeComplete_IncludeCompletionsWithFixIts.
5440  *
5441  * For the clients to be able to compute position of the cursor after applying
5442  * fix-its, the following conditions are guaranteed to hold for
5443  * replacement_range of the stored fix-its:
5444  * - Ranges in the fix-its are guaranteed to never contain the completion
5445  * point (or identifier under completion point, if any) inside them, except
5446  * at the start or at the end of the range.
5447  * - If a fix-it range starts or ends with completion point (or starts or
5448  * ends after the identifier under completion point), it will contain at
5449  * least one character. It allows to unambiguously recompute completion
5450  * point after applying the fix-it.
5451  *
5452  * The intuition is that provided fix-its change code around the identifier we
5453  * complete, but are not allowed to touch the identifier itself or the
5454  * completion point. One example of completions with corrections are the ones
5455  * replacing '.' with '->' and vice versa:
5456  *
5457  * std::unique_ptr<std::vector<int>> vec_ptr;
5458  * In 'vec_ptr.^', one of the completions is 'push_back', it requires
5459  * replacing '.' with '->'.
5460  * In 'vec_ptr->^', one of the completions is 'release', it requires
5461  * replacing '->' with '.'.
5462  *
5463  * \param results The structure keeping all completion results
5464  *
5465  * \param completion_index The index of the completion
5466  *
5467  * \param fixit_index The index of the fix-it for the completion at
5468  * completion_index
5469  *
5470  * \param replacement_range The fix-it range that must be replaced before the
5471  * completion at completion_index can be applied
5472  *
5473  * \returns The fix-it string that must replace the code at replacement_range
5474  * before the completion at completion_index can be applied
5475  */
5477  CXCodeCompleteResults *results, unsigned completion_index,
5478  unsigned fixit_index, CXSourceRange *replacement_range);
5479 
5480 /**
5481  * Flags that can be passed to \c clang_codeCompleteAt() to
5482  * modify its behavior.
5483  *
5484  * The enumerators in this enumeration can be bitwise-OR'd together to
5485  * provide multiple options to \c clang_codeCompleteAt().
5486  */
5488  /**
5489  * Whether to include macros within the set of code
5490  * completions returned.
5491  */
5493 
5494  /**
5495  * Whether to include code patterns for language constructs
5496  * within the set of code completions, e.g., for loops.
5497  */
5499 
5500  /**
5501  * Whether to include brief documentation within the set of code
5502  * completions returned.
5503  */
5505 
5506  /**
5507  * Whether to speed up completion by omitting top- or namespace-level entities
5508  * defined in the preamble. There's no guarantee any particular entity is
5509  * omitted. This may be useful if the headers are indexed externally.
5510  */
5512 
5513  /**
5514  * Whether to include completions with small
5515  * fix-its, e.g. change '.' to '->' on member access, etc.
5516  */
5518 };
5519 
5520 /**
5521  * Bits that represent the context under which completion is occurring.
5522  *
5523  * The enumerators in this enumeration may be bitwise-OR'd together if multiple
5524  * contexts are occurring simultaneously.
5525  */
5527  /**
5528  * The context for completions is unexposed, as only Clang results
5529  * should be included. (This is equivalent to having no context bits set.)
5530  */
5532 
5533  /**
5534  * Completions for any possible type should be included in the results.
5535  */
5537 
5538  /**
5539  * Completions for any possible value (variables, function calls, etc.)
5540  * should be included in the results.
5541  */
5543  /**
5544  * Completions for values that resolve to an Objective-C object should
5545  * be included in the results.
5546  */
5548  /**
5549  * Completions for values that resolve to an Objective-C selector
5550  * should be included in the results.
5551  */
5553  /**
5554  * Completions for values that resolve to a C++ class type should be
5555  * included in the results.
5556  */
5558 
5559  /**
5560  * Completions for fields of the member being accessed using the dot
5561  * operator should be included in the results.
5562  */
5564  /**
5565  * Completions for fields of the member being accessed using the arrow
5566  * operator should be included in the results.
5567  */
5569  /**
5570  * Completions for properties of the Objective-C object being accessed
5571  * using the dot operator should be included in the results.
5572  */
5574 
5575  /**
5576  * Completions for enum tags should be included in the results.
5577  */
5579  /**
5580  * Completions for union tags should be included in the results.
5581  */
5583  /**
5584  * Completions for struct tags should be included in the results.
5585  */
5587 
5588  /**
5589  * Completions for C++ class names should be included in the results.
5590  */
5592  /**
5593  * Completions for C++ namespaces and namespace aliases should be
5594  * included in the results.
5595  */
5597  /**
5598  * Completions for C++ nested name specifiers should be included in
5599  * the results.
5600  */
5602 
5603  /**
5604  * Completions for Objective-C interfaces (classes) should be included
5605  * in the results.
5606  */
5608  /**
5609  * Completions for Objective-C protocols should be included in
5610  * the results.
5611  */
5613  /**
5614  * Completions for Objective-C categories should be included in
5615  * the results.
5616  */
5618  /**
5619  * Completions for Objective-C instance messages should be included
5620  * in the results.
5621  */
5623  /**
5624  * Completions for Objective-C class messages should be included in
5625  * the results.
5626  */
5628  /**
5629  * Completions for Objective-C selector names should be included in
5630  * the results.
5631  */
5633 
5634  /**
5635  * Completions for preprocessor macro names should be included in
5636  * the results.
5637  */
5639 
5640  /**
5641  * Natural language completions should be included in the results.
5642  */
5644 
5645  /**
5646  * #include file completions should be included in the results.
5647  */
5649 
5650  /**
5651  * The current context is unknown, so set all contexts.
5652  */
5654 };
5655 
5656 /**
5657  * Returns a default set of code-completion options that can be
5658  * passed to\c clang_codeCompleteAt().
5659  */
5661 
5662 /**
5663  * Perform code completion at a given location in a translation unit.
5664  *
5665  * This function performs code completion at a particular file, line, and
5666  * column within source code, providing results that suggest potential
5667  * code snippets based on the context of the completion. The basic model