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