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