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