clang API Documentation

Index.h
Go to the documentation of this file.
00001 /*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\
00002 |*                                                                            *|
00003 |*                     The LLVM Compiler Infrastructure                       *|
00004 |*                                                                            *|
00005 |* This file is distributed under the University of Illinois Open Source      *|
00006 |* License. See LICENSE.TXT for details.                                      *|
00007 |*                                                                            *|
00008 |*===----------------------------------------------------------------------===*|
00009 |*                                                                            *|
00010 |* This header provides a public inferface to a Clang library for extracting  *|
00011 |* high-level symbol information from source files without exposing the full  *|
00012 |* Clang C++ API.                                                             *|
00013 |*                                                                            *|
00014 \*===----------------------------------------------------------------------===*/
00015 
00016 #ifndef CLANG_C_INDEX_H
00017 #define CLANG_C_INDEX_H
00018 
00019 #include <time.h>
00020 
00021 #include "clang-c/Platform.h"
00022 #include "clang-c/CXErrorCode.h"
00023 #include "clang-c/CXString.h"
00024 #include "clang-c/BuildSystem.h"
00025 
00026 /**
00027  * \brief The version constants for the libclang API.
00028  * CINDEX_VERSION_MINOR should increase when there are API additions.
00029  * CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes.
00030  *
00031  * The policy about the libclang API was always to keep it source and ABI
00032  * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
00033  */
00034 #define CINDEX_VERSION_MAJOR 0
00035 #define CINDEX_VERSION_MINOR 24
00036 
00037 #define CINDEX_VERSION_ENCODE(major, minor) ( \
00038       ((major) * 10000)                       \
00039     + ((minor) *     1))
00040 
00041 #define CINDEX_VERSION CINDEX_VERSION_ENCODE( \
00042     CINDEX_VERSION_MAJOR,                     \
00043     CINDEX_VERSION_MINOR )
00044 
00045 #define CINDEX_VERSION_STRINGIZE_(major, minor)   \
00046     #major"."#minor
00047 #define CINDEX_VERSION_STRINGIZE(major, minor)    \
00048     CINDEX_VERSION_STRINGIZE_(major, minor)
00049 
00050 #define CINDEX_VERSION_STRING CINDEX_VERSION_STRINGIZE( \
00051     CINDEX_VERSION_MAJOR,                               \
00052     CINDEX_VERSION_MINOR)
00053 
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif
00057 
00058 /** \defgroup CINDEX libclang: C Interface to Clang
00059  *
00060  * The C Interface to Clang provides a relatively small API that exposes
00061  * facilities for parsing source code into an abstract syntax tree (AST),
00062  * loading already-parsed ASTs, traversing the AST, associating
00063  * physical source locations with elements within the AST, and other
00064  * facilities that support Clang-based development tools.
00065  *
00066  * This C interface to Clang will never provide all of the information
00067  * representation stored in Clang's C++ AST, nor should it: the intent is to
00068  * maintain an API that is relatively stable from one release to the next,
00069  * providing only the basic functionality needed to support development tools.
00070  *
00071  * To avoid namespace pollution, data types are prefixed with "CX" and
00072  * functions are prefixed with "clang_".
00073  *
00074  * @{
00075  */
00076 
00077 /**
00078  * \brief An "index" that consists of a set of translation units that would
00079  * typically be linked together into an executable or library.
00080  */
00081 typedef void *CXIndex;
00082 
00083 /**
00084  * \brief A single translation unit, which resides in an index.
00085  */
00086 typedef struct CXTranslationUnitImpl *CXTranslationUnit;
00087 
00088 /**
00089  * \brief Opaque pointer representing client data that will be passed through
00090  * to various callbacks and visitors.
00091  */
00092 typedef void *CXClientData;
00093 
00094 /**
00095  * \brief Provides the contents of a file that has not yet been saved to disk.
00096  *
00097  * Each CXUnsavedFile instance provides the name of a file on the
00098  * system along with the current contents of that file that have not
00099  * yet been saved to disk.
00100  */
00101 struct CXUnsavedFile {
00102   /**
00103    * \brief The file whose contents have not yet been saved.
00104    *
00105    * This file must already exist in the file system.
00106    */
00107   const char *Filename;
00108 
00109   /**
00110    * \brief A buffer containing the unsaved contents of this file.
00111    */
00112   const char *Contents;
00113 
00114   /**
00115    * \brief The length of the unsaved contents of this buffer.
00116    */
00117   unsigned long Length;
00118 };
00119 
00120 /**
00121  * \brief Describes the availability of a particular entity, which indicates
00122  * whether the use of this entity will result in a warning or error due to
00123  * it being deprecated or unavailable.
00124  */
00125 enum CXAvailabilityKind {
00126   /**
00127    * \brief The entity is available.
00128    */
00129   CXAvailability_Available,
00130   /**
00131    * \brief The entity is available, but has been deprecated (and its use is
00132    * not recommended).
00133    */
00134   CXAvailability_Deprecated,
00135   /**
00136    * \brief The entity is not available; any use of it will be an error.
00137    */
00138   CXAvailability_NotAvailable,
00139   /**
00140    * \brief The entity is available, but not accessible; any use of it will be
00141    * an error.
00142    */
00143   CXAvailability_NotAccessible
00144 };
00145 
00146 /**
00147  * \brief Describes a version number of the form major.minor.subminor.
00148  */
00149 typedef struct CXVersion {
00150   /**
00151    * \brief The major version number, e.g., the '10' in '10.7.3'. A negative
00152    * value indicates that there is no version number at all.
00153    */
00154   int Major;
00155   /**
00156    * \brief The minor version number, e.g., the '7' in '10.7.3'. This value
00157    * will be negative if no minor version number was provided, e.g., for 
00158    * version '10'.
00159    */
00160   int Minor;
00161   /**
00162    * \brief The subminor version number, e.g., the '3' in '10.7.3'. This value
00163    * will be negative if no minor or subminor version number was provided,
00164    * e.g., in version '10' or '10.7'.
00165    */
00166   int Subminor;
00167 } CXVersion;
00168   
00169 /**
00170  * \brief Provides a shared context for creating translation units.
00171  *
00172  * It provides two options:
00173  *
00174  * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
00175  * declarations (when loading any new translation units). A "local" declaration
00176  * is one that belongs in the translation unit itself and not in a precompiled
00177  * header that was used by the translation unit. If zero, all declarations
00178  * will be enumerated.
00179  *
00180  * Here is an example:
00181  *
00182  * \code
00183  *   // excludeDeclsFromPCH = 1, displayDiagnostics=1
00184  *   Idx = clang_createIndex(1, 1);
00185  *
00186  *   // IndexTest.pch was produced with the following command:
00187  *   // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
00188  *   TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
00189  *
00190  *   // This will load all the symbols from 'IndexTest.pch'
00191  *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
00192  *                       TranslationUnitVisitor, 0);
00193  *   clang_disposeTranslationUnit(TU);
00194  *
00195  *   // This will load all the symbols from 'IndexTest.c', excluding symbols
00196  *   // from 'IndexTest.pch'.
00197  *   char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
00198  *   TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
00199  *                                                  0, 0);
00200  *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
00201  *                       TranslationUnitVisitor, 0);
00202  *   clang_disposeTranslationUnit(TU);
00203  * \endcode
00204  *
00205  * This process of creating the 'pch', loading it separately, and using it (via
00206  * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
00207  * (which gives the indexer the same performance benefit as the compiler).
00208  */
00209 CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
00210                                          int displayDiagnostics);
00211 
00212 /**
00213  * \brief Destroy the given index.
00214  *
00215  * The index must not be destroyed until all of the translation units created
00216  * within that index have been destroyed.
00217  */
00218 CINDEX_LINKAGE void clang_disposeIndex(CXIndex index);
00219 
00220 typedef enum {
00221   /**
00222    * \brief Used to indicate that no special CXIndex options are needed.
00223    */
00224   CXGlobalOpt_None = 0x0,
00225 
00226   /**
00227    * \brief Used to indicate that threads that libclang creates for indexing
00228    * purposes should use background priority.
00229    *
00230    * Affects #clang_indexSourceFile, #clang_indexTranslationUnit,
00231    * #clang_parseTranslationUnit, #clang_saveTranslationUnit.
00232    */
00233   CXGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1,
00234 
00235   /**
00236    * \brief Used to indicate that threads that libclang creates for editing
00237    * purposes should use background priority.
00238    *
00239    * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt,
00240    * #clang_annotateTokens
00241    */
00242   CXGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2,
00243 
00244   /**
00245    * \brief Used to indicate that all threads that libclang creates should use
00246    * background priority.
00247    */
00248   CXGlobalOpt_ThreadBackgroundPriorityForAll =
00249       CXGlobalOpt_ThreadBackgroundPriorityForIndexing |
00250       CXGlobalOpt_ThreadBackgroundPriorityForEditing
00251 
00252 } CXGlobalOptFlags;
00253 
00254 /**
00255  * \brief Sets general options associated with a CXIndex.
00256  *
00257  * For example:
00258  * \code
00259  * CXIndex idx = ...;
00260  * clang_CXIndex_setGlobalOptions(idx,
00261  *     clang_CXIndex_getGlobalOptions(idx) |
00262  *     CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
00263  * \endcode
00264  *
00265  * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.
00266  */
00267 CINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options);
00268 
00269 /**
00270  * \brief Gets the general options associated with a CXIndex.
00271  *
00272  * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that
00273  * are associated with the given CXIndex object.
00274  */
00275 CINDEX_LINKAGE unsigned clang_CXIndex_getGlobalOptions(CXIndex);
00276 
00277 /**
00278  * \defgroup CINDEX_FILES File manipulation routines
00279  *
00280  * @{
00281  */
00282 
00283 /**
00284  * \brief A particular source file that is part of a translation unit.
00285  */
00286 typedef void *CXFile;
00287 
00288 
00289 /**
00290  * \brief Retrieve the complete file and path name of the given file.
00291  */
00292 CINDEX_LINKAGE CXString clang_getFileName(CXFile SFile);
00293 
00294 /**
00295  * \brief Retrieve the last modification time of the given file.
00296  */
00297 CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
00298 
00299 /**
00300  * \brief Uniquely identifies a CXFile, that refers to the same underlying file,
00301  * across an indexing session.
00302  */
00303 typedef struct {
00304   unsigned long long data[3];
00305 } CXFileUniqueID;
00306 
00307 /**
00308  * \brief Retrieve the unique ID for the given \c file.
00309  *
00310  * \param file the file to get the ID for.
00311  * \param outID stores the returned CXFileUniqueID.
00312  * \returns If there was a failure getting the unique ID, returns non-zero,
00313  * otherwise returns 0.
00314 */
00315 CINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID);
00316 
00317 /**
00318  * \brief Determine whether the given header is guarded against
00319  * multiple inclusions, either with the conventional
00320  * \#ifndef/\#define/\#endif macro guards or with \#pragma once.
00321  */
00322 CINDEX_LINKAGE unsigned 
00323 clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
00324 
00325 /**
00326  * \brief Retrieve a file handle within the given translation unit.
00327  *
00328  * \param tu the translation unit
00329  *
00330  * \param file_name the name of the file.
00331  *
00332  * \returns the file handle for the named file in the translation unit \p tu,
00333  * or a NULL file handle if the file was not a part of this translation unit.
00334  */
00335 CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,
00336                                     const char *file_name);
00337 
00338 /**
00339  * @}
00340  */
00341 
00342 /**
00343  * \defgroup CINDEX_LOCATIONS Physical source locations
00344  *
00345  * Clang represents physical source locations in its abstract syntax tree in
00346  * great detail, with file, line, and column information for the majority of
00347  * the tokens parsed in the source code. These data types and functions are
00348  * used to represent source location information, either for a particular
00349  * point in the program or for a range of points in the program, and extract
00350  * specific location information from those data types.
00351  *
00352  * @{
00353  */
00354 
00355 /**
00356  * \brief Identifies a specific source location within a translation
00357  * unit.
00358  *
00359  * Use clang_getExpansionLocation() or clang_getSpellingLocation()
00360  * to map a source location to a particular file, line, and column.
00361  */
00362 typedef struct {
00363   const void *ptr_data[2];
00364   unsigned int_data;
00365 } CXSourceLocation;
00366 
00367 /**
00368  * \brief Identifies a half-open character range in the source code.
00369  *
00370  * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
00371  * starting and end locations from a source range, respectively.
00372  */
00373 typedef struct {
00374   const void *ptr_data[2];
00375   unsigned begin_int_data;
00376   unsigned end_int_data;
00377 } CXSourceRange;
00378 
00379 /**
00380  * \brief Retrieve a NULL (invalid) source location.
00381  */
00382 CINDEX_LINKAGE CXSourceLocation clang_getNullLocation(void);
00383 
00384 /**
00385  * \brief Determine whether two source locations, which must refer into
00386  * the same translation unit, refer to exactly the same point in the source
00387  * code.
00388  *
00389  * \returns non-zero if the source locations refer to the same location, zero
00390  * if they refer to different locations.
00391  */
00392 CINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1,
00393                                              CXSourceLocation loc2);
00394 
00395 /**
00396  * \brief Retrieves the source location associated with a given file/line/column
00397  * in a particular translation unit.
00398  */
00399 CINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu,
00400                                                   CXFile file,
00401                                                   unsigned line,
00402                                                   unsigned column);
00403 /**
00404  * \brief Retrieves the source location associated with a given character offset
00405  * in a particular translation unit.
00406  */
00407 CINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu,
00408                                                            CXFile file,
00409                                                            unsigned offset);
00410 
00411 /**
00412  * \brief Returns non-zero if the given source location is in a system header.
00413  */
00414 CINDEX_LINKAGE int clang_Location_isInSystemHeader(CXSourceLocation location);
00415 
00416 /**
00417  * \brief Returns non-zero if the given source location is in the main file of
00418  * the corresponding translation unit.
00419  */
00420 CINDEX_LINKAGE int clang_Location_isFromMainFile(CXSourceLocation location);
00421 
00422 /**
00423  * \brief Retrieve a NULL (invalid) source range.
00424  */
00425 CINDEX_LINKAGE CXSourceRange clang_getNullRange(void);
00426 
00427 /**
00428  * \brief Retrieve a source range given the beginning and ending source
00429  * locations.
00430  */
00431 CINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin,
00432                                             CXSourceLocation end);
00433 
00434 /**
00435  * \brief Determine whether two ranges are equivalent.
00436  *
00437  * \returns non-zero if the ranges are the same, zero if they differ.
00438  */
00439 CINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1,
00440                                           CXSourceRange range2);
00441 
00442 /**
00443  * \brief Returns non-zero if \p range is null.
00444  */
00445 CINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range);
00446 
00447 /**
00448  * \brief Retrieve the file, line, column, and offset represented by
00449  * the given source location.
00450  *
00451  * If the location refers into a macro expansion, retrieves the
00452  * location of the macro expansion.
00453  *
00454  * \param location the location within a source file that will be decomposed
00455  * into its parts.
00456  *
00457  * \param file [out] if non-NULL, will be set to the file to which the given
00458  * source location points.
00459  *
00460  * \param line [out] if non-NULL, will be set to the line to which the given
00461  * source location points.
00462  *
00463  * \param column [out] if non-NULL, will be set to the column to which the given
00464  * source location points.
00465  *
00466  * \param offset [out] if non-NULL, will be set to the offset into the
00467  * buffer to which the given source location points.
00468  */
00469 CINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location,
00470                                                CXFile *file,
00471                                                unsigned *line,
00472                                                unsigned *column,
00473                                                unsigned *offset);
00474 
00475 /**
00476  * \brief Retrieve the file, line, column, and offset represented by
00477  * the given source location, as specified in a # line directive.
00478  *
00479  * Example: given the following source code in a file somefile.c
00480  *
00481  * \code
00482  * #123 "dummy.c" 1
00483  *
00484  * static int func(void)
00485  * {
00486  *     return 0;
00487  * }
00488  * \endcode
00489  *
00490  * the location information returned by this function would be
00491  *
00492  * File: dummy.c Line: 124 Column: 12
00493  *
00494  * whereas clang_getExpansionLocation would have returned
00495  *
00496  * File: somefile.c Line: 3 Column: 12
00497  *
00498  * \param location the location within a source file that will be decomposed
00499  * into its parts.
00500  *
00501  * \param filename [out] if non-NULL, will be set to the filename of the
00502  * source location. Note that filenames returned will be for "virtual" files,
00503  * which don't necessarily exist on the machine running clang - e.g. when
00504  * parsing preprocessed output obtained from a different environment. If
00505  * a non-NULL value is passed in, remember to dispose of the returned value
00506  * using \c clang_disposeString() once you've finished with it. For an invalid
00507  * source location, an empty string is returned.
00508  *
00509  * \param line [out] if non-NULL, will be set to the line number of the
00510  * source location. For an invalid source location, zero is returned.
00511  *
00512  * \param column [out] if non-NULL, will be set to the column number of the
00513  * source location. For an invalid source location, zero is returned.
00514  */
00515 CINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location,
00516                                               CXString *filename,
00517                                               unsigned *line,
00518                                               unsigned *column);
00519 
00520 /**
00521  * \brief Legacy API to retrieve the file, line, column, and offset represented
00522  * by the given source location.
00523  *
00524  * This interface has been replaced by the newer interface
00525  * #clang_getExpansionLocation(). See that interface's documentation for
00526  * details.
00527  */
00528 CINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location,
00529                                                    CXFile *file,
00530                                                    unsigned *line,
00531                                                    unsigned *column,
00532                                                    unsigned *offset);
00533 
00534 /**
00535  * \brief Retrieve the file, line, column, and offset represented by
00536  * the given source location.
00537  *
00538  * If the location refers into a macro instantiation, return where the
00539  * location was originally spelled in the source file.
00540  *
00541  * \param location the location within a source file that will be decomposed
00542  * into its parts.
00543  *
00544  * \param file [out] if non-NULL, will be set to the file to which the given
00545  * source location points.
00546  *
00547  * \param line [out] if non-NULL, will be set to the line to which the given
00548  * source location points.
00549  *
00550  * \param column [out] if non-NULL, will be set to the column to which the given
00551  * source location points.
00552  *
00553  * \param offset [out] if non-NULL, will be set to the offset into the
00554  * buffer to which the given source location points.
00555  */
00556 CINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location,
00557                                               CXFile *file,
00558                                               unsigned *line,
00559                                               unsigned *column,
00560                                               unsigned *offset);
00561 
00562 /**
00563  * \brief Retrieve the file, line, column, and offset represented by
00564  * the given source location.
00565  *
00566  * If the location refers into a macro expansion, return where the macro was
00567  * expanded or where the macro argument was written, if the location points at
00568  * a macro argument.
00569  *
00570  * \param location the location within a source file that will be decomposed
00571  * into its parts.
00572  *
00573  * \param file [out] if non-NULL, will be set to the file to which the given
00574  * source location points.
00575  *
00576  * \param line [out] if non-NULL, will be set to the line to which the given
00577  * source location points.
00578  *
00579  * \param column [out] if non-NULL, will be set to the column to which the given
00580  * source location points.
00581  *
00582  * \param offset [out] if non-NULL, will be set to the offset into the
00583  * buffer to which the given source location points.
00584  */
00585 CINDEX_LINKAGE void clang_getFileLocation(CXSourceLocation location,
00586                                           CXFile *file,
00587                                           unsigned *line,
00588                                           unsigned *column,
00589                                           unsigned *offset);
00590 
00591 /**
00592  * \brief Retrieve a source location representing the first character within a
00593  * source range.
00594  */
00595 CINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range);
00596 
00597 /**
00598  * \brief Retrieve a source location representing the last character within a
00599  * source range.
00600  */
00601 CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range);
00602 
00603 /**
00604  * \brief Identifies an array of ranges.
00605  */
00606 typedef struct {
00607   /** \brief The number of ranges in the \c ranges array. */
00608   unsigned count;
00609   /**
00610    * \brief An array of \c CXSourceRanges.
00611    */
00612   CXSourceRange *ranges;
00613 } CXSourceRangeList;
00614 
00615 /**
00616  * \brief Retrieve all ranges that were skipped by the preprocessor.
00617  *
00618  * The preprocessor will skip lines when they are surrounded by an
00619  * if/ifdef/ifndef directive whose condition does not evaluate to true.
00620  */
00621 CINDEX_LINKAGE CXSourceRangeList *clang_getSkippedRanges(CXTranslationUnit tu,
00622                                                          CXFile file);
00623 
00624 /**
00625  * \brief Destroy the given \c CXSourceRangeList.
00626  */
00627 CINDEX_LINKAGE void clang_disposeSourceRangeList(CXSourceRangeList *ranges);
00628 
00629 /**
00630  * @}
00631  */
00632 
00633 /**
00634  * \defgroup CINDEX_DIAG Diagnostic reporting
00635  *
00636  * @{
00637  */
00638 
00639 /**
00640  * \brief Describes the severity of a particular diagnostic.
00641  */
00642 enum CXDiagnosticSeverity {
00643   /**
00644    * \brief A diagnostic that has been suppressed, e.g., by a command-line
00645    * option.
00646    */
00647   CXDiagnostic_Ignored = 0,
00648 
00649   /**
00650    * \brief This diagnostic is a note that should be attached to the
00651    * previous (non-note) diagnostic.
00652    */
00653   CXDiagnostic_Note    = 1,
00654 
00655   /**
00656    * \brief This diagnostic is a remark that provides additional information
00657    * for the user.
00658    */
00659   CXDiagnostic_Remark = 5,
00660 
00661   /**
00662    * \brief This diagnostic indicates suspicious code that may not be
00663    * wrong.
00664    */
00665   CXDiagnostic_Warning = 2,
00666 
00667   /**
00668    * \brief This diagnostic indicates that the code is ill-formed.
00669    */
00670   CXDiagnostic_Error   = 3,
00671 
00672   /**
00673    * \brief This diagnostic indicates that the code is ill-formed such
00674    * that future parser recovery is unlikely to produce useful
00675    * results.
00676    */
00677   CXDiagnostic_Fatal   = 4
00678 };
00679 
00680 /**
00681  * \brief A single diagnostic, containing the diagnostic's severity,
00682  * location, text, source ranges, and fix-it hints.
00683  */
00684 typedef void *CXDiagnostic;
00685 
00686 /**
00687  * \brief A group of CXDiagnostics.
00688  */
00689 typedef void *CXDiagnosticSet;
00690   
00691 /**
00692  * \brief Determine the number of diagnostics in a CXDiagnosticSet.
00693  */
00694 CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags);
00695 
00696 /**
00697  * \brief Retrieve a diagnostic associated with the given CXDiagnosticSet.
00698  *
00699  * \param Diags the CXDiagnosticSet to query.
00700  * \param Index the zero-based diagnostic number to retrieve.
00701  *
00702  * \returns the requested diagnostic. This diagnostic must be freed
00703  * via a call to \c clang_disposeDiagnostic().
00704  */
00705 CINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,
00706                                                      unsigned Index);  
00707 
00708 
00709 /**
00710  * \brief Describes the kind of error that occurred (if any) in a call to
00711  * \c clang_loadDiagnostics.
00712  */
00713 enum CXLoadDiag_Error {
00714   /**
00715    * \brief Indicates that no error occurred.
00716    */
00717   CXLoadDiag_None = 0,
00718   
00719   /**
00720    * \brief Indicates that an unknown error occurred while attempting to
00721    * deserialize diagnostics.
00722    */
00723   CXLoadDiag_Unknown = 1,
00724   
00725   /**
00726    * \brief Indicates that the file containing the serialized diagnostics
00727    * could not be opened.
00728    */
00729   CXLoadDiag_CannotLoad = 2,
00730   
00731   /**
00732    * \brief Indicates that the serialized diagnostics file is invalid or
00733    * corrupt.
00734    */
00735   CXLoadDiag_InvalidFile = 3
00736 };
00737   
00738 /**
00739  * \brief Deserialize a set of diagnostics from a Clang diagnostics bitcode
00740  * file.
00741  *
00742  * \param file The name of the file to deserialize.
00743  * \param error A pointer to a enum value recording if there was a problem
00744  *        deserializing the diagnostics.
00745  * \param errorString A pointer to a CXString for recording the error string
00746  *        if the file was not successfully loaded.
00747  *
00748  * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise.  These
00749  * diagnostics should be released using clang_disposeDiagnosticSet().
00750  */
00751 CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file,
00752                                                   enum CXLoadDiag_Error *error,
00753                                                   CXString *errorString);
00754 
00755 /**
00756  * \brief Release a CXDiagnosticSet and all of its contained diagnostics.
00757  */
00758 CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags);
00759 
00760 /**
00761  * \brief Retrieve the child diagnostics of a CXDiagnostic. 
00762  *
00763  * This CXDiagnosticSet does not need to be released by
00764  * clang_disposeDiagnosticSet.
00765  */
00766 CINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D);
00767 
00768 /**
00769  * \brief Determine the number of diagnostics produced for the given
00770  * translation unit.
00771  */
00772 CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit);
00773 
00774 /**
00775  * \brief Retrieve a diagnostic associated with the given translation unit.
00776  *
00777  * \param Unit the translation unit to query.
00778  * \param Index the zero-based diagnostic number to retrieve.
00779  *
00780  * \returns the requested diagnostic. This diagnostic must be freed
00781  * via a call to \c clang_disposeDiagnostic().
00782  */
00783 CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,
00784                                                 unsigned Index);
00785 
00786 /**
00787  * \brief Retrieve the complete set of diagnostics associated with a
00788  *        translation unit.
00789  *
00790  * \param Unit the translation unit to query.
00791  */
00792 CINDEX_LINKAGE CXDiagnosticSet
00793   clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);  
00794 
00795 /**
00796  * \brief Destroy a diagnostic.
00797  */
00798 CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
00799 
00800 /**
00801  * \brief Options to control the display of diagnostics.
00802  *
00803  * The values in this enum are meant to be combined to customize the
00804  * behavior of \c clang_formatDiagnostic().
00805  */
00806 enum CXDiagnosticDisplayOptions {
00807   /**
00808    * \brief Display the source-location information where the
00809    * diagnostic was located.
00810    *
00811    * When set, diagnostics will be prefixed by the file, line, and
00812    * (optionally) column to which the diagnostic refers. For example,
00813    *
00814    * \code
00815    * test.c:28: warning: extra tokens at end of #endif directive
00816    * \endcode
00817    *
00818    * This option corresponds to the clang flag \c -fshow-source-location.
00819    */
00820   CXDiagnostic_DisplaySourceLocation = 0x01,
00821 
00822   /**
00823    * \brief If displaying the source-location information of the
00824    * diagnostic, also include the column number.
00825    *
00826    * This option corresponds to the clang flag \c -fshow-column.
00827    */
00828   CXDiagnostic_DisplayColumn = 0x02,
00829 
00830   /**
00831    * \brief If displaying the source-location information of the
00832    * diagnostic, also include information about source ranges in a
00833    * machine-parsable format.
00834    *
00835    * This option corresponds to the clang flag
00836    * \c -fdiagnostics-print-source-range-info.
00837    */
00838   CXDiagnostic_DisplaySourceRanges = 0x04,
00839   
00840   /**
00841    * \brief Display the option name associated with this diagnostic, if any.
00842    *
00843    * The option name displayed (e.g., -Wconversion) will be placed in brackets
00844    * after the diagnostic text. This option corresponds to the clang flag
00845    * \c -fdiagnostics-show-option.
00846    */
00847   CXDiagnostic_DisplayOption = 0x08,
00848   
00849   /**
00850    * \brief Display the category number associated with this diagnostic, if any.
00851    *
00852    * The category number is displayed within brackets after the diagnostic text.
00853    * This option corresponds to the clang flag 
00854    * \c -fdiagnostics-show-category=id.
00855    */
00856   CXDiagnostic_DisplayCategoryId = 0x10,
00857 
00858   /**
00859    * \brief Display the category name associated with this diagnostic, if any.
00860    *
00861    * The category name is displayed within brackets after the diagnostic text.
00862    * This option corresponds to the clang flag 
00863    * \c -fdiagnostics-show-category=name.
00864    */
00865   CXDiagnostic_DisplayCategoryName = 0x20
00866 };
00867 
00868 /**
00869  * \brief Format the given diagnostic in a manner that is suitable for display.
00870  *
00871  * This routine will format the given diagnostic to a string, rendering
00872  * the diagnostic according to the various options given. The
00873  * \c clang_defaultDiagnosticDisplayOptions() function returns the set of
00874  * options that most closely mimics the behavior of the clang compiler.
00875  *
00876  * \param Diagnostic The diagnostic to print.
00877  *
00878  * \param Options A set of options that control the diagnostic display,
00879  * created by combining \c CXDiagnosticDisplayOptions values.
00880  *
00881  * \returns A new string containing for formatted diagnostic.
00882  */
00883 CINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic,
00884                                                unsigned Options);
00885 
00886 /**
00887  * \brief Retrieve the set of display options most similar to the
00888  * default behavior of the clang compiler.
00889  *
00890  * \returns A set of display options suitable for use with \c
00891  * clang_formatDiagnostic().
00892  */
00893 CINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void);
00894 
00895 /**
00896  * \brief Determine the severity of the given diagnostic.
00897  */
00898 CINDEX_LINKAGE enum CXDiagnosticSeverity
00899 clang_getDiagnosticSeverity(CXDiagnostic);
00900 
00901 /**
00902  * \brief Retrieve the source location of the given diagnostic.
00903  *
00904  * This location is where Clang would print the caret ('^') when
00905  * displaying the diagnostic on the command line.
00906  */
00907 CINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic);
00908 
00909 /**
00910  * \brief Retrieve the text of the given diagnostic.
00911  */
00912 CINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic);
00913 
00914 /**
00915  * \brief Retrieve the name of the command-line option that enabled this
00916  * diagnostic.
00917  *
00918  * \param Diag The diagnostic to be queried.
00919  *
00920  * \param Disable If non-NULL, will be set to the option that disables this
00921  * diagnostic (if any).
00922  *
00923  * \returns A string that contains the command-line option used to enable this
00924  * warning, such as "-Wconversion" or "-pedantic". 
00925  */
00926 CINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag,
00927                                                   CXString *Disable);
00928 
00929 /**
00930  * \brief Retrieve the category number for this diagnostic.
00931  *
00932  * Diagnostics can be categorized into groups along with other, related
00933  * diagnostics (e.g., diagnostics under the same warning flag). This routine 
00934  * retrieves the category number for the given diagnostic.
00935  *
00936  * \returns The number of the category that contains this diagnostic, or zero
00937  * if this diagnostic is uncategorized.
00938  */
00939 CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
00940 
00941 /**
00942  * \brief Retrieve the name of a particular diagnostic category.  This
00943  *  is now deprecated.  Use clang_getDiagnosticCategoryText()
00944  *  instead.
00945  *
00946  * \param Category A diagnostic category number, as returned by 
00947  * \c clang_getDiagnosticCategory().
00948  *
00949  * \returns The name of the given diagnostic category.
00950  */
00951 CINDEX_DEPRECATED CINDEX_LINKAGE
00952 CXString clang_getDiagnosticCategoryName(unsigned Category);
00953 
00954 /**
00955  * \brief Retrieve the diagnostic category text for a given diagnostic.
00956  *
00957  * \returns The text of the given diagnostic category.
00958  */
00959 CINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic);
00960   
00961 /**
00962  * \brief Determine the number of source ranges associated with the given
00963  * diagnostic.
00964  */
00965 CINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic);
00966 
00967 /**
00968  * \brief Retrieve a source range associated with the diagnostic.
00969  *
00970  * A diagnostic's source ranges highlight important elements in the source
00971  * code. On the command line, Clang displays source ranges by
00972  * underlining them with '~' characters.
00973  *
00974  * \param Diagnostic the diagnostic whose range is being extracted.
00975  *
00976  * \param Range the zero-based index specifying which range to
00977  *
00978  * \returns the requested source range.
00979  */
00980 CINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic,
00981                                                       unsigned Range);
00982 
00983 /**
00984  * \brief Determine the number of fix-it hints associated with the
00985  * given diagnostic.
00986  */
00987 CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
00988 
00989 /**
00990  * \brief Retrieve the replacement information for a given fix-it.
00991  *
00992  * Fix-its are described in terms of a source range whose contents
00993  * should be replaced by a string. This approach generalizes over
00994  * three kinds of operations: removal of source code (the range covers
00995  * the code to be removed and the replacement string is empty),
00996  * replacement of source code (the range covers the code to be
00997  * replaced and the replacement string provides the new code), and
00998  * insertion (both the start and end of the range point at the
00999  * insertion location, and the replacement string provides the text to
01000  * insert).
01001  *
01002  * \param Diagnostic The diagnostic whose fix-its are being queried.
01003  *
01004  * \param FixIt The zero-based index of the fix-it.
01005  *
01006  * \param ReplacementRange The source range whose contents will be
01007  * replaced with the returned replacement string. Note that source
01008  * ranges are half-open ranges [a, b), so the source code should be
01009  * replaced from a and up to (but not including) b.
01010  *
01011  * \returns A string containing text that should be replace the source
01012  * code indicated by the \c ReplacementRange.
01013  */
01014 CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic,
01015                                                  unsigned FixIt,
01016                                                CXSourceRange *ReplacementRange);
01017 
01018 /**
01019  * @}
01020  */
01021 
01022 /**
01023  * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation
01024  *
01025  * The routines in this group provide the ability to create and destroy
01026  * translation units from files, either by parsing the contents of the files or
01027  * by reading in a serialized representation of a translation unit.
01028  *
01029  * @{
01030  */
01031 
01032 /**
01033  * \brief Get the original translation unit source file name.
01034  */
01035 CINDEX_LINKAGE CXString
01036 clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
01037 
01038 /**
01039  * \brief Return the CXTranslationUnit for a given source file and the provided
01040  * command line arguments one would pass to the compiler.
01041  *
01042  * Note: The 'source_filename' argument is optional.  If the caller provides a
01043  * NULL pointer, the name of the source file is expected to reside in the
01044  * specified command line arguments.
01045  *
01046  * Note: When encountered in 'clang_command_line_args', the following options
01047  * are ignored:
01048  *
01049  *   '-c'
01050  *   '-emit-ast'
01051  *   '-fsyntax-only'
01052  *   '-o <output file>'  (both '-o' and '<output file>' are ignored)
01053  *
01054  * \param CIdx The index object with which the translation unit will be
01055  * associated.
01056  *
01057  * \param source_filename The name of the source file to load, or NULL if the
01058  * source file is included in \p clang_command_line_args.
01059  *
01060  * \param num_clang_command_line_args The number of command-line arguments in
01061  * \p clang_command_line_args.
01062  *
01063  * \param clang_command_line_args The command-line arguments that would be
01064  * passed to the \c clang executable if it were being invoked out-of-process.
01065  * These command-line options will be parsed and will affect how the translation
01066  * unit is parsed. Note that the following options are ignored: '-c',
01067  * '-emit-ast', '-fsyntax-only' (which is the default), and '-o <output file>'.
01068  *
01069  * \param num_unsaved_files the number of unsaved file entries in \p
01070  * unsaved_files.
01071  *
01072  * \param unsaved_files the files that have not yet been saved to disk
01073  * but may be required for code completion, including the contents of
01074  * those files.  The contents and name of these files (as specified by
01075  * CXUnsavedFile) are copied when necessary, so the client only needs to
01076  * guarantee their validity until the call to this function returns.
01077  */
01078 CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile(
01079                                          CXIndex CIdx,
01080                                          const char *source_filename,
01081                                          int num_clang_command_line_args,
01082                                    const char * const *clang_command_line_args,
01083                                          unsigned num_unsaved_files,
01084                                          struct CXUnsavedFile *unsaved_files);
01085 
01086 /**
01087  * \brief Same as \c clang_createTranslationUnit2, but returns
01088  * the \c CXTranslationUnit instead of an error code.  In case of an error this
01089  * routine returns a \c NULL \c CXTranslationUnit, without further detailed
01090  * error codes.
01091  */
01092 CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(
01093     CXIndex CIdx,
01094     const char *ast_filename);
01095 
01096 /**
01097  * \brief Create a translation unit from an AST file (\c -emit-ast).
01098  *
01099  * \param[out] out_TU A non-NULL pointer to store the created
01100  * \c CXTranslationUnit.
01101  *
01102  * \returns Zero on success, otherwise returns an error code.
01103  */
01104 CINDEX_LINKAGE enum CXErrorCode clang_createTranslationUnit2(
01105     CXIndex CIdx,
01106     const char *ast_filename,
01107     CXTranslationUnit *out_TU);
01108 
01109 /**
01110  * \brief Flags that control the creation of translation units.
01111  *
01112  * The enumerators in this enumeration type are meant to be bitwise
01113  * ORed together to specify which options should be used when
01114  * constructing the translation unit.
01115  */
01116 enum CXTranslationUnit_Flags {
01117   /**
01118    * \brief Used to indicate that no special translation-unit options are
01119    * needed.
01120    */
01121   CXTranslationUnit_None = 0x0,
01122 
01123   /**
01124    * \brief Used to indicate that the parser should construct a "detailed"
01125    * preprocessing record, including all macro definitions and instantiations.
01126    *
01127    * Constructing a detailed preprocessing record requires more memory
01128    * and time to parse, since the information contained in the record
01129    * is usually not retained. However, it can be useful for
01130    * applications that require more detailed information about the
01131    * behavior of the preprocessor.
01132    */
01133   CXTranslationUnit_DetailedPreprocessingRecord = 0x01,
01134 
01135   /**
01136    * \brief Used to indicate that the translation unit is incomplete.
01137    *
01138    * When a translation unit is considered "incomplete", semantic
01139    * analysis that is typically performed at the end of the
01140    * translation unit will be suppressed. For example, this suppresses
01141    * the completion of tentative declarations in C and of
01142    * instantiation of implicitly-instantiation function templates in
01143    * C++. This option is typically used when parsing a header with the
01144    * intent of producing a precompiled header.
01145    */
01146   CXTranslationUnit_Incomplete = 0x02,
01147   
01148   /**
01149    * \brief Used to indicate that the translation unit should be built with an 
01150    * implicit precompiled header for the preamble.
01151    *
01152    * An implicit precompiled header is used as an optimization when a
01153    * particular translation unit is likely to be reparsed many times
01154    * when the sources aren't changing that often. In this case, an
01155    * implicit precompiled header will be built containing all of the
01156    * initial includes at the top of the main file (what we refer to as
01157    * the "preamble" of the file). In subsequent parses, if the
01158    * preamble or the files in it have not changed, \c
01159    * clang_reparseTranslationUnit() will re-use the implicit
01160    * precompiled header to improve parsing performance.
01161    */
01162   CXTranslationUnit_PrecompiledPreamble = 0x04,
01163   
01164   /**
01165    * \brief Used to indicate that the translation unit should cache some
01166    * code-completion results with each reparse of the source file.
01167    *
01168    * Caching of code-completion results is a performance optimization that
01169    * introduces some overhead to reparsing but improves the performance of
01170    * code-completion operations.
01171    */
01172   CXTranslationUnit_CacheCompletionResults = 0x08,
01173 
01174   /**
01175    * \brief Used to indicate that the translation unit will be serialized with
01176    * \c clang_saveTranslationUnit.
01177    *
01178    * This option is typically used when parsing a header with the intent of
01179    * producing a precompiled header.
01180    */
01181   CXTranslationUnit_ForSerialization = 0x10,
01182 
01183   /**
01184    * \brief DEPRECATED: Enabled chained precompiled preambles in C++.
01185    *
01186    * Note: this is a *temporary* option that is available only while
01187    * we are testing C++ precompiled preamble support. It is deprecated.
01188    */
01189   CXTranslationUnit_CXXChainedPCH = 0x20,
01190 
01191   /**
01192    * \brief Used to indicate that function/method bodies should be skipped while
01193    * parsing.
01194    *
01195    * This option can be used to search for declarations/definitions while
01196    * ignoring the usages.
01197    */
01198   CXTranslationUnit_SkipFunctionBodies = 0x40,
01199 
01200   /**
01201    * \brief Used to indicate that brief documentation comments should be
01202    * included into the set of code completions returned from this translation
01203    * unit.
01204    */
01205   CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80
01206 };
01207 
01208 /**
01209  * \brief Returns the set of flags that is suitable for parsing a translation
01210  * unit that is being edited.
01211  *
01212  * The set of flags returned provide options for \c clang_parseTranslationUnit()
01213  * to indicate that the translation unit is likely to be reparsed many times,
01214  * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
01215  * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
01216  * set contains an unspecified set of optimizations (e.g., the precompiled 
01217  * preamble) geared toward improving the performance of these routines. The
01218  * set of optimizations enabled may change from one version to the next.
01219  */
01220 CINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void);
01221 
01222 /**
01223  * \brief Same as \c clang_parseTranslationUnit2, but returns
01224  * the \c CXTranslationUnit instead of an error code.  In case of an error this
01225  * routine returns a \c NULL \c CXTranslationUnit, without further detailed
01226  * error codes.
01227  */
01228 CINDEX_LINKAGE CXTranslationUnit
01229 clang_parseTranslationUnit(CXIndex CIdx,
01230                            const char *source_filename,
01231                            const char *const *command_line_args,
01232                            int num_command_line_args,
01233                            struct CXUnsavedFile *unsaved_files,
01234                            unsigned num_unsaved_files,
01235                            unsigned options);
01236 
01237 /**
01238  * \brief Parse the given source file and the translation unit corresponding
01239  * to that file.
01240  *
01241  * This routine is the main entry point for the Clang C API, providing the
01242  * ability to parse a source file into a translation unit that can then be
01243  * queried by other functions in the API. This routine accepts a set of
01244  * command-line arguments so that the compilation can be configured in the same
01245  * way that the compiler is configured on the command line.
01246  *
01247  * \param CIdx The index object with which the translation unit will be 
01248  * associated.
01249  *
01250  * \param source_filename The name of the source file to load, or NULL if the
01251  * source file is included in \c command_line_args.
01252  *
01253  * \param command_line_args The command-line arguments that would be
01254  * passed to the \c clang executable if it were being invoked out-of-process.
01255  * These command-line options will be parsed and will affect how the translation
01256  * unit is parsed. Note that the following options are ignored: '-c', 
01257  * '-emit-ast', '-fsyntax-only' (which is the default), and '-o <output file>'.
01258  *
01259  * \param num_command_line_args The number of command-line arguments in
01260  * \c command_line_args.
01261  *
01262  * \param unsaved_files the files that have not yet been saved to disk
01263  * but may be required for parsing, including the contents of
01264  * those files.  The contents and name of these files (as specified by
01265  * CXUnsavedFile) are copied when necessary, so the client only needs to
01266  * guarantee their validity until the call to this function returns.
01267  *
01268  * \param num_unsaved_files the number of unsaved file entries in \p
01269  * unsaved_files.
01270  *
01271  * \param options A bitmask of options that affects how the translation unit
01272  * is managed but not its compilation. This should be a bitwise OR of the
01273  * CXTranslationUnit_XXX flags.
01274  *
01275  * \param[out] out_TU A non-NULL pointer to store the created
01276  * \c CXTranslationUnit, describing the parsed code and containing any
01277  * diagnostics produced by the compiler.
01278  *
01279  * \returns Zero on success, otherwise returns an error code.
01280  */
01281 CINDEX_LINKAGE enum CXErrorCode
01282 clang_parseTranslationUnit2(CXIndex CIdx,
01283                             const char *source_filename,
01284                             const char *const *command_line_args,
01285                             int num_command_line_args,
01286                             struct CXUnsavedFile *unsaved_files,
01287                             unsigned num_unsaved_files,
01288                             unsigned options,
01289                             CXTranslationUnit *out_TU);
01290 
01291 /**
01292  * \brief Flags that control how translation units are saved.
01293  *
01294  * The enumerators in this enumeration type are meant to be bitwise
01295  * ORed together to specify which options should be used when
01296  * saving the translation unit.
01297  */
01298 enum CXSaveTranslationUnit_Flags {
01299   /**
01300    * \brief Used to indicate that no special saving options are needed.
01301    */
01302   CXSaveTranslationUnit_None = 0x0
01303 };
01304 
01305 /**
01306  * \brief Returns the set of flags that is suitable for saving a translation
01307  * unit.
01308  *
01309  * The set of flags returned provide options for
01310  * \c clang_saveTranslationUnit() by default. The returned flag
01311  * set contains an unspecified set of options that save translation units with
01312  * the most commonly-requested data.
01313  */
01314 CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU);
01315 
01316 /**
01317  * \brief Describes the kind of error that occurred (if any) in a call to
01318  * \c clang_saveTranslationUnit().
01319  */
01320 enum CXSaveError {
01321   /**
01322    * \brief Indicates that no error occurred while saving a translation unit.
01323    */
01324   CXSaveError_None = 0,
01325   
01326   /**
01327    * \brief Indicates that an unknown error occurred while attempting to save
01328    * the file.
01329    *
01330    * This error typically indicates that file I/O failed when attempting to 
01331    * write the file.
01332    */
01333   CXSaveError_Unknown = 1,
01334   
01335   /**
01336    * \brief Indicates that errors during translation prevented this attempt
01337    * to save the translation unit.
01338    * 
01339    * Errors that prevent the translation unit from being saved can be
01340    * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
01341    */
01342   CXSaveError_TranslationErrors = 2,
01343   
01344   /**
01345    * \brief Indicates that the translation unit to be saved was somehow
01346    * invalid (e.g., NULL).
01347    */
01348   CXSaveError_InvalidTU = 3
01349 };
01350   
01351 /**
01352  * \brief Saves a translation unit into a serialized representation of
01353  * that translation unit on disk.
01354  *
01355  * Any translation unit that was parsed without error can be saved
01356  * into a file. The translation unit can then be deserialized into a
01357  * new \c CXTranslationUnit with \c clang_createTranslationUnit() or,
01358  * if it is an incomplete translation unit that corresponds to a
01359  * header, used as a precompiled header when parsing other translation
01360  * units.
01361  *
01362  * \param TU The translation unit to save.
01363  *
01364  * \param FileName The file to which the translation unit will be saved.
01365  *
01366  * \param options A bitmask of options that affects how the translation unit
01367  * is saved. This should be a bitwise OR of the
01368  * CXSaveTranslationUnit_XXX flags.
01369  *
01370  * \returns A value that will match one of the enumerators of the CXSaveError
01371  * enumeration. Zero (CXSaveError_None) indicates that the translation unit was 
01372  * saved successfully, while a non-zero value indicates that a problem occurred.
01373  */
01374 CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU,
01375                                              const char *FileName,
01376                                              unsigned options);
01377 
01378 /**
01379  * \brief Destroy the specified CXTranslationUnit object.
01380  */
01381 CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
01382 
01383 /**
01384  * \brief Flags that control the reparsing of translation units.
01385  *
01386  * The enumerators in this enumeration type are meant to be bitwise
01387  * ORed together to specify which options should be used when
01388  * reparsing the translation unit.
01389  */
01390 enum CXReparse_Flags {
01391   /**
01392    * \brief Used to indicate that no special reparsing options are needed.
01393    */
01394   CXReparse_None = 0x0
01395 };
01396  
01397 /**
01398  * \brief Returns the set of flags that is suitable for reparsing a translation
01399  * unit.
01400  *
01401  * The set of flags returned provide options for
01402  * \c clang_reparseTranslationUnit() by default. The returned flag
01403  * set contains an unspecified set of optimizations geared toward common uses
01404  * of reparsing. The set of optimizations enabled may change from one version 
01405  * to the next.
01406  */
01407 CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
01408 
01409 /**
01410  * \brief Reparse the source files that produced this translation unit.
01411  *
01412  * This routine can be used to re-parse the source files that originally
01413  * created the given translation unit, for example because those source files
01414  * have changed (either on disk or as passed via \p unsaved_files). The
01415  * source code will be reparsed with the same command-line options as it
01416  * was originally parsed. 
01417  *
01418  * Reparsing a translation unit invalidates all cursors and source locations
01419  * that refer into that translation unit. This makes reparsing a translation
01420  * unit semantically equivalent to destroying the translation unit and then
01421  * creating a new translation unit with the same command-line arguments.
01422  * However, it may be more efficient to reparse a translation 
01423  * unit using this routine.
01424  *
01425  * \param TU The translation unit whose contents will be re-parsed. The
01426  * translation unit must originally have been built with 
01427  * \c clang_createTranslationUnitFromSourceFile().
01428  *
01429  * \param num_unsaved_files The number of unsaved file entries in \p
01430  * unsaved_files.
01431  *
01432  * \param unsaved_files The files that have not yet been saved to disk
01433  * but may be required for parsing, including the contents of
01434  * those files.  The contents and name of these files (as specified by
01435  * CXUnsavedFile) are copied when necessary, so the client only needs to
01436  * guarantee their validity until the call to this function returns.
01437  * 
01438  * \param options A bitset of options composed of the flags in CXReparse_Flags.
01439  * The function \c clang_defaultReparseOptions() produces a default set of
01440  * options recommended for most uses, based on the translation unit.
01441  *
01442  * \returns 0 if the sources could be reparsed.  A non-zero error code will be
01443  * returned if reparsing was impossible, such that the translation unit is
01444  * invalid. In such cases, the only valid call for \c TU is
01445  * \c clang_disposeTranslationUnit(TU).  The error codes returned by this
01446  * routine are described by the \c CXErrorCode enum.
01447  */
01448 CINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU,
01449                                                 unsigned num_unsaved_files,
01450                                           struct CXUnsavedFile *unsaved_files,
01451                                                 unsigned options);
01452 
01453 /**
01454   * \brief Categorizes how memory is being used by a translation unit.
01455   */
01456 enum CXTUResourceUsageKind {
01457   CXTUResourceUsage_AST = 1,
01458   CXTUResourceUsage_Identifiers = 2,
01459   CXTUResourceUsage_Selectors = 3,
01460   CXTUResourceUsage_GlobalCompletionResults = 4,
01461   CXTUResourceUsage_SourceManagerContentCache = 5,
01462   CXTUResourceUsage_AST_SideTables = 6,
01463   CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7,
01464   CXTUResourceUsage_SourceManager_Membuffer_MMap = 8,
01465   CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9, 
01466   CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10, 
01467   CXTUResourceUsage_Preprocessor = 11,
01468   CXTUResourceUsage_PreprocessingRecord = 12,
01469   CXTUResourceUsage_SourceManager_DataStructures = 13,
01470   CXTUResourceUsage_Preprocessor_HeaderSearch = 14,
01471   CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST,
01472   CXTUResourceUsage_MEMORY_IN_BYTES_END =
01473     CXTUResourceUsage_Preprocessor_HeaderSearch,
01474 
01475   CXTUResourceUsage_First = CXTUResourceUsage_AST,
01476   CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch
01477 };
01478 
01479 /**
01480   * \brief Returns the human-readable null-terminated C string that represents
01481   *  the name of the memory category.  This string should never be freed.
01482   */
01483 CINDEX_LINKAGE
01484 const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind);
01485 
01486 typedef struct CXTUResourceUsageEntry {
01487   /* \brief The memory usage category. */
01488   enum CXTUResourceUsageKind kind;  
01489   /* \brief Amount of resources used. 
01490       The units will depend on the resource kind. */
01491   unsigned long amount;
01492 } CXTUResourceUsageEntry;
01493 
01494 /**
01495   * \brief The memory usage of a CXTranslationUnit, broken into categories.
01496   */
01497 typedef struct CXTUResourceUsage {
01498   /* \brief Private data member, used for queries. */
01499   void *data;
01500 
01501   /* \brief The number of entries in the 'entries' array. */
01502   unsigned numEntries;
01503 
01504   /* \brief An array of key-value pairs, representing the breakdown of memory
01505             usage. */
01506   CXTUResourceUsageEntry *entries;
01507 
01508 } CXTUResourceUsage;
01509 
01510 /**
01511   * \brief Return the memory usage of a translation unit.  This object
01512   *  should be released with clang_disposeCXTUResourceUsage().
01513   */
01514 CINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU);
01515 
01516 CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);
01517 
01518 /**
01519  * @}
01520  */
01521 
01522 /**
01523  * \brief Describes the kind of entity that a cursor refers to.
01524  */
01525 enum CXCursorKind {
01526   /* Declarations */
01527   /**
01528    * \brief A declaration whose specific kind is not exposed via this
01529    * interface.
01530    *
01531    * Unexposed declarations have the same operations as any other kind
01532    * of declaration; one can extract their location information,
01533    * spelling, find their definitions, etc. However, the specific kind
01534    * of the declaration is not reported.
01535    */
01536   CXCursor_UnexposedDecl                 = 1,
01537   /** \brief A C or C++ struct. */
01538   CXCursor_StructDecl                    = 2,
01539   /** \brief A C or C++ union. */
01540   CXCursor_UnionDecl                     = 3,
01541   /** \brief A C++ class. */
01542   CXCursor_ClassDecl                     = 4,
01543   /** \brief An enumeration. */
01544   CXCursor_EnumDecl                      = 5,
01545   /**
01546    * \brief A field (in C) or non-static data member (in C++) in a
01547    * struct, union, or C++ class.
01548    */
01549   CXCursor_FieldDecl                     = 6,
01550   /** \brief An enumerator constant. */
01551   CXCursor_EnumConstantDecl              = 7,
01552   /** \brief A function. */
01553   CXCursor_FunctionDecl                  = 8,
01554   /** \brief A variable. */
01555   CXCursor_VarDecl                       = 9,
01556   /** \brief A function or method parameter. */
01557   CXCursor_ParmDecl                      = 10,
01558   /** \brief An Objective-C \@interface. */
01559   CXCursor_ObjCInterfaceDecl             = 11,
01560   /** \brief An Objective-C \@interface for a category. */
01561   CXCursor_ObjCCategoryDecl              = 12,
01562   /** \brief An Objective-C \@protocol declaration. */
01563   CXCursor_ObjCProtocolDecl              = 13,
01564   /** \brief An Objective-C \@property declaration. */
01565   CXCursor_ObjCPropertyDecl              = 14,
01566   /** \brief An Objective-C instance variable. */
01567   CXCursor_ObjCIvarDecl                  = 15,
01568   /** \brief An Objective-C instance method. */
01569   CXCursor_ObjCInstanceMethodDecl        = 16,
01570   /** \brief An Objective-C class method. */
01571   CXCursor_ObjCClassMethodDecl           = 17,
01572   /** \brief An Objective-C \@implementation. */
01573   CXCursor_ObjCImplementationDecl        = 18,
01574   /** \brief An Objective-C \@implementation for a category. */
01575   CXCursor_ObjCCategoryImplDecl          = 19,
01576   /** \brief A typedef */
01577   CXCursor_TypedefDecl                   = 20,
01578   /** \brief A C++ class method. */
01579   CXCursor_CXXMethod                     = 21,
01580   /** \brief A C++ namespace. */
01581   CXCursor_Namespace                     = 22,
01582   /** \brief A linkage specification, e.g. 'extern "C"'. */
01583   CXCursor_LinkageSpec                   = 23,
01584   /** \brief A C++ constructor. */
01585   CXCursor_Constructor                   = 24,
01586   /** \brief A C++ destructor. */
01587   CXCursor_Destructor                    = 25,
01588   /** \brief A C++ conversion function. */
01589   CXCursor_ConversionFunction            = 26,
01590   /** \brief A C++ template type parameter. */
01591   CXCursor_TemplateTypeParameter         = 27,
01592   /** \brief A C++ non-type template parameter. */
01593   CXCursor_NonTypeTemplateParameter      = 28,
01594   /** \brief A C++ template template parameter. */
01595   CXCursor_TemplateTemplateParameter     = 29,
01596   /** \brief A C++ function template. */
01597   CXCursor_FunctionTemplate              = 30,
01598   /** \brief A C++ class template. */
01599   CXCursor_ClassTemplate                 = 31,
01600   /** \brief A C++ class template partial specialization. */
01601   CXCursor_ClassTemplatePartialSpecialization = 32,
01602   /** \brief A C++ namespace alias declaration. */
01603   CXCursor_NamespaceAlias                = 33,
01604   /** \brief A C++ using directive. */
01605   CXCursor_UsingDirective                = 34,
01606   /** \brief A C++ using declaration. */
01607   CXCursor_UsingDeclaration              = 35,
01608   /** \brief A C++ alias declaration */
01609   CXCursor_TypeAliasDecl                 = 36,
01610   /** \brief An Objective-C \@synthesize definition. */
01611   CXCursor_ObjCSynthesizeDecl            = 37,
01612   /** \brief An Objective-C \@dynamic definition. */
01613   CXCursor_ObjCDynamicDecl               = 38,
01614   /** \brief An access specifier. */
01615   CXCursor_CXXAccessSpecifier            = 39,
01616 
01617   CXCursor_FirstDecl                     = CXCursor_UnexposedDecl,
01618   CXCursor_LastDecl                      = CXCursor_CXXAccessSpecifier,
01619 
01620   /* References */
01621   CXCursor_FirstRef                      = 40, /* Decl references */
01622   CXCursor_ObjCSuperClassRef             = 40,
01623   CXCursor_ObjCProtocolRef               = 41,
01624   CXCursor_ObjCClassRef                  = 42,
01625   /**
01626    * \brief A reference to a type declaration.
01627    *
01628    * A type reference occurs anywhere where a type is named but not
01629    * declared. For example, given:
01630    *
01631    * \code
01632    * typedef unsigned size_type;
01633    * size_type size;
01634    * \endcode
01635    *
01636    * The typedef is a declaration of size_type (CXCursor_TypedefDecl),
01637    * while the type of the variable "size" is referenced. The cursor
01638    * referenced by the type of size is the typedef for size_type.
01639    */
01640   CXCursor_TypeRef                       = 43,
01641   CXCursor_CXXBaseSpecifier              = 44,
01642   /** 
01643    * \brief A reference to a class template, function template, template
01644    * template parameter, or class template partial specialization.
01645    */
01646   CXCursor_TemplateRef                   = 45,
01647   /**
01648    * \brief A reference to a namespace or namespace alias.
01649    */
01650   CXCursor_NamespaceRef                  = 46,
01651   /**
01652    * \brief A reference to a member of a struct, union, or class that occurs in 
01653    * some non-expression context, e.g., a designated initializer.
01654    */
01655   CXCursor_MemberRef                     = 47,
01656   /**
01657    * \brief A reference to a labeled statement.
01658    *
01659    * This cursor kind is used to describe the jump to "start_over" in the 
01660    * goto statement in the following example:
01661    *
01662    * \code
01663    *   start_over:
01664    *     ++counter;
01665    *
01666    *     goto start_over;
01667    * \endcode
01668    *
01669    * A label reference cursor refers to a label statement.
01670    */
01671   CXCursor_LabelRef                      = 48,
01672   
01673   /**
01674    * \brief A reference to a set of overloaded functions or function templates
01675    * that has not yet been resolved to a specific function or function template.
01676    *
01677    * An overloaded declaration reference cursor occurs in C++ templates where
01678    * a dependent name refers to a function. For example:
01679    *
01680    * \code
01681    * template<typename T> void swap(T&, T&);
01682    *
01683    * struct X { ... };
01684    * void swap(X&, X&);
01685    *
01686    * template<typename T>
01687    * void reverse(T* first, T* last) {
01688    *   while (first < last - 1) {
01689    *     swap(*first, *--last);
01690    *     ++first;
01691    *   }
01692    * }
01693    *
01694    * struct Y { };
01695    * void swap(Y&, Y&);
01696    * \endcode
01697    *
01698    * Here, the identifier "swap" is associated with an overloaded declaration
01699    * reference. In the template definition, "swap" refers to either of the two
01700    * "swap" functions declared above, so both results will be available. At
01701    * instantiation time, "swap" may also refer to other functions found via
01702    * argument-dependent lookup (e.g., the "swap" function at the end of the
01703    * example).
01704    *
01705    * The functions \c clang_getNumOverloadedDecls() and 
01706    * \c clang_getOverloadedDecl() can be used to retrieve the definitions
01707    * referenced by this cursor.
01708    */
01709   CXCursor_OverloadedDeclRef             = 49,
01710   
01711   /**
01712    * \brief A reference to a variable that occurs in some non-expression 
01713    * context, e.g., a C++ lambda capture list.
01714    */
01715   CXCursor_VariableRef                   = 50,
01716   
01717   CXCursor_LastRef                       = CXCursor_VariableRef,
01718 
01719   /* Error conditions */
01720   CXCursor_FirstInvalid                  = 70,
01721   CXCursor_InvalidFile                   = 70,
01722   CXCursor_NoDeclFound                   = 71,
01723   CXCursor_NotImplemented                = 72,
01724   CXCursor_InvalidCode                   = 73,
01725   CXCursor_LastInvalid                   = CXCursor_InvalidCode,
01726 
01727   /* Expressions */
01728   CXCursor_FirstExpr                     = 100,
01729 
01730   /**
01731    * \brief An expression whose specific kind is not exposed via this
01732    * interface.
01733    *
01734    * Unexposed expressions have the same operations as any other kind
01735    * of expression; one can extract their location information,
01736    * spelling, children, etc. However, the specific kind of the
01737    * expression is not reported.
01738    */
01739   CXCursor_UnexposedExpr                 = 100,
01740 
01741   /**
01742    * \brief An expression that refers to some value declaration, such
01743    * as a function, variable, or enumerator.
01744    */
01745   CXCursor_DeclRefExpr                   = 101,
01746 
01747   /**
01748    * \brief An expression that refers to a member of a struct, union,
01749    * class, Objective-C class, etc.
01750    */
01751   CXCursor_MemberRefExpr                 = 102,
01752 
01753   /** \brief An expression that calls a function. */
01754   CXCursor_CallExpr                      = 103,
01755 
01756   /** \brief An expression that sends a message to an Objective-C
01757    object or class. */
01758   CXCursor_ObjCMessageExpr               = 104,
01759 
01760   /** \brief An expression that represents a block literal. */
01761   CXCursor_BlockExpr                     = 105,
01762 
01763   /** \brief An integer literal.
01764    */
01765   CXCursor_IntegerLiteral                = 106,
01766 
01767   /** \brief A floating point number literal.
01768    */
01769   CXCursor_FloatingLiteral               = 107,
01770 
01771   /** \brief An imaginary number literal.
01772    */
01773   CXCursor_ImaginaryLiteral              = 108,
01774 
01775   /** \brief A string literal.
01776    */
01777   CXCursor_StringLiteral                 = 109,
01778 
01779   /** \brief A character literal.
01780    */
01781   CXCursor_CharacterLiteral              = 110,
01782 
01783   /** \brief A parenthesized expression, e.g. "(1)".
01784    *
01785    * This AST node is only formed if full location information is requested.
01786    */
01787   CXCursor_ParenExpr                     = 111,
01788 
01789   /** \brief This represents the unary-expression's (except sizeof and
01790    * alignof).
01791    */
01792   CXCursor_UnaryOperator                 = 112,
01793 
01794   /** \brief [C99 6.5.2.1] Array Subscripting.
01795    */
01796   CXCursor_ArraySubscriptExpr            = 113,
01797 
01798   /** \brief A builtin binary operation expression such as "x + y" or
01799    * "x <= y".
01800    */
01801   CXCursor_BinaryOperator                = 114,
01802 
01803   /** \brief Compound assignment such as "+=".
01804    */
01805   CXCursor_CompoundAssignOperator        = 115,
01806 
01807   /** \brief The ?: ternary operator.
01808    */
01809   CXCursor_ConditionalOperator           = 116,
01810 
01811   /** \brief An explicit cast in C (C99 6.5.4) or a C-style cast in C++
01812    * (C++ [expr.cast]), which uses the syntax (Type)expr.
01813    *
01814    * For example: (int)f.
01815    */
01816   CXCursor_CStyleCastExpr                = 117,
01817 
01818   /** \brief [C99 6.5.2.5]
01819    */
01820   CXCursor_CompoundLiteralExpr           = 118,
01821 
01822   /** \brief Describes an C or C++ initializer list.
01823    */
01824   CXCursor_InitListExpr                  = 119,
01825 
01826   /** \brief The GNU address of label extension, representing &&label.
01827    */
01828   CXCursor_AddrLabelExpr                 = 120,
01829 
01830   /** \brief This is the GNU Statement Expression extension: ({int X=4; X;})
01831    */
01832   CXCursor_StmtExpr                      = 121,
01833 
01834   /** \brief Represents a C11 generic selection.
01835    */
01836   CXCursor_GenericSelectionExpr          = 122,
01837 
01838   /** \brief Implements the GNU __null extension, which is a name for a null
01839    * pointer constant that has integral type (e.g., int or long) and is the same
01840    * size and alignment as a pointer.
01841    *
01842    * The __null extension is typically only used by system headers, which define
01843    * NULL as __null in C++ rather than using 0 (which is an integer that may not
01844    * match the size of a pointer).
01845    */
01846   CXCursor_GNUNullExpr                   = 123,
01847 
01848   /** \brief C++'s static_cast<> expression.
01849    */
01850   CXCursor_CXXStaticCastExpr             = 124,
01851 
01852   /** \brief C++'s dynamic_cast<> expression.
01853    */
01854   CXCursor_CXXDynamicCastExpr            = 125,
01855 
01856   /** \brief C++'s reinterpret_cast<> expression.
01857    */
01858   CXCursor_CXXReinterpretCastExpr        = 126,
01859 
01860   /** \brief C++'s const_cast<> expression.
01861    */
01862   CXCursor_CXXConstCastExpr              = 127,
01863 
01864   /** \brief Represents an explicit C++ type conversion that uses "functional"
01865    * notion (C++ [expr.type.conv]).
01866    *
01867    * Example:
01868    * \code
01869    *   x = int(0.5);
01870    * \endcode
01871    */
01872   CXCursor_CXXFunctionalCastExpr         = 128,
01873 
01874   /** \brief A C++ typeid expression (C++ [expr.typeid]).
01875    */
01876   CXCursor_CXXTypeidExpr                 = 129,
01877 
01878   /** \brief [C++ 2.13.5] C++ Boolean Literal.
01879    */
01880   CXCursor_CXXBoolLiteralExpr            = 130,
01881 
01882   /** \brief [C++0x 2.14.7] C++ Pointer Literal.
01883    */
01884   CXCursor_CXXNullPtrLiteralExpr         = 131,
01885 
01886   /** \brief Represents the "this" expression in C++
01887    */
01888   CXCursor_CXXThisExpr                   = 132,
01889 
01890   /** \brief [C++ 15] C++ Throw Expression.
01891    *
01892    * This handles 'throw' and 'throw' assignment-expression. When
01893    * assignment-expression isn't present, Op will be null.
01894    */
01895   CXCursor_CXXThrowExpr                  = 133,
01896 
01897   /** \brief A new expression for memory allocation and constructor calls, e.g:
01898    * "new CXXNewExpr(foo)".
01899    */
01900   CXCursor_CXXNewExpr                    = 134,
01901 
01902   /** \brief A delete expression for memory deallocation and destructor calls,
01903    * e.g. "delete[] pArray".
01904    */
01905   CXCursor_CXXDeleteExpr                 = 135,
01906 
01907   /** \brief A unary expression.
01908    */
01909   CXCursor_UnaryExpr                     = 136,
01910 
01911   /** \brief An Objective-C string literal i.e. @"foo".
01912    */
01913   CXCursor_ObjCStringLiteral             = 137,
01914 
01915   /** \brief An Objective-C \@encode expression.
01916    */
01917   CXCursor_ObjCEncodeExpr                = 138,
01918 
01919   /** \brief An Objective-C \@selector expression.
01920    */
01921   CXCursor_ObjCSelectorExpr              = 139,
01922 
01923   /** \brief An Objective-C \@protocol expression.
01924    */
01925   CXCursor_ObjCProtocolExpr              = 140,
01926 
01927   /** \brief An Objective-C "bridged" cast expression, which casts between
01928    * Objective-C pointers and C pointers, transferring ownership in the process.
01929    *
01930    * \code
01931    *   NSString *str = (__bridge_transfer NSString *)CFCreateString();
01932    * \endcode
01933    */
01934   CXCursor_ObjCBridgedCastExpr           = 141,
01935 
01936   /** \brief Represents a C++0x pack expansion that produces a sequence of
01937    * expressions.
01938    *
01939    * A pack expansion expression contains a pattern (which itself is an
01940    * expression) followed by an ellipsis. For example:
01941    *
01942    * \code
01943    * template<typename F, typename ...Types>
01944    * void forward(F f, Types &&...args) {
01945    *  f(static_cast<Types&&>(args)...);
01946    * }
01947    * \endcode
01948    */
01949   CXCursor_PackExpansionExpr             = 142,
01950 
01951   /** \brief Represents an expression that computes the length of a parameter
01952    * pack.
01953    *
01954    * \code
01955    * template<typename ...Types>
01956    * struct count {
01957    *   static const unsigned value = sizeof...(Types);
01958    * };
01959    * \endcode
01960    */
01961   CXCursor_SizeOfPackExpr                = 143,
01962 
01963   /* \brief Represents a C++ lambda expression that produces a local function
01964    * object.
01965    *
01966    * \code
01967    * void abssort(float *x, unsigned N) {
01968    *   std::sort(x, x + N,
01969    *             [](float a, float b) {
01970    *               return std::abs(a) < std::abs(b);
01971    *             });
01972    * }
01973    * \endcode
01974    */
01975   CXCursor_LambdaExpr                    = 144,
01976   
01977   /** \brief Objective-c Boolean Literal.
01978    */
01979   CXCursor_ObjCBoolLiteralExpr           = 145,
01980 
01981   /** \brief Represents the "self" expression in an Objective-C method.
01982    */
01983   CXCursor_ObjCSelfExpr                  = 146,
01984 
01985   CXCursor_LastExpr                      = CXCursor_ObjCSelfExpr,
01986 
01987   /* Statements */
01988   CXCursor_FirstStmt                     = 200,
01989   /**
01990    * \brief A statement whose specific kind is not exposed via this
01991    * interface.
01992    *
01993    * Unexposed statements have the same operations as any other kind of
01994    * statement; one can extract their location information, spelling,
01995    * children, etc. However, the specific kind of the statement is not
01996    * reported.
01997    */
01998   CXCursor_UnexposedStmt                 = 200,
01999   
02000   /** \brief A labelled statement in a function. 
02001    *
02002    * This cursor kind is used to describe the "start_over:" label statement in 
02003    * the following example:
02004    *
02005    * \code
02006    *   start_over:
02007    *     ++counter;
02008    * \endcode
02009    *
02010    */
02011   CXCursor_LabelStmt                     = 201,
02012 
02013   /** \brief A group of statements like { stmt stmt }.
02014    *
02015    * This cursor kind is used to describe compound statements, e.g. function
02016    * bodies.
02017    */
02018   CXCursor_CompoundStmt                  = 202,
02019 
02020   /** \brief A case statement.
02021    */
02022   CXCursor_CaseStmt                      = 203,
02023 
02024   /** \brief A default statement.
02025    */
02026   CXCursor_DefaultStmt                   = 204,
02027 
02028   /** \brief An if statement
02029    */
02030   CXCursor_IfStmt                        = 205,
02031 
02032   /** \brief A switch statement.
02033    */
02034   CXCursor_SwitchStmt                    = 206,
02035 
02036   /** \brief A while statement.
02037    */
02038   CXCursor_WhileStmt                     = 207,
02039 
02040   /** \brief A do statement.
02041    */
02042   CXCursor_DoStmt                        = 208,
02043 
02044   /** \brief A for statement.
02045    */
02046   CXCursor_ForStmt                       = 209,
02047 
02048   /** \brief A goto statement.
02049    */
02050   CXCursor_GotoStmt                      = 210,
02051 
02052   /** \brief An indirect goto statement.
02053    */
02054   CXCursor_IndirectGotoStmt              = 211,
02055 
02056   /** \brief A continue statement.
02057    */
02058   CXCursor_ContinueStmt                  = 212,
02059 
02060   /** \brief A break statement.
02061    */
02062   CXCursor_BreakStmt                     = 213,
02063 
02064   /** \brief A return statement.
02065    */
02066   CXCursor_ReturnStmt                    = 214,
02067 
02068   /** \brief A GCC inline assembly statement extension.
02069    */
02070   CXCursor_GCCAsmStmt                    = 215,
02071   CXCursor_AsmStmt                       = CXCursor_GCCAsmStmt,
02072 
02073   /** \brief Objective-C's overall \@try-\@catch-\@finally statement.
02074    */
02075   CXCursor_ObjCAtTryStmt                 = 216,
02076 
02077   /** \brief Objective-C's \@catch statement.
02078    */
02079   CXCursor_ObjCAtCatchStmt               = 217,
02080 
02081   /** \brief Objective-C's \@finally statement.
02082    */
02083   CXCursor_ObjCAtFinallyStmt             = 218,
02084 
02085   /** \brief Objective-C's \@throw statement.
02086    */
02087   CXCursor_ObjCAtThrowStmt               = 219,
02088 
02089   /** \brief Objective-C's \@synchronized statement.
02090    */
02091   CXCursor_ObjCAtSynchronizedStmt        = 220,
02092 
02093   /** \brief Objective-C's autorelease pool statement.
02094    */
02095   CXCursor_ObjCAutoreleasePoolStmt       = 221,
02096 
02097   /** \brief Objective-C's collection statement.
02098    */
02099   CXCursor_ObjCForCollectionStmt         = 222,
02100 
02101   /** \brief C++'s catch statement.
02102    */
02103   CXCursor_CXXCatchStmt                  = 223,
02104 
02105   /** \brief C++'s try statement.
02106    */
02107   CXCursor_CXXTryStmt                    = 224,
02108 
02109   /** \brief C++'s for (* : *) statement.
02110    */
02111   CXCursor_CXXForRangeStmt               = 225,
02112 
02113   /** \brief Windows Structured Exception Handling's try statement.
02114    */
02115   CXCursor_SEHTryStmt                    = 226,
02116 
02117   /** \brief Windows Structured Exception Handling's except statement.
02118    */
02119   CXCursor_SEHExceptStmt                 = 227,
02120 
02121   /** \brief Windows Structured Exception Handling's finally statement.
02122    */
02123   CXCursor_SEHFinallyStmt                = 228,
02124 
02125   /** \brief A MS inline assembly statement extension.
02126    */
02127   CXCursor_MSAsmStmt                     = 229,
02128 
02129   /** \brief The null satement ";": C99 6.8.3p3.
02130    *
02131    * This cursor kind is used to describe the null statement.
02132    */
02133   CXCursor_NullStmt                      = 230,
02134 
02135   /** \brief Adaptor class for mixing declarations with statements and
02136    * expressions.
02137    */
02138   CXCursor_DeclStmt                      = 231,
02139 
02140   /** \brief OpenMP parallel directive.
02141    */
02142   CXCursor_OMPParallelDirective          = 232,
02143 
02144   /** \brief OpenMP simd directive.
02145    */
02146   CXCursor_OMPSimdDirective              = 233,
02147 
02148   CXCursor_LastStmt                      = CXCursor_OMPSimdDirective,
02149 
02150   /**
02151    * \brief Cursor that represents the translation unit itself.
02152    *
02153    * The translation unit cursor exists primarily to act as the root
02154    * cursor for traversing the contents of a translation unit.
02155    */
02156   CXCursor_TranslationUnit               = 300,
02157 
02158   /* Attributes */
02159   CXCursor_FirstAttr                     = 400,
02160   /**
02161    * \brief An attribute whose specific kind is not exposed via this
02162    * interface.
02163    */
02164   CXCursor_UnexposedAttr                 = 400,
02165 
02166   CXCursor_IBActionAttr                  = 401,
02167   CXCursor_IBOutletAttr                  = 402,
02168   CXCursor_IBOutletCollectionAttr        = 403,
02169   CXCursor_CXXFinalAttr                  = 404,
02170   CXCursor_CXXOverrideAttr               = 405,
02171   CXCursor_AnnotateAttr                  = 406,
02172   CXCursor_AsmLabelAttr                  = 407,
02173   CXCursor_PackedAttr                    = 408,
02174   CXCursor_LastAttr                      = CXCursor_PackedAttr,
02175      
02176   /* Preprocessing */
02177   CXCursor_PreprocessingDirective        = 500,
02178   CXCursor_MacroDefinition               = 501,
02179   CXCursor_MacroExpansion                = 502,
02180   CXCursor_MacroInstantiation            = CXCursor_MacroExpansion,
02181   CXCursor_InclusionDirective            = 503,
02182   CXCursor_FirstPreprocessing            = CXCursor_PreprocessingDirective,
02183   CXCursor_LastPreprocessing             = CXCursor_InclusionDirective,
02184 
02185   /* Extra Declarations */
02186   /**
02187    * \brief A module import declaration.
02188    */
02189   CXCursor_ModuleImportDecl              = 600,
02190   CXCursor_FirstExtraDecl                = CXCursor_ModuleImportDecl,
02191   CXCursor_LastExtraDecl                 = CXCursor_ModuleImportDecl
02192 };
02193 
02194 /**
02195  * \brief A cursor representing some element in the abstract syntax tree for
02196  * a translation unit.
02197  *
02198  * The cursor abstraction unifies the different kinds of entities in a
02199  * program--declaration, statements, expressions, references to declarations,
02200  * etc.--under a single "cursor" abstraction with a common set of operations.
02201  * Common operation for a cursor include: getting the physical location in
02202  * a source file where the cursor points, getting the name associated with a
02203  * cursor, and retrieving cursors for any child nodes of a particular cursor.
02204  *
02205  * Cursors can be produced in two specific ways.
02206  * clang_getTranslationUnitCursor() produces a cursor for a translation unit,
02207  * from which one can use clang_visitChildren() to explore the rest of the
02208  * translation unit. clang_getCursor() maps from a physical source location
02209  * to the entity that resides at that location, allowing one to map from the
02210  * source code into the AST.
02211  */
02212 typedef struct {
02213   enum CXCursorKind kind;
02214   int xdata;
02215   const void *data[3];
02216 } CXCursor;
02217 
02218 /**
02219  * \brief A comment AST node.
02220  */
02221 typedef struct {
02222   const void *ASTNode;
02223   CXTranslationUnit TranslationUnit;
02224 } CXComment;
02225 
02226 /**
02227  * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations
02228  *
02229  * @{
02230  */
02231 
02232 /**
02233  * \brief Retrieve the NULL cursor, which represents no entity.
02234  */
02235 CINDEX_LINKAGE CXCursor clang_getNullCursor(void);
02236 
02237 /**
02238  * \brief Retrieve the cursor that represents the given translation unit.
02239  *
02240  * The translation unit cursor can be used to start traversing the
02241  * various declarations within the given translation unit.
02242  */
02243 CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
02244 
02245 /**
02246  * \brief Determine whether two cursors are equivalent.
02247  */
02248 CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
02249 
02250 /**
02251  * \brief Returns non-zero if \p cursor is null.
02252  */
02253 CINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor);
02254 
02255 /**
02256  * \brief Compute a hash value for the given cursor.
02257  */
02258 CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);
02259   
02260 /**
02261  * \brief Retrieve the kind of the given cursor.
02262  */
02263 CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
02264 
02265 /**
02266  * \brief Determine whether the given cursor kind represents a declaration.
02267  */
02268 CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
02269 
02270 /**
02271  * \brief Determine whether the given cursor kind represents a simple
02272  * reference.
02273  *
02274  * Note that other kinds of cursors (such as expressions) can also refer to
02275  * other cursors. Use clang_getCursorReferenced() to determine whether a
02276  * particular cursor refers to another entity.
02277  */
02278 CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind);
02279 
02280 /**
02281  * \brief Determine whether the given cursor kind represents an expression.
02282  */
02283 CINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind);
02284 
02285 /**
02286  * \brief Determine whether the given cursor kind represents a statement.
02287  */
02288 CINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind);
02289 
02290 /**
02291  * \brief Determine whether the given cursor kind represents an attribute.
02292  */
02293 CINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind);
02294 
02295 /**
02296  * \brief Determine whether the given cursor kind represents an invalid
02297  * cursor.
02298  */
02299 CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind);
02300 
02301 /**
02302  * \brief Determine whether the given cursor kind represents a translation
02303  * unit.
02304  */
02305 CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind);
02306 
02307 /***
02308  * \brief Determine whether the given cursor represents a preprocessing
02309  * element, such as a preprocessor directive or macro instantiation.
02310  */
02311 CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind);
02312   
02313 /***
02314  * \brief Determine whether the given cursor represents a currently
02315  *  unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
02316  */
02317 CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind);
02318 
02319 /**
02320  * \brief Describe the linkage of the entity referred to by a cursor.
02321  */
02322 enum CXLinkageKind {
02323   /** \brief This value indicates that no linkage information is available
02324    * for a provided CXCursor. */
02325   CXLinkage_Invalid,
02326   /**
02327    * \brief This is the linkage for variables, parameters, and so on that
02328    *  have automatic storage.  This covers normal (non-extern) local variables.
02329    */
02330   CXLinkage_NoLinkage,
02331   /** \brief This is the linkage for static variables and static functions. */
02332   CXLinkage_Internal,
02333   /** \brief This is the linkage for entities with external linkage that live
02334    * in C++ anonymous namespaces.*/
02335   CXLinkage_UniqueExternal,
02336   /** \brief This is the linkage for entities with true, external linkage. */
02337   CXLinkage_External
02338 };
02339 
02340 /**
02341  * \brief Determine the linkage of the entity referred to by a given cursor.
02342  */
02343 CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
02344 
02345 /**
02346  * \brief Determine the availability of the entity that this cursor refers to,
02347  * taking the current target platform into account.
02348  *
02349  * \param cursor The cursor to query.
02350  *
02351  * \returns The availability of the cursor.
02352  */
02353 CINDEX_LINKAGE enum CXAvailabilityKind 
02354 clang_getCursorAvailability(CXCursor cursor);
02355 
02356 /**
02357  * Describes the availability of a given entity on a particular platform, e.g.,
02358  * a particular class might only be available on Mac OS 10.7 or newer.
02359  */
02360 typedef struct CXPlatformAvailability {
02361   /**
02362    * \brief A string that describes the platform for which this structure
02363    * provides availability information.
02364    *
02365    * Possible values are "ios" or "macosx".
02366    */
02367   CXString Platform;
02368   /**
02369    * \brief The version number in which this entity was introduced.
02370    */
02371   CXVersion Introduced;
02372   /**
02373    * \brief The version number in which this entity was deprecated (but is
02374    * still available).
02375    */
02376   CXVersion Deprecated;
02377   /**
02378    * \brief The version number in which this entity was obsoleted, and therefore
02379    * is no longer available.
02380    */
02381   CXVersion Obsoleted;
02382   /**
02383    * \brief Whether the entity is unconditionally unavailable on this platform.
02384    */
02385   int Unavailable;
02386   /**
02387    * \brief An optional message to provide to a user of this API, e.g., to
02388    * suggest replacement APIs.
02389    */
02390   CXString Message;
02391 } CXPlatformAvailability;
02392 
02393 /**
02394  * \brief Determine the availability of the entity that this cursor refers to
02395  * on any platforms for which availability information is known.
02396  *
02397  * \param cursor The cursor to query.
02398  *
02399  * \param always_deprecated If non-NULL, will be set to indicate whether the 
02400  * entity is deprecated on all platforms.
02401  *
02402  * \param deprecated_message If non-NULL, will be set to the message text 
02403  * provided along with the unconditional deprecation of this entity. The client
02404  * is responsible for deallocating this string.
02405  *
02406  * \param always_unavailable If non-NULL, will be set to indicate whether the
02407  * entity is unavailable on all platforms.
02408  *
02409  * \param unavailable_message If non-NULL, will be set to the message text
02410  * provided along with the unconditional unavailability of this entity. The 
02411  * client is responsible for deallocating this string.
02412  *
02413  * \param availability If non-NULL, an array of CXPlatformAvailability instances
02414  * that will be populated with platform availability information, up to either
02415  * the number of platforms for which availability information is available (as
02416  * returned by this function) or \c availability_size, whichever is smaller.
02417  *
02418  * \param availability_size The number of elements available in the 
02419  * \c availability array.
02420  *
02421  * \returns The number of platforms (N) for which availability information is
02422  * available (which is unrelated to \c availability_size).
02423  *
02424  * Note that the client is responsible for calling 
02425  * \c clang_disposeCXPlatformAvailability to free each of the 
02426  * platform-availability structures returned. There are 
02427  * \c min(N, availability_size) such structures.
02428  */
02429 CINDEX_LINKAGE int
02430 clang_getCursorPlatformAvailability(CXCursor cursor,
02431                                     int *always_deprecated,
02432                                     CXString *deprecated_message,
02433                                     int *always_unavailable,
02434                                     CXString *unavailable_message,
02435                                     CXPlatformAvailability *availability,
02436                                     int availability_size);
02437 
02438 /**
02439  * \brief Free the memory associated with a \c CXPlatformAvailability structure.
02440  */
02441 CINDEX_LINKAGE void
02442 clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability);
02443   
02444 /**
02445  * \brief Describe the "language" of the entity referred to by a cursor.
02446  */
02447 enum CXLanguageKind {
02448   CXLanguage_Invalid = 0,
02449   CXLanguage_C,
02450   CXLanguage_ObjC,
02451   CXLanguage_CPlusPlus
02452 };
02453 
02454 /**
02455  * \brief Determine the "language" of the entity referred to by a given cursor.
02456  */
02457 CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor);
02458 
02459 /**
02460  * \brief Returns the translation unit that a cursor originated from.
02461  */
02462 CINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor);
02463 
02464 
02465 /**
02466  * \brief A fast container representing a set of CXCursors.
02467  */
02468 typedef struct CXCursorSetImpl *CXCursorSet;
02469 
02470 /**
02471  * \brief Creates an empty CXCursorSet.
02472  */
02473 CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void);
02474 
02475 /**
02476  * \brief Disposes a CXCursorSet and releases its associated memory.
02477  */
02478 CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset);
02479 
02480 /**
02481  * \brief Queries a CXCursorSet to see if it contains a specific CXCursor.
02482  *
02483  * \returns non-zero if the set contains the specified cursor.
02484 */
02485 CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset,
02486                                                    CXCursor cursor);
02487 
02488 /**
02489  * \brief Inserts a CXCursor into a CXCursorSet.
02490  *
02491  * \returns zero if the CXCursor was already in the set, and non-zero otherwise.
02492 */
02493 CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,
02494                                                  CXCursor cursor);
02495 
02496 /**
02497  * \brief Determine the semantic parent of the given cursor.
02498  *
02499  * The semantic parent of a cursor is the cursor that semantically contains
02500  * the given \p cursor. For many declarations, the lexical and semantic parents
02501  * are equivalent (the lexical parent is returned by 
02502  * \c clang_getCursorLexicalParent()). They diverge when declarations or
02503  * definitions are provided out-of-line. For example:
02504  *
02505  * \code
02506  * class C {
02507  *  void f();
02508  * };
02509  *
02510  * void C::f() { }
02511  * \endcode
02512  *
02513  * In the out-of-line definition of \c C::f, the semantic parent is
02514  * the class \c C, of which this function is a member. The lexical parent is
02515  * the place where the declaration actually occurs in the source code; in this
02516  * case, the definition occurs in the translation unit. In general, the
02517  * lexical parent for a given entity can change without affecting the semantics
02518  * of the program, and the lexical parent of different declarations of the
02519  * same entity may be different. Changing the semantic parent of a declaration,
02520  * on the other hand, can have a major impact on semantics, and redeclarations
02521  * of a particular entity should all have the same semantic context.
02522  *
02523  * In the example above, both declarations of \c C::f have \c C as their
02524  * semantic context, while the lexical context of the first \c C::f is \c C
02525  * and the lexical context of the second \c C::f is the translation unit.
02526  *
02527  * For global declarations, the semantic parent is the translation unit.
02528  */
02529 CINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor);
02530 
02531 /**
02532  * \brief Determine the lexical parent of the given cursor.
02533  *
02534  * The lexical parent of a cursor is the cursor in which the given \p cursor
02535  * was actually written. For many declarations, the lexical and semantic parents
02536  * are equivalent (the semantic parent is returned by 
02537  * \c clang_getCursorSemanticParent()). They diverge when declarations or
02538  * definitions are provided out-of-line. For example:
02539  *
02540  * \code
02541  * class C {
02542  *  void f();
02543  * };
02544  *
02545  * void C::f() { }
02546  * \endcode
02547  *
02548  * In the out-of-line definition of \c C::f, the semantic parent is
02549  * the class \c C, of which this function is a member. The lexical parent is
02550  * the place where the declaration actually occurs in the source code; in this
02551  * case, the definition occurs in the translation unit. In general, the
02552  * lexical parent for a given entity can change without affecting the semantics
02553  * of the program, and the lexical parent of different declarations of the
02554  * same entity may be different. Changing the semantic parent of a declaration,
02555  * on the other hand, can have a major impact on semantics, and redeclarations
02556  * of a particular entity should all have the same semantic context.
02557  *
02558  * In the example above, both declarations of \c C::f have \c C as their
02559  * semantic context, while the lexical context of the first \c C::f is \c C
02560  * and the lexical context of the second \c C::f is the translation unit.
02561  *
02562  * For declarations written in the global scope, the lexical parent is
02563  * the translation unit.
02564  */
02565 CINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor);
02566 
02567 /**
02568  * \brief Determine the set of methods that are overridden by the given
02569  * method.
02570  *
02571  * In both Objective-C and C++, a method (aka virtual member function,
02572  * in C++) can override a virtual method in a base class. For
02573  * Objective-C, a method is said to override any method in the class's
02574  * base class, its protocols, or its categories' protocols, that has the same
02575  * selector and is of the same kind (class or instance).
02576  * If no such method exists, the search continues to the class's superclass,
02577  * its protocols, and its categories, and so on. A method from an Objective-C
02578  * implementation is considered to override the same methods as its
02579  * corresponding method in the interface.
02580  *
02581  * For C++, a virtual member function overrides any virtual member
02582  * function with the same signature that occurs in its base
02583  * classes. With multiple inheritance, a virtual member function can
02584  * override several virtual member functions coming from different
02585  * base classes.
02586  *
02587  * In all cases, this function determines the immediate overridden
02588  * method, rather than all of the overridden methods. For example, if
02589  * a method is originally declared in a class A, then overridden in B
02590  * (which in inherits from A) and also in C (which inherited from B),
02591  * then the only overridden method returned from this function when
02592  * invoked on C's method will be B's method. The client may then
02593  * invoke this function again, given the previously-found overridden
02594  * methods, to map out the complete method-override set.
02595  *
02596  * \param cursor A cursor representing an Objective-C or C++
02597  * method. This routine will compute the set of methods that this
02598  * method overrides.
02599  * 
02600  * \param overridden A pointer whose pointee will be replaced with a
02601  * pointer to an array of cursors, representing the set of overridden
02602  * methods. If there are no overridden methods, the pointee will be
02603  * set to NULL. The pointee must be freed via a call to 
02604  * \c clang_disposeOverriddenCursors().
02605  *
02606  * \param num_overridden A pointer to the number of overridden
02607  * functions, will be set to the number of overridden functions in the
02608  * array pointed to by \p overridden.
02609  */
02610 CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor, 
02611                                                CXCursor **overridden,
02612                                                unsigned *num_overridden);
02613 
02614 /**
02615  * \brief Free the set of overridden cursors returned by \c
02616  * clang_getOverriddenCursors().
02617  */
02618 CINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden);
02619 
02620 /**
02621  * \brief Retrieve the file that is included by the given inclusion directive
02622  * cursor.
02623  */
02624 CINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor);
02625   
02626 /**
02627  * @}
02628  */
02629 
02630 /**
02631  * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code
02632  *
02633  * Cursors represent a location within the Abstract Syntax Tree (AST). These
02634  * routines help map between cursors and the physical locations where the
02635  * described entities occur in the source code. The mapping is provided in
02636  * both directions, so one can map from source code to the AST and back.
02637  *
02638  * @{
02639  */
02640 
02641 /**
02642  * \brief Map a source location to the cursor that describes the entity at that
02643  * location in the source code.
02644  *
02645  * clang_getCursor() maps an arbitrary source location within a translation
02646  * unit down to the most specific cursor that describes the entity at that
02647  * location. For example, given an expression \c x + y, invoking
02648  * clang_getCursor() with a source location pointing to "x" will return the
02649  * cursor for "x"; similarly for "y". If the cursor points anywhere between
02650  * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
02651  * will return a cursor referring to the "+" expression.
02652  *
02653  * \returns a cursor representing the entity at the given source location, or
02654  * a NULL cursor if no such entity can be found.
02655  */
02656 CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation);
02657 
02658 /**
02659  * \brief Retrieve the physical location of the source constructor referenced
02660  * by the given cursor.
02661  *
02662  * The location of a declaration is typically the location of the name of that
02663  * declaration, where the name of that declaration would occur if it is
02664  * unnamed, or some keyword that introduces that particular declaration.
02665  * The location of a reference is where that reference occurs within the
02666  * source code.
02667  */
02668 CINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor);
02669 
02670 /**
02671  * \brief Retrieve the physical extent of the source construct referenced by
02672  * the given cursor.
02673  *
02674  * The extent of a cursor starts with the file/line/column pointing at the
02675  * first character within the source construct that the cursor refers to and
02676  * ends with the last character within that source construct. For a
02677  * declaration, the extent covers the declaration itself. For a reference,
02678  * the extent covers the location of the reference (e.g., where the referenced
02679  * entity was actually used).
02680  */
02681 CINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor);
02682 
02683 /**
02684  * @}
02685  */
02686     
02687 /**
02688  * \defgroup CINDEX_TYPES Type information for CXCursors
02689  *
02690  * @{
02691  */
02692 
02693 /**
02694  * \brief Describes the kind of type
02695  */
02696 enum CXTypeKind {
02697   /**
02698    * \brief Represents an invalid type (e.g., where no type is available).
02699    */
02700   CXType_Invalid = 0,
02701 
02702   /**
02703    * \brief A type whose specific kind is not exposed via this
02704    * interface.
02705    */
02706   CXType_Unexposed = 1,
02707 
02708   /* Builtin types */
02709   CXType_Void = 2,
02710   CXType_Bool = 3,
02711   CXType_Char_U = 4,
02712   CXType_UChar = 5,
02713   CXType_Char16 = 6,
02714   CXType_Char32 = 7,
02715   CXType_UShort = 8,
02716   CXType_UInt = 9,
02717   CXType_ULong = 10,
02718   CXType_ULongLong = 11,
02719   CXType_UInt128 = 12,
02720   CXType_Char_S = 13,
02721   CXType_SChar = 14,
02722   CXType_WChar = 15,
02723   CXType_Short = 16,
02724   CXType_Int = 17,
02725   CXType_Long = 18,
02726   CXType_LongLong = 19,
02727   CXType_Int128 = 20,
02728   CXType_Float = 21,
02729   CXType_Double = 22,
02730   CXType_LongDouble = 23,
02731   CXType_NullPtr = 24,
02732   CXType_Overload = 25,
02733   CXType_Dependent = 26,
02734   CXType_ObjCId = 27,
02735   CXType_ObjCClass = 28,
02736   CXType_ObjCSel = 29,
02737   CXType_FirstBuiltin = CXType_Void,
02738   CXType_LastBuiltin  = CXType_ObjCSel,
02739 
02740   CXType_Complex = 100,
02741   CXType_Pointer = 101,
02742   CXType_BlockPointer = 102,
02743   CXType_LValueReference = 103,
02744   CXType_RValueReference = 104,
02745   CXType_Record = 105,
02746   CXType_Enum = 106,
02747   CXType_Typedef = 107,
02748   CXType_ObjCInterface = 108,
02749   CXType_ObjCObjectPointer = 109,
02750   CXType_FunctionNoProto = 110,
02751   CXType_FunctionProto = 111,
02752   CXType_ConstantArray = 112,
02753   CXType_Vector = 113,
02754   CXType_IncompleteArray = 114,
02755   CXType_VariableArray = 115,
02756   CXType_DependentSizedArray = 116,
02757   CXType_MemberPointer = 117
02758 };
02759 
02760 /**
02761  * \brief Describes the calling convention of a function type
02762  */
02763 enum CXCallingConv {
02764   CXCallingConv_Default = 0,
02765   CXCallingConv_C = 1,
02766   CXCallingConv_X86StdCall = 2,
02767   CXCallingConv_X86FastCall = 3,
02768   CXCallingConv_X86ThisCall = 4,
02769   CXCallingConv_X86Pascal = 5,
02770   CXCallingConv_AAPCS = 6,
02771   CXCallingConv_AAPCS_VFP = 7,
02772   CXCallingConv_PnaclCall = 8,
02773   CXCallingConv_IntelOclBicc = 9,
02774   CXCallingConv_X86_64Win64 = 10,
02775   CXCallingConv_X86_64SysV = 11,
02776 
02777   CXCallingConv_Invalid = 100,
02778   CXCallingConv_Unexposed = 200
02779 };
02780 
02781 
02782 /**
02783  * \brief The type of an element in the abstract syntax tree.
02784  *
02785  */
02786 typedef struct {
02787   enum CXTypeKind kind;
02788   void *data[2];
02789 } CXType;
02790 
02791 /**
02792  * \brief Retrieve the type of a CXCursor (if any).
02793  */
02794 CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C);
02795 
02796 /**
02797  * \brief Pretty-print the underlying type using the rules of the
02798  * language of the translation unit from which it came.
02799  *
02800  * If the type is invalid, an empty string is returned.
02801  */
02802 CINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT);
02803 
02804 /**
02805  * \brief Retrieve the underlying type of a typedef declaration.
02806  *
02807  * If the cursor does not reference a typedef declaration, an invalid type is
02808  * returned.
02809  */
02810 CINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C);
02811 
02812 /**
02813  * \brief Retrieve the integer type of an enum declaration.
02814  *
02815  * If the cursor does not reference an enum declaration, an invalid type is
02816  * returned.
02817  */
02818 CINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C);
02819 
02820 /**
02821  * \brief Retrieve the integer value of an enum constant declaration as a signed
02822  *  long long.
02823  *
02824  * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned.
02825  * Since this is also potentially a valid constant value, the kind of the cursor
02826  * must be verified before calling this function.
02827  */
02828 CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C);
02829 
02830 /**
02831  * \brief Retrieve the integer value of an enum constant declaration as an unsigned
02832  *  long long.
02833  *
02834  * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned.
02835  * Since this is also potentially a valid constant value, the kind of the cursor
02836  * must be verified before calling this function.
02837  */
02838 CINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C);
02839 
02840 /**
02841  * \brief Retrieve the bit width of a bit field declaration as an integer.
02842  *
02843  * If a cursor that is not a bit field declaration is passed in, -1 is returned.
02844  */
02845 CINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C);
02846 
02847 /**
02848  * \brief Retrieve the number of non-variadic arguments associated with a given
02849  * cursor.
02850  *
02851  * The number of arguments can be determined for calls as well as for
02852  * declarations of functions or methods. For other cursors -1 is returned.
02853  */
02854 CINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C);
02855 
02856 /**
02857  * \brief Retrieve the argument cursor of a function or method.
02858  *
02859  * The argument cursor can be determined for calls as well as for declarations
02860  * of functions or methods. For other cursors and for invalid indices, an
02861  * invalid cursor is returned.
02862  */
02863 CINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i);
02864 
02865 /**
02866  * \brief Determine whether two CXTypes represent the same type.
02867  *
02868  * \returns non-zero if the CXTypes represent the same type and
02869  *          zero otherwise.
02870  */
02871 CINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B);
02872 
02873 /**
02874  * \brief Return the canonical type for a CXType.
02875  *
02876  * Clang's type system explicitly models typedefs and all the ways
02877  * a specific type can be represented.  The canonical type is the underlying
02878  * type with all the "sugar" removed.  For example, if 'T' is a typedef
02879  * for 'int', the canonical type for 'T' would be 'int'.
02880  */
02881 CINDEX_LINKAGE CXType clang_getCanonicalType(CXType T);
02882 
02883 /**
02884  * \brief Determine whether a CXType has the "const" qualifier set,
02885  * without looking through typedefs that may have added "const" at a
02886  * different level.
02887  */
02888 CINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T);
02889 
02890 /**
02891  * \brief Determine whether a CXType has the "volatile" qualifier set,
02892  * without looking through typedefs that may have added "volatile" at
02893  * a different level.
02894  */
02895 CINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T);
02896 
02897 /**
02898  * \brief Determine whether a CXType has the "restrict" qualifier set,
02899  * without looking through typedefs that may have added "restrict" at a
02900  * different level.
02901  */
02902 CINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T);
02903 
02904 /**
02905  * \brief For pointer types, returns the type of the pointee.
02906  */
02907 CINDEX_LINKAGE CXType clang_getPointeeType(CXType T);
02908 
02909 /**
02910  * \brief Return the cursor for the declaration of the given type.
02911  */
02912 CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T);
02913 
02914 /**
02915  * Returns the Objective-C type encoding for the specified declaration.
02916  */
02917 CINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C);
02918 
02919 /**
02920  * \brief Retrieve the spelling of a given CXTypeKind.
02921  */
02922 CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K);
02923 
02924 /**
02925  * \brief Retrieve the calling convention associated with a function type.
02926  *
02927  * If a non-function type is passed in, CXCallingConv_Invalid is returned.
02928  */
02929 CINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T);
02930 
02931 /**
02932  * \brief Retrieve the return type associated with a function type.
02933  *
02934  * If a non-function type is passed in, an invalid type is returned.
02935  */
02936 CINDEX_LINKAGE CXType clang_getResultType(CXType T);
02937 
02938 /**
02939  * \brief Retrieve the number of non-variadic parameters associated with a
02940  * function type.
02941  *
02942  * If a non-function type is passed in, -1 is returned.
02943  */
02944 CINDEX_LINKAGE int clang_getNumArgTypes(CXType T);
02945 
02946 /**
02947  * \brief Retrieve the type of a parameter of a function type.
02948  *
02949  * If a non-function type is passed in or the function does not have enough
02950  * parameters, an invalid type is returned.
02951  */
02952 CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i);
02953 
02954 /**
02955  * \brief Return 1 if the CXType is a variadic function type, and 0 otherwise.
02956  */
02957 CINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T);
02958 
02959 /**
02960  * \brief Retrieve the return type associated with a given cursor.
02961  *
02962  * This only returns a valid type if the cursor refers to a function or method.
02963  */
02964 CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C);
02965 
02966 /**
02967  * \brief Return 1 if the CXType is a POD (plain old data) type, and 0
02968  *  otherwise.
02969  */
02970 CINDEX_LINKAGE unsigned clang_isPODType(CXType T);
02971 
02972 /**
02973  * \brief Return the element type of an array, complex, or vector type.
02974  *
02975  * If a type is passed in that is not an array, complex, or vector type,
02976  * an invalid type is returned.
02977  */
02978 CINDEX_LINKAGE CXType clang_getElementType(CXType T);
02979 
02980 /**
02981  * \brief Return the number of elements of an array or vector type.
02982  *
02983  * If a type is passed in that is not an array or vector type,
02984  * -1 is returned.
02985  */
02986 CINDEX_LINKAGE long long clang_getNumElements(CXType T);
02987 
02988 /**
02989  * \brief Return the element type of an array type.
02990  *
02991  * If a non-array type is passed in, an invalid type is returned.
02992  */
02993 CINDEX_LINKAGE CXType clang_getArrayElementType(CXType T);
02994 
02995 /**
02996  * \brief Return the array size of a constant array.
02997  *
02998  * If a non-array type is passed in, -1 is returned.
02999  */
03000 CINDEX_LINKAGE long long clang_getArraySize(CXType T);
03001 
03002 /**
03003  * \brief List the possible error codes for \c clang_Type_getSizeOf,
03004  *   \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
03005  *   \c clang_Cursor_getOffsetOf.
03006  *
03007  * A value of this enumeration type can be returned if the target type is not
03008  * a valid argument to sizeof, alignof or offsetof.
03009  */
03010 enum CXTypeLayoutError {
03011   /**
03012    * \brief Type is of kind CXType_Invalid.
03013    */
03014   CXTypeLayoutError_Invalid = -1,
03015   /**
03016    * \brief The type is an incomplete Type.
03017    */
03018   CXTypeLayoutError_Incomplete = -2,
03019   /**
03020    * \brief The type is a dependent Type.
03021    */
03022   CXTypeLayoutError_Dependent = -3,
03023   /**
03024    * \brief The type is not a constant size type.
03025    */
03026   CXTypeLayoutError_NotConstantSize = -4,
03027   /**
03028    * \brief The Field name is not valid for this record.
03029    */
03030   CXTypeLayoutError_InvalidFieldName = -5
03031 };
03032 
03033 /**
03034  * \brief Return the alignment of a type in bytes as per C++[expr.alignof]
03035  *   standard.
03036  *
03037  * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
03038  * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
03039  *   is returned.
03040  * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
03041  *   returned.
03042  * If the type declaration is not a constant size type,
03043  *   CXTypeLayoutError_NotConstantSize is returned.
03044  */
03045 CINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T);
03046 
03047 /**
03048  * \brief Return the class type of an member pointer type.
03049  *
03050  * If a non-member-pointer type is passed in, an invalid type is returned.
03051  */
03052 CINDEX_LINKAGE CXType clang_Type_getClassType(CXType T);
03053 
03054 /**
03055  * \brief Return the size of a type in bytes as per C++[expr.sizeof] standard.
03056  *
03057  * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
03058  * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
03059  *   is returned.
03060  * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
03061  *   returned.
03062  */
03063 CINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T);
03064 
03065 /**
03066  * \brief Return the offset of a field named S in a record of type T in bits
03067  *   as it would be returned by __offsetof__ as per C++11[18.2p4]
03068  *
03069  * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid
03070  *   is returned.
03071  * If the field's type declaration is an incomplete type,
03072  *   CXTypeLayoutError_Incomplete is returned.
03073  * If the field's type declaration is a dependent type,
03074  *   CXTypeLayoutError_Dependent is returned.
03075  * If the field's name S is not found,
03076  *   CXTypeLayoutError_InvalidFieldName is returned.
03077  */
03078 CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S);
03079 
03080 enum CXRefQualifierKind {
03081   /** \brief No ref-qualifier was provided. */
03082   CXRefQualifier_None = 0,
03083   /** \brief An lvalue ref-qualifier was provided (\c &). */
03084   CXRefQualifier_LValue,
03085   /** \brief An rvalue ref-qualifier was provided (\c &&). */
03086   CXRefQualifier_RValue
03087 };
03088 
03089 /**
03090  * \brief Returns the number of template arguments for given class template
03091  * specialization, or -1 if type \c T is not a class template specialization.
03092  *
03093  * Variadic argument packs count as only one argument, and can not be inspected
03094  * further.
03095  */
03096 CINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T);
03097 
03098 /**
03099  * \brief Returns the type template argument of a template class specialization
03100  * at given index.
03101  *
03102  * This function only returns template type arguments and does not handle
03103  * template template arguments or variadic packs.
03104  */
03105 CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T, unsigned i);
03106 
03107 /**
03108  * \brief Retrieve the ref-qualifier kind of a function or method.
03109  *
03110  * The ref-qualifier is returned for C++ functions or methods. For other types
03111  * or non-C++ declarations, CXRefQualifier_None is returned.
03112  */
03113 CINDEX_LINKAGE enum CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T);
03114 
03115 /**
03116  * \brief Returns non-zero if the cursor specifies a Record member that is a
03117  *   bitfield.
03118  */
03119 CINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C);
03120 
03121 /**
03122  * \brief Returns 1 if the base class specified by the cursor with kind
03123  *   CX_CXXBaseSpecifier is virtual.
03124  */
03125 CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor);
03126     
03127 /**
03128  * \brief Represents the C++ access control level to a base class for a
03129  * cursor with kind CX_CXXBaseSpecifier.
03130  */
03131 enum CX_CXXAccessSpecifier {
03132   CX_CXXInvalidAccessSpecifier,
03133   CX_CXXPublic,
03134   CX_CXXProtected,
03135   CX_CXXPrivate
03136 };
03137 
03138 /**
03139  * \brief Returns the access control level for the referenced object.
03140  *
03141  * If the cursor refers to a C++ declaration, its access control level within its
03142  * parent scope is returned. Otherwise, if the cursor refers to a base specifier or
03143  * access specifier, the specifier itself is returned.
03144  */
03145 CINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);
03146 
03147 /**
03148  * \brief Determine the number of overloaded declarations referenced by a 
03149  * \c CXCursor_OverloadedDeclRef cursor.
03150  *
03151  * \param cursor The cursor whose overloaded declarations are being queried.
03152  *
03153  * \returns The number of overloaded declarations referenced by \c cursor. If it
03154  * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
03155  */
03156 CINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor);
03157 
03158 /**
03159  * \brief Retrieve a cursor for one of the overloaded declarations referenced
03160  * by a \c CXCursor_OverloadedDeclRef cursor.
03161  *
03162  * \param cursor The cursor whose overloaded declarations are being queried.
03163  *
03164  * \param index The zero-based index into the set of overloaded declarations in
03165  * the cursor.
03166  *
03167  * \returns A cursor representing the declaration referenced by the given 
03168  * \c cursor at the specified \c index. If the cursor does not have an 
03169  * associated set of overloaded declarations, or if the index is out of bounds,
03170  * returns \c clang_getNullCursor();
03171  */
03172 CINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor, 
03173                                                 unsigned index);
03174   
03175 /**
03176  * @}
03177  */
03178   
03179 /**
03180  * \defgroup CINDEX_ATTRIBUTES Information for attributes
03181  *
03182  * @{
03183  */
03184 
03185 
03186 /**
03187  * \brief For cursors representing an iboutletcollection attribute,
03188  *  this function returns the collection element type.
03189  *
03190  */
03191 CINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor);
03192 
03193 /**
03194  * @}
03195  */
03196 
03197 /**
03198  * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors
03199  *
03200  * These routines provide the ability to traverse the abstract syntax tree
03201  * using cursors.
03202  *
03203  * @{
03204  */
03205 
03206 /**
03207  * \brief Describes how the traversal of the children of a particular
03208  * cursor should proceed after visiting a particular child cursor.
03209  *
03210  * A value of this enumeration type should be returned by each
03211  * \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
03212  */
03213 enum CXChildVisitResult {
03214   /**
03215    * \brief Terminates the cursor traversal.
03216    */
03217   CXChildVisit_Break,
03218   /**
03219    * \brief Continues the cursor traversal with the next sibling of
03220    * the cursor just visited, without visiting its children.
03221    */
03222   CXChildVisit_Continue,
03223   /**
03224    * \brief Recursively traverse the children of this cursor, using
03225    * the same visitor and client data.
03226    */
03227   CXChildVisit_Recurse
03228 };
03229 
03230 /**
03231  * \brief Visitor invoked for each cursor found by a traversal.
03232  *
03233  * This visitor function will be invoked for each cursor found by
03234  * clang_visitCursorChildren(). Its first argument is the cursor being
03235  * visited, its second argument is the parent visitor for that cursor,
03236  * and its third argument is the client data provided to
03237  * clang_visitCursorChildren().
03238  *
03239  * The visitor should return one of the \c CXChildVisitResult values
03240  * to direct clang_visitCursorChildren().
03241  */
03242 typedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor,
03243                                                    CXCursor parent,
03244                                                    CXClientData client_data);
03245 
03246 /**
03247  * \brief Visit the children of a particular cursor.
03248  *
03249  * This function visits all the direct children of the given cursor,
03250  * invoking the given \p visitor function with the cursors of each
03251  * visited child. The traversal may be recursive, if the visitor returns
03252  * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
03253  * the visitor returns \c CXChildVisit_Break.
03254  *
03255  * \param parent the cursor whose child may be visited. All kinds of
03256  * cursors can be visited, including invalid cursors (which, by
03257  * definition, have no children).
03258  *
03259  * \param visitor the visitor function that will be invoked for each
03260  * child of \p parent.
03261  *
03262  * \param client_data pointer data supplied by the client, which will
03263  * be passed to the visitor each time it is invoked.
03264  *
03265  * \returns a non-zero value if the traversal was terminated
03266  * prematurely by the visitor returning \c CXChildVisit_Break.
03267  */
03268 CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,
03269                                             CXCursorVisitor visitor,
03270                                             CXClientData client_data);
03271 #ifdef __has_feature
03272 #  if __has_feature(blocks)
03273 /**
03274  * \brief Visitor invoked for each cursor found by a traversal.
03275  *
03276  * This visitor block will be invoked for each cursor found by
03277  * clang_visitChildrenWithBlock(). Its first argument is the cursor being
03278  * visited, its second argument is the parent visitor for that cursor.
03279  *
03280  * The visitor should return one of the \c CXChildVisitResult values
03281  * to direct clang_visitChildrenWithBlock().
03282  */
03283 typedef enum CXChildVisitResult 
03284      (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent);
03285 
03286 /**
03287  * Visits the children of a cursor using the specified block.  Behaves
03288  * identically to clang_visitChildren() in all other respects.
03289  */
03290 unsigned clang_visitChildrenWithBlock(CXCursor parent,
03291                                       CXCursorVisitorBlock block);
03292 #  endif
03293 #endif
03294 
03295 /**
03296  * @}
03297  */
03298 
03299 /**
03300  * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST
03301  *
03302  * These routines provide the ability to determine references within and
03303  * across translation units, by providing the names of the entities referenced
03304  * by cursors, follow reference cursors to the declarations they reference,
03305  * and associate declarations with their definitions.
03306  *
03307  * @{
03308  */
03309 
03310 /**
03311  * \brief Retrieve a Unified Symbol Resolution (USR) for the entity referenced
03312  * by the given cursor.
03313  *
03314  * A Unified Symbol Resolution (USR) is a string that identifies a particular
03315  * entity (function, class, variable, etc.) within a program. USRs can be
03316  * compared across translation units to determine, e.g., when references in
03317  * one translation refer to an entity defined in another translation unit.
03318  */
03319 CINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor);
03320 
03321 /**
03322  * \brief Construct a USR for a specified Objective-C class.
03323  */
03324 CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);
03325 
03326 /**
03327  * \brief Construct a USR for a specified Objective-C category.
03328  */
03329 CINDEX_LINKAGE CXString
03330   clang_constructUSR_ObjCCategory(const char *class_name,
03331                                  const char *category_name);
03332 
03333 /**
03334  * \brief Construct a USR for a specified Objective-C protocol.
03335  */
03336 CINDEX_LINKAGE CXString
03337   clang_constructUSR_ObjCProtocol(const char *protocol_name);
03338 
03339 
03340 /**
03341  * \brief Construct a USR for a specified Objective-C instance variable and
03342  *   the USR for its containing class.
03343  */
03344 CINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name,
03345                                                     CXString classUSR);
03346 
03347 /**
03348  * \brief Construct a USR for a specified Objective-C method and
03349  *   the USR for its containing class.
03350  */
03351 CINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name,
03352                                                       unsigned isInstanceMethod,
03353                                                       CXString classUSR);
03354 
03355 /**
03356  * \brief Construct a USR for a specified Objective-C property and the USR
03357  *  for its containing class.
03358  */
03359 CINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property,
03360                                                         CXString classUSR);
03361 
03362 /**
03363  * \brief Retrieve a name for the entity referenced by this cursor.
03364  */
03365 CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);
03366 
03367 /**
03368  * \brief Retrieve a range for a piece that forms the cursors spelling name.
03369  * Most of the times there is only one range for the complete spelling but for
03370  * Objective-C methods and Objective-C message expressions, there are multiple
03371  * pieces for each selector identifier.
03372  * 
03373  * \param pieceIndex the index of the spelling name piece. If this is greater
03374  * than the actual number of pieces, it will return a NULL (invalid) range.
03375  *  
03376  * \param options Reserved.
03377  */
03378 CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor,
03379                                                           unsigned pieceIndex,
03380                                                           unsigned options);
03381 
03382 /**
03383  * \brief Retrieve the display name for the entity referenced by this cursor.
03384  *
03385  * The display name contains extra information that helps identify the cursor,
03386  * such as the parameters of a function or template or the arguments of a 
03387  * class template specialization.
03388  */
03389 CINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor);
03390   
03391 /** \brief For a cursor that is a reference, retrieve a cursor representing the
03392  * entity that it references.
03393  *
03394  * Reference cursors refer to other entities in the AST. For example, an
03395  * Objective-C superclass reference cursor refers to an Objective-C class.
03396  * This function produces the cursor for the Objective-C class from the
03397  * cursor for the superclass reference. If the input cursor is a declaration or
03398  * definition, it returns that declaration or definition unchanged.
03399  * Otherwise, returns the NULL cursor.
03400  */
03401 CINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor);
03402 
03403 /**
03404  *  \brief For a cursor that is either a reference to or a declaration
03405  *  of some entity, retrieve a cursor that describes the definition of
03406  *  that entity.
03407  *
03408  *  Some entities can be declared multiple times within a translation
03409  *  unit, but only one of those declarations can also be a
03410  *  definition. For example, given:
03411  *
03412  *  \code
03413  *  int f(int, int);
03414  *  int g(int x, int y) { return f(x, y); }
03415  *  int f(int a, int b) { return a + b; }
03416  *  int f(int, int);
03417  *  \endcode
03418  *
03419  *  there are three declarations of the function "f", but only the
03420  *  second one is a definition. The clang_getCursorDefinition()
03421  *  function will take any cursor pointing to a declaration of "f"
03422  *  (the first or fourth lines of the example) or a cursor referenced
03423  *  that uses "f" (the call to "f' inside "g") and will return a
03424  *  declaration cursor pointing to the definition (the second "f"
03425  *  declaration).
03426  *
03427  *  If given a cursor for which there is no corresponding definition,
03428  *  e.g., because there is no definition of that entity within this
03429  *  translation unit, returns a NULL cursor.
03430  */
03431 CINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor);
03432 
03433 /**
03434  * \brief Determine whether the declaration pointed to by this cursor
03435  * is also a definition of that entity.
03436  */
03437 CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);
03438 
03439 /**
03440  * \brief Retrieve the canonical cursor corresponding to the given cursor.
03441  *
03442  * In the C family of languages, many kinds of entities can be declared several
03443  * times within a single translation unit. For example, a structure type can
03444  * be forward-declared (possibly multiple times) and later defined:
03445  *
03446  * \code
03447  * struct X;
03448  * struct X;
03449  * struct X {
03450  *   int member;
03451  * };
03452  * \endcode
03453  *
03454  * The declarations and the definition of \c X are represented by three 
03455  * different cursors, all of which are declarations of the same underlying 
03456  * entity. One of these cursor is considered the "canonical" cursor, which
03457  * is effectively the representative for the underlying entity. One can 
03458  * determine if two cursors are declarations of the same underlying entity by
03459  * comparing their canonical cursors.
03460  *
03461  * \returns The canonical cursor for the entity referred to by the given cursor.
03462  */
03463 CINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor);
03464 
03465 
03466 /**
03467  * \brief If the cursor points to a selector identifier in an Objective-C
03468  * method or message expression, this returns the selector index.
03469  *
03470  * After getting a cursor with #clang_getCursor, this can be called to
03471  * determine if the location points to a selector identifier.
03472  *
03473  * \returns The selector index if the cursor is an Objective-C method or message
03474  * expression and the cursor is pointing to a selector identifier, or -1
03475  * otherwise.
03476  */
03477 CINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor);
03478 
03479 /**
03480  * \brief Given a cursor pointing to a C++ method call or an Objective-C
03481  * message, returns non-zero if the method/message is "dynamic", meaning:
03482  * 
03483  * For a C++ method: the call is virtual.
03484  * For an Objective-C message: the receiver is an object instance, not 'super'
03485  * or a specific class.
03486  * 
03487  * If the method/message is "static" or the cursor does not point to a
03488  * method/message, it will return zero.
03489  */
03490 CINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C);
03491 
03492 /**
03493  * \brief Given a cursor pointing to an Objective-C message, returns the CXType
03494  * of the receiver.
03495  */
03496 CINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C);
03497 
03498 /**
03499  * \brief Property attributes for a \c CXCursor_ObjCPropertyDecl.
03500  */
03501 typedef enum {
03502   CXObjCPropertyAttr_noattr    = 0x00,
03503   CXObjCPropertyAttr_readonly  = 0x01,
03504   CXObjCPropertyAttr_getter    = 0x02,
03505   CXObjCPropertyAttr_assign    = 0x04,
03506   CXObjCPropertyAttr_readwrite = 0x08,
03507   CXObjCPropertyAttr_retain    = 0x10,
03508   CXObjCPropertyAttr_copy      = 0x20,
03509   CXObjCPropertyAttr_nonatomic = 0x40,
03510   CXObjCPropertyAttr_setter    = 0x80,
03511   CXObjCPropertyAttr_atomic    = 0x100,
03512   CXObjCPropertyAttr_weak      = 0x200,
03513   CXObjCPropertyAttr_strong    = 0x400,
03514   CXObjCPropertyAttr_unsafe_unretained = 0x800
03515 } CXObjCPropertyAttrKind;
03516 
03517 /**
03518  * \brief Given a cursor that represents a property declaration, return the
03519  * associated property attributes. The bits are formed from
03520  * \c CXObjCPropertyAttrKind.
03521  *
03522  * \param reserved Reserved for future use, pass 0.
03523  */
03524 CINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C,
03525                                                              unsigned reserved);
03526 
03527 /**
03528  * \brief 'Qualifiers' written next to the return and parameter types in
03529  * Objective-C method declarations.
03530  */
03531 typedef enum {
03532   CXObjCDeclQualifier_None = 0x0,
03533   CXObjCDeclQualifier_In = 0x1,
03534   CXObjCDeclQualifier_Inout = 0x2,
03535   CXObjCDeclQualifier_Out = 0x4,
03536   CXObjCDeclQualifier_Bycopy = 0x8,
03537   CXObjCDeclQualifier_Byref = 0x10,
03538   CXObjCDeclQualifier_Oneway = 0x20
03539 } CXObjCDeclQualifierKind;
03540 
03541 /**
03542  * \brief Given a cursor that represents an Objective-C method or parameter
03543  * declaration, return the associated Objective-C qualifiers for the return
03544  * type or the parameter respectively. The bits are formed from
03545  * CXObjCDeclQualifierKind.
03546  */
03547 CINDEX_LINKAGE unsigned clang_Cursor_getObjCDeclQualifiers(CXCursor C);
03548 
03549 /**
03550  * \brief Given a cursor that represents an Objective-C method or property
03551  * declaration, return non-zero if the declaration was affected by "@optional".
03552  * Returns zero if the cursor is not such a declaration or it is "@required".
03553  */
03554 CINDEX_LINKAGE unsigned clang_Cursor_isObjCOptional(CXCursor C);
03555 
03556 /**
03557  * \brief Returns non-zero if the given cursor is a variadic function or method.
03558  */
03559 CINDEX_LINKAGE unsigned clang_Cursor_isVariadic(CXCursor C);
03560 
03561 /**
03562  * \brief Given a cursor that represents a declaration, return the associated
03563  * comment's source range.  The range may include multiple consecutive comments
03564  * with whitespace in between.
03565  */
03566 CINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C);
03567 
03568 /**
03569  * \brief Given a cursor that represents a declaration, return the associated
03570  * comment text, including comment markers.
03571  */
03572 CINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C);
03573 
03574 /**
03575  * \brief Given a cursor that represents a documentable entity (e.g.,
03576  * declaration), return the associated \\brief paragraph; otherwise return the
03577  * first paragraph.
03578  */
03579 CINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C);
03580 
03581 /**
03582  * \brief Given a cursor that represents a documentable entity (e.g.,
03583  * declaration), return the associated parsed comment as a
03584  * \c CXComment_FullComment AST node.
03585  */
03586 CINDEX_LINKAGE CXComment clang_Cursor_getParsedComment(CXCursor C);
03587 
03588 /**
03589  * @}
03590  */
03591 
03592 /**
03593  * \defgroup CINDEX_MODULE Module introspection
03594  *
03595  * The functions in this group provide access to information about modules.
03596  *
03597  * @{
03598  */
03599 
03600 typedef void *CXModule;
03601 
03602 /**
03603  * \brief Given a CXCursor_ModuleImportDecl cursor, return the associated module.
03604  */
03605 CINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C);
03606 
03607 /**
03608  * \param Module a module object.
03609  *
03610  * \returns the module file where the provided module object came from.
03611  */
03612 CINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module);
03613 
03614 /**
03615  * \param Module a module object.
03616  *
03617  * \returns the parent of a sub-module or NULL if the given module is top-level,
03618  * e.g. for 'std.vector' it will return the 'std' module.
03619  */
03620 CINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module);
03621 
03622 /**
03623  * \param Module a module object.
03624  *
03625  * \returns the name of the module, e.g. for the 'std.vector' sub-module it
03626  * will return "vector".
03627  */
03628 CINDEX_LINKAGE CXString clang_Module_getName(CXModule Module);
03629 
03630 /**
03631  * \param Module a module object.
03632  *
03633  * \returns the full name of the module, e.g. "std.vector".
03634  */
03635 CINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module);
03636 
03637 /**
03638  * \param Module a module object.
03639  *
03640  * \returns the number of top level headers associated with this module.
03641  */
03642 CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit,
03643                                                            CXModule Module);
03644 
03645 /**
03646  * \param Module a module object.
03647  *
03648  * \param Index top level header index (zero-based).
03649  *
03650  * \returns the specified top level header associated with the module.
03651  */
03652 CINDEX_LINKAGE
03653 CXFile clang_Module_getTopLevelHeader(CXTranslationUnit,
03654                                       CXModule Module, unsigned Index);
03655 
03656 /**
03657  * @}
03658  */
03659 
03660 /**
03661  * \defgroup CINDEX_COMMENT Comment AST introspection
03662  *
03663  * The routines in this group provide access to information in the
03664  * documentation comment ASTs.
03665  *
03666  * @{
03667  */
03668 
03669 /**
03670  * \brief Describes the type of the comment AST node (\c CXComment).  A comment
03671  * node can be considered block content (e. g., paragraph), inline content
03672  * (plain text) or neither (the root AST node).
03673  */
03674 enum CXCommentKind {
03675   /**
03676    * \brief Null comment.  No AST node is constructed at the requested location
03677    * because there is no text or a syntax error.
03678    */
03679   CXComment_Null = 0,
03680 
03681   /**
03682    * \brief Plain text.  Inline content.
03683    */
03684   CXComment_Text = 1,
03685 
03686   /**
03687    * \brief A command with word-like arguments that is considered inline content.
03688    *
03689    * For example: \\c command.
03690    */
03691   CXComment_InlineCommand = 2,
03692 
03693   /**
03694    * \brief HTML start tag with attributes (name-value pairs).  Considered
03695    * inline content.
03696    *
03697    * For example:
03698    * \verbatim
03699    * <br> <br /> <a href="http://example.org/">
03700    * \endverbatim
03701    */
03702   CXComment_HTMLStartTag = 3,
03703 
03704   /**
03705    * \brief HTML end tag.  Considered inline content.
03706    *
03707    * For example:
03708    * \verbatim
03709    * </a>
03710    * \endverbatim
03711    */
03712   CXComment_HTMLEndTag = 4,
03713 
03714   /**
03715    * \brief A paragraph, contains inline comment.  The paragraph itself is
03716    * block content.
03717    */
03718   CXComment_Paragraph = 5,
03719 
03720   /**
03721    * \brief A command that has zero or more word-like arguments (number of
03722    * word-like arguments depends on command name) and a paragraph as an
03723    * argument.  Block command is block content.
03724    *
03725    * Paragraph argument is also a child of the block command.
03726    *
03727    * For example: \\brief has 0 word-like arguments and a paragraph argument.
03728    *
03729    * AST nodes of special kinds that parser knows about (e. g., \\param
03730    * command) have their own node kinds.
03731    */
03732   CXComment_BlockCommand = 6,
03733 
03734   /**
03735    * \brief A \\param or \\arg command that describes the function parameter
03736    * (name, passing direction, description).
03737    *
03738    * For example: \\param [in] ParamName description.
03739    */
03740   CXComment_ParamCommand = 7,
03741 
03742   /**
03743    * \brief A \\tparam command that describes a template parameter (name and
03744    * description).
03745    *
03746    * For example: \\tparam T description.
03747    */
03748   CXComment_TParamCommand = 8,
03749 
03750   /**
03751    * \brief A verbatim block command (e. g., preformatted code).  Verbatim
03752    * block has an opening and a closing command and contains multiple lines of
03753    * text (\c CXComment_VerbatimBlockLine child nodes).
03754    *
03755    * For example:
03756    * \\verbatim
03757    * aaa
03758    * \\endverbatim
03759    */
03760   CXComment_VerbatimBlockCommand = 9,
03761 
03762   /**
03763    * \brief A line of text that is contained within a
03764    * CXComment_VerbatimBlockCommand node.
03765    */
03766   CXComment_VerbatimBlockLine = 10,
03767 
03768   /**
03769    * \brief A verbatim line command.  Verbatim line has an opening command,
03770    * a single line of text (up to the newline after the opening command) and
03771    * has no closing command.
03772    */
03773   CXComment_VerbatimLine = 11,
03774 
03775   /**
03776    * \brief A full comment attached to a declaration, contains block content.
03777    */
03778   CXComment_FullComment = 12
03779 };
03780 
03781 /**
03782  * \brief The most appropriate rendering mode for an inline command, chosen on
03783  * command semantics in Doxygen.
03784  */
03785 enum CXCommentInlineCommandRenderKind {
03786   /**
03787    * \brief Command argument should be rendered in a normal font.
03788    */
03789   CXCommentInlineCommandRenderKind_Normal,
03790 
03791   /**
03792    * \brief Command argument should be rendered in a bold font.
03793    */
03794   CXCommentInlineCommandRenderKind_Bold,
03795 
03796   /**
03797    * \brief Command argument should be rendered in a monospaced font.
03798    */
03799   CXCommentInlineCommandRenderKind_Monospaced,
03800 
03801   /**
03802    * \brief Command argument should be rendered emphasized (typically italic
03803    * font).
03804    */
03805   CXCommentInlineCommandRenderKind_Emphasized
03806 };
03807 
03808 /**
03809  * \brief Describes parameter passing direction for \\param or \\arg command.
03810  */
03811 enum CXCommentParamPassDirection {
03812   /**
03813    * \brief The parameter is an input parameter.
03814    */
03815   CXCommentParamPassDirection_In,
03816 
03817   /**
03818    * \brief The parameter is an output parameter.
03819    */
03820   CXCommentParamPassDirection_Out,
03821 
03822   /**
03823    * \brief The parameter is an input and output parameter.
03824    */
03825   CXCommentParamPassDirection_InOut
03826 };
03827 
03828 /**
03829  * \param Comment AST node of any kind.
03830  *
03831  * \returns the type of the AST node.
03832  */
03833 CINDEX_LINKAGE enum CXCommentKind clang_Comment_getKind(CXComment Comment);
03834 
03835 /**
03836  * \param Comment AST node of any kind.
03837  *
03838  * \returns number of children of the AST node.
03839  */
03840 CINDEX_LINKAGE unsigned clang_Comment_getNumChildren(CXComment Comment);
03841 
03842 /**
03843  * \param Comment AST node of any kind.
03844  *
03845  * \param ChildIdx child index (zero-based).
03846  *
03847  * \returns the specified child of the AST node.
03848  */
03849 CINDEX_LINKAGE
03850 CXComment clang_Comment_getChild(CXComment Comment, unsigned ChildIdx);
03851 
03852 /**
03853  * \brief A \c CXComment_Paragraph node is considered whitespace if it contains
03854  * only \c CXComment_Text nodes that are empty or whitespace.
03855  *
03856  * Other AST nodes (except \c CXComment_Paragraph and \c CXComment_Text) are
03857  * never considered whitespace.
03858  *
03859  * \returns non-zero if \c Comment is whitespace.
03860  */
03861 CINDEX_LINKAGE unsigned clang_Comment_isWhitespace(CXComment Comment);
03862 
03863 /**
03864  * \returns non-zero if \c Comment is inline content and has a newline
03865  * immediately following it in the comment text.  Newlines between paragraphs
03866  * do not count.
03867  */
03868 CINDEX_LINKAGE
03869 unsigned clang_InlineContentComment_hasTrailingNewline(CXComment Comment);
03870 
03871 /**
03872  * \param Comment a \c CXComment_Text AST node.
03873  *
03874  * \returns text contained in the AST node.
03875  */
03876 CINDEX_LINKAGE CXString clang_TextComment_getText(CXComment Comment);
03877 
03878 /**
03879  * \param Comment a \c CXComment_InlineCommand AST node.
03880  *
03881  * \returns name of the inline command.
03882  */
03883 CINDEX_LINKAGE
03884 CXString clang_InlineCommandComment_getCommandName(CXComment Comment);
03885 
03886 /**
03887  * \param Comment a \c CXComment_InlineCommand AST node.
03888  *
03889  * \returns the most appropriate rendering mode, chosen on command
03890  * semantics in Doxygen.
03891  */
03892 CINDEX_LINKAGE enum CXCommentInlineCommandRenderKind
03893 clang_InlineCommandComment_getRenderKind(CXComment Comment);
03894 
03895 /**
03896  * \param Comment a \c CXComment_InlineCommand AST node.
03897  *
03898  * \returns number of command arguments.
03899  */
03900 CINDEX_LINKAGE
03901 unsigned clang_InlineCommandComment_getNumArgs(CXComment Comment);
03902 
03903 /**
03904  * \param Comment a \c CXComment_InlineCommand AST node.
03905  *
03906  * \param ArgIdx argument index (zero-based).
03907  *
03908  * \returns text of the specified argument.
03909  */
03910 CINDEX_LINKAGE
03911 CXString clang_InlineCommandComment_getArgText(CXComment Comment,
03912                                                unsigned ArgIdx);
03913 
03914 /**
03915  * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
03916  * node.
03917  *
03918  * \returns HTML tag name.
03919  */
03920 CINDEX_LINKAGE CXString clang_HTMLTagComment_getTagName(CXComment Comment);
03921 
03922 /**
03923  * \param Comment a \c CXComment_HTMLStartTag AST node.
03924  *
03925  * \returns non-zero if tag is self-closing (for example, &lt;br /&gt;).
03926  */
03927 CINDEX_LINKAGE
03928 unsigned clang_HTMLStartTagComment_isSelfClosing(CXComment Comment);
03929 
03930 /**
03931  * \param Comment a \c CXComment_HTMLStartTag AST node.
03932  *
03933  * \returns number of attributes (name-value pairs) attached to the start tag.
03934  */
03935 CINDEX_LINKAGE unsigned clang_HTMLStartTag_getNumAttrs(CXComment Comment);
03936 
03937 /**
03938  * \param Comment a \c CXComment_HTMLStartTag AST node.
03939  *
03940  * \param AttrIdx attribute index (zero-based).
03941  *
03942  * \returns name of the specified attribute.
03943  */
03944 CINDEX_LINKAGE
03945 CXString clang_HTMLStartTag_getAttrName(CXComment Comment, unsigned AttrIdx);
03946 
03947 /**
03948  * \param Comment a \c CXComment_HTMLStartTag AST node.
03949  *
03950  * \param AttrIdx attribute index (zero-based).
03951  *
03952  * \returns value of the specified attribute.
03953  */
03954 CINDEX_LINKAGE
03955 CXString clang_HTMLStartTag_getAttrValue(CXComment Comment, unsigned AttrIdx);
03956 
03957 /**
03958  * \param Comment a \c CXComment_BlockCommand AST node.
03959  *
03960  * \returns name of the block command.
03961  */
03962 CINDEX_LINKAGE
03963 CXString clang_BlockCommandComment_getCommandName(CXComment Comment);
03964 
03965 /**
03966  * \param Comment a \c CXComment_BlockCommand AST node.
03967  *
03968  * \returns number of word-like arguments.
03969  */
03970 CINDEX_LINKAGE
03971 unsigned clang_BlockCommandComment_getNumArgs(CXComment Comment);
03972 
03973 /**
03974  * \param Comment a \c CXComment_BlockCommand AST node.
03975  *
03976  * \param ArgIdx argument index (zero-based).
03977  *
03978  * \returns text of the specified word-like argument.
03979  */
03980 CINDEX_LINKAGE
03981 CXString clang_BlockCommandComment_getArgText(CXComment Comment,
03982                                               unsigned ArgIdx);
03983 
03984 /**
03985  * \param Comment a \c CXComment_BlockCommand or
03986  * \c CXComment_VerbatimBlockCommand AST node.
03987  *
03988  * \returns paragraph argument of the block command.
03989  */
03990 CINDEX_LINKAGE
03991 CXComment clang_BlockCommandComment_getParagraph(CXComment Comment);
03992 
03993 /**
03994  * \param Comment a \c CXComment_ParamCommand AST node.
03995  *
03996  * \returns parameter name.
03997  */
03998 CINDEX_LINKAGE
03999 CXString clang_ParamCommandComment_getParamName(CXComment Comment);
04000 
04001 /**
04002  * \param Comment a \c CXComment_ParamCommand AST node.
04003  *
04004  * \returns non-zero if the parameter that this AST node represents was found
04005  * in the function prototype and \c clang_ParamCommandComment_getParamIndex
04006  * function will return a meaningful value.
04007  */
04008 CINDEX_LINKAGE
04009 unsigned clang_ParamCommandComment_isParamIndexValid(CXComment Comment);
04010 
04011 /**
04012  * \param Comment a \c CXComment_ParamCommand AST node.
04013  *
04014  * \returns zero-based parameter index in function prototype.
04015  */
04016 CINDEX_LINKAGE
04017 unsigned clang_ParamCommandComment_getParamIndex(CXComment Comment);
04018 
04019 /**
04020  * \param Comment a \c CXComment_ParamCommand AST node.
04021  *
04022  * \returns non-zero if parameter passing direction was specified explicitly in
04023  * the comment.
04024  */
04025 CINDEX_LINKAGE
04026 unsigned clang_ParamCommandComment_isDirectionExplicit(CXComment Comment);
04027 
04028 /**
04029  * \param Comment a \c CXComment_ParamCommand AST node.
04030  *
04031  * \returns parameter passing direction.
04032  */
04033 CINDEX_LINKAGE
04034 enum CXCommentParamPassDirection clang_ParamCommandComment_getDirection(
04035                                                             CXComment Comment);
04036 
04037 /**
04038  * \param Comment a \c CXComment_TParamCommand AST node.
04039  *
04040  * \returns template parameter name.
04041  */
04042 CINDEX_LINKAGE
04043 CXString clang_TParamCommandComment_getParamName(CXComment Comment);
04044 
04045 /**
04046  * \param Comment a \c CXComment_TParamCommand AST node.
04047  *
04048  * \returns non-zero if the parameter that this AST node represents was found
04049  * in the template parameter list and
04050  * \c clang_TParamCommandComment_getDepth and
04051  * \c clang_TParamCommandComment_getIndex functions will return a meaningful
04052  * value.
04053  */
04054 CINDEX_LINKAGE
04055 unsigned clang_TParamCommandComment_isParamPositionValid(CXComment Comment);
04056 
04057 /**
04058  * \param Comment a \c CXComment_TParamCommand AST node.
04059  *
04060  * \returns zero-based nesting depth of this parameter in the template parameter list.
04061  *
04062  * For example,
04063  * \verbatim
04064  *     template<typename C, template<typename T> class TT>
04065  *     void test(TT<int> aaa);
04066  * \endverbatim
04067  * for C and TT nesting depth is 0,
04068  * for T nesting depth is 1.
04069  */
04070 CINDEX_LINKAGE
04071 unsigned clang_TParamCommandComment_getDepth(CXComment Comment);
04072 
04073 /**
04074  * \param Comment a \c CXComment_TParamCommand AST node.
04075  *
04076  * \returns zero-based parameter index in the template parameter list at a
04077  * given nesting depth.
04078  *
04079  * For example,
04080  * \verbatim
04081  *     template<typename C, template<typename T> class TT>
04082  *     void test(TT<int> aaa);
04083  * \endverbatim
04084  * for C and TT nesting depth is 0, so we can ask for index at depth 0:
04085  * at depth 0 C's index is 0, TT's index is 1.
04086  *
04087  * For T nesting depth is 1, so we can ask for index at depth 0 and 1:
04088  * at depth 0 T's index is 1 (same as TT's),
04089  * at depth 1 T's index is 0.
04090  */
04091 CINDEX_LINKAGE
04092 unsigned clang_TParamCommandComment_getIndex(CXComment Comment, unsigned Depth);
04093 
04094 /**
04095  * \param Comment a \c CXComment_VerbatimBlockLine AST node.
04096  *
04097  * \returns text contained in the AST node.
04098  */
04099 CINDEX_LINKAGE
04100 CXString clang_VerbatimBlockLineComment_getText(CXComment Comment);
04101 
04102 /**
04103  * \param Comment a \c CXComment_VerbatimLine AST node.
04104  *
04105  * \returns text contained in the AST node.
04106  */
04107 CINDEX_LINKAGE CXString clang_VerbatimLineComment_getText(CXComment Comment);
04108 
04109 /**
04110  * \brief Convert an HTML tag AST node to string.
04111  *
04112  * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
04113  * node.
04114  *
04115  * \returns string containing an HTML tag.
04116  */
04117 CINDEX_LINKAGE CXString clang_HTMLTagComment_getAsString(CXComment Comment);
04118 
04119 /**
04120  * \brief Convert a given full parsed comment to an HTML fragment.
04121  *
04122  * Specific details of HTML layout are subject to change.  Don't try to parse
04123  * this HTML back into an AST, use other APIs instead.
04124  *
04125  * Currently the following CSS classes are used:
04126  * \li "para-brief" for \\brief paragraph and equivalent commands;
04127  * \li "para-returns" for \\returns paragraph and equivalent commands;
04128  * \li "word-returns" for the "Returns" word in \\returns paragraph.
04129  *
04130  * Function argument documentation is rendered as a <dl> list with arguments
04131  * sorted in function prototype order.  CSS classes used:
04132  * \li "param-name-index-NUMBER" for parameter name (<dt>);
04133  * \li "param-descr-index-NUMBER" for parameter description (<dd>);
04134  * \li "param-name-index-invalid" and "param-descr-index-invalid" are used if
04135  * parameter index is invalid.
04136  *
04137  * Template parameter documentation is rendered as a <dl> list with
04138  * parameters sorted in template parameter list order.  CSS classes used:
04139  * \li "tparam-name-index-NUMBER" for parameter name (<dt>);
04140  * \li "tparam-descr-index-NUMBER" for parameter description (<dd>);
04141  * \li "tparam-name-index-other" and "tparam-descr-index-other" are used for
04142  * names inside template template parameters;
04143  * \li "tparam-name-index-invalid" and "tparam-descr-index-invalid" are used if
04144  * parameter position is invalid.
04145  *
04146  * \param Comment a \c CXComment_FullComment AST node.
04147  *
04148  * \returns string containing an HTML fragment.
04149  */
04150 CINDEX_LINKAGE CXString clang_FullComment_getAsHTML(CXComment Comment);
04151 
04152 /**
04153  * \brief Convert a given full parsed comment to an XML document.
04154  *
04155  * A Relax NG schema for the XML can be found in comment-xml-schema.rng file
04156  * inside clang source tree.
04157  *
04158  * \param Comment a \c CXComment_FullComment AST node.
04159  *
04160  * \returns string containing an XML document.
04161  */
04162 CINDEX_LINKAGE CXString clang_FullComment_getAsXML(CXComment Comment);
04163 
04164 /**
04165  * @}
04166  */
04167 
04168 /**
04169  * \defgroup CINDEX_CPP C++ AST introspection
04170  *
04171  * The routines in this group provide access information in the ASTs specific
04172  * to C++ language features.
04173  *
04174  * @{
04175  */
04176 
04177 /**
04178  * \brief Determine if a C++ member function or member function template is
04179  * pure virtual.
04180  */
04181 CINDEX_LINKAGE unsigned clang_CXXMethod_isPureVirtual(CXCursor C);
04182 
04183 /**
04184  * \brief Determine if a C++ member function or member function template is 
04185  * declared 'static'.
04186  */
04187 CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);
04188 
04189 /**
04190  * \brief Determine if a C++ member function or member function template is
04191  * explicitly declared 'virtual' or if it overrides a virtual method from
04192  * one of the base classes.
04193  */
04194 CINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C);
04195 
04196 /**
04197  * \brief Determine if a C++ member function or member function template is
04198  * declared 'const'.
04199  */
04200 CINDEX_LINKAGE unsigned clang_CXXMethod_isConst(CXCursor C);
04201 
04202 /**
04203  * \brief Given a cursor that represents a template, determine
04204  * the cursor kind of the specializations would be generated by instantiating
04205  * the template.
04206  *
04207  * This routine can be used to determine what flavor of function template,
04208  * class template, or class template partial specialization is stored in the
04209  * cursor. For example, it can describe whether a class template cursor is
04210  * declared with "struct", "class" or "union".
04211  *
04212  * \param C The cursor to query. This cursor should represent a template
04213  * declaration.
04214  *
04215  * \returns The cursor kind of the specializations that would be generated
04216  * by instantiating the template \p C. If \p C is not a template, returns
04217  * \c CXCursor_NoDeclFound.
04218  */
04219 CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);
04220   
04221 /**
04222  * \brief Given a cursor that may represent a specialization or instantiation
04223  * of a template, retrieve the cursor that represents the template that it
04224  * specializes or from which it was instantiated.
04225  *
04226  * This routine determines the template involved both for explicit 
04227  * specializations of templates and for implicit instantiations of the template,
04228  * both of which are referred to as "specializations". For a class template
04229  * specialization (e.g., \c std::vector<bool>), this routine will return 
04230  * either the primary template (\c std::vector) or, if the specialization was
04231  * instantiated from a class template partial specialization, the class template
04232  * partial specialization. For a class template partial specialization and a
04233  * function template specialization (including instantiations), this
04234  * this routine will return the specialized template.
04235  *
04236  * For members of a class template (e.g., member functions, member classes, or
04237  * static data members), returns the specialized or instantiated member. 
04238  * Although not strictly "templates" in the C++ language, members of class
04239  * templates have the same notions of specializations and instantiations that
04240  * templates do, so this routine treats them similarly.
04241  *
04242  * \param C A cursor that may be a specialization of a template or a member
04243  * of a template.
04244  *
04245  * \returns If the given cursor is a specialization or instantiation of a 
04246  * template or a member thereof, the template or member that it specializes or
04247  * from which it was instantiated. Otherwise, returns a NULL cursor.
04248  */
04249 CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
04250 
04251 /**
04252  * \brief Given a cursor that references something else, return the source range
04253  * covering that reference.
04254  *
04255  * \param C A cursor pointing to a member reference, a declaration reference, or
04256  * an operator call.
04257  * \param NameFlags A bitset with three independent flags: 
04258  * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
04259  * CXNameRange_WantSinglePiece.
04260  * \param PieceIndex For contiguous names or when passing the flag 
04261  * CXNameRange_WantSinglePiece, only one piece with index 0 is 
04262  * available. When the CXNameRange_WantSinglePiece flag is not passed for a
04263  * non-contiguous names, this index can be used to retrieve the individual
04264  * pieces of the name. See also CXNameRange_WantSinglePiece.
04265  *
04266  * \returns The piece of the name pointed to by the given cursor. If there is no
04267  * name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
04268  */
04269 CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C,
04270                                                 unsigned NameFlags, 
04271                                                 unsigned PieceIndex);
04272 
04273 enum CXNameRefFlags {
04274   /**
04275    * \brief Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
04276    * range.
04277    */
04278   CXNameRange_WantQualifier = 0x1,
04279   
04280   /**
04281    * \brief Include the explicit template arguments, e.g. <int> in x.f<int>,
04282    * in the range.
04283    */
04284   CXNameRange_WantTemplateArgs = 0x2,
04285 
04286   /**
04287    * \brief If the name is non-contiguous, return the full spanning range.
04288    *
04289    * Non-contiguous names occur in Objective-C when a selector with two or more
04290    * parameters is used, or in C++ when using an operator:
04291    * \code
04292    * [object doSomething:here withValue:there]; // Objective-C
04293    * return some_vector[1]; // C++
04294    * \endcode
04295    */
04296   CXNameRange_WantSinglePiece = 0x4
04297 };
04298   
04299 /**
04300  * @}
04301  */
04302 
04303 /**
04304  * \defgroup CINDEX_LEX Token extraction and manipulation
04305  *
04306  * The routines in this group provide access to the tokens within a
04307  * translation unit, along with a semantic mapping of those tokens to
04308  * their corresponding cursors.
04309  *
04310  * @{
04311  */
04312 
04313 /**
04314  * \brief Describes a kind of token.
04315  */
04316 typedef enum CXTokenKind {
04317   /**
04318    * \brief A token that contains some kind of punctuation.
04319    */
04320   CXToken_Punctuation,
04321 
04322   /**
04323    * \brief A language keyword.
04324    */
04325   CXToken_Keyword,
04326 
04327   /**
04328    * \brief An identifier (that is not a keyword).
04329    */
04330   CXToken_Identifier,
04331 
04332   /**
04333    * \brief A numeric, string, or character literal.
04334    */
04335   CXToken_Literal,
04336 
04337   /**
04338    * \brief A comment.
04339    */
04340   CXToken_Comment
04341 } CXTokenKind;
04342 
04343 /**
04344  * \brief Describes a single preprocessing token.
04345  */
04346 typedef struct {
04347   unsigned int_data[4];
04348   void *ptr_data;
04349 } CXToken;
04350 
04351 /**
04352  * \brief Determine the kind of the given token.
04353  */
04354 CINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken);
04355 
04356 /**
04357  * \brief Determine the spelling of the given token.
04358  *
04359  * The spelling of a token is the textual representation of that token, e.g.,
04360  * the text of an identifier or keyword.
04361  */
04362 CINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken);
04363 
04364 /**
04365  * \brief Retrieve the source location of the given token.
04366  */
04367 CINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit,
04368                                                        CXToken);
04369 
04370 /**
04371  * \brief Retrieve a source range that covers the given token.
04372  */
04373 CINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);
04374 
04375 /**
04376  * \brief Tokenize the source code described by the given range into raw
04377  * lexical tokens.
04378  *
04379  * \param TU the translation unit whose text is being tokenized.
04380  *
04381  * \param Range the source range in which text should be tokenized. All of the
04382  * tokens produced by tokenization will fall within this source range,
04383  *
04384  * \param Tokens this pointer will be set to point to the array of tokens
04385  * that occur within the given source range. The returned pointer must be
04386  * freed with clang_disposeTokens() before the translation unit is destroyed.
04387  *
04388  * \param NumTokens will be set to the number of tokens in the \c *Tokens
04389  * array.
04390  *
04391  */
04392 CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
04393                                    CXToken **Tokens, unsigned *NumTokens);
04394 
04395 /**
04396  * \brief Annotate the given set of tokens by providing cursors for each token
04397  * that can be mapped to a specific entity within the abstract syntax tree.
04398  *
04399  * This token-annotation routine is equivalent to invoking
04400  * clang_getCursor() for the source locations of each of the
04401  * tokens. The cursors provided are filtered, so that only those
04402  * cursors that have a direct correspondence to the token are
04403  * accepted. For example, given a function call \c f(x),
04404  * clang_getCursor() would provide the following cursors:
04405  *
04406  *   * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
04407  *   * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
04408  *   * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
04409  *
04410  * Only the first and last of these cursors will occur within the
04411  * annotate, since the tokens "f" and "x' directly refer to a function
04412  * and a variable, respectively, but the parentheses are just a small
04413  * part of the full syntax of the function call expression, which is
04414  * not provided as an annotation.
04415  *
04416  * \param TU the translation unit that owns the given tokens.
04417  *
04418  * \param Tokens the set of tokens to annotate.
04419  *
04420  * \param NumTokens the number of tokens in \p Tokens.
04421  *
04422  * \param Cursors an array of \p NumTokens cursors, whose contents will be
04423  * replaced with the cursors corresponding to each token.
04424  */
04425 CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU,
04426                                          CXToken *Tokens, unsigned NumTokens,
04427                                          CXCursor *Cursors);
04428 
04429 /**
04430  * \brief Free the given set of tokens.
04431  */
04432 CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
04433                                         CXToken *Tokens, unsigned NumTokens);
04434 
04435 /**
04436  * @}
04437  */
04438 
04439 /**
04440  * \defgroup CINDEX_DEBUG Debugging facilities
04441  *
04442  * These routines are used for testing and debugging, only, and should not
04443  * be relied upon.
04444  *
04445  * @{
04446  */
04447 
04448 /* for debug/testing */
04449 CINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind);
04450 CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor,
04451                                           const char **startBuf,
04452                                           const char **endBuf,
04453                                           unsigned *startLine,
04454                                           unsigned *startColumn,
04455                                           unsigned *endLine,
04456                                           unsigned *endColumn);
04457 CINDEX_LINKAGE void clang_enableStackTraces(void);
04458 CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data,
04459                                           unsigned stack_size);
04460 
04461 /**
04462  * @}
04463  */
04464 
04465 /**
04466  * \defgroup CINDEX_CODE_COMPLET Code completion
04467  *
04468  * Code completion involves taking an (incomplete) source file, along with
04469  * knowledge of where the user is actively editing that file, and suggesting
04470  * syntactically- and semantically-valid constructs that the user might want to
04471  * use at that particular point in the source code. These data structures and
04472  * routines provide support for code completion.
04473  *
04474  * @{
04475  */
04476 
04477 /**
04478  * \brief A semantic string that describes a code-completion result.
04479  *
04480  * A semantic string that describes the formatting of a code-completion
04481  * result as a single "template" of text that should be inserted into the
04482  * source buffer when a particular code-completion result is selected.
04483  * Each semantic string is made up of some number of "chunks", each of which
04484  * contains some text along with a description of what that text means, e.g.,
04485  * the name of the entity being referenced, whether the text chunk is part of
04486  * the template, or whether it is a "placeholder" that the user should replace
04487  * with actual code,of a specific kind. See \c CXCompletionChunkKind for a
04488  * description of the different kinds of chunks.
04489  */
04490 typedef void *CXCompletionString;
04491 
04492 /**
04493  * \brief A single result of code completion.
04494  */
04495 typedef struct {
04496   /**
04497    * \brief The kind of entity that this completion refers to.
04498    *
04499    * The cursor kind will be a macro, keyword, or a declaration (one of the
04500    * *Decl cursor kinds), describing the entity that the completion is
04501    * referring to.
04502    *
04503    * \todo In the future, we would like to provide a full cursor, to allow
04504    * the client to extract additional information from declaration.
04505    */
04506   enum CXCursorKind CursorKind;
04507 
04508   /**
04509    * \brief The code-completion string that describes how to insert this
04510    * code-completion result into the editing buffer.
04511    */
04512   CXCompletionString CompletionString;
04513 } CXCompletionResult;
04514 
04515 /**
04516  * \brief Describes a single piece of text within a code-completion string.
04517  *
04518  * Each "chunk" within a code-completion string (\c CXCompletionString) is
04519  * either a piece of text with a specific "kind" that describes how that text
04520  * should be interpreted by the client or is another completion string.
04521  */
04522 enum CXCompletionChunkKind {
04523   /**
04524    * \brief A code-completion string that describes "optional" text that
04525    * could be a part of the template (but is not required).
04526    *
04527    * The Optional chunk is the only kind of chunk that has a code-completion
04528    * string for its representation, which is accessible via
04529    * \c clang_getCompletionChunkCompletionString(). The code-completion string
04530    * describes an additional part of the template that is completely optional.
04531    * For example, optional chunks can be used to describe the placeholders for
04532    * arguments that match up with defaulted function parameters, e.g. given:
04533    *
04534    * \code
04535    * void f(int x, float y = 3.14, double z = 2.71828);
04536    * \endcode
04537    *
04538    * The code-completion string for this function would contain:
04539    *   - a TypedText chunk for "f".
04540    *   - a LeftParen chunk for "(".
04541    *   - a Placeholder chunk for "int x"
04542    *   - an Optional chunk containing the remaining defaulted arguments, e.g.,
04543    *       - a Comma chunk for ","
04544    *       - a Placeholder chunk for "float y"
04545    *       - an Optional chunk containing the last defaulted argument:
04546    *           - a Comma chunk for ","
04547    *           - a Placeholder chunk for "double z"
04548    *   - a RightParen chunk for ")"
04549    *
04550    * There are many ways to handle Optional chunks. Two simple approaches are:
04551    *   - Completely ignore optional chunks, in which case the template for the
04552    *     function "f" would only include the first parameter ("int x").
04553    *   - Fully expand all optional chunks, in which case the template for the
04554    *     function "f" would have all of the parameters.
04555    */
04556   CXCompletionChunk_Optional,
04557   /**
04558    * \brief Text that a user would be expected to type to get this
04559    * code-completion result.
04560    *
04561    * There will be exactly one "typed text" chunk in a semantic string, which
04562    * will typically provide the spelling of a keyword or the name of a
04563    * declaration that could be used at the current code point. Clients are
04564    * expected to filter the code-completion results based on the text in this
04565    * chunk.
04566    */
04567   CXCompletionChunk_TypedText,
04568   /**
04569    * \brief Text that should be inserted as part of a code-completion result.
04570    *
04571    * A "text" chunk represents text that is part of the template to be
04572    * inserted into user code should this particular code-completion result
04573    * be selected.
04574    */
04575   CXCompletionChunk_Text,
04576   /**
04577    * \brief Placeholder text that should be replaced by the user.
04578    *
04579    * A "placeholder" chunk marks a place where the user should insert text
04580    * into the code-completion template. For example, placeholders might mark
04581    * the function parameters for a function declaration, to indicate that the
04582    * user should provide arguments for each of those parameters. The actual
04583    * text in a placeholder is a suggestion for the text to display before
04584    * the user replaces the placeholder with real code.
04585    */
04586   CXCompletionChunk_Placeholder,
04587   /**
04588    * \brief Informative text that should be displayed but never inserted as
04589    * part of the template.
04590    *
04591    * An "informative" chunk contains annotations that can be displayed to
04592    * help the user decide whether a particular code-completion result is the
04593    * right option, but which is not part of the actual template to be inserted
04594    * by code completion.
04595    */
04596   CXCompletionChunk_Informative,
04597   /**
04598    * \brief Text that describes the current parameter when code-completion is
04599    * referring to function call, message send, or template specialization.
04600    *
04601    * A "current parameter" chunk occurs when code-completion is providing
04602    * information about a parameter corresponding to the argument at the
04603    * code-completion point. For example, given a function
04604    *
04605    * \code
04606    * int add(int x, int y);
04607    * \endcode
04608    *
04609    * and the source code \c add(, where the code-completion point is after the
04610    * "(", the code-completion string will contain a "current parameter" chunk
04611    * for "int x", indicating that the current argument will initialize that
04612    * parameter. After typing further, to \c add(17, (where the code-completion
04613    * point is after the ","), the code-completion string will contain a
04614    * "current paremeter" chunk to "int y".
04615    */
04616   CXCompletionChunk_CurrentParameter,
04617   /**
04618    * \brief A left parenthesis ('('), used to initiate a function call or
04619    * signal the beginning of a function parameter list.
04620    */
04621   CXCompletionChunk_LeftParen,
04622   /**
04623    * \brief A right parenthesis (')'), used to finish a function call or
04624    * signal the end of a function parameter list.
04625    */
04626   CXCompletionChunk_RightParen,
04627   /**
04628    * \brief A left bracket ('[').
04629    */
04630   CXCompletionChunk_LeftBracket,
04631   /**
04632    * \brief A right bracket (']').
04633    */
04634   CXCompletionChunk_RightBracket,
04635   /**
04636    * \brief A left brace ('{').
04637    */
04638   CXCompletionChunk_LeftBrace,
04639   /**
04640    * \brief A right brace ('}').
04641    */
04642   CXCompletionChunk_RightBrace,
04643   /**
04644    * \brief A left angle bracket ('<').
04645    */
04646   CXCompletionChunk_LeftAngle,
04647   /**
04648    * \brief A right angle bracket ('>').
04649    */
04650   CXCompletionChunk_RightAngle,
04651   /**
04652    * \brief A comma separator (',').
04653    */
04654   CXCompletionChunk_Comma,
04655   /**
04656    * \brief Text that specifies the result type of a given result.
04657    *
04658    * This special kind of informative chunk is not meant to be inserted into
04659    * the text buffer. Rather, it is meant to illustrate the type that an
04660    * expression using the given completion string would have.
04661    */
04662   CXCompletionChunk_ResultType,
04663   /**
04664    * \brief A colon (':').
04665    */
04666   CXCompletionChunk_Colon,
04667   /**
04668    * \brief A semicolon (';').
04669    */
04670   CXCompletionChunk_SemiColon,
04671   /**
04672    * \brief An '=' sign.
04673    */
04674   CXCompletionChunk_Equal,
04675   /**
04676    * Horizontal space (' ').
04677    */
04678   CXCompletionChunk_HorizontalSpace,
04679   /**
04680    * Vertical space ('\n'), after which it is generally a good idea to
04681    * perform indentation.
04682    */
04683   CXCompletionChunk_VerticalSpace
04684 };
04685 
04686 /**
04687  * \brief Determine the kind of a particular chunk within a completion string.
04688  *
04689  * \param completion_string the completion string to query.
04690  *
04691  * \param chunk_number the 0-based index of the chunk in the completion string.
04692  *
04693  * \returns the kind of the chunk at the index \c chunk_number.
04694  */
04695 CINDEX_LINKAGE enum CXCompletionChunkKind
04696 clang_getCompletionChunkKind(CXCompletionString completion_string,
04697                              unsigned chunk_number);
04698 
04699 /**
04700  * \brief Retrieve the text associated with a particular chunk within a
04701  * completion string.
04702  *
04703  * \param completion_string the completion string to query.
04704  *
04705  * \param chunk_number the 0-based index of the chunk in the completion string.
04706  *
04707  * \returns the text associated with the chunk at index \c chunk_number.
04708  */
04709 CINDEX_LINKAGE CXString
04710 clang_getCompletionChunkText(CXCompletionString completion_string,
04711                              unsigned chunk_number);
04712 
04713 /**
04714  * \brief Retrieve the completion string associated with a particular chunk
04715  * within a completion string.
04716  *
04717  * \param completion_string the completion string to query.
04718  *
04719  * \param chunk_number the 0-based index of the chunk in the completion string.
04720  *
04721  * \returns the completion string associated with the chunk at index
04722  * \c chunk_number.
04723  */
04724 CINDEX_LINKAGE CXCompletionString
04725 clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
04726                                          unsigned chunk_number);
04727 
04728 /**
04729  * \brief Retrieve the number of chunks in the given code-completion string.
04730  */
04731 CINDEX_LINKAGE unsigned
04732 clang_getNumCompletionChunks(CXCompletionString completion_string);
04733 
04734 /**
04735  * \brief Determine the priority of this code completion.
04736  *
04737  * The priority of a code completion indicates how likely it is that this 
04738  * particular completion is the completion that the user will select. The
04739  * priority is selected by various internal heuristics.
04740  *
04741  * \param completion_string The completion string to query.
04742  *
04743  * \returns The priority of this completion string. Smaller values indicate
04744  * higher-priority (more likely) completions.
04745  */
04746 CINDEX_LINKAGE unsigned
04747 clang_getCompletionPriority(CXCompletionString completion_string);
04748   
04749 /**
04750  * \brief Determine the availability of the entity that this code-completion
04751  * string refers to.
04752  *
04753  * \param completion_string The completion string to query.
04754  *
04755  * \returns The availability of the completion string.
04756  */
04757 CINDEX_LINKAGE enum CXAvailabilityKind 
04758 clang_getCompletionAvailability(CXCompletionString completion_string);
04759 
04760 /**
04761  * \brief Retrieve the number of annotations associated with the given
04762  * completion string.
04763  *
04764  * \param completion_string the completion string to query.
04765  *
04766  * \returns the number of annotations associated with the given completion
04767  * string.
04768  */
04769 CINDEX_LINKAGE unsigned
04770 clang_getCompletionNumAnnotations(CXCompletionString completion_string);
04771 
04772 /**
04773  * \brief Retrieve the annotation associated with the given completion string.
04774  *
04775  * \param completion_string the completion string to query.
04776  *
04777  * \param annotation_number the 0-based index of the annotation of the
04778  * completion string.
04779  *
04780  * \returns annotation string associated with the completion at index
04781  * \c annotation_number, or a NULL string if that annotation is not available.
04782  */
04783 CINDEX_LINKAGE CXString
04784 clang_getCompletionAnnotation(CXCompletionString completion_string,
04785                               unsigned annotation_number);
04786 
04787 /**
04788  * \brief Retrieve the parent context of the given completion string.
04789  *
04790  * The parent context of a completion string is the semantic parent of 
04791  * the declaration (if any) that the code completion represents. For example,
04792  * a code completion for an Objective-C method would have the method's class
04793  * or protocol as its context.
04794  *
04795  * \param completion_string The code completion string whose parent is
04796  * being queried.
04797  *
04798  * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL.
04799  *
04800  * \returns The name of the completion parent, e.g., "NSObject" if
04801  * the completion string represents a method in the NSObject class.
04802  */
04803 CINDEX_LINKAGE CXString
04804 clang_getCompletionParent(CXCompletionString completion_string,
04805                           enum CXCursorKind *kind);
04806 
04807 /**
04808  * \brief Retrieve the brief documentation comment attached to the declaration
04809  * that corresponds to the given completion string.
04810  */
04811 CINDEX_LINKAGE CXString
04812 clang_getCompletionBriefComment(CXCompletionString completion_string);
04813 
04814 /**
04815  * \brief Retrieve a completion string for an arbitrary declaration or macro
04816  * definition cursor.
04817  *
04818  * \param cursor The cursor to query.
04819  *
04820  * \returns A non-context-sensitive completion string for declaration and macro
04821  * definition cursors, or NULL for other kinds of cursors.
04822  */
04823 CINDEX_LINKAGE CXCompletionString
04824 clang_getCursorCompletionString(CXCursor cursor);
04825   
04826 /**
04827  * \brief Contains the results of code-completion.
04828  *
04829  * This data structure contains the results of code completion, as
04830  * produced by \c clang_codeCompleteAt(). Its contents must be freed by
04831  * \c clang_disposeCodeCompleteResults.
04832  */
04833 typedef struct {
04834   /**
04835    * \brief The code-completion results.
04836    */
04837   CXCompletionResult *Results;
04838 
04839   /**
04840    * \brief The number of code-completion results stored in the
04841    * \c Results array.
04842    */
04843   unsigned NumResults;
04844 } CXCodeCompleteResults;
04845 
04846 /**
04847  * \brief Flags that can be passed to \c clang_codeCompleteAt() to
04848  * modify its behavior.
04849  *
04850  * The enumerators in this enumeration can be bitwise-OR'd together to
04851  * provide multiple options to \c clang_codeCompleteAt().
04852  */
04853 enum CXCodeComplete_Flags {
04854   /**
04855    * \brief Whether to include macros within the set of code
04856    * completions returned.
04857    */
04858   CXCodeComplete_IncludeMacros = 0x01,
04859 
04860   /**
04861    * \brief Whether to include code patterns for language constructs
04862    * within the set of code completions, e.g., for loops.
04863    */
04864   CXCodeComplete_IncludeCodePatterns = 0x02,
04865 
04866   /**
04867    * \brief Whether to include brief documentation within the set of code
04868    * completions returned.
04869    */
04870   CXCodeComplete_IncludeBriefComments = 0x04
04871 };
04872 
04873 /**
04874  * \brief Bits that represent the context under which completion is occurring.
04875  *
04876  * The enumerators in this enumeration may be bitwise-OR'd together if multiple
04877  * contexts are occurring simultaneously.
04878  */
04879 enum CXCompletionContext {
04880   /**
04881    * \brief The context for completions is unexposed, as only Clang results
04882    * should be included. (This is equivalent to having no context bits set.)
04883    */
04884   CXCompletionContext_Unexposed = 0,
04885   
04886   /**
04887    * \brief Completions for any possible type should be included in the results.
04888    */
04889   CXCompletionContext_AnyType = 1 << 0,
04890   
04891   /**
04892    * \brief Completions for any possible value (variables, function calls, etc.)
04893    * should be included in the results.
04894    */
04895   CXCompletionContext_AnyValue = 1 << 1,
04896   /**
04897    * \brief Completions for values that resolve to an Objective-C object should
04898    * be included in the results.
04899    */
04900   CXCompletionContext_ObjCObjectValue = 1 << 2,
04901   /**
04902    * \brief Completions for values that resolve to an Objective-C selector
04903    * should be included in the results.
04904    */
04905   CXCompletionContext_ObjCSelectorValue = 1 << 3,
04906   /**
04907    * \brief Completions for values that resolve to a C++ class type should be
04908    * included in the results.
04909    */
04910   CXCompletionContext_CXXClassTypeValue = 1 << 4,
04911   
04912   /**
04913    * \brief Completions for fields of the member being accessed using the dot
04914    * operator should be included in the results.
04915    */
04916   CXCompletionContext_DotMemberAccess = 1 << 5,
04917   /**
04918    * \brief Completions for fields of the member being accessed using the arrow
04919    * operator should be included in the results.
04920    */
04921   CXCompletionContext_ArrowMemberAccess = 1 << 6,
04922   /**
04923    * \brief Completions for properties of the Objective-C object being accessed
04924    * using the dot operator should be included in the results.
04925    */
04926   CXCompletionContext_ObjCPropertyAccess = 1 << 7,
04927   
04928   /**
04929    * \brief Completions for enum tags should be included in the results.
04930    */
04931   CXCompletionContext_EnumTag = 1 << 8,
04932   /**
04933    * \brief Completions for union tags should be included in the results.
04934    */
04935   CXCompletionContext_UnionTag = 1 << 9,
04936   /**
04937    * \brief Completions for struct tags should be included in the results.
04938    */
04939   CXCompletionContext_StructTag = 1 << 10,
04940   
04941   /**
04942    * \brief Completions for C++ class names should be included in the results.
04943    */
04944   CXCompletionContext_ClassTag = 1 << 11,
04945   /**
04946    * \brief Completions for C++ namespaces and namespace aliases should be
04947    * included in the results.
04948    */
04949   CXCompletionContext_Namespace = 1 << 12,
04950   /**
04951    * \brief Completions for C++ nested name specifiers should be included in
04952    * the results.
04953    */
04954   CXCompletionContext_NestedNameSpecifier = 1 << 13,
04955   
04956   /**
04957    * \brief Completions for Objective-C interfaces (classes) should be included
04958    * in the results.
04959    */
04960   CXCompletionContext_ObjCInterface = 1 << 14,
04961   /**
04962    * \brief Completions for Objective-C protocols should be included in
04963    * the results.
04964    */
04965   CXCompletionContext_ObjCProtocol = 1 << 15,
04966   /**
04967    * \brief Completions for Objective-C categories should be included in
04968    * the results.
04969    */
04970   CXCompletionContext_ObjCCategory = 1 << 16,
04971   /**
04972    * \brief Completions for Objective-C instance messages should be included
04973    * in the results.
04974    */
04975   CXCompletionContext_ObjCInstanceMessage = 1 << 17,
04976   /**
04977    * \brief Completions for Objective-C class messages should be included in
04978    * the results.
04979    */
04980   CXCompletionContext_ObjCClassMessage = 1 << 18,
04981   /**
04982    * \brief Completions for Objective-C selector names should be included in
04983    * the results.
04984    */
04985   CXCompletionContext_ObjCSelectorName = 1 << 19,
04986   
04987   /**
04988    * \brief Completions for preprocessor macro names should be included in
04989    * the results.
04990    */
04991   CXCompletionContext_MacroName = 1 << 20,
04992   
04993   /**
04994    * \brief Natural language completions should be included in the results.
04995    */
04996   CXCompletionContext_NaturalLanguage = 1 << 21,
04997   
04998   /**
04999    * \brief The current context is unknown, so set all contexts.
05000    */
05001   CXCompletionContext_Unknown = ((1 << 22) - 1)
05002 };
05003   
05004 /**
05005  * \brief Returns a default set of code-completion options that can be
05006  * passed to\c clang_codeCompleteAt(). 
05007  */
05008 CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
05009 
05010 /**
05011  * \brief Perform code completion at a given location in a translation unit.
05012  *
05013  * This function performs code completion at a particular file, line, and
05014  * column within source code, providing results that suggest potential
05015  * code snippets based on the context of the completion. The basic model
05016  * for code completion is that Clang will parse a complete source file,
05017  * performing syntax checking up to the location where code-completion has
05018  * been requested. At that point, a special code-completion token is passed
05019  * to the parser, which recognizes this token and determines, based on the
05020  * current location in the C/Objective-C/C++ grammar and the state of
05021  * semantic analysis, what completions to provide. These completions are
05022  * returned via a new \c CXCodeCompleteResults structure.
05023  *
05024  * Code completion itself is meant to be triggered by the client when the
05025  * user types punctuation characters or whitespace, at which point the
05026  * code-completion location will coincide with the cursor. For example, if \c p
05027  * is a pointer, code-completion might be triggered after the "-" and then
05028  * after the ">" in \c p->. When the code-completion location is afer the ">",
05029  * the completion results will provide, e.g., the members of the struct that
05030  * "p" points to. The client is responsible for placing the cursor at the
05031  * beginning of the token currently being typed, then filtering the results
05032  * based on the contents of the token. For example, when code-completing for
05033  * the expression \c p->get, the client should provide the location just after
05034  * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the
05035  * client can filter the results based on the current token text ("get"), only
05036  * showing those results that start with "get". The intent of this interface
05037  * is to separate the relatively high-latency acquisition of code-completion
05038  * results from the filtering of results on a per-character basis, which must
05039  * have a lower latency.
05040  *
05041  * \param TU The translation unit in which code-completion should
05042  * occur. The source files for this translation unit need not be
05043  * completely up-to-date (and the contents of those source files may
05044  * be overridden via \p unsaved_files). Cursors referring into the
05045  * translation unit may be invalidated by this invocation.
05046  *
05047  * \param complete_filename The name of the source file where code
05048  * completion should be performed. This filename may be any file
05049  * included in the translation unit.
05050  *
05051  * \param complete_line The line at which code-completion should occur.
05052  *
05053  * \param complete_column The column at which code-completion should occur.
05054  * Note that the column should point just after the syntactic construct that
05055  * initiated code completion, and not in the middle of a lexical token.
05056  *
05057  * \param unsaved_files the Tiles that have not yet been saved to disk
05058  * but may be required for parsing or code completion, including the
05059  * contents of those files.  The contents and name of these files (as
05060  * specified by CXUnsavedFile) are copied when necessary, so the
05061  * client only needs to guarantee their validity until the call to
05062  * this function returns.
05063  *
05064  * \param num_unsaved_files The number of unsaved file entries in \p
05065  * unsaved_files.
05066  *
05067  * \param options Extra options that control the behavior of code
05068  * completion, expressed as a bitwise OR of the enumerators of the
05069  * CXCodeComplete_Flags enumeration. The 
05070  * \c clang_defaultCodeCompleteOptions() function returns a default set
05071  * of code-completion options.
05072  *
05073  * \returns If successful, a new \c CXCodeCompleteResults structure
05074  * containing code-completion results, which should eventually be
05075  * freed with \c clang_disposeCodeCompleteResults(). If code
05076  * completion fails, returns NULL.
05077  */
05078 CINDEX_LINKAGE
05079 CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
05080                                             const char *complete_filename,
05081                                             unsigned complete_line,
05082                                             unsigned complete_column,
05083                                             struct CXUnsavedFile *unsaved_files,
05084                                             unsigned num_unsaved_files,
05085                                             unsigned options);
05086 
05087 /**
05088  * \brief Sort the code-completion results in case-insensitive alphabetical 
05089  * order.
05090  *
05091  * \param Results The set of results to sort.
05092  * \param NumResults The number of results in \p Results.
05093  */
05094 CINDEX_LINKAGE
05095 void clang_sortCodeCompletionResults(CXCompletionResult *Results,
05096                                      unsigned NumResults);
05097   
05098 /**
05099  * \brief Free the given set of code-completion results.
05100  */
05101 CINDEX_LINKAGE
05102 void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
05103   
05104 /**
05105  * \brief Determine the number of diagnostics produced prior to the
05106  * location where code completion was performed.
05107  */
05108 CINDEX_LINKAGE
05109 unsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results);
05110 
05111 /**
05112  * \brief Retrieve a diagnostic associated with the given code completion.
05113  *
05114  * \param Results the code completion results to query.
05115  * \param Index the zero-based diagnostic number to retrieve.
05116  *
05117  * \returns the requested diagnostic. This diagnostic must be freed
05118  * via a call to \c clang_disposeDiagnostic().
05119  */
05120 CINDEX_LINKAGE
05121 CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
05122                                              unsigned Index);
05123 
05124 /**
05125  * \brief Determines what completions are appropriate for the context
05126  * the given code completion.
05127  * 
05128  * \param Results the code completion results to query
05129  *
05130  * \returns the kinds of completions that are appropriate for use
05131  * along with the given code completion results.
05132  */
05133 CINDEX_LINKAGE
05134 unsigned long long clang_codeCompleteGetContexts(
05135                                                 CXCodeCompleteResults *Results);
05136 
05137 /**
05138  * \brief Returns the cursor kind for the container for the current code
05139  * completion context. The container is only guaranteed to be set for
05140  * contexts where a container exists (i.e. member accesses or Objective-C
05141  * message sends); if there is not a container, this function will return
05142  * CXCursor_InvalidCode.
05143  *
05144  * \param Results the code completion results to query
05145  *
05146  * \param IsIncomplete on return, this value will be false if Clang has complete
05147  * information about the container. If Clang does not have complete
05148  * information, this value will be true.
05149  *
05150  * \returns the container kind, or CXCursor_InvalidCode if there is not a
05151  * container
05152  */
05153 CINDEX_LINKAGE
05154 enum CXCursorKind clang_codeCompleteGetContainerKind(
05155                                                  CXCodeCompleteResults *Results,
05156                                                      unsigned *IsIncomplete);
05157 
05158 /**
05159  * \brief Returns the USR for the container for the current code completion
05160  * context. If there is not a container for the current context, this
05161  * function will return the empty string.
05162  *
05163  * \param Results the code completion results to query
05164  *
05165  * \returns the USR for the container
05166  */
05167 CINDEX_LINKAGE
05168 CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results);
05169   
05170   
05171 /**
05172  * \brief Returns the currently-entered selector for an Objective-C message
05173  * send, formatted like "initWithFoo:bar:". Only guaranteed to return a
05174  * non-empty string for CXCompletionContext_ObjCInstanceMessage and
05175  * CXCompletionContext_ObjCClassMessage.
05176  *
05177  * \param Results the code completion results to query
05178  *
05179  * \returns the selector (or partial selector) that has been entered thus far
05180  * for an Objective-C message send.
05181  */
05182 CINDEX_LINKAGE
05183 CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results);
05184   
05185 /**
05186  * @}
05187  */
05188 
05189 
05190 /**
05191  * \defgroup CINDEX_MISC Miscellaneous utility functions
05192  *
05193  * @{
05194  */
05195 
05196 /**
05197  * \brief Return a version string, suitable for showing to a user, but not
05198  *        intended to be parsed (the format is not guaranteed to be stable).
05199  */
05200 CINDEX_LINKAGE CXString clang_getClangVersion(void);
05201 
05202   
05203 /**
05204  * \brief Enable/disable crash recovery.
05205  *
05206  * \param isEnabled Flag to indicate if crash recovery is enabled.  A non-zero
05207  *        value enables crash recovery, while 0 disables it.
05208  */
05209 CINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled);
05210   
05211  /**
05212   * \brief Visitor invoked for each file in a translation unit
05213   *        (used with clang_getInclusions()).
05214   *
05215   * This visitor function will be invoked by clang_getInclusions() for each
05216   * file included (either at the top-level or by \#include directives) within
05217   * a translation unit.  The first argument is the file being included, and
05218   * the second and third arguments provide the inclusion stack.  The
05219   * array is sorted in order of immediate inclusion.  For example,
05220   * the first element refers to the location that included 'included_file'.
05221   */
05222 typedef void (*CXInclusionVisitor)(CXFile included_file,
05223                                    CXSourceLocation* inclusion_stack,
05224                                    unsigned include_len,
05225                                    CXClientData client_data);
05226 
05227 /**
05228  * \brief Visit the set of preprocessor inclusions in a translation unit.
05229  *   The visitor function is called with the provided data for every included
05230  *   file.  This does not include headers included by the PCH file (unless one
05231  *   is inspecting the inclusions in the PCH file itself).
05232  */
05233 CINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu,
05234                                         CXInclusionVisitor visitor,
05235                                         CXClientData client_data);
05236 
05237 /**
05238  * @}
05239  */
05240 
05241 /** \defgroup CINDEX_REMAPPING Remapping functions
05242  *
05243  * @{
05244  */
05245 
05246 /**
05247  * \brief A remapping of original source files and their translated files.
05248  */
05249 typedef void *CXRemapping;
05250 
05251 /**
05252  * \brief Retrieve a remapping.
05253  *
05254  * \param path the path that contains metadata about remappings.
05255  *
05256  * \returns the requested remapping. This remapping must be freed
05257  * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
05258  */
05259 CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path);
05260 
05261 /**
05262  * \brief Retrieve a remapping.
05263  *
05264  * \param filePaths pointer to an array of file paths containing remapping info.
05265  *
05266  * \param numFiles number of file paths.
05267  *
05268  * \returns the requested remapping. This remapping must be freed
05269  * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
05270  */
05271 CINDEX_LINKAGE
05272 CXRemapping clang_getRemappingsFromFileList(const char **filePaths,
05273                                             unsigned numFiles);
05274 
05275 /**
05276  * \brief Determine the number of remappings.
05277  */
05278 CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
05279 
05280 /**
05281  * \brief Get the original and the associated filename from the remapping.
05282  * 
05283  * \param original If non-NULL, will be set to the original filename.
05284  *
05285  * \param transformed If non-NULL, will be set to the filename that the original
05286  * is associated with.
05287  */
05288 CINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index,
05289                                      CXString *original, CXString *transformed);
05290 
05291 /**
05292  * \brief Dispose the remapping.
05293  */
05294 CINDEX_LINKAGE void clang_remap_dispose(CXRemapping);
05295 
05296 /**
05297  * @}
05298  */
05299 
05300 /** \defgroup CINDEX_HIGH Higher level API functions
05301  *
05302  * @{
05303  */
05304 
05305 enum CXVisitorResult {
05306   CXVisit_Break,
05307   CXVisit_Continue
05308 };
05309 
05310 typedef struct {
05311   void *context;
05312   enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange);
05313 } CXCursorAndRangeVisitor;
05314 
05315 typedef enum {
05316   /**
05317    * \brief Function returned successfully.
05318    */
05319   CXResult_Success = 0,
05320   /**
05321    * \brief One of the parameters was invalid for the function.
05322    */
05323   CXResult_Invalid = 1,
05324   /**
05325    * \brief The function was terminated by a callback (e.g. it returned
05326    * CXVisit_Break)
05327    */
05328   CXResult_VisitBreak = 2
05329 
05330 } CXResult;
05331 
05332 /**
05333  * \brief Find references of a declaration in a specific file.
05334  * 
05335  * \param cursor pointing to a declaration or a reference of one.
05336  *
05337  * \param file to search for references.
05338  *
05339  * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for
05340  * each reference found.
05341  * The CXSourceRange will point inside the file; if the reference is inside
05342  * a macro (and not a macro argument) the CXSourceRange will be invalid.
05343  *
05344  * \returns one of the CXResult enumerators.
05345  */
05346 CINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file,
05347                                                CXCursorAndRangeVisitor visitor);
05348 
05349 /**
05350  * \brief Find #import/#include directives in a specific file.
05351  *
05352  * \param TU translation unit containing the file to query.
05353  *
05354  * \param file to search for #import/#include directives.
05355  *
05356  * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for
05357  * each directive found.
05358  *
05359  * \returns one of the CXResult enumerators.
05360  */
05361 CINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU,
05362                                                  CXFile file,
05363                                               CXCursorAndRangeVisitor visitor);
05364 
05365 #ifdef __has_feature
05366 #  if __has_feature(blocks)
05367 
05368 typedef enum CXVisitorResult
05369     (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange);
05370 
05371 CINDEX_LINKAGE
05372 CXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile,
05373                                              CXCursorAndRangeVisitorBlock);
05374 
05375 CINDEX_LINKAGE
05376 CXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile,
05377                                            CXCursorAndRangeVisitorBlock);
05378 
05379 #  endif
05380 #endif
05381 
05382 /**
05383  * \brief The client's data object that is associated with a CXFile.
05384  */
05385 typedef void *CXIdxClientFile;
05386 
05387 /**
05388  * \brief The client's data object that is associated with a semantic entity.
05389  */
05390 typedef void *CXIdxClientEntity;
05391 
05392 /**
05393  * \brief The client's data object that is associated with a semantic container
05394  * of entities.
05395  */
05396 typedef void *CXIdxClientContainer;
05397 
05398 /**
05399  * \brief The client's data object that is associated with an AST file (PCH
05400  * or module).
05401  */
05402 typedef void *CXIdxClientASTFile;
05403 
05404 /**
05405  * \brief Source location passed to index callbacks.
05406  */
05407 typedef struct {
05408   void *ptr_data[2];
05409   unsigned int_data;
05410 } CXIdxLoc;
05411 
05412 /**
05413  * \brief Data for ppIncludedFile callback.
05414  */
05415 typedef struct {
05416   /**
05417    * \brief Location of '#' in the \#include/\#import directive.
05418    */
05419   CXIdxLoc hashLoc;
05420   /**
05421    * \brief Filename as written in the \#include/\#import directive.
05422    */
05423   const char *filename;
05424   /**
05425    * \brief The actual file that the \#include/\#import directive resolved to.
05426    */
05427   CXFile file;
05428   int isImport;
05429   int isAngled;
05430   /**
05431    * \brief Non-zero if the directive was automatically turned into a module
05432    * import.
05433    */
05434   int isModuleImport;
05435 } CXIdxIncludedFileInfo;
05436 
05437 /**
05438  * \brief Data for IndexerCallbacks#importedASTFile.
05439  */
05440 typedef struct {
05441   /**
05442    * \brief Top level AST file containing the imported PCH, module or submodule.
05443    */
05444   CXFile file;
05445   /**
05446    * \brief The imported module or NULL if the AST file is a PCH.
05447    */
05448   CXModule module;
05449   /**
05450    * \brief Location where the file is imported. Applicable only for modules.
05451    */
05452   CXIdxLoc loc;
05453   /**
05454    * \brief Non-zero if an inclusion directive was automatically turned into
05455    * a module import. Applicable only for modules.
05456    */
05457   int isImplicit;
05458 
05459 } CXIdxImportedASTFileInfo;
05460 
05461 typedef enum {
05462   CXIdxEntity_Unexposed     = 0,
05463   CXIdxEntity_Typedef       = 1,
05464   CXIdxEntity_Function      = 2,
05465   CXIdxEntity_Variable      = 3,
05466   CXIdxEntity_Field         = 4,
05467   CXIdxEntity_EnumConstant  = 5,
05468 
05469   CXIdxEntity_ObjCClass     = 6,
05470   CXIdxEntity_ObjCProtocol  = 7,
05471   CXIdxEntity_ObjCCategory  = 8,
05472 
05473   CXIdxEntity_ObjCInstanceMethod = 9,
05474   CXIdxEntity_ObjCClassMethod    = 10,
05475   CXIdxEntity_ObjCProperty  = 11,
05476   CXIdxEntity_ObjCIvar      = 12,
05477 
05478   CXIdxEntity_Enum          = 13,
05479   CXIdxEntity_Struct        = 14,
05480   CXIdxEntity_Union         = 15,
05481 
05482   CXIdxEntity_CXXClass              = 16,
05483   CXIdxEntity_CXXNamespace          = 17,
05484   CXIdxEntity_CXXNamespaceAlias     = 18,
05485   CXIdxEntity_CXXStaticVariable     = 19,
05486   CXIdxEntity_CXXStaticMethod       = 20,
05487   CXIdxEntity_CXXInstanceMethod     = 21,
05488   CXIdxEntity_CXXConstructor        = 22,
05489   CXIdxEntity_CXXDestructor         = 23,
05490   CXIdxEntity_CXXConversionFunction = 24,
05491   CXIdxEntity_CXXTypeAlias          = 25,
05492   CXIdxEntity_CXXInterface          = 26
05493 
05494 } CXIdxEntityKind;
05495 
05496 typedef enum {
05497   CXIdxEntityLang_None = 0,
05498   CXIdxEntityLang_C    = 1,
05499   CXIdxEntityLang_ObjC = 2,
05500   CXIdxEntityLang_CXX  = 3
05501 } CXIdxEntityLanguage;
05502 
05503 /**
05504  * \brief Extra C++ template information for an entity. This can apply to:
05505  * CXIdxEntity_Function
05506  * CXIdxEntity_CXXClass
05507  * CXIdxEntity_CXXStaticMethod
05508  * CXIdxEntity_CXXInstanceMethod
05509  * CXIdxEntity_CXXConstructor
05510  * CXIdxEntity_CXXConversionFunction
05511  * CXIdxEntity_CXXTypeAlias
05512  */
05513 typedef enum {
05514   CXIdxEntity_NonTemplate   = 0,
05515   CXIdxEntity_Template      = 1,
05516   CXIdxEntity_TemplatePartialSpecialization = 2,
05517   CXIdxEntity_TemplateSpecialization = 3
05518 } CXIdxEntityCXXTemplateKind;
05519 
05520 typedef enum {
05521   CXIdxAttr_Unexposed     = 0,
05522   CXIdxAttr_IBAction      = 1,
05523   CXIdxAttr_IBOutlet      = 2,
05524   CXIdxAttr_IBOutletCollection = 3
05525 } CXIdxAttrKind;
05526 
05527 typedef struct {
05528   CXIdxAttrKind kind;
05529   CXCursor cursor;
05530   CXIdxLoc loc;
05531 } CXIdxAttrInfo;
05532 
05533 typedef struct {
05534   CXIdxEntityKind kind;
05535   CXIdxEntityCXXTemplateKind templateKind;
05536   CXIdxEntityLanguage lang;
05537   const char *name;
05538   const char *USR;
05539   CXCursor cursor;
05540   const CXIdxAttrInfo *const *attributes;
05541   unsigned numAttributes;
05542 } CXIdxEntityInfo;
05543 
05544 typedef struct {
05545   CXCursor cursor;
05546 } CXIdxContainerInfo;
05547 
05548 typedef struct {
05549   const CXIdxAttrInfo *attrInfo;
05550   const CXIdxEntityInfo *objcClass;
05551   CXCursor classCursor;
05552   CXIdxLoc classLoc;
05553 } CXIdxIBOutletCollectionAttrInfo;
05554 
05555 typedef enum {
05556   CXIdxDeclFlag_Skipped = 0x1
05557 } CXIdxDeclInfoFlags;
05558 
05559 typedef struct {
05560   const CXIdxEntityInfo *entityInfo;
05561   CXCursor cursor;
05562   CXIdxLoc loc;
05563   const CXIdxContainerInfo *semanticContainer;
05564   /**
05565    * \brief Generally same as #semanticContainer but can be different in
05566    * cases like out-of-line C++ member functions.
05567    */
05568   const CXIdxContainerInfo *lexicalContainer;
05569   int isRedeclaration;
05570   int isDefinition;
05571   int isContainer;
05572   const CXIdxContainerInfo *declAsContainer;
05573   /**
05574    * \brief Whether the declaration exists in code or was created implicitly
05575    * by the compiler, e.g. implicit Objective-C methods for properties.
05576    */
05577   int isImplicit;
05578   const CXIdxAttrInfo *const *attributes;
05579   unsigned numAttributes;
05580 
05581   unsigned flags;
05582 
05583 } CXIdxDeclInfo;
05584 
05585 typedef enum {
05586   CXIdxObjCContainer_ForwardRef = 0,
05587   CXIdxObjCContainer_Interface = 1,
05588   CXIdxObjCContainer_Implementation = 2
05589 } CXIdxObjCContainerKind;
05590 
05591 typedef struct {
05592   const CXIdxDeclInfo *declInfo;
05593   CXIdxObjCContainerKind kind;
05594 } CXIdxObjCContainerDeclInfo;
05595 
05596 typedef struct {
05597   const CXIdxEntityInfo *base;
05598   CXCursor cursor;
05599   CXIdxLoc loc;
05600 } CXIdxBaseClassInfo;
05601 
05602 typedef struct {
05603   const CXIdxEntityInfo *protocol;
05604   CXCursor cursor;
05605   CXIdxLoc loc;
05606 } CXIdxObjCProtocolRefInfo;
05607 
05608 typedef struct {
05609   const CXIdxObjCProtocolRefInfo *const *protocols;
05610   unsigned numProtocols;
05611 } CXIdxObjCProtocolRefListInfo;
05612 
05613 typedef struct {
05614   const CXIdxObjCContainerDeclInfo *containerInfo;
05615   const CXIdxBaseClassInfo *superInfo;
05616   const CXIdxObjCProtocolRefListInfo *protocols;
05617 } CXIdxObjCInterfaceDeclInfo;
05618 
05619 typedef struct {
05620   const CXIdxObjCContainerDeclInfo *containerInfo;
05621   const CXIdxEntityInfo *objcClass;
05622   CXCursor classCursor;
05623   CXIdxLoc classLoc;
05624   const CXIdxObjCProtocolRefListInfo *protocols;
05625 } CXIdxObjCCategoryDeclInfo;
05626 
05627 typedef struct {
05628   const CXIdxDeclInfo *declInfo;
05629   const CXIdxEntityInfo *getter;
05630   const CXIdxEntityInfo *setter;
05631 } CXIdxObjCPropertyDeclInfo;
05632 
05633 typedef struct {
05634   const CXIdxDeclInfo *declInfo;
05635   const CXIdxBaseClassInfo *const *bases;
05636   unsigned numBases;
05637 } CXIdxCXXClassDeclInfo;
05638 
05639 /**
05640  * \brief Data for IndexerCallbacks#indexEntityReference.
05641  */
05642 typedef enum {
05643   /**
05644    * \brief The entity is referenced directly in user's code.
05645    */
05646   CXIdxEntityRef_Direct = 1,
05647   /**
05648    * \brief An implicit reference, e.g. a reference of an Objective-C method
05649    * via the dot syntax.
05650    */
05651   CXIdxEntityRef_Implicit = 2
05652 } CXIdxEntityRefKind;
05653 
05654 /**
05655  * \brief Data for IndexerCallbacks#indexEntityReference.
05656  */
05657 typedef struct {
05658   CXIdxEntityRefKind kind;
05659   /**
05660    * \brief Reference cursor.
05661    */
05662   CXCursor cursor;
05663   CXIdxLoc loc;
05664   /**
05665    * \brief The entity that gets referenced.
05666    */
05667   const CXIdxEntityInfo *referencedEntity;
05668   /**
05669    * \brief Immediate "parent" of the reference. For example:
05670    * 
05671    * \code
05672    * Foo *var;
05673    * \endcode
05674    * 
05675    * The parent of reference of type 'Foo' is the variable 'var'.
05676    * For references inside statement bodies of functions/methods,
05677    * the parentEntity will be the function/method.
05678    */
05679   const CXIdxEntityInfo *parentEntity;
05680   /**
05681    * \brief Lexical container context of the reference.
05682    */
05683   const CXIdxContainerInfo *container;
05684 } CXIdxEntityRefInfo;
05685 
05686 /**
05687  * \brief A group of callbacks used by #clang_indexSourceFile and
05688  * #clang_indexTranslationUnit.
05689  */
05690 typedef struct {
05691   /**
05692    * \brief Called periodically to check whether indexing should be aborted.
05693    * Should return 0 to continue, and non-zero to abort.
05694    */
05695   int (*abortQuery)(CXClientData client_data, void *reserved);
05696 
05697   /**
05698    * \brief Called at the end of indexing; passes the complete diagnostic set.
05699    */
05700   void (*diagnostic)(CXClientData client_data,
05701                      CXDiagnosticSet, void *reserved);
05702 
05703   CXIdxClientFile (*enteredMainFile)(CXClientData client_data,
05704                                      CXFile mainFile, void *reserved);
05705   
05706   /**
05707    * \brief Called when a file gets \#included/\#imported.
05708    */
05709   CXIdxClientFile (*ppIncludedFile)(CXClientData client_data,
05710                                     const CXIdxIncludedFileInfo *);
05711   
05712   /**
05713    * \brief Called when a AST file (PCH or module) gets imported.
05714    * 
05715    * AST files will not get indexed (there will not be callbacks to index all
05716    * the entities in an AST file). The recommended action is that, if the AST
05717    * file is not already indexed, to initiate a new indexing job specific to
05718    * the AST file.
05719    */
05720   CXIdxClientASTFile (*importedASTFile)(CXClientData client_data,
05721                                         const CXIdxImportedASTFileInfo *);
05722 
05723   /**
05724    * \brief Called at the beginning of indexing a translation unit.
05725    */
05726   CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data,
05727                                                  void *reserved);
05728 
05729   void (*indexDeclaration)(CXClientData client_data,
05730                            const CXIdxDeclInfo *);
05731 
05732   /**
05733    * \brief Called to index a reference of an entity.
05734    */
05735   void (*indexEntityReference)(CXClientData client_data,
05736                                const CXIdxEntityRefInfo *);
05737 
05738 } IndexerCallbacks;
05739 
05740 CINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind);
05741 CINDEX_LINKAGE const CXIdxObjCContainerDeclInfo *
05742 clang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *);
05743 
05744 CINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo *
05745 clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *);
05746 
05747 CINDEX_LINKAGE
05748 const CXIdxObjCCategoryDeclInfo *
05749 clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *);
05750 
05751 CINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo *
05752 clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *);
05753 
05754 CINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo *
05755 clang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *);
05756 
05757 CINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo *
05758 clang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *);
05759 
05760 CINDEX_LINKAGE const CXIdxCXXClassDeclInfo *
05761 clang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *);
05762 
05763 /**
05764  * \brief For retrieving a custom CXIdxClientContainer attached to a
05765  * container.
05766  */
05767 CINDEX_LINKAGE CXIdxClientContainer
05768 clang_index_getClientContainer(const CXIdxContainerInfo *);
05769 
05770 /**
05771  * \brief For setting a custom CXIdxClientContainer attached to a
05772  * container.
05773  */
05774 CINDEX_LINKAGE void
05775 clang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer);
05776 
05777 /**
05778  * \brief For retrieving a custom CXIdxClientEntity attached to an entity.
05779  */
05780 CINDEX_LINKAGE CXIdxClientEntity
05781 clang_index_getClientEntity(const CXIdxEntityInfo *);
05782 
05783 /**
05784  * \brief For setting a custom CXIdxClientEntity attached to an entity.
05785  */
05786 CINDEX_LINKAGE void
05787 clang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity);
05788 
05789 /**
05790  * \brief An indexing action/session, to be applied to one or multiple
05791  * translation units.
05792  */
05793 typedef void *CXIndexAction;
05794 
05795 /**
05796  * \brief An indexing action/session, to be applied to one or multiple
05797  * translation units.
05798  *
05799  * \param CIdx The index object with which the index action will be associated.
05800  */
05801 CINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx);
05802 
05803 /**
05804  * \brief Destroy the given index action.
05805  *
05806  * The index action must not be destroyed until all of the translation units
05807  * created within that index action have been destroyed.
05808  */
05809 CINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction);
05810 
05811 typedef enum {
05812   /**
05813    * \brief Used to indicate that no special indexing options are needed.
05814    */
05815   CXIndexOpt_None = 0x0,
05816   
05817   /**
05818    * \brief Used to indicate that IndexerCallbacks#indexEntityReference should
05819    * be invoked for only one reference of an entity per source file that does
05820    * not also include a declaration/definition of the entity.
05821    */
05822   CXIndexOpt_SuppressRedundantRefs = 0x1,
05823 
05824   /**
05825    * \brief Function-local symbols should be indexed. If this is not set
05826    * function-local symbols will be ignored.
05827    */
05828   CXIndexOpt_IndexFunctionLocalSymbols = 0x2,
05829 
05830   /**
05831    * \brief Implicit function/class template instantiations should be indexed.
05832    * If this is not set, implicit instantiations will be ignored.
05833    */
05834   CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4,
05835 
05836   /**
05837    * \brief Suppress all compiler warnings when parsing for indexing.
05838    */
05839   CXIndexOpt_SuppressWarnings = 0x8,
05840 
05841   /**
05842    * \brief Skip a function/method body that was already parsed during an
05843    * indexing session associated with a \c CXIndexAction object.
05844    * Bodies in system headers are always skipped.
05845    */
05846   CXIndexOpt_SkipParsedBodiesInSession = 0x10
05847 
05848 } CXIndexOptFlags;
05849 
05850 /**
05851  * \brief Index the given source file and the translation unit corresponding
05852  * to that file via callbacks implemented through #IndexerCallbacks.
05853  *
05854  * \param client_data pointer data supplied by the client, which will
05855  * be passed to the invoked callbacks.
05856  *
05857  * \param index_callbacks Pointer to indexing callbacks that the client
05858  * implements.
05859  *
05860  * \param index_callbacks_size Size of #IndexerCallbacks structure that gets
05861  * passed in index_callbacks.
05862  *
05863  * \param index_options A bitmask of options that affects how indexing is
05864  * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags.
05865  *
05866  * \param[out] out_TU pointer to store a \c CXTranslationUnit that can be
05867  * reused after indexing is finished. Set to \c NULL if you do not require it.
05868  *
05869  * \returns 0 on success or if there were errors from which the compiler could
05870  * recover.  If there is a failure from which the there is no recovery, returns
05871  * a non-zero \c CXErrorCode.
05872  *
05873  * The rest of the parameters are the same as #clang_parseTranslationUnit.
05874  */
05875 CINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction,
05876                                          CXClientData client_data,
05877                                          IndexerCallbacks *index_callbacks,
05878                                          unsigned index_callbacks_size,
05879                                          unsigned index_options,
05880                                          const char *source_filename,
05881                                          const char * const *command_line_args,
05882                                          int num_command_line_args,
05883                                          struct CXUnsavedFile *unsaved_files,
05884                                          unsigned num_unsaved_files,
05885                                          CXTranslationUnit *out_TU,
05886                                          unsigned TU_options);
05887 
05888 /**
05889  * \brief Index the given translation unit via callbacks implemented through
05890  * #IndexerCallbacks.
05891  * 
05892  * The order of callback invocations is not guaranteed to be the same as
05893  * when indexing a source file. The high level order will be:
05894  * 
05895  *   -Preprocessor callbacks invocations
05896  *   -Declaration/reference callbacks invocations
05897  *   -Diagnostic callback invocations
05898  *
05899  * The parameters are the same as #clang_indexSourceFile.
05900  * 
05901  * \returns If there is a failure from which the there is no recovery, returns
05902  * non-zero, otherwise returns 0.
05903  */
05904 CINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction,
05905                                               CXClientData client_data,
05906                                               IndexerCallbacks *index_callbacks,
05907                                               unsigned index_callbacks_size,
05908                                               unsigned index_options,
05909                                               CXTranslationUnit);
05910 
05911 /**
05912  * \brief Retrieve the CXIdxFile, file, line, column, and offset represented by
05913  * the given CXIdxLoc.
05914  *
05915  * If the location refers into a macro expansion, retrieves the
05916  * location of the macro expansion and if it refers into a macro argument
05917  * retrieves the location of the argument.
05918  */
05919 CINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc,
05920                                                    CXIdxClientFile *indexFile,
05921                                                    CXFile *file,
05922                                                    unsigned *line,
05923                                                    unsigned *column,
05924                                                    unsigned *offset);
05925 
05926 /**
05927  * \brief Retrieve the CXSourceLocation represented by the given CXIdxLoc.
05928  */
05929 CINDEX_LINKAGE
05930 CXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc);
05931 
05932 /**
05933  * @}
05934  */
05935 
05936 /**
05937  * @}
05938  */
05939 
05940 #ifdef __cplusplus
05941 }
05942 #endif
05943 #endif
05944