1d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek/*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\
2d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|*                                                                            *|
3d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|*                     The LLVM Compiler Infrastructure                       *|
4d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|*                                                                            *|
5d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* This file is distributed under the University of Illinois Open Source      *|
6d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* License. See LICENSE.TXT for details.                                      *|
7d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|*                                                                            *|
8d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|*===----------------------------------------------------------------------===*|
9d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|*                                                                            *|
10d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* This header provides a public inferface to a Clang library for extracting  *|
11d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* high-level symbol information from source files without exposing the full  *|
12d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* Clang C++ API.                                                             *|
13d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|*                                                                            *|
14d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek\*===----------------------------------------------------------------------===*/
15d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
16d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifndef CLANG_C_INDEX_H
17d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#define CLANG_C_INDEX_H
18d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
1988145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff#include <sys/stat.h>
203d31560343856c573376a04558a7111e7afad4f7Chandler Carruth#include <time.h>
210a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor#include <stdio.h>
2288145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff
23db2a685287e57d9dfec09c867152c465af6fc6b0Arnaud A. de Grandmaison#include "clang-c/Platform.h"
24db2a685287e57d9dfec09c867152c465af6fc6b0Arnaud A. de Grandmaison#include "clang-c/CXString.h"
25db2a685287e57d9dfec09c867152c465af6fc6b0Arnaud A. de Grandmaison
264d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis/**
274d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * \brief The version constants for the libclang API.
284d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * CINDEX_VERSION_MINOR should increase when there are API additions.
294d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes.
304d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis *
314d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * The policy about the libclang API was always to keep it source and ABI
324d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
334d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis */
34ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_MAJOR 0
35edab047e10d745a65d12c8cb36be2ba9e96c9e0eArgyrios Kyrtzidis#define CINDEX_VERSION_MINOR 19
36ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis
37ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_ENCODE(major, minor) ( \
38ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis      ((major) * 10000)                       \
39ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis    + ((minor) *     1))
40ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis
41ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION CINDEX_VERSION_ENCODE( \
42ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis    CINDEX_VERSION_MAJOR,                     \
43ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis    CINDEX_VERSION_MINOR )
44ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis
45ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_STRINGIZE_(major, minor)   \
46ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis    #major"."#minor
47ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_STRINGIZE(major, minor)    \
48ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis    CINDEX_VERSION_STRINGIZE_(major, minor)
49ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis
50ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_STRING CINDEX_VERSION_STRINGIZE( \
51ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis    CINDEX_VERSION_MAJOR,                               \
52ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis    CINDEX_VERSION_MINOR)
53ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis
54d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus
55d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenekextern "C" {
56d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
57d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
5887fb9404cd962b78c98947d75d68be1691c4e737Douglas Gregor/** \defgroup CINDEX libclang: C Interface to Clang
5920d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor *
601efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The C Interface to Clang provides a relatively small API that exposes
61f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * facilities for parsing source code into an abstract syntax tree (AST),
62f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * loading already-parsed ASTs, traversing the AST, associating
63f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * physical source locations with elements within the AST, and other
64f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * facilities that support Clang-based development tools.
65f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
661efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * This C interface to Clang will never provide all of the information
67f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * representation stored in Clang's C++ AST, nor should it: the intent is to
68f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * maintain an API that is relatively stable from one release to the next,
69f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * providing only the basic functionality needed to support development tools.
701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar *
711efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * To avoid namespace pollution, data types are prefixed with "CX" and
72f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * functions are prefixed with "clang_".
7320d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor *
7420d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * @{
7520d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor */
761efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
777f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
787f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief An "index" that consists of a set of translation units that would
797f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * typically be linked together into an executable or library.
807f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
817f17376e0931a337d544b75d9030bc92763be287Douglas Gregortypedef void *CXIndex;
82600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
837f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
847f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief A single translation unit, which resides in an index.
857f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
860a90d32523bfe5fa63e11b648686c9699f786d15Ted Kremenektypedef struct CXTranslationUnitImpl *CXTranslationUnit;
87600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
887f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
89c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Opaque pointer representing client data that will be passed through
90c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to various callbacks and visitors.
917f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
92c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregortypedef void *CXClientData;
931efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
94735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor/**
95735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * \brief Provides the contents of a file that has not yet been saved to disk.
96735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor *
97735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * Each CXUnsavedFile instance provides the name of a file on the
98735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * system along with the current contents of that file that have not
99735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * yet been saved to disk.
100735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor */
101735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregorstruct CXUnsavedFile {
1021efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
1031efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief The file whose contents have not yet been saved.
104735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor   *
105735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor   * This file must already exist in the file system.
106735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor   */
107735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor  const char *Filename;
108735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor
1091efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
110c8dfe5ece04e683106eb96c58a2999f70b53ac21Douglas Gregor   * \brief A buffer containing the unsaved contents of this file.
111735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor   */
112735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor  const char *Contents;
113735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor
114735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor  /**
115c8dfe5ece04e683106eb96c58a2999f70b53ac21Douglas Gregor   * \brief The length of the unsaved contents of this buffer.
116735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor   */
117735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor  unsigned long Length;
118735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor};
119735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor
120076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne/**
121076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * \brief Describes the availability of a particular entity, which indicates
122076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * whether the use of this entity will result in a warning or error due to
123076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * it being deprecated or unavailable.
124076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne */
12558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorenum CXAvailabilityKind {
126076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne  /**
127076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   * \brief The entity is available.
128076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   */
12958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor  CXAvailability_Available,
130076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne  /**
131076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   * \brief The entity is available, but has been deprecated (and its use is
132076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   * not recommended).
133076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   */
13458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor  CXAvailability_Deprecated,
135076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne  /**
136076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   * \brief The entity is not available; any use of it will be an error.
137076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   */
138d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen  CXAvailability_NotAvailable,
139d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen  /**
140d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen   * \brief The entity is available, but not accessible; any use of it will be
141d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen   * an error.
142d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen   */
143d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen  CXAvailability_NotAccessible
14458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor};
145cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor
146cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/**
147cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Describes a version number of the form major.minor.subminor.
148cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */
149cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregortypedef struct CXVersion {
150cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
151cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief The major version number, e.g., the '10' in '10.7.3'. A negative
152cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * value indicates that there is no version number at all.
153cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
154cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  int Major;
155cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
156cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief The minor version number, e.g., the '7' in '10.7.3'. This value
157cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * will be negative if no minor version number was provided, e.g., for
158cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * version '10'.
159cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
160cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  int Minor;
161cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
162cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief The subminor version number, e.g., the '3' in '10.7.3'. This value
163cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * will be negative if no minor or subminor version number was provided,
164cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * e.g., in version '10' or '10.7'.
165cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
166cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  int Subminor;
167cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor} CXVersion;
16858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
1697f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1707eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Provides a shared context for creating translation units.
1717eee0184570366285589d788bcd7f5dda8345915James Dennett *
1727eee0184570366285589d788bcd7f5dda8345915James Dennett * It provides two options:
173e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff *
174e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
175e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * declarations (when loading any new translation units). A "local" declaration
1761efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * is one that belongs in the translation unit itself and not in a precompiled
177e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * header that was used by the translation unit. If zero, all declarations
178e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * will be enumerated.
179e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff *
180b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * Here is an example:
181b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
1827eee0184570366285589d788bcd7f5dda8345915James Dennett * \code
1830a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *   // excludeDeclsFromPCH = 1, displayDiagnostics=1
1840a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *   Idx = clang_createIndex(1, 1);
185b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
186b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // IndexTest.pch was produced with the following command:
187b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
188b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
189b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
190b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // This will load all the symbols from 'IndexTest.pch'
1911efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
192002a528ab0189fc60cfbf9328962c96ccbe567eeDouglas Gregor *                       TranslationUnitVisitor, 0);
193b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   clang_disposeTranslationUnit(TU);
194b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
195b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // This will load all the symbols from 'IndexTest.c', excluding symbols
196b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // from 'IndexTest.pch'.
197fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar *   char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
198fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar *   TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
199fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar *                                                  0, 0);
200b2cd48756119f4d8d2a865b4b3e0e8efd02e26a0Douglas Gregor *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
201b2cd48756119f4d8d2a865b4b3e0e8efd02e26a0Douglas Gregor *                       TranslationUnitVisitor, 0);
202b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   clang_disposeTranslationUnit(TU);
2037eee0184570366285589d788bcd7f5dda8345915James Dennett * \endcode
204b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
205b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * This process of creating the 'pch', loading it separately, and using it (via
206b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
207b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * (which gives the indexer the same performance benefit as the compiler).
208e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff */
2090a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
2100a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor                                         int displayDiagnostics);
211896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2120087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor/**
2130087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * \brief Destroy the given index.
2140087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor *
2150087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * The index must not be destroyed until all of the translation units created
2160087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * within that index have been destroyed.
2170087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor */
2188506dde586459887b7e14e23a30af8ac5be5adb6Daniel DunbarCINDEX_LINKAGE void clang_disposeIndex(CXIndex index);
2191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
220fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidistypedef enum {
221fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis  /**
222fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   * \brief Used to indicate that no special CXIndex options are needed.
223fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   */
224fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis  CXGlobalOpt_None = 0x0,
225fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis
226fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis  /**
227fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   * \brief Used to indicate that threads that libclang creates for indexing
228fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   * purposes should use background priority.
2297eee0184570366285589d788bcd7f5dda8345915James Dennett   *
2307eee0184570366285589d788bcd7f5dda8345915James Dennett   * Affects #clang_indexSourceFile, #clang_indexTranslationUnit,
2317eee0184570366285589d788bcd7f5dda8345915James Dennett   * #clang_parseTranslationUnit, #clang_saveTranslationUnit.
232fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   */
233fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis  CXGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1,
234fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis
235fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis  /**
236fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   * \brief Used to indicate that threads that libclang creates for editing
237fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   * purposes should use background priority.
2387eee0184570366285589d788bcd7f5dda8345915James Dennett   *
2397eee0184570366285589d788bcd7f5dda8345915James Dennett   * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt,
2407eee0184570366285589d788bcd7f5dda8345915James Dennett   * #clang_annotateTokens
241fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   */
242fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis  CXGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2,
243fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis
244fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis  /**
245fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   * \brief Used to indicate that all threads that libclang creates should use
246fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   * background priority.
247fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis   */
248fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis  CXGlobalOpt_ThreadBackgroundPriorityForAll =
249fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis      CXGlobalOpt_ThreadBackgroundPriorityForIndexing |
250fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis      CXGlobalOpt_ThreadBackgroundPriorityForEditing
251fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis
252fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis} CXGlobalOptFlags;
253fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis
254fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis/**
2557eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Sets general options associated with a CXIndex.
256fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis *
257fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * For example:
258fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \code
259fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * CXIndex idx = ...;
260fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * clang_CXIndex_setGlobalOptions(idx,
261fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis *     clang_CXIndex_getGlobalOptions(idx) |
262fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis *     CXGlobalOpt_ThreadBackgroundPriorityForIndexing);
263fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \endcode
264fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis *
265fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.
266fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */
267fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios KyrtzidisCINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options);
268fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis
269fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis/**
270fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Gets the general options associated with a CXIndex.
271fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis *
272fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that
273fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * are associated with the given CXIndex object.
274fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */
275fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios KyrtzidisCINDEX_LINKAGE unsigned clang_CXIndex_getGlobalOptions(CXIndex);
276fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis
2771efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
278c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_FILES File manipulation routines
279f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
280f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{
281f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
2821efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
283f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
284f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief A particular source file that is part of a translation unit.
285f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
286f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregortypedef void *CXFile;
2871efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
288f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor
289f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
290f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief Retrieve the complete file and path name of the given file.
29188145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff */
29274844072411bae91d5dbb89955d200cbe1e0a1c8Ted KremenekCINDEX_LINKAGE CXString clang_getFileName(CXFile SFile);
2931efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
294f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
295f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief Retrieve the last modification time of the given file.
296f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
29708b0e8daeb683686b876d72674962ad96df21d45Douglas GregorCINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
29888145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff
2993c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/**
300db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * \brief Uniquely identifies a CXFile, that refers to the same underlying file,
301db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * across an indexing session.
302db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis */
303db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidistypedef struct {
304db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis  unsigned long long data[3];
305db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis} CXFileUniqueID;
306db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis
307db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis/**
308db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * \brief Retrieve the unique ID for the given \c file.
309db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis *
310db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * \param file the file to get the ID for.
311db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * \param outID stores the returned CXFileUniqueID.
312db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * \returns If there was a failure getting the unique ID, returns non-zero,
313db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * otherwise returns 0.
314db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis*/
315db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios KyrtzidisCINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID);
316db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis
317db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis/**
318dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * \brief Determine whether the given header is guarded against
319dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * multiple inclusions, either with the conventional
3207eee0184570366285589d788bcd7f5dda8345915James Dennett * \#ifndef/\#define/\#endif macro guards or with \#pragma once.
321dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor */
322dd3e5549e3c11e217078938aacf72f042eea5343Douglas GregorCINDEX_LINKAGE unsigned
323dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregorclang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
324dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor
325dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor/**
326b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a file handle within the given translation unit.
327b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
328b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param tu the translation unit
3291efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar *
330b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param file_name the name of the file.
331b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
332b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns the file handle for the named file in the translation unit \p tu,
333b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * or a NULL file handle if the file was not a part of this translation unit.
334b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
3351efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,
336b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                    const char *file_name);
3371efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
338b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
339f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @}
340f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
341f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor
342f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
343f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \defgroup CINDEX_LOCATIONS Physical source locations
344f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
345f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * Clang represents physical source locations in its abstract syntax tree in
346f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * great detail, with file, line, and column information for the majority of
347f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * the tokens parsed in the source code. These data types and functions are
348f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * used to represent source location information, either for a particular
349f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * point in the program or for a range of points in the program, and extract
350f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * specific location information from those data types.
351f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
352f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{
353f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
3541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
355f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
3561db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * \brief Identifies a specific source location within a translation
3571db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * unit.
3581db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
35920174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * Use clang_getExpansionLocation() or clang_getSpellingLocation()
360a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * to map a source location to a particular file, line, and column.
3613c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */
3623c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct {
363e2748288a04cda2e976a3fe859e4334afaf9274aArgyrios Kyrtzidis  const void *ptr_data[2];
3641db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor  unsigned int_data;
3653c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceLocation;
366fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek
3673c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/**
368d52864bd33c66aacc84133460d8c9c0dfcdd5c18Daniel Dunbar * \brief Identifies a half-open character range in the source code.
3693c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor *
3701db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
3711db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * starting and end locations from a source range, respectively.
3723c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */
3733c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct {
374e2748288a04cda2e976a3fe859e4334afaf9274aArgyrios Kyrtzidis  const void *ptr_data[2];
3751db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor  unsigned begin_int_data;
3761db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor  unsigned end_int_data;
3773c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceRange;
378fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek
3791db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/**
380b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a NULL (invalid) source location.
381b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
382f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXSourceLocation clang_getNullLocation(void);
3831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
384b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
3857eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether two source locations, which must refer into
3861efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * the same translation unit, refer to exactly the same point in the source
387b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * code.
388b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
389b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns non-zero if the source locations refer to the same location, zero
390b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * if they refer to different locations.
391b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
392b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1,
393b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                             CXSourceLocation loc2);
3941efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
395b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
3961efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieves the source location associated with a given file/line/column
3971efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * in a particular translation unit.
398b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
399b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu,
400b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                                  CXFile file,
401b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                                  unsigned line,
402b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                                  unsigned column);
40383889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall/**
40483889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * \brief Retrieves the source location associated with a given character offset
40583889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * in a particular translation unit.
40683889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall */
40783889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid ChisnallCINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu,
40883889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall                                                           CXFile file,
40983889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall                                                           unsigned offset);
4101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
411b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
4124522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios Kyrtzidis * \brief Returns non-zero if the given source location is in a system header.
4134522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios Kyrtzidis */
4144522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios KyrtzidisCINDEX_LINKAGE int clang_Location_isInSystemHeader(CXSourceLocation location);
4154522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios Kyrtzidis
4164522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios Kyrtzidis/**
4175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve a NULL (invalid) source range.
4185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
419f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXSourceRange clang_getNullRange(void);
420896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
422b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a source range given the beginning and ending source
423b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * locations.
424b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
425b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin,
426b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                            CXSourceLocation end);
4271efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
428b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
429ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \brief Determine whether two ranges are equivalent.
430ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor *
431ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \returns non-zero if the ranges are the same, zero if they differ.
432ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor */
433ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas GregorCINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1,
434ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor                                          CXSourceRange range2);
435ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor
436ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor/**
4371824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko * \brief Returns non-zero if \p range is null.
438de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis */
439733dbc805facad7cebec5420f6c47c83848cee5fErik VerbruggenCINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range);
440de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis
441de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis/**
44246766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \brief Retrieve the file, line, column, and offset represented by
44346766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * the given source location.
4441db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
44520174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * If the location refers into a macro expansion, retrieves the
44620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * location of the macro expansion.
447a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
4481efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param location the location within a source file that will be decomposed
4491efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * into its parts.
4501db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
4511efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param file [out] if non-NULL, will be set to the file to which the given
4521db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points.
4531db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
4541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param line [out] if non-NULL, will be set to the line to which the given
4551db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points.
4561db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
4571efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param column [out] if non-NULL, will be set to the column to which the given
4581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source location points.
45946766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor *
46046766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the
46146766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * buffer to which the given source location points.
4621db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */
46320174221af145554b76a0b0f5e4eb3ac70d05945Chandler CarruthCINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location,
46420174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               CXFile *file,
46520174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               unsigned *line,
46620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               unsigned *column,
46720174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               unsigned *offset);
46820174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth
46920174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth/**
470e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \brief Retrieve the file, line, column, and offset represented by
471e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the given source location, as specified in a # line directive.
472e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
473e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * Example: given the following source code in a file somefile.c
474e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
4757eee0184570366285589d788bcd7f5dda8345915James Dennett * \code
476e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * #123 "dummy.c" 1
477e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
478e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * static int func(void)
479e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * {
480e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *     return 0;
481e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * }
4827eee0184570366285589d788bcd7f5dda8345915James Dennett * \endcode
483e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
484e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the location information returned by this function would be
485e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
486e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: dummy.c Line: 124 Column: 12
487e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
488e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * whereas clang_getExpansionLocation would have returned
489e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
490e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: somefile.c Line: 3 Column: 12
491e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
492e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param location the location within a source file that will be decomposed
493e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * into its parts.
494e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
495e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param filename [out] if non-NULL, will be set to the filename of the
496e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. Note that filenames returned will be for "virtual" files,
497e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * which don't necessarily exist on the machine running clang - e.g. when
498e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * parsing preprocessed output obtained from a different environment. If
499e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * a non-NULL value is passed in, remember to dispose of the returned value
500e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * using \c clang_disposeString() once you've finished with it. For an invalid
501e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location, an empty string is returned.
502e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
503e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param line [out] if non-NULL, will be set to the line number of the
504e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned.
505e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
506e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param column [out] if non-NULL, will be set to the column number of the
507e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned.
508e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis */
509e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios KyrtzidisCINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location,
510e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis                                              CXString *filename,
511e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis                                              unsigned *line,
512e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis                                              unsigned *column);
513e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis
514e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis/**
51520174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * \brief Legacy API to retrieve the file, line, column, and offset represented
51620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * by the given source location.
51720174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth *
51820174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * This interface has been replaced by the newer interface
5197eee0184570366285589d788bcd7f5dda8345915James Dennett * #clang_getExpansionLocation(). See that interface's documentation for
52020174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * details.
52120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth */
5221db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location,
5231db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor                                                   CXFile *file,
5241db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor                                                   unsigned *line,
52546766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor                                                   unsigned *column,
52646766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor                                                   unsigned *offset);
527e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor
528e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor/**
529a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \brief Retrieve the file, line, column, and offset represented by
530a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * the given source location.
531a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
532a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * If the location refers into a macro instantiation, return where the
533a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * location was originally spelled in the source file.
534a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
535a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param location the location within a source file that will be decomposed
536a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * into its parts.
537a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
538a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param file [out] if non-NULL, will be set to the file to which the given
539a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points.
540a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
541a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param line [out] if non-NULL, will be set to the line to which the given
542a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points.
543a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
544a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param column [out] if non-NULL, will be set to the column to which the given
545a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points.
546a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
547a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the
548a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * buffer to which the given source location points.
549a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor */
550a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas GregorCINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location,
551a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              CXFile *file,
552a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              unsigned *line,
553a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              unsigned *column,
554a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              unsigned *offset);
5552d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis
5562d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis/**
5572d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \brief Retrieve the file, line, column, and offset represented by
5582d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * the given source location.
5592d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis *
5602d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * If the location refers into a macro expansion, return where the macro was
5612d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * expanded or where the macro argument was written, if the location points at
5622d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * a macro argument.
5632d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis *
5642d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param location the location within a source file that will be decomposed
5652d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * into its parts.
5662d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis *
5672d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param file [out] if non-NULL, will be set to the file to which the given
5682d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * source location points.
5692d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis *
5702d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param line [out] if non-NULL, will be set to the line to which the given
5712d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * source location points.
5722d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis *
5732d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param column [out] if non-NULL, will be set to the column to which the given
5742d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * source location points.
5752d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis *
5762d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param offset [out] if non-NULL, will be set to the offset into the
5772d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * buffer to which the given source location points.
5782d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis */
5792d5c133d3dd95507db63147997109f06e8cfa833Argyrios KyrtzidisCINDEX_LINKAGE void clang_getFileLocation(CXSourceLocation location,
5802d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis                                          CXFile *file,
5812d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis                                          unsigned *line,
5822d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis                                          unsigned *column,
5832d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis                                          unsigned *offset);
584a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor
585a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor/**
5861efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the first character within a
5871efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range.
5881db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */
5891db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range);
5901db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor
5911db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/**
5921efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the last character within a
5931efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range.
5941db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */
5951db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range);
5961db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor
597f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
598f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @}
599f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
600c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
601c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
6025352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_DIAG Diagnostic reporting
6035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
6045352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{
6055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
6065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
6075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
6085352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Describes the severity of a particular diagnostic.
6095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
6105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorenum CXDiagnosticSeverity {
6115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
612896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek   * \brief A diagnostic that has been suppressed, e.g., by a command-line
6135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * option.
6145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
6155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Ignored = 0,
616896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
6175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
6185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic is a note that should be attached to the
6195352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * previous (non-note) diagnostic.
6205352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
6215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Note    = 1,
6225352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
6235352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
6245352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic indicates suspicious code that may not be
6255352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * wrong.
6265352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
6275352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Warning = 2,
6285352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
6295352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
6305352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic indicates that the code is ill-formed.
6315352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
6325352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Error   = 3,
6335352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
6345352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
6355352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic indicates that the code is ill-formed such
6365352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * that future parser recovery is unlikely to produce useful
6375352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * results.
6385352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
6395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Fatal   = 4
6405352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor};
6415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
6425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
6435352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief A single diagnostic, containing the diagnostic's severity,
6445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * location, text, source ranges, and fix-it hints.
6455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
6465352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregortypedef void *CXDiagnostic;
6475352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
6485352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
649153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief A group of CXDiagnostics.
650153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
651153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenektypedef void *CXDiagnosticSet;
652153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
653153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
654153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Determine the number of diagnostics in a CXDiagnosticSet.
655153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
656153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags);
657153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
658153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
659153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Retrieve a diagnostic associated with the given CXDiagnosticSet.
660153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *
6617eee0184570366285589d788bcd7f5dda8345915James Dennett * \param Diags the CXDiagnosticSet to query.
662153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param Index the zero-based diagnostic number to retrieve.
663153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *
664153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \returns the requested diagnostic. This diagnostic must be freed
665153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * via a call to \c clang_disposeDiagnostic().
666153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
667153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,
668153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek                                                     unsigned Index);
669153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
670153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
671153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
672153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Describes the kind of error that occurred (if any) in a call to
673153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \c clang_loadDiagnostics.
674153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
675153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenekenum CXLoadDiag_Error {
676153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  /**
677153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * \brief Indicates that no error occurred.
678153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   */
679153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  CXLoadDiag_None = 0,
680153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
681153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  /**
682153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * \brief Indicates that an unknown error occurred while attempting to
683153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * deserialize diagnostics.
684153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   */
685153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  CXLoadDiag_Unknown = 1,
686153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
687153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  /**
688153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * \brief Indicates that the file containing the serialized diagnostics
689153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * could not be opened.
690153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   */
691153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  CXLoadDiag_CannotLoad = 2,
692153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
693153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  /**
694153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * \brief Indicates that the serialized diagnostics file is invalid or
6957eee0184570366285589d788bcd7f5dda8345915James Dennett   * corrupt.
696153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   */
697153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  CXLoadDiag_InvalidFile = 3
698153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek};
699153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
700153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
701153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Deserialize a set of diagnostics from a Clang diagnostics bitcode
7027eee0184570366285589d788bcd7f5dda8345915James Dennett * file.
703153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *
7047eee0184570366285589d788bcd7f5dda8345915James Dennett * \param file The name of the file to deserialize.
7057eee0184570366285589d788bcd7f5dda8345915James Dennett * \param error A pointer to a enum value recording if there was a problem
706153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *        deserializing the diagnostics.
7077eee0184570366285589d788bcd7f5dda8345915James Dennett * \param errorString A pointer to a CXString for recording the error string
708153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *        if the file was not successfully loaded.
709153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *
710153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise.  These
7117eee0184570366285589d788bcd7f5dda8345915James Dennett * diagnostics should be released using clang_disposeDiagnosticSet().
712153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
713153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file,
714153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek                                                  enum CXLoadDiag_Error *error,
715153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek                                                  CXString *errorString);
716153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
717153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
718153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Release a CXDiagnosticSet and all of its contained diagnostics.
719153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
720153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags);
721153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
722153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
7237eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Retrieve the child diagnostics of a CXDiagnostic.
7247eee0184570366285589d788bcd7f5dda8345915James Dennett *
7257eee0184570366285589d788bcd7f5dda8345915James Dennett * This CXDiagnosticSet does not need to be released by
7267eee0184570366285589d788bcd7f5dda8345915James Dennett * clang_diposeDiagnosticSet.
727153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
728153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D);
729153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
730153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
731a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced for the given
732a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * translation unit.
733a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
734a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit);
735a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
736a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
737a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given translation unit.
7385352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
739a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Unit the translation unit to query.
740a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve.
7415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
742a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed
743a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic().
7445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
745a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,
746a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                                unsigned Index);
747a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
748a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
7490373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * \brief Retrieve the complete set of diagnostics associated with a
7500373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek *        translation unit.
7510373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek *
7520373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * \param Unit the translation unit to query.
7530373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek */
7540373fcc3e5b205cc26656c70d7dff737b0e08345Ted KremenekCINDEX_LINKAGE CXDiagnosticSet
7550373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek  clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);
7560373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek
7570373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek/**
758a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Destroy a diagnostic.
759a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
760a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
7615352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
7625352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
7630a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Options to control the display of diagnostics.
7640a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
7650a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * The values in this enum are meant to be combined to customize the
7660a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * behavior of \c clang_displayDiagnostic().
7670a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */
7680a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregorenum CXDiagnosticDisplayOptions {
7690a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  /**
7700a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \brief Display the source-location information where the
7710a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * diagnostic was located.
7720a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
7730a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * When set, diagnostics will be prefixed by the file, line, and
7740a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * (optionally) column to which the diagnostic refers. For example,
7750a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
7760a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \code
7770a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * test.c:28: warning: extra tokens at end of #endif directive
7780a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \endcode
7790a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
7800a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * This option corresponds to the clang flag \c -fshow-source-location.
7810a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   */
7820a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  CXDiagnostic_DisplaySourceLocation = 0x01,
7830a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
7840a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  /**
7850a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \brief If displaying the source-location information of the
7860a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * diagnostic, also include the column number.
7870a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
7880a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * This option corresponds to the clang flag \c -fshow-column.
7890a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   */
7900a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  CXDiagnostic_DisplayColumn = 0x02,
7910a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
7920a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  /**
7930a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \brief If displaying the source-location information of the
7940a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * diagnostic, also include information about source ranges in a
7950a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * machine-parsable format.
7960a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
797896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek   * This option corresponds to the clang flag
7980a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \c -fdiagnostics-print-source-range-info.
7990a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   */
800aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplaySourceRanges = 0x04,
801aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
802aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  /**
803aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \brief Display the option name associated with this diagnostic, if any.
804aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   *
805aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * The option name displayed (e.g., -Wconversion) will be placed in brackets
806aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * after the diagnostic text. This option corresponds to the clang flag
807aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \c -fdiagnostics-show-option.
808aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   */
809aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplayOption = 0x08,
810aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
811aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  /**
812aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \brief Display the category number associated with this diagnostic, if any.
813aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   *
814aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * The category number is displayed within brackets after the diagnostic text.
815aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * This option corresponds to the clang flag
816aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \c -fdiagnostics-show-category=id.
817aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   */
818aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplayCategoryId = 0x10,
819aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
820aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  /**
821aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \brief Display the category name associated with this diagnostic, if any.
822aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   *
823aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * The category name is displayed within brackets after the diagnostic text.
824aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * This option corresponds to the clang flag
825aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \c -fdiagnostics-show-category=name.
826aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   */
827aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplayCategoryName = 0x20
8280a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor};
8290a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
8300a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/**
831274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \brief Format the given diagnostic in a manner that is suitable for display.
8320a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
833274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * This routine will format the given diagnostic to a string, rendering
834896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the diagnostic according to the various options given. The
835896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \c clang_defaultDiagnosticDisplayOptions() function returns the set of
8360a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * options that most closely mimics the behavior of the clang compiler.
8370a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
8380a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \param Diagnostic The diagnostic to print.
8390a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
840896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Options A set of options that control the diagnostic display,
8410a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * created by combining \c CXDiagnosticDisplayOptions values.
842274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor *
843274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \returns A new string containing for formatted diagnostic.
8440a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */
845274f1906f12ebf8fcc179701deeda6d3271120c1Douglas GregorCINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic,
846274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor                                               unsigned Options);
8470a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
8480a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/**
8490a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Retrieve the set of display options most similar to the
8500a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * default behavior of the clang compiler.
8510a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
8520a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \returns A set of display options suitable for use with \c
8530a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * clang_displayDiagnostic().
8540a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */
8550a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void);
8560a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
8570a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/**
8585352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the severity of the given diagnostic.
8595352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
860896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE enum CXDiagnosticSeverity
8615352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getDiagnosticSeverity(CXDiagnostic);
8625352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
8635352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
8645352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the source location of the given diagnostic.
8655352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8665352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * This location is where Clang would print the caret ('^') when
8675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * displaying the diagnostic on the command line.
8685352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
8695352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic);
8705352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
8715352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
8725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the text of the given diagnostic.
8735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
8745352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic);
875a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor
876a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor/**
877aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the name of the command-line option that enabled this
878aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic.
879aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
880aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Diag The diagnostic to be queried.
881aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
882aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Disable If non-NULL, will be set to the option that disables this
883aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic (if any).
884aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
885aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns A string that contains the command-line option used to enable this
886aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * warning, such as "-Wconversion" or "-pedantic".
887aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */
888aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag,
889aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor                                                  CXString *Disable);
890aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
891aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/**
892aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the category number for this diagnostic.
893aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
894aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * Diagnostics can be categorized into groups along with other, related
895aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostics (e.g., diagnostics under the same warning flag). This routine
896aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * retrieves the category number for the given diagnostic.
897aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
898aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The number of the category that contains this diagnostic, or zero
899aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * if this diagnostic is uncategorized.
900aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */
901aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
902aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
903aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/**
90478d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * \brief Retrieve the name of a particular diagnostic category.  This
90578d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek *  is now deprecated.  Use clang_getDiagnosticCategoryText()
90678d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek *  instead.
907aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
908aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Category A diagnostic category number, as returned by
909aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c clang_getDiagnosticCategory().
910aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
911aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The name of the given diagnostic category.
912aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */
91378d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted KremenekCINDEX_DEPRECATED CINDEX_LINKAGE
91478d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted KremenekCXString clang_getDiagnosticCategoryName(unsigned Category);
91578d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek
91678d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek/**
91778d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * \brief Retrieve the diagnostic category text for a given diagnostic.
91878d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek *
91978d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * \returns The text of the given diagnostic category.
92078d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek */
92178d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted KremenekCINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic);
922aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
923aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/**
924a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Determine the number of source ranges associated with the given
925a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * diagnostic.
926a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor */
927a3890baf1256ff26081306c7fef70202f8223f41Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic);
928896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
9295352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
930a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Retrieve a source range associated with the diagnostic.
9315352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
932a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * A diagnostic's source ranges highlight important elements in the source
9335352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * code. On the command line, Clang displays source ranges by
934896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * underlining them with '~' characters.
9355352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
936a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \param Diagnostic the diagnostic whose range is being extracted.
9375352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
938896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Range the zero-based index specifying which range to
9395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
940a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \returns the requested source range.
9415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
942896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic,
943a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor                                                      unsigned Range);
9445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
9455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
9465352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the number of fix-it hints associated with the
9475352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * given diagnostic.
9485352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
9495352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
9505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
9515352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
952473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \brief Retrieve the replacement information for a given fix-it.
9535352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
954473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * Fix-its are described in terms of a source range whose contents
955473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * should be replaced by a string. This approach generalizes over
956473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * three kinds of operations: removal of source code (the range covers
957473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * the code to be removed and the replacement string is empty),
958473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replacement of source code (the range covers the code to be
959473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced and the replacement string provides the new code), and
960473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion (both the start and end of the range point at the
961473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion location, and the replacement string provides the text to
962473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insert).
9635352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
964473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param Diagnostic The diagnostic whose fix-its are being queried.
9655352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
966473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param FixIt The zero-based index of the fix-it.
9675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
968473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param ReplacementRange The source range whose contents will be
969473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced with the returned replacement string. Note that source
970473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * ranges are half-open ranges [a, b), so the source code should be
971473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced from a and up to (but not including) b.
9725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
973473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \returns A string containing text that should be replace the source
974473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * code indicated by the \c ReplacementRange.
9755352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
976896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic,
977473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor                                                 unsigned FixIt,
978473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor                                               CXSourceRange *ReplacementRange);
9795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
9805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
9815352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @}
9825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
9835352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
9845352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
9855352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation
9865352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
9875352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * The routines in this group provide the ability to create and destroy
9885352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * translation units from files, either by parsing the contents of the files or
9895352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * by reading in a serialized representation of a translation unit.
9905352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
9915352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{
9925352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
993896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
9945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
9955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Get the original translation unit source file name.
9965352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
9975352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString
9985352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
9995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
10005352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
10015352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Return the CXTranslationUnit for a given source file and the provided
10025352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * command line arguments one would pass to the compiler.
10035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
10045352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: The 'source_filename' argument is optional.  If the caller provides a
10055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * NULL pointer, the name of the source file is expected to reside in the
10065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * specified command line arguments.
10075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
10085352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: When encountered in 'clang_command_line_args', the following options
10095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * are ignored:
10105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
10115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-c'
10125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-emit-ast'
10135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-fsyntax-only'
10147eee0184570366285589d788bcd7f5dda8345915James Dennett *   '-o \<output file>'  (both '-o' and '\<output file>' are ignored)
10155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
10161ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param CIdx The index object with which the translation unit will be
10171ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * associated.
10185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
10197eee0184570366285589d788bcd7f5dda8345915James Dennett * \param source_filename The name of the source file to load, or NULL if the
10201ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p clang_command_line_args.
10211ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek *
10221ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param num_clang_command_line_args The number of command-line arguments in
10231ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \p clang_command_line_args.
10241ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek *
10251ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param clang_command_line_args The command-line arguments that would be
10261ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * passed to the \c clang executable if it were being invoked out-of-process.
10271ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * These command-line options will be parsed and will affect how the translation
10281ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * unit is parsed. Note that the following options are ignored: '-c',
10297eee0184570366285589d788bcd7f5dda8345915James Dennett * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'.
10305352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
10315352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p
10325352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * unsaved_files.
10335352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
10345352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk
10355352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * but may be required for code completion, including the contents of
1036c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * those files.  The contents and name of these files (as specified by
1037c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * CXUnsavedFile) are copied when necessary, so the client only needs to
1038c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * guarantee their validity until the call to this function returns.
10395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
10405352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile(
10415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         CXIndex CIdx,
10425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         const char *source_filename,
10435352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         int num_clang_command_line_args,
10442ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor                                   const char * const *clang_command_line_args,
10455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         unsigned num_unsaved_files,
1046a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                         struct CXUnsavedFile *unsaved_files);
1047896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
10485352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
10495352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Create a translation unit from an AST file (-emit-ast).
10505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
1051896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(CXIndex,
1052a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                             const char *ast_filename);
10535352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
105444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor/**
105544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * \brief Flags that control the creation of translation units.
105644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor *
105744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * The enumerators in this enumeration type are meant to be bitwise
105844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * ORed together to specify which options should be used when
105944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * constructing the translation unit.
106044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */
10615a43021ac491bf091494167127772a20d9a9bb48Douglas Gregorenum CXTranslationUnit_Flags {
10625a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor  /**
10635a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * \brief Used to indicate that no special translation-unit options are
10645a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * needed.
10655a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   */
10665a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor  CXTranslationUnit_None = 0x0,
10675a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor
10685a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor  /**
10695a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * \brief Used to indicate that the parser should construct a "detailed"
10705a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * preprocessing record, including all macro definitions and instantiations.
10715a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   *
10725a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * Constructing a detailed preprocessing record requires more memory
10735a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * and time to parse, since the information contained in the record
10745a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * is usually not retained. However, it can be useful for
10755a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * applications that require more detailed information about the
10765a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * behavior of the preprocessor.
10775a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   */
107844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor  CXTranslationUnit_DetailedPreprocessingRecord = 0x01,
107944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor
108044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor  /**
1081b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * \brief Used to indicate that the translation unit is incomplete.
108244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   *
1083b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * When a translation unit is considered "incomplete", semantic
1084b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * analysis that is typically performed at the end of the
1085b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * translation unit will be suppressed. For example, this suppresses
1086b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * the completion of tentative declarations in C and of
1087b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * instantiation of implicitly-instantiation function templates in
1088b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * C++. This option is typically used when parsing a header with the
1089b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * intent of producing a precompiled header.
109044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   */
1091b1c031be513705d924038f497279b9b599868ba1Douglas Gregor  CXTranslationUnit_Incomplete = 0x02,
109244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor
109344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor  /**
109444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * \brief Used to indicate that the translation unit should be built with an
109544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * implicit precompiled header for the preamble.
109644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   *
109744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * An implicit precompiled header is used as an optimization when a
109844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * particular translation unit is likely to be reparsed many times
109944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * when the sources aren't changing that often. In this case, an
110044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * implicit precompiled header will be built containing all of the
110144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * initial includes at the top of the main file (what we refer to as
110244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * the "preamble" of the file). In subsequent parses, if the
110344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * preamble or the files in it have not changed, \c
110444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * clang_reparseTranslationUnit() will re-use the implicit
110544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * precompiled header to improve parsing performance.
110644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   */
1107e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  CXTranslationUnit_PrecompiledPreamble = 0x04,
1108e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor
1109e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  /**
1110e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * \brief Used to indicate that the translation unit should cache some
1111e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * code-completion results with each reparse of the source file.
1112e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   *
1113e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * Caching of code-completion results is a performance optimization that
1114e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * introduces some overhead to reparsing but improves the performance of
1115e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * code-completion operations.
1116e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   */
111799ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  CXTranslationUnit_CacheCompletionResults = 0x08,
1118900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis
111999ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  /**
1120900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis   * \brief Used to indicate that the translation unit will be serialized with
1121900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis   * \c clang_saveTranslationUnit.
112299ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   *
1123900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis   * This option is typically used when parsing a header with the intent of
1124900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis   * producing a precompiled header.
112599ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   */
1126900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis  CXTranslationUnit_ForSerialization = 0x10,
112799ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor
112899ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  /**
1129b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor   * \brief DEPRECATED: Enabled chained precompiled preambles in C++.
113099ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   *
113199ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   * Note: this is a *temporary* option that is available only while
1132b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor   * we are testing C++ precompiled preamble support. It is deprecated.
113399ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   */
11346a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen  CXTranslationUnit_CXXChainedPCH = 0x20,
11356a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen
11366a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen  /**
11376a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen   * \brief Used to indicate that function/method bodies should be skipped while
11386a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen   * parsing.
11396a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen   *
11406a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen   * This option can be used to search for declarations/definitions while
11416a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen   * ignoring the usages.
11426a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen   */
1143d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko  CXTranslationUnit_SkipFunctionBodies = 0x40,
1144d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko
1145d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko  /**
1146d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko   * \brief Used to indicate that brief documentation comments should be
1147d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko   * included into the set of code completions returned from this translation
1148d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko   * unit.
1149d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko   */
1150d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko  CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80
11515a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor};
11525a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor
11535a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor/**
1154b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * \brief Returns the set of flags that is suitable for parsing a translation
1155b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * unit that is being edited.
1156b1c031be513705d924038f497279b9b599868ba1Douglas Gregor *
1157b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * The set of flags returned provide options for \c clang_parseTranslationUnit()
1158b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * to indicate that the translation unit is likely to be reparsed many times,
1159b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
1160b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
1161b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set contains an unspecified set of optimizations (e.g., the precompiled
1162b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * preamble) geared toward improving the performance of these routines. The
1163b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set of optimizations enabled may change from one version to the next.
1164b1c031be513705d924038f497279b9b599868ba1Douglas Gregor */
1165e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void);
1166b1c031be513705d924038f497279b9b599868ba1Douglas Gregor
1167b1c031be513705d924038f497279b9b599868ba1Douglas Gregor/**
11685a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Parse the given source file and the translation unit corresponding
11695a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * to that file.
11705a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
11715a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * This routine is the main entry point for the Clang C API, providing the
11725a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * ability to parse a source file into a translation unit that can then be
11735a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * queried by other functions in the API. This routine accepts a set of
11745a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * command-line arguments so that the compilation can be configured in the same
11755a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * way that the compiler is configured on the command line.
11765a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
11775a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param CIdx The index object with which the translation unit will be
11785a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * associated.
11795a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
11805a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param source_filename The name of the source file to load, or NULL if the
11811ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p command_line_args.
11825a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
11835a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param command_line_args The command-line arguments that would be
11845a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * passed to the \c clang executable if it were being invoked out-of-process.
11855a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * These command-line options will be parsed and will affect how the translation
11865a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unit is parsed. Note that the following options are ignored: '-c',
11877eee0184570366285589d788bcd7f5dda8345915James Dennett * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'.
11885a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
11895a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_command_line_args The number of command-line arguments in
11905a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \p command_line_args.
11915a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
11925a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk
11931abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing, including the contents of
11945a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * those files.  The contents and name of these files (as specified by
11955a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to
11965a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * guarantee their validity until the call to this function returns.
11975a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
11985a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p
11995a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unsaved_files.
12005a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
12015a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param options A bitmask of options that affects how the translation unit
12025a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * is managed but not its compilation. This should be a bitwise OR of the
12035a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXTranslationUnit_XXX flags.
12045a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
12055a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \returns A new translation unit describing the parsed code and containing
12065a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * any diagnostics produced by the compiler. If there is a failure from which
12075a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * the compiler cannot recover, returns NULL.
12085a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */
12095a43021ac491bf091494167127772a20d9a9bb48Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_parseTranslationUnit(CXIndex CIdx,
12105a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                    const char *source_filename,
12112ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor                                         const char * const *command_line_args,
12125a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                      int num_command_line_args,
12135a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                            struct CXUnsavedFile *unsaved_files,
12145a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                     unsigned num_unsaved_files,
12155a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                            unsigned options);
12165a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor
12175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
12181999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Flags that control how translation units are saved.
12191999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
12201999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise
12211999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * ORed together to specify which options should be used when
12221999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * saving the translation unit.
12231999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */
12241999844e7a18786e61e619e1dc6c789827541863Douglas Gregorenum CXSaveTranslationUnit_Flags {
12251999844e7a18786e61e619e1dc6c789827541863Douglas Gregor  /**
12261999844e7a18786e61e619e1dc6c789827541863Douglas Gregor   * \brief Used to indicate that no special saving options are needed.
12271999844e7a18786e61e619e1dc6c789827541863Douglas Gregor   */
12281999844e7a18786e61e619e1dc6c789827541863Douglas Gregor  CXSaveTranslationUnit_None = 0x0
12291999844e7a18786e61e619e1dc6c789827541863Douglas Gregor};
12301999844e7a18786e61e619e1dc6c789827541863Douglas Gregor
12311999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/**
12321999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Returns the set of flags that is suitable for saving a translation
12331999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * unit.
12341999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
12351999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The set of flags returned provide options for
12361999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \c clang_saveTranslationUnit() by default. The returned flag
12371999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * set contains an unspecified set of options that save translation units with
12381999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * the most commonly-requested data.
12391999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */
12401999844e7a18786e61e619e1dc6c789827541863Douglas GregorCINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU);
12411999844e7a18786e61e619e1dc6c789827541863Douglas Gregor
12421999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/**
124339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Describes the kind of error that occurred (if any) in a call to
124439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \c clang_saveTranslationUnit().
124539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */
124639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregorenum CXSaveError {
124739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
124839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that no error occurred while saving a translation unit.
124939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
125039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_None = 0,
125139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
125239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
125339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that an unknown error occurred while attempting to save
125439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * the file.
125539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   *
125639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * This error typically indicates that file I/O failed when attempting to
125739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * write the file.
125839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
125939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_Unknown = 1,
126039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
126139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
126239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that errors during translation prevented this attempt
126339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * to save the translation unit.
126439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   *
126539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * Errors that prevent the translation unit from being saved can be
126639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
126739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
126839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_TranslationErrors = 2,
126939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
127039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
127139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that the translation unit to be saved was somehow
127239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * invalid (e.g., NULL).
127339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
127439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_InvalidTU = 3
127539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor};
127639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
127739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor/**
12787ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \brief Saves a translation unit into a serialized representation of
12797ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * that translation unit on disk.
12807ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor *
12817ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * Any translation unit that was parsed without error can be saved
12827ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * into a file. The translation unit can then be deserialized into a
12837ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * new \c CXTranslationUnit with \c clang_createTranslationUnit() or,
12847ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * if it is an incomplete translation unit that corresponds to a
12857ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * header, used as a precompiled header when parsing other translation
12867ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * units.
12877ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor *
12887ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param TU The translation unit to save.
12891999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
12907ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param FileName The file to which the translation unit will be saved.
12917ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor *
12921999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \param options A bitmask of options that affects how the translation unit
12931999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * is saved. This should be a bitwise OR of the
12941999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * CXSaveTranslationUnit_XXX flags.
12951999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
129639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \returns A value that will match one of the enumerators of the CXSaveError
129739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * enumeration. Zero (CXSaveError_None) indicates that the translation unit was
129839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * saved successfully, while a non-zero value indicates that a problem occurred.
12997ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor */
13007ae2faafd30524ef5f863bb3b8701977888839bbDouglas GregorCINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU,
13011999844e7a18786e61e619e1dc6c789827541863Douglas Gregor                                             const char *FileName,
13021999844e7a18786e61e619e1dc6c789827541863Douglas Gregor                                             unsigned options);
13037ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor
13047ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor/**
13055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Destroy the specified CXTranslationUnit object.
13065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
13075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
1308896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
13095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
1310e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Flags that control the reparsing of translation units.
1311e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor *
1312e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise
1313e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * ORed together to specify which options should be used when
1314e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * reparsing the translation unit.
1315e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */
1316e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregorenum CXReparse_Flags {
1317e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  /**
1318e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * \brief Used to indicate that no special reparsing options are needed.
1319e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   */
1320e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  CXReparse_None = 0x0
1321e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor};
1322e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor
1323e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/**
1324e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Returns the set of flags that is suitable for reparsing a translation
1325e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * unit.
1326e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor *
1327e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The set of flags returned provide options for
1328e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \c clang_reparseTranslationUnit() by default. The returned flag
1329e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * set contains an unspecified set of optimizations geared toward common uses
1330e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * of reparsing. The set of optimizations enabled may change from one version
1331e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * to the next.
1332e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */
1333e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
1334e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor
1335e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/**
1336abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \brief Reparse the source files that produced this translation unit.
1337abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1338abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * This routine can be used to re-parse the source files that originally
1339abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * created the given translation unit, for example because those source files
1340abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * have changed (either on disk or as passed via \p unsaved_files). The
1341abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * source code will be reparsed with the same command-line options as it
1342abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * was originally parsed.
1343abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1344abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * Reparsing a translation unit invalidates all cursors and source locations
1345abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * that refer into that translation unit. This makes reparsing a translation
1346abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit semantically equivalent to destroying the translation unit and then
1347abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * creating a new translation unit with the same command-line arguments.
1348abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * However, it may be more efficient to reparse a translation
1349abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit using this routine.
1350abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1351abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param TU The translation unit whose contents will be re-parsed. The
1352abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * translation unit must originally have been built with
1353abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_createTranslationUnitFromSourceFile().
1354abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1355abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p
1356abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unsaved_files.
1357abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1358abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param unsaved_files The files that have not yet been saved to disk
1359abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * but may be required for parsing, including the contents of
1360abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * those files.  The contents and name of these files (as specified by
1361abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to
1362abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * guarantee their validity until the call to this function returns.
1363abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1364e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \param options A bitset of options composed of the flags in CXReparse_Flags.
1365e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The function \c clang_defaultReparseOptions() produces a default set of
1366e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * options recommended for most uses, based on the translation unit.
1367e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor *
1368abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \returns 0 if the sources could be reparsed. A non-zero value will be
1369abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * returned if reparsing was impossible, such that the translation unit is
1370abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * invalid. In such cases, the only valid call for \p TU is
1371abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_disposeTranslationUnit(TU).
1372abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor */
1373abc563f554951259bbe0315055cad92ee14d87e4Douglas GregorCINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU,
1374abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor                                                unsigned num_unsaved_files,
1375e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor                                          struct CXUnsavedFile *unsaved_files,
1376e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor                                                unsigned options);
137759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
137859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
137959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief Categorizes how memory is being used by a translation unit.
138059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
1381f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekenum CXTUResourceUsageKind {
1382f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_AST = 1,
1383f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_Identifiers = 2,
1384f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_Selectors = 3,
1385f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_GlobalCompletionResults = 4,
1386457aaf0692dfb2d9638f383334b81027f637f20cTed Kremenek  CXTUResourceUsage_SourceManagerContentCache = 5,
1387ba29bd25515fbd99e98ba0fedb9d93617b27609eTed Kremenek  CXTUResourceUsage_AST_SideTables = 6,
1388f61b831d7f6a15676b07647f507de80324cb7056Ted Kremenek  CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7,
1389e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek  CXTUResourceUsage_SourceManager_Membuffer_MMap = 8,
1390e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek  CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9,
1391e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek  CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10,
13925e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek  CXTUResourceUsage_Preprocessor = 11,
13935e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek  CXTUResourceUsage_PreprocessingRecord = 12,
1394ca7dc2b755eb81ac95121ce1a1f1aa44a4a0fe12Ted Kremenek  CXTUResourceUsage_SourceManager_DataStructures = 13,
1395d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek  CXTUResourceUsage_Preprocessor_HeaderSearch = 14,
1396f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST,
1397f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_MEMORY_IN_BYTES_END =
1398d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek    CXTUResourceUsage_Preprocessor_HeaderSearch,
1399f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek
1400f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_First = CXTUResourceUsage_AST,
1401d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek  CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch
140259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek};
140359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
140459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
140559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief Returns the human-readable null-terminated C string that represents
1406f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  *  the name of the memory category.  This string should never be freed.
140759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
140859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted KremenekCINDEX_LINKAGE
1409f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekconst char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind);
141059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1411f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsageEntry {
141259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief The memory usage category. */
1413f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  enum CXTUResourceUsageKind kind;
1414f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  /* \brief Amount of resources used.
1415f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek      The units will depend on the resource kind. */
141659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  unsigned long amount;
1417f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsageEntry;
141859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
141959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
142059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief The memory usage of a CXTranslationUnit, broken into categories.
142159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
1422f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsage {
142359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief Private data member, used for queries. */
142459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  void *data;
142559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
142659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief The number of entries in the 'entries' array. */
142759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  unsigned numEntries;
142859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
142959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief An array of key-value pairs, representing the breakdown of memory
143059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek            usage. */
1431f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsageEntry *entries;
143259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1433f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsage;
143459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
143559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
143659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief Return the memory usage of a translation unit.  This object
1437f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  *  should be released with clang_disposeCXTUResourceUsage().
143859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
1439f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU);
144059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1441f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);
144259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1443abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor/**
14445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @}
14455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
1446896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
14475352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
1448c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes the kind of entity that a cursor refers to.
1449c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1450c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXCursorKind {
1451c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Declarations */
14521efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
1453c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A declaration whose specific kind is not exposed via this
14541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * interface.
1455c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1456c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * Unexposed declarations have the same operations as any other kind
1457c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * of declaration; one can extract their location information,
1458c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * spelling, find their definitions, etc. However, the specific kind
1459c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * of the declaration is not reported.
1460c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1461c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnexposedDecl                 = 1,
1462c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A C or C++ struct. */
14631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  CXCursor_StructDecl                    = 2,
1464c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A C or C++ union. */
1465c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnionDecl                     = 3,
1466c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A C++ class. */
1467c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ClassDecl                     = 4,
1468c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An enumeration. */
1469c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_EnumDecl                      = 5,
14701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
1471c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A field (in C) or non-static data member (in C++) in a
1472c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * struct, union, or C++ class.
1473c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1474c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FieldDecl                     = 6,
1475c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An enumerator constant. */
1476c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_EnumConstantDecl              = 7,
1477c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A function. */
1478c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FunctionDecl                  = 8,
1479c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A variable. */
1480c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_VarDecl                       = 9,
1481c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A function or method parameter. */
1482c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ParmDecl                      = 10,
148317d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett  /** \brief An Objective-C \@interface. */
1484c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCInterfaceDecl             = 11,
148517d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett  /** \brief An Objective-C \@interface for a category. */
1486c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCCategoryDecl              = 12,
148717d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett  /** \brief An Objective-C \@protocol declaration. */
1488c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCProtocolDecl              = 13,
148917d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett  /** \brief An Objective-C \@property declaration. */
1490c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCPropertyDecl              = 14,
1491c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C instance variable. */
1492c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCIvarDecl                  = 15,
1493c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C instance method. */
1494c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCInstanceMethodDecl        = 16,
1495c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C class method. */
1496c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCClassMethodDecl           = 17,
149717d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett  /** \brief An Objective-C \@implementation. */
1498c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCImplementationDecl        = 18,
149917d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett  /** \brief An Objective-C \@implementation for a category. */
1500c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCCategoryImplDecl          = 19,
1501c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A typedef */
1502c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_TypedefDecl                   = 20,
15038bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek  /** \brief A C++ class method. */
15048bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek  CXCursor_CXXMethod                     = 21,
15058f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek  /** \brief A C++ namespace. */
15068f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek  CXCursor_Namespace                     = 22,
1507a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek  /** \brief A linkage specification, e.g. 'extern "C"'. */
1508a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek  CXCursor_LinkageSpec                   = 23,
150901829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  /** \brief A C++ constructor. */
151001829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  CXCursor_Constructor                   = 24,
151101829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  /** \brief A C++ destructor. */
151201829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  CXCursor_Destructor                    = 25,
151301829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  /** \brief A C++ conversion function. */
151401829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  CXCursor_ConversionFunction            = 26,
1515fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ template type parameter. */
1516fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_TemplateTypeParameter         = 27,
1517fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ non-type template parameter. */
1518fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_NonTypeTemplateParameter      = 28,
1519fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ template template parameter. */
1520fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_TemplateTemplateParameter     = 29,
1521fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ function template. */
1522fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_FunctionTemplate              = 30,
152339d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor  /** \brief A C++ class template. */
152439d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor  CXCursor_ClassTemplate                 = 31,
152574dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor  /** \brief A C++ class template partial specialization. */
152674dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor  CXCursor_ClassTemplatePartialSpecialization = 32,
15276931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  /** \brief A C++ namespace alias declaration. */
15286931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  CXCursor_NamespaceAlias                = 33,
15290a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor  /** \brief A C++ using directive. */
15300a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor  CXCursor_UsingDirective                = 34,
1531162e1c1b487352434552147967c3dd296ebee2f7Richard Smith  /** \brief A C++ using declaration. */
15327e24256c95afb64b4d5abf201a0f9f0527cb4cf3Douglas Gregor  CXCursor_UsingDeclaration              = 35,
1533162e1c1b487352434552147967c3dd296ebee2f7Richard Smith  /** \brief A C++ alias declaration */
1534162e1c1b487352434552147967c3dd296ebee2f7Richard Smith  CXCursor_TypeAliasDecl                 = 36,
15357eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief An Objective-C \@synthesize definition. */
1536352697a87bca664356f21a838b162084013625eaDouglas Gregor  CXCursor_ObjCSynthesizeDecl            = 37,
15377eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief An Objective-C \@dynamic definition. */
1538352697a87bca664356f21a838b162084013625eaDouglas Gregor  CXCursor_ObjCDynamicDecl               = 38,
15392dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis  /** \brief An access specifier. */
15402dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis  CXCursor_CXXAccessSpecifier            = 39,
154142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
154250aa6acd0b8d40c8956372a69e0a73f0802a5494Ted Kremenek  CXCursor_FirstDecl                     = CXCursor_UnexposedDecl,
15432dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis  CXCursor_LastDecl                      = CXCursor_CXXAccessSpecifier,
15441efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1545c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* References */
1546c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstRef                      = 40, /* Decl references */
15471efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  CXCursor_ObjCSuperClassRef             = 40,
1548c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCProtocolRef               = 41,
1549c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCClassRef                  = 42,
1550c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1551c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A reference to a type declaration.
1552c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1553c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * A type reference occurs anywhere where a type is named but not
1554c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * declared. For example, given:
1555c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1556c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \code
1557c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * typedef unsigned size_type;
1558c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * size_type size;
1559c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \endcode
1560c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1561c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * The typedef is a declaration of size_type (CXCursor_TypedefDecl),
1562c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * while the type of the variable "size" is referenced. The cursor
1563c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * referenced by the type of size is the typedef for size_type.
1564c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1565c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_TypeRef                       = 43,
15663064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CXCursor_CXXBaseSpecifier              = 44,
15670b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor  /**
1568a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor   * \brief A reference to a class template, function template, template
1569a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor   * template parameter, or class template partial specialization.
15700b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor   */
15710b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor  CXCursor_TemplateRef                   = 45,
15726931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  /**
15736931900f43cea558c6974075256c07728dbfecc6Douglas Gregor   * \brief A reference to a namespace or namespace alias.
15746931900f43cea558c6974075256c07728dbfecc6Douglas Gregor   */
15756931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  CXCursor_NamespaceRef                  = 46,
1576a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor  /**
157736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \brief A reference to a member of a struct, union, or class that occurs in
157836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * some non-expression context, e.g., a designated initializer.
1579a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor   */
1580a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor  CXCursor_MemberRef                     = 47,
158136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  /**
158236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \brief A reference to a labeled statement.
158336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
158436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * This cursor kind is used to describe the jump to "start_over" in the
158536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * goto statement in the following example:
158636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
158736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \code
158836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *   start_over:
158936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *     ++counter;
159036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
159136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *     goto start_over;
159236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \endcode
159336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
159436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * A label reference cursor refers to a label statement.
159536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   */
159636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  CXCursor_LabelRef                      = 48,
159736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor
15981f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor  /**
15991f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \brief A reference to a set of overloaded functions or function templates
16001f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * that has not yet been resolved to a specific function or function template.
16011f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
16021f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * An overloaded declaration reference cursor occurs in C++ templates where
16031f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * a dependent name refers to a function. For example:
16041f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
16051f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \code
16061f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * template<typename T> void swap(T&, T&);
16071f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
16081f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * struct X { ... };
16091f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * void swap(X&, X&);
16101f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
16111f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * template<typename T>
16121f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * void reverse(T* first, T* last) {
16131f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *   while (first < last - 1) {
16141f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *     swap(*first, *--last);
16151f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *     ++first;
16161f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *   }
16171f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * }
16181f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
16191f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * struct Y { };
16201f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * void swap(Y&, Y&);
16211f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \endcode
16221f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
16231f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * Here, the identifier "swap" is associated with an overloaded declaration
16241f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * reference. In the template definition, "swap" refers to either of the two
16251f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * "swap" functions declared above, so both results will be available. At
16261f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * instantiation time, "swap" may also refer to other functions found via
16271f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * argument-dependent lookup (e.g., the "swap" function at the end of the
16281f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * example).
16291f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
16301f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * The functions \c clang_getNumOverloadedDecls() and
16311f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \c clang_getOverloadedDecl() can be used to retrieve the definitions
16321f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * referenced by this cursor.
16331f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   */
16341f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor  CXCursor_OverloadedDeclRef             = 49,
16351f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
1636011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor  /**
1637011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   * \brief A reference to a variable that occurs in some non-expression
1638011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   * context, e.g., a C++ lambda capture list.
1639011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   */
1640011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor  CXCursor_VariableRef                   = 50,
1641011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor
1642011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor  CXCursor_LastRef                       = CXCursor_VariableRef,
16431efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1644c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Error conditions */
1645c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstInvalid                  = 70,
1646c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_InvalidFile                   = 70,
1647c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_NoDeclFound                   = 71,
1648c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_NotImplemented                = 72,
1649ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek  CXCursor_InvalidCode                   = 73,
1650ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek  CXCursor_LastInvalid                   = CXCursor_InvalidCode,
16511efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1652c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Expressions */
1653c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstExpr                     = 100,
16541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1655c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1656c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief An expression whose specific kind is not exposed via this
16571efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * interface.
1658c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1659c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * Unexposed expressions have the same operations as any other kind
1660c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * of expression; one can extract their location information,
1661c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * spelling, children, etc. However, the specific kind of the
1662c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * expression is not reported.
1663c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1664c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnexposedExpr                 = 100,
16651efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1666c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1667c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief An expression that refers to some value declaration, such
1668c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * as a function, varible, or enumerator.
1669c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1670c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_DeclRefExpr                   = 101,
16711efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1672c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1673c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief An expression that refers to a member of a struct, union,
1674c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * class, Objective-C class, etc.
1675c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1676c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_MemberRefExpr                 = 102,
16771efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1678c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An expression that calls a function. */
1679c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_CallExpr                      = 103,
16801efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1681c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An expression that sends a message to an Objective-C
1682c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   object or class. */
1683c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCMessageExpr               = 104,
16841ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek
16851ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek  /** \brief An expression that represents a block literal. */
16861ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek  CXCursor_BlockExpr                     = 105,
16871ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek
168842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An integer literal.
168942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
169042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IntegerLiteral                = 106,
169142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
169242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A floating point number literal.
169342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
169442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_FloatingLiteral               = 107,
169542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
169642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An imaginary number literal.
169742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
169842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ImaginaryLiteral              = 108,
169942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
170042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A string literal.
170142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
170242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_StringLiteral                 = 109,
170342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
170442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A character literal.
170542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
170642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CharacterLiteral              = 110,
170742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
170842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A parenthesized expression, e.g. "(1)".
170942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
171042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This AST node is only formed if full location information is requested.
171142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
171242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ParenExpr                     = 111,
171342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
171442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief This represents the unary-expression's (except sizeof and
171542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * alignof).
171642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
171742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_UnaryOperator                 = 112,
171842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
171942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C99 6.5.2.1] Array Subscripting.
172042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
172142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ArraySubscriptExpr            = 113,
172242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
172342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A builtin binary operation expression such as "x + y" or
172442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * "x <= y".
172542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
172642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_BinaryOperator                = 114,
172742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
172842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Compound assignment such as "+=".
172942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
173042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CompoundAssignOperator        = 115,
173142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
173242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief The ?: ternary operator.
173342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
173442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ConditionalOperator           = 116,
173542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
173642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An explicit cast in C (C99 6.5.4) or a C-style cast in C++
173742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * (C++ [expr.cast]), which uses the syntax (Type)expr.
173842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
173942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * For example: (int)f.
174042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
174142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CStyleCastExpr                = 117,
174242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
174342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C99 6.5.2.5]
174442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
174542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CompoundLiteralExpr           = 118,
174642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
174742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Describes an C or C++ initializer list.
174842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
174942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_InitListExpr                  = 119,
175042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
175142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief The GNU address of label extension, representing &&label.
175242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
175342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_AddrLabelExpr                 = 120,
175442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
175542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief This is the GNU Statement Expression extension: ({int X=4; X;})
175642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
175742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_StmtExpr                      = 121,
175842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
1759ffbe9b9c64ab2e94b9d48ec56e511f75826fc80aBenjamin Kramer  /** \brief Represents a C11 generic selection.
176042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
176142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_GenericSelectionExpr          = 122,
176242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
176342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Implements the GNU __null extension, which is a name for a null
176442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * pointer constant that has integral type (e.g., int or long) and is the same
176542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * size and alignment as a pointer.
176642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
176742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * The __null extension is typically only used by system headers, which define
176842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * NULL as __null in C++ rather than using 0 (which is an integer that may not
176942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * match the size of a pointer).
177042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
177142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_GNUNullExpr                   = 123,
177242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
177342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s static_cast<> expression.
177442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
177542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXStaticCastExpr             = 124,
177642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
177742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s dynamic_cast<> expression.
177842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
177942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXDynamicCastExpr            = 125,
178042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
178142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s reinterpret_cast<> expression.
178242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
178342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXReinterpretCastExpr        = 126,
178442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
178542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s const_cast<> expression.
178642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
178742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXConstCastExpr              = 127,
178842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
178942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents an explicit C++ type conversion that uses "functional"
179042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * notion (C++ [expr.type.conv]).
179142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
179242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * Example:
179342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
179442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *   x = int(0.5);
179542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
179642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
179742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXFunctionalCastExpr         = 128,
179842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
179942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A C++ typeid expression (C++ [expr.typeid]).
180042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
180142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXTypeidExpr                 = 129,
180242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
180342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C++ 2.13.5] C++ Boolean Literal.
180442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
180542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXBoolLiteralExpr            = 130,
180642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
180742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C++0x 2.14.7] C++ Pointer Literal.
180842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
180942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXNullPtrLiteralExpr         = 131,
181042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
181142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents the "this" expression in C++
181242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
181342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXThisExpr                   = 132,
181442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
181542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C++ 15] C++ Throw Expression.
181642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
181742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This handles 'throw' and 'throw' assignment-expression. When
181842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * assignment-expression isn't present, Op will be null.
181942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
182042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXThrowExpr                  = 133,
182142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
182242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A new expression for memory allocation and constructor calls, e.g:
182342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * "new CXXNewExpr(foo)".
182442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
182542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXNewExpr                    = 134,
182642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
182742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A delete expression for memory deallocation and destructor calls,
182842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * e.g. "delete[] pArray".
182942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
183042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXDeleteExpr                 = 135,
183142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
183242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A unary expression.
183342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
183442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_UnaryExpr                     = 136,
183542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
18369793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor  /** \brief An Objective-C string literal i.e. @"foo".
183742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
183842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCStringLiteral             = 137,
183942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
18407eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief An Objective-C \@encode expression.
184142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
184242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCEncodeExpr                = 138,
184342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
18447eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief An Objective-C \@selector expression.
184542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
184642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCSelectorExpr              = 139,
184742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
184817d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett  /** \brief An Objective-C \@protocol expression.
184942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
185042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCProtocolExpr              = 140,
185142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
185242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An Objective-C "bridged" cast expression, which casts between
185342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * Objective-C pointers and C pointers, transferring ownership in the process.
185442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
185542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
185642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *   NSString *str = (__bridge_transfer NSString *)CFCreateString();
185742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
185842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
185942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCBridgedCastExpr           = 141,
186042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
186142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents a C++0x pack expansion that produces a sequence of
186242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * expressions.
186342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
186442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * A pack expansion expression contains a pattern (which itself is an
186542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * expression) followed by an ellipsis. For example:
186642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
186742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
186842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * template<typename F, typename ...Types>
186942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * void forward(F f, Types &&...args) {
187042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *  f(static_cast<Types&&>(args)...);
187142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * }
187242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
187342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
187442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_PackExpansionExpr             = 142,
187542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
187642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents an expression that computes the length of a parameter
187742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * pack.
187842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
187942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
188042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * template<typename ...Types>
188142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * struct count {
188242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *   static const unsigned value = sizeof...(Types);
188342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * };
188442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
188542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
188642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SizeOfPackExpr                = 143,
188742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
1888011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor  /* \brief Represents a C++ lambda expression that produces a local function
1889011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   * object.
1890011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   *
1891011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   * \code
1892011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   * void abssort(float *x, unsigned N) {
1893011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   *   std::sort(x, x + N,
1894011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   *             [](float a, float b) {
1895011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   *               return std::abs(a) < std::abs(b);
1896011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   *             });
1897011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   * }
1898011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   * \endcode
1899011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor   */
1900011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor  CXCursor_LambdaExpr                    = 144,
1901011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor
1902b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek  /** \brief Objective-c Boolean Literal.
1903b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek   */
1904b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek  CXCursor_ObjCBoolLiteralExpr           = 145,
1905b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek
1906edab047e10d745a65d12c8cb36be2ba9e96c9e0eArgyrios Kyrtzidis  /** \brief Represents the "self" expression in a ObjC method.
1907edab047e10d745a65d12c8cb36be2ba9e96c9e0eArgyrios Kyrtzidis   */
1908edab047e10d745a65d12c8cb36be2ba9e96c9e0eArgyrios Kyrtzidis  CXCursor_ObjCSelfExpr                  = 146,
1909edab047e10d745a65d12c8cb36be2ba9e96c9e0eArgyrios Kyrtzidis
1910edab047e10d745a65d12c8cb36be2ba9e96c9e0eArgyrios Kyrtzidis  CXCursor_LastExpr                      = CXCursor_ObjCSelfExpr,
19111efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1912c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Statements */
1913c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstStmt                     = 200,
1914c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1915c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A statement whose specific kind is not exposed via this
1916c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * interface.
1917c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1918c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * Unexposed statements have the same operations as any other kind of
1919c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * statement; one can extract their location information, spelling,
1920c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * children, etc. However, the specific kind of the statement is not
1921c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * reported.
1922c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1923c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnexposedStmt                 = 200,
192436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor
192536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  /** \brief A labelled statement in a function.
192636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
192736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * This cursor kind is used to describe the "start_over:" label statement in
192836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * the following example:
192936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
193036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \code
193136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *   start_over:
193236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *     ++counter;
193336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \endcode
193436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
193536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   */
193636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  CXCursor_LabelStmt                     = 201,
193742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
193842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A group of statements like { stmt stmt }.
193942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
194042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This cursor kind is used to describe compound statements, e.g. function
194142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * bodies.
194242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
194342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CompoundStmt                  = 202,
194442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
194542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A case statment.
194642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
194742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CaseStmt                      = 203,
194842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
194942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A default statement.
195042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
195142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DefaultStmt                   = 204,
195242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
195342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An if statement
195442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
195542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IfStmt                        = 205,
195642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
195742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A switch statement.
195842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
195942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SwitchStmt                    = 206,
196042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
196142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A while statement.
196242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
196342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_WhileStmt                     = 207,
196442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
196542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A do statement.
196642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
196742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DoStmt                        = 208,
196842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
196942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A for statement.
197042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
197142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ForStmt                       = 209,
197242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
197342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A goto statement.
197442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
197542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_GotoStmt                      = 210,
197642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
197742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An indirect goto statement.
197842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
197942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IndirectGotoStmt              = 211,
198042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
198142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A continue statement.
198242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
198342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ContinueStmt                  = 212,
198442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
198542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A break statement.
198642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
198742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_BreakStmt                     = 213,
198842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
198942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A return statement.
199042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
199142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ReturnStmt                    = 214,
199242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
1993df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier  /** \brief A GCC inline assembly statement extension.
199442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
1995df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier  CXCursor_GCCAsmStmt                    = 215,
19965e02f6525d109c42650575c352bd2fdb14ed4193Argyrios Kyrtzidis  CXCursor_AsmStmt                       = CXCursor_GCCAsmStmt,
199742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
19987eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief Objective-C's overall \@try-\@catch-\@finally statement.
199942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
200042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtTryStmt                 = 216,
200142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20027eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief Objective-C's \@catch statement.
200342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
200442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtCatchStmt               = 217,
200542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20067eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief Objective-C's \@finally statement.
200742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
200842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtFinallyStmt             = 218,
200942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20107eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief Objective-C's \@throw statement.
201142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
201242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtThrowStmt               = 219,
201342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20147eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief Objective-C's \@synchronized statement.
201542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
201642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtSynchronizedStmt        = 220,
201742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
201842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's autorelease pool statement.
201942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
202042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAutoreleasePoolStmt       = 221,
202142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
202242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's collection statement.
202342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
202442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCForCollectionStmt         = 222,
202542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
202642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s catch statement.
202742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
202842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXCatchStmt                  = 223,
202942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
203042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s try statement.
203142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
203242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXTryStmt                    = 224,
203342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
203442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s for (* : *) statement.
203542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
203642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXForRangeStmt               = 225,
203742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
203842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's try statement.
203942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
204042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHTryStmt                    = 226,
204142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
204242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's except statement.
204342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
204442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHExceptStmt                 = 227,
204542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
204642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's finally statement.
204742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
204842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHFinallyStmt                = 228,
204942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20508cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier  /** \brief A MS inline assembly statement extension.
20518cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier   */
20528cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier  CXCursor_MSAsmStmt                     = 229,
20538cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier
205442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief The null satement ";": C99 6.8.3p3.
205542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
205642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This cursor kind is used to describe the null statement.
205742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
205842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_NullStmt                      = 230,
205942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
206042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Adaptor class for mixing declarations with statements and
206142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * expressions.
206242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
206342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DeclStmt                      = 231,
206442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20654fa7eab771ab8212e1058bd1a91061ff120c8fbbAlexey Bataev  /** \brief OpenMP parallel directive.
20664fa7eab771ab8212e1058bd1a91061ff120c8fbbAlexey Bataev   */
20674fa7eab771ab8212e1058bd1a91061ff120c8fbbAlexey Bataev  CXCursor_OMPParallelDirective          = 232,
20684fa7eab771ab8212e1058bd1a91061ff120c8fbbAlexey Bataev
20694fa7eab771ab8212e1058bd1a91061ff120c8fbbAlexey Bataev  CXCursor_LastStmt                      = CXCursor_OMPParallelDirective,
20701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2071c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
2072c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Cursor that represents the translation unit itself.
2073c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
2074c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * The translation unit cursor exists primarily to act as the root
2075c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * cursor for traversing the contents of a translation unit.
2076c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
2077e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_TranslationUnit               = 300,
2078e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek
2079ad017fa7a4df7389d245d02a49b3c79ed70bedb9Bill Wendling  /* Attributes */
2080e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_FirstAttr                     = 400,
2081e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  /**
2082e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   * \brief An attribute whose specific kind is not exposed via this
2083e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   * interface.
2084e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   */
2085e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_UnexposedAttr                 = 400,
2086e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek
2087e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_IBActionAttr                  = 401,
2088e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_IBOutletAttr                  = 402,
2089857e918a8a40deb128840308a318bf623d68295fTed Kremenek  CXCursor_IBOutletCollectionAttr        = 403,
20906639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis  CXCursor_CXXFinalAttr                  = 404,
20916639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis  CXCursor_CXXOverrideAttr               = 405,
20925f1c822def3efffe1d8f7299fbbbc3b1cdd4833dErik Verbruggen  CXCursor_AnnotateAttr                  = 406,
209384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCursor_AsmLabelAttr                  = 407,
209484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCursor_LastAttr                      = CXCursor_AsmLabelAttr,
20959f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor
20969f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  /* Preprocessing */
20979f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  CXCursor_PreprocessingDirective        = 500,
2098572feb2a190b5e8b04fb06c4ac50ee0f61e93ff0Douglas Gregor  CXCursor_MacroDefinition               = 501,
20999b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth  CXCursor_MacroExpansion                = 502,
21009b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth  CXCursor_MacroInstantiation            = CXCursor_MacroExpansion,
2101ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor  CXCursor_InclusionDirective            = 503,
21029f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  CXCursor_FirstPreprocessing            = CXCursor_PreprocessingDirective,
21036a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  CXCursor_LastPreprocessing             = CXCursor_InclusionDirective,
21046a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis
21056a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  /* Extra Declarations */
21066a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  /**
21076a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis   * \brief A module import declaration.
21086a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis   */
21096a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  CXCursor_ModuleImportDecl              = 600,
21106a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  CXCursor_FirstExtraDecl                = CXCursor_ModuleImportDecl,
21116a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  CXCursor_LastExtraDecl                 = CXCursor_ModuleImportDecl
2112c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor};
2113c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2114c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2115c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A cursor representing some element in the abstract syntax tree for
2116c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a translation unit.
2117c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
21181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The cursor abstraction unifies the different kinds of entities in a
2119c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * program--declaration, statements, expressions, references to declarations,
2120c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * etc.--under a single "cursor" abstraction with a common set of operations.
2121c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Common operation for a cursor include: getting the physical location in
2122c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a source file where the cursor points, getting the name associated with a
2123c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor, and retrieving cursors for any child nodes of a particular cursor.
2124c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2125c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors can be produced in two specific ways.
2126c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_getTranslationUnitCursor() produces a cursor for a translation unit,
2127c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * from which one can use clang_visitChildren() to explore the rest of the
2128c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * translation unit. clang_getCursor() maps from a physical source location
2129c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to the entity that resides at that location, allowing one to map from the
2130c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * source code into the AST.
2131c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2132c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregortypedef struct {
2133c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  enum CXCursorKind kind;
2134aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  int xdata;
213567812b2f94f4b5e7d2596db1705ffa1149ddc45aDmitri Gribenko  const void *data[3];
21361efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar} CXCursor;
2137c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2138c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2139ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A comment AST node.
2140ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
2141ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkotypedef struct {
2142e4330a302ac20b41b9800267ebd4b5b01f8553f8Dmitri Gribenko  const void *ASTNode;
2143e4330a302ac20b41b9800267ebd4b5b01f8553f8Dmitri Gribenko  CXTranslationUnit TranslationUnit;
2144ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko} CXComment;
2145ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
2146ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
2147c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations
2148c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2149c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
2150c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
21511efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2152c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2153c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the NULL cursor, which represents no entity.
2154c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2155c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getNullCursor(void);
21561efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2157c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2158c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the cursor that represents the given translation unit.
2159c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2160c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The translation unit cursor can be used to start traversing the
2161c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * various declarations within the given translation unit.
2162c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2163c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
2164c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2165c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2166c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether two cursors are equivalent.
2167c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2168c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
21691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2170c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
21711824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko * \brief Returns non-zero if \p cursor is null.
2172b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */
21731824d54df85a462ada812dadda18130f951d40f3Dmitri GribenkoCINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor);
2174b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis
2175b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/**
21769ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor * \brief Compute a hash value for the given cursor.
21779ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor */
21789ce5584553054d0cb934940586aca0186e87fa57Douglas GregorCINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);
21799ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor
21809ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor/**
2181c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the kind of the given cursor.
2182c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2183c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
2184c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2185c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2186c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a declaration.
2187c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2188c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
2189c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2190c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2191c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a simple
2192c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * reference.
2193c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2194c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Note that other kinds of cursors (such as expressions) can also refer to
2195c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * other cursors. Use clang_getCursorReferenced() to determine whether a
2196c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * particular cursor refers to another entity.
2197c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2198c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind);
2199c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2200c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2201c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents an expression.
2202c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2203c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind);
2204c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2205c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2206c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a statement.
2207c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2208c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind);
2209c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2210c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
22118be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor * \brief Determine whether the given cursor kind represents an attribute.
22128be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor */
22138be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas GregorCINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind);
22148be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor
22158be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor/**
22161efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents an invalid
2217c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor.
22181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar */
2219c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind);
2220c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2221c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
22221efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents a translation
22231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unit.
2224c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2225c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind);
22261efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2227ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek/***
22289f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * \brief Determine whether the given cursor represents a preprocessing
22299f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * element, such as a preprocessor directive or macro instantiation.
22309f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor */
22319f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas GregorCINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind);
22329f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor
22339f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor/***
2234ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek * \brief Determine whether the given cursor represents a currently
2235ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek *  unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
2236ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek */
2237ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted KremenekCINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind);
2238ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek
2239c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
224016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * \brief Describe the linkage of the entity referred to by a cursor.
224116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */
224216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenekenum CXLinkageKind {
224316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This value indicates that no linkage information is available
224416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * for a provided CXCursor. */
224516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_Invalid,
224616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /**
224716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * \brief This is the linkage for variables, parameters, and so on that
224816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   *  have automatic storage.  This covers normal (non-extern) local variables.
224916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   */
225016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_NoLinkage,
225116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for static variables and static functions. */
225216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_Internal,
225316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for entities with external linkage that live
225416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * in C++ anonymous namespaces.*/
225516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_UniqueExternal,
225616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for entities with true, external linkage. */
225716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_External
225816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek};
225916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek
226016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/**
226145e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the linkage of the entity referred to by a given cursor.
226216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */
226316b4259aecaa22b642d35d36fd89965ed700c1e0Ted KremenekCINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
226416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek
226516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/**
2266cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to,
2267cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * taking the current target platform into account.
226858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
226958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param cursor The cursor to query.
227058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
227158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the cursor.
227258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */
227358ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind
227458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCursorAvailability(CXCursor cursor);
227558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
227658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/**
2277cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * Describes the availability of a given entity on a particular platform, e.g.,
2278cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * a particular class might only be available on Mac OS 10.7 or newer.
2279cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */
2280cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregortypedef struct CXPlatformAvailability {
2281cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2282cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief A string that describes the platform for which this structure
2283cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * provides availability information.
2284cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   *
2285cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * Possible values are "ios" or "macosx".
2286cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2287cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  CXString Platform;
2288cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2289cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief The version number in which this entity was introduced.
2290cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2291cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  CXVersion Introduced;
2292cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2293cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief The version number in which this entity was deprecated (but is
2294cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * still available).
2295cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2296cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  CXVersion Deprecated;
2297cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2298cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief The version number in which this entity was obsoleted, and therefore
2299cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * is no longer available.
2300cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2301cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  CXVersion Obsoleted;
2302cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2303cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief Whether the entity is unconditionally unavailable on this platform.
2304cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2305cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  int Unavailable;
2306cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2307cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief An optional message to provide to a user of this API, e.g., to
2308cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * suggest replacement APIs.
2309cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2310cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  CXString Message;
2311cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor} CXPlatformAvailability;
2312cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor
2313cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/**
2314cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to
2315cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * on any platforms for which availability information is known.
2316cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2317cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param cursor The cursor to query.
2318cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2319cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param always_deprecated If non-NULL, will be set to indicate whether the
2320cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * entity is deprecated on all platforms.
2321cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2322cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param deprecated_message If non-NULL, will be set to the message text
2323cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * provided along with the unconditional deprecation of this entity. The client
2324cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * is responsible for deallocating this string.
2325cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
23267eee0184570366285589d788bcd7f5dda8345915James Dennett * \param always_unavailable If non-NULL, will be set to indicate whether the
2327cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * entity is unavailable on all platforms.
2328cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2329cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param unavailable_message If non-NULL, will be set to the message text
2330cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * provided along with the unconditional unavailability of this entity. The
2331cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * client is responsible for deallocating this string.
2332cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2333cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param availability If non-NULL, an array of CXPlatformAvailability instances
2334cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * that will be populated with platform availability information, up to either
2335cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * the number of platforms for which availability information is available (as
2336cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * returned by this function) or \c availability_size, whichever is smaller.
2337cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2338cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param availability_size The number of elements available in the
2339cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c availability array.
2340cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2341cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \returns The number of platforms (N) for which availability information is
2342cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * available (which is unrelated to \c availability_size).
2343cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2344cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * Note that the client is responsible for calling
2345cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c clang_disposeCXPlatformAvailability to free each of the
2346cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * platform-availability structures returned. There are
2347cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c min(N, availability_size) such structures.
2348cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */
2349cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas GregorCINDEX_LINKAGE int
2350cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregorclang_getCursorPlatformAvailability(CXCursor cursor,
2351cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    int *always_deprecated,
2352cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    CXString *deprecated_message,
2353cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    int *always_unavailable,
2354cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    CXString *unavailable_message,
2355cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    CXPlatformAvailability *availability,
2356cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    int availability_size);
2357cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor
2358cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/**
2359cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Free the memory associated with a \c CXPlatformAvailability structure.
2360cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */
2361cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas GregorCINDEX_LINKAGE void
2362cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregorclang_disposeCXPlatformAvailability(CXPlatformAvailability *availability);
2363cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor
2364cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/**
236545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Describe the "language" of the entity referred to by a cursor.
236645e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */
236745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind {
23686cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek  CXLanguage_Invalid = 0,
236945e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek  CXLanguage_C,
237045e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek  CXLanguage_ObjC,
23716cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek  CXLanguage_CPlusPlus
237245e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek};
237345e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek
237445e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/**
237545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the "language" of the entity referred to by a given cursor.
237645e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */
237745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor);
237845e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek
2379b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/**
2380b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis * \brief Returns the translation unit that a cursor originated from.
2381b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */
2382b0d6eaa6b646c18c49923aefc76973801f561701Argyrios KyrtzidisCINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor);
2383b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis
2384017dd74979c74c8950f733938953b98cfa250478Ted Kremenek
2385017dd74979c74c8950f733938953b98cfa250478Ted Kremenek/**
2386017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \brief A fast container representing a set of CXCursors.
2387017dd74979c74c8950f733938953b98cfa250478Ted Kremenek */
2388017dd74979c74c8950f733938953b98cfa250478Ted Kremenektypedef struct CXCursorSetImpl *CXCursorSet;
2389017dd74979c74c8950f733938953b98cfa250478Ted Kremenek
2390017dd74979c74c8950f733938953b98cfa250478Ted Kremenek/**
2391017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \brief Creates an empty CXCursorSet.
2392017dd74979c74c8950f733938953b98cfa250478Ted Kremenek */
2393017dd74979c74c8950f733938953b98cfa250478Ted KremenekCINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void);
2394017dd74979c74c8950f733938953b98cfa250478Ted Kremenek
2395017dd74979c74c8950f733938953b98cfa250478Ted Kremenek/**
2396017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \brief Disposes a CXCursorSet and releases its associated memory.
2397017dd74979c74c8950f733938953b98cfa250478Ted Kremenek */
2398017dd74979c74c8950f733938953b98cfa250478Ted KremenekCINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset);
2399017dd74979c74c8950f733938953b98cfa250478Ted Kremenek
2400017dd74979c74c8950f733938953b98cfa250478Ted Kremenek/**
2401017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \brief Queries a CXCursorSet to see if it contains a specific CXCursor.
2402017dd74979c74c8950f733938953b98cfa250478Ted Kremenek *
2403017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \returns non-zero if the set contains the specified cursor.
2404017dd74979c74c8950f733938953b98cfa250478Ted Kremenek*/
2405017dd74979c74c8950f733938953b98cfa250478Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset,
2406017dd74979c74c8950f733938953b98cfa250478Ted Kremenek                                                   CXCursor cursor);
2407017dd74979c74c8950f733938953b98cfa250478Ted Kremenek
2408017dd74979c74c8950f733938953b98cfa250478Ted Kremenek/**
2409017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \brief Inserts a CXCursor into a CXCursorSet.
2410017dd74979c74c8950f733938953b98cfa250478Ted Kremenek *
2411017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \returns zero if the CXCursor was already in the set, and non-zero otherwise.
2412017dd74979c74c8950f733938953b98cfa250478Ted Kremenek*/
2413017dd74979c74c8950f733938953b98cfa250478Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,
2414017dd74979c74c8950f733938953b98cfa250478Ted Kremenek                                                 CXCursor cursor);
2415017dd74979c74c8950f733938953b98cfa250478Ted Kremenek
24162be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/**
24172be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the semantic parent of the given cursor.
24182be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24192be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The semantic parent of a cursor is the cursor that semantically contains
24202be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the given \p cursor. For many declarations, the lexical and semantic parents
24212be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the lexical parent is returned by
24222be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorLexicalParent()). They diverge when declarations or
24232be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example:
24242be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24252be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code
24262be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C {
24272be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *  void f();
24282be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * };
24292be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24302be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { }
24312be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode
24322be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24332be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the
24342be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is
24352be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this
24362be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the
24372be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics
24382be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the
24392be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration,
24402be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations
24412be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context.
24422be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24432be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their
24442be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C
24452be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit.
24463910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor *
24473910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For global declarations, the semantic parent is the translation unit.
24482be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */
24492be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor);
24502be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor
24512be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/**
24522be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the lexical parent of the given cursor.
24532be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24542be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The lexical parent of a cursor is the cursor in which the given \p cursor
24552be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * was actually written. For many declarations, the lexical and semantic parents
24562be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the semantic parent is returned by
24572be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorSemanticParent()). They diverge when declarations or
24582be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example:
24592be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24602be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code
24612be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C {
24622be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *  void f();
24632be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * };
24642be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24652be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { }
24662be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode
24672be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24682be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the
24692be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is
24702be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this
24712be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the
24722be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics
24732be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the
24742be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration,
24752be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations
24762be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context.
24772be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24782be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their
24792be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C
24802be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit.
24813910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor *
24823910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For declarations written in the global scope, the lexical parent is
24833910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * the translation unit.
24842be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */
24852be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor);
24869f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
24879f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/**
24889f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Determine the set of methods that are overridden by the given
24899f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method.
24909f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
24919f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In both Objective-C and C++, a method (aka virtual member function,
24929f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * in C++) can override a virtual method in a base class. For
24939f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * Objective-C, a method is said to override any method in the class's
2494044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * base class, its protocols, or its categories' protocols, that has the same
2495044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * selector and is of the same kind (class or instance).
2496044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * If no such method exists, the search continues to the class's superclass,
2497044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * its protocols, and its categories, and so on. A method from an Objective-C
2498044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * implementation is considered to override the same methods as its
2499044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * corresponding method in the interface.
25009f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
25019f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * For C++, a virtual member function overrides any virtual member
25029f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * function with the same signature that occurs in its base
25039f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * classes. With multiple inheritance, a virtual member function can
25049f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * override several virtual member functions coming from different
25059f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * base classes.
25069f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
25079f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In all cases, this function determines the immediate overridden
25089f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method, rather than all of the overridden methods. For example, if
25099f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * a method is originally declared in a class A, then overridden in B
25109f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * (which in inherits from A) and also in C (which inherited from B),
25119f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * then the only overridden method returned from this function when
25129f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoked on C's method will be B's method. The client may then
25139f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoke this function again, given the previously-found overridden
25149f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods, to map out the complete method-override set.
25159f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
25169f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param cursor A cursor representing an Objective-C or C++
25179f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method. This routine will compute the set of methods that this
25189f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method overrides.
25199f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
25209f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param overridden A pointer whose pointee will be replaced with a
25219f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * pointer to an array of cursors, representing the set of overridden
25229f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods. If there are no overridden methods, the pointee will be
25239f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * set to NULL. The pointee must be freed via a call to
25249f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \c clang_disposeOverriddenCursors().
25259f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
25269f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param num_overridden A pointer to the number of overridden
25279f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * functions, will be set to the number of overridden functions in the
25289f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * array pointed to by \p overridden.
25299f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */
25309f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor,
25319f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor                                               CXCursor **overridden,
25329f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor                                               unsigned *num_overridden);
25339f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
25349f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/**
25359f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Free the set of overridden cursors returned by \c
25369f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * clang_getOverriddenCursors().
25379f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */
25389f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden);
25399f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
254045e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/**
2541ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * \brief Retrieve the file that is included by the given inclusion directive
2542ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * cursor.
2543ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor */
2544ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas GregorCINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor);
2545ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor
2546ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor/**
2547c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2548c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
25491efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2550c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2551c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code
2552c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2553c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors represent a location within the Abstract Syntax Tree (AST). These
2554c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines help map between cursors and the physical locations where the
2555c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * described entities occur in the source code. The mapping is provided in
2556c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * both directions, so one can map from source code to the AST and back.
2557c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2558c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
255950398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */
25601efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
25616a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff/**
2562b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Map a source location to the cursor that describes the entity at that
2563b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * location in the source code.
2564b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
2565b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() maps an arbitrary source location within a translation
2566b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * unit down to the most specific cursor that describes the entity at that
25671efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * location. For example, given an expression \c x + y, invoking
2568b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() with a source location pointing to "x" will return the
25691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * cursor for "x"; similarly for "y". If the cursor points anywhere between
2570b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
2571b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * will return a cursor referring to the "+" expression.
2572b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
2573b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns a cursor representing the entity at the given source location, or
2574b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * a NULL cursor if no such entity can be found.
25756a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff */
2576b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation);
25771efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
257898258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor/**
257998258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * \brief Retrieve the physical location of the source constructor referenced
258098258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * by the given cursor.
258198258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor *
258298258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * The location of a declaration is typically the location of the name of that
25831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * declaration, where the name of that declaration would occur if it is
25841efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unnamed, or some keyword that introduces that particular declaration.
25851efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The location of a reference is where that reference occurs within the
258698258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * source code.
258798258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor */
258898258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor);
2589c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2590b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor/**
2591b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Retrieve the physical extent of the source construct referenced by
2592a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the given cursor.
2593a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor *
2594a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * The extent of a cursor starts with the file/line/column pointing at the
2595a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * first character within the source construct that the cursor refers to and
25961efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * ends with the last character withinin that source construct. For a
2597a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * declaration, the extent covers the declaration itself. For a reference,
2598a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the extent covers the location of the reference (e.g., where the referenced
2599a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * entity was actually used).
2600a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor */
2601a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas GregorCINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor);
2602c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor
2603c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2604c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2605c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
260695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
2607c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
26088e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \defgroup CINDEX_TYPES Type information for CXCursors
26098e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
26108e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @{
26118e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
26128e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26138e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
26148e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Describes the kind of type
26158e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
26168e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenekenum CXTypeKind {
26178e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /**
26188e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * \brief Reprents an invalid type (e.g., where no type is available).
26198e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   */
26208e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Invalid = 0,
26218e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26228e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /**
26238e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * \brief A type whose specific kind is not exposed via this
26248e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * interface.
26258e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   */
26268e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Unexposed = 1,
26278e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /* Builtin types */
26298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Void = 2,
26308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Bool = 3,
26318e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char_U = 4,
26328e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UChar = 5,
26338e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char16 = 6,
26348e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char32 = 7,
26358e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UShort = 8,
26368e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UInt = 9,
26378e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ULong = 10,
26388e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ULongLong = 11,
26398e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UInt128 = 12,
26408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char_S = 13,
26418e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_SChar = 14,
26428e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_WChar = 15,
26438e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Short = 16,
26448e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Int = 17,
26458e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Long = 18,
26468e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LongLong = 19,
26478e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Int128 = 20,
26488e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Float = 21,
26498e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Double = 22,
26508e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LongDouble = 23,
26518e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_NullPtr = 24,
26528e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Overload = 25,
26538e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Dependent = 26,
26548e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCId = 27,
26558e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCClass = 28,
26568e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCSel = 29,
26578e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_FirstBuiltin = CXType_Void,
26588e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LastBuiltin  = CXType_ObjCSel,
26598e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26608e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Complex = 100,
26618e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Pointer = 101,
26628e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_BlockPointer = 102,
26638e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LValueReference = 103,
26648e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_RValueReference = 104,
26658e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Record = 105,
26668e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Enum = 106,
26678e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Typedef = 107,
26688e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCInterface = 108,
266904c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek  CXType_ObjCObjectPointer = 109,
267004c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek  CXType_FunctionNoProto = 110,
26715f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis  CXType_FunctionProto = 111,
267284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXType_ConstantArray = 112,
26734c4f6fe2a6d6b3ffd0ce114cb8099366662b67f7Argyrios Kyrtzidis  CXType_Vector = 113,
26744c4f6fe2a6d6b3ffd0ce114cb8099366662b67f7Argyrios Kyrtzidis  CXType_IncompleteArray = 114,
26754c4f6fe2a6d6b3ffd0ce114cb8099366662b67f7Argyrios Kyrtzidis  CXType_VariableArray = 115,
26764c4f6fe2a6d6b3ffd0ce114cb8099366662b67f7Argyrios Kyrtzidis  CXType_DependentSizedArray = 116
26778e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek};
26788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
268084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Describes the calling convention of a function type
268184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
268284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidisenum CXCallingConv {
268384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_Default = 0,
268484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_C = 1,
268584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86StdCall = 2,
268684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86FastCall = 3,
268784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86ThisCall = 4,
268884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86Pascal = 5,
268984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_AAPCS = 6,
269084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_AAPCS_VFP = 7,
2691263366f9241366f29ba65b703120f302490c39ffDerek Schuff  CXCallingConv_PnaclCall = 8,
269238980086c0f791e8c23cc882574f18e5b4a87db6Guy Benyei  CXCallingConv_IntelOclBicc = 9,
269384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
269484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_Invalid = 100,
269584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_Unexposed = 200
269684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis};
269784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
269884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
269984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
27008e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief The type of an element in the abstract syntax tree.
27018e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
27028e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
27038e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenektypedef struct {
27048e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  enum CXTypeKind kind;
27058e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  void *data[2];
27068e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek} CXType;
27078e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
27088e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
27098e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the type of a CXCursor (if any).
27108e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
27118e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCursorType(CXCursor C);
27128e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
27138e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
2714ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko * \brief Pretty-print the underlying type using the rules of the
2715ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko * language of the translation unit from which it came.
2716ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko *
2717ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko * If the type is invalid, an empty string is returned.
2718ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko */
2719ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri GribenkoCINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT);
2720ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko
2721ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko/**
272284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the underlying type of a typedef declaration.
272384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
272484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference a typedef declaration, an invalid type is
272584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned.
272684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
272784b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C);
272884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
272984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
273084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer type of an enum declaration.
273184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
273284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum declaration, an invalid type is
273384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned.
273484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
273584b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C);
273684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
273784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
273884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as a signed
273984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *  long long.
274084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
274184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned.
274284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor
274384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function.
274484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
274584b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C);
274684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
274784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
274884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as an unsigned
274984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *  long long.
275084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
275184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned.
275284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor
275384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function.
275484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
275584b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C);
275684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
275784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
27581eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko * \brief Retrieve the bit width of a bit field declaration as an integer.
27591eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko *
27601eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko * If a cursor that is not a bit field declaration is passed in, -1 is returned.
27611eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko */
27621eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri GribenkoCINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C);
27631eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko
27641eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko/**
2765d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * \brief Retrieve the number of non-variadic arguments associated with a given
2766d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * cursor.
2767d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis *
2768e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * The number of arguments can be determined for calls as well as for
2769e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * declarations of functions or methods. For other cursors -1 is returned.
2770d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis */
2771d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C);
2772d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis
2773d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis/**
2774d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * \brief Retrieve the argument cursor of a function or method.
2775d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis *
2776e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * The argument cursor can be determined for calls as well as for declarations
2777e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * of functions or methods. For other cursors and for invalid indices, an
2778e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * invalid cursor is returned.
2779d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis */
2780d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i);
2781d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis
2782d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis/**
27837eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether two CXTypes represent the same type.
27848e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
27857eee0184570366285589d788bcd7f5dda8345915James Dennett * \returns non-zero if the CXTypes represent the same type and
27867eee0184570366285589d788bcd7f5dda8345915James Dennett *          zero otherwise.
27878e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
27888e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B);
27898e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
27908e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
27918e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the canonical type for a CXType.
27928e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
27938e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * Clang's type system explicitly models typedefs and all the ways
27948e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * a specific type can be represented.  The canonical type is the underlying
27958e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * type with all the "sugar" removed.  For example, if 'T' is a typedef
27968e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * for 'int', the canonical type for 'T' would be 'int'.
27978e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
27988e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCanonicalType(CXType T);
27998e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
28008e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
28017eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "const" qualifier set,
28027eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "const" at a
28037eee0184570366285589d788bcd7f5dda8345915James Dennett * different level.
2804e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2805e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T);
2806e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2807e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
28087eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "volatile" qualifier set,
28097eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "volatile" at
28107eee0184570366285589d788bcd7f5dda8345915James Dennett * a different level.
2811e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2812e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T);
2813e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2814e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
28157eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "restrict" qualifier set,
28167eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "restrict" at a
28177eee0184570366285589d788bcd7f5dda8345915James Dennett * different level.
2818e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2819e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T);
2820e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2821e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
28228e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief For pointer types, returns the type of the pointee.
28238e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
28248e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getPointeeType(CXType T);
28258e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
28268e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
28278e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the cursor for the declaration of the given type.
28288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
28298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T);
28308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
28315389f48b24937ad7b4093307128b3cbf25235654David Chisnall/**
28325389f48b24937ad7b4093307128b3cbf25235654David Chisnall * Returns the Objective-C type encoding for the specified declaration.
28335389f48b24937ad7b4093307128b3cbf25235654David Chisnall */
28345389f48b24937ad7b4093307128b3cbf25235654David ChisnallCINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C);
28358e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
28368e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
28378e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the spelling of a given CXTypeKind.
28388e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
28398e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K);
28408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
28418e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
284284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the calling convention associated with a function type.
284384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
284484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, CXCallingConv_Invalid is returned.
284584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
284684b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T);
284784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
284884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
28499a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek * \brief Retrieve the result type associated with a function type.
285084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
285184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, an invalid type is returned.
285204c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek */
285304c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted KremenekCINDEX_LINKAGE CXType clang_getResultType(CXType T);
285404c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek
285504c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek/**
28567eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Retrieve the number of non-variadic arguments associated with a
28577eee0184570366285589d788bcd7f5dda8345915James Dennett * function type.
285884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
2859d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * If a non-function type is passed in, -1 is returned.
286084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
2861d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE int clang_getNumArgTypes(CXType T);
286284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
286384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
286484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the type of an argument of a function type.
286584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
28667eee0184570366285589d788bcd7f5dda8345915James Dennett * If a non-function type is passed in or the function does not have enough
28677eee0184570366285589d788bcd7f5dda8345915James Dennett * parameters, an invalid type is returned.
286884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
286984b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i);
287084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
287184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
287284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return 1 if the CXType is a variadic function type, and 0 otherwise.
287384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
287484b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T);
287584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
287684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
287784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the result type associated with a given cursor.
287884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
287984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * This only returns a valid type if the cursor refers to a function or method.
28809a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek */
28819a140845438c2fc31e7d48a6dedbc695f4c83c68Ted KremenekCINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C);
28829a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek
28839a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek/**
28843ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek * \brief Return 1 if the CXType is a POD (plain old data) type, and 0
28853ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek *  otherwise.
28863ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek */
28873ce9e7d270e7df86c09c8126b4412d55be7c123bTed KremenekCINDEX_LINKAGE unsigned clang_isPODType(CXType T);
28883ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek
28893ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek/**
289084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the element type of an array, complex, or vector type.
289184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
289284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array, complex, or vector type,
289384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * an invalid type is returned.
289484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
289584b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getElementType(CXType T);
289684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
289784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
289884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the number of elements of an array or vector type.
289984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
290084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array or vector type,
290184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * -1 is returned.
290284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
290384b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getNumElements(CXType T);
290484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
290584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
29065f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * \brief Return the element type of an array type.
29075f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis *
29085f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, an invalid type is returned.
29095f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */
29105f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArrayElementType(CXType T);
29115f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis
29125f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/**
2913bed28ac1d1463adca3ecf24fca5c30646fa9dbb2Sylvestre Ledru * \brief Return the array size of a constant array.
29145f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis *
29155f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, -1 is returned.
29165f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */
29175f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE long long clang_getArraySize(CXType T);
29185f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis
29195f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/**
2920411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief List the possible error codes for \c clang_Type_getSizeOf,
2921411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
2922411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   \c clang_Cursor_getOffsetOf.
2923411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *
2924411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * A value of this enumeration type can be returned if the target type is not
2925411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * a valid argument to sizeof, alignof or offsetof.
2926411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */
2927411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidisenum CXTypeLayoutError {
2928411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  /**
2929411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   * \brief Type is of kind CXType_Invalid.
2930411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   */
2931411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  CXTypeLayoutError_Invalid = -1,
2932411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  /**
2933411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   * \brief The type is an incomplete Type.
2934411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   */
2935411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  CXTypeLayoutError_Incomplete = -2,
2936411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  /**
2937411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   * \brief The type is a dependent Type.
2938411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   */
2939411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  CXTypeLayoutError_Dependent = -3,
2940411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  /**
2941411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   * \brief The type is not a constant size type.
2942411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   */
2943411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  CXTypeLayoutError_NotConstantSize = -4,
2944411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  /**
2945411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   * \brief The Field name is not valid for this record.
2946411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   */
2947411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  CXTypeLayoutError_InvalidFieldName = -5
2948411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis};
2949411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis
2950411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/**
2951411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Return the alignment of a type in bytes as per C++[expr.alignof]
2952411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   standard.
2953411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *
2954411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
2955411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
2956411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   is returned.
2957411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
2958411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   returned.
2959411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is not a constant size type,
2960411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   CXTypeLayoutError_NotConstantSize is returned.
2961411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */
2962411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T);
2963411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis
2964411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/**
2965411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Return the size of a type in bytes as per C++[expr.sizeof] standard.
2966411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *
2967411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
2968411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
2969411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   is returned.
2970411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
2971411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   returned.
2972411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */
2973411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T);
2974411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis
2975411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/**
2976411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Return the offset of a field named S in a record of type T in bits
2977411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   as it would be returned by __offsetof__ as per C++11[18.2p4]
2978411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *
2979411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid
2980411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   is returned.
2981411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the field's type declaration is an incomplete type,
2982411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   CXTypeLayoutError_Incomplete is returned.
2983411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the field's type declaration is a dependent type,
2984411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   CXTypeLayoutError_Dependent is returned.
2985411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the field's name S is not found,
2986411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   CXTypeLayoutError_InvalidFieldName is returned.
2987411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */
2988411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S);
2989411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis
2990411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/**
2991411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Returns non-zero if the cursor specifies a Record member that is a
2992411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   bitfield.
2993411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */
2994411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C);
2995411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis
2996411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/**
29973064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns 1 if the base class specified by the cursor with kind
29983064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek *   CX_CXXBaseSpecifier is virtual.
29993064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
30003064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor);
30013064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
30023064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
30033064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Represents the C++ access control level to a base class for a
30043064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * cursor with kind CX_CXXBaseSpecifier.
30053064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
30063064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenekenum CX_CXXAccessSpecifier {
30073064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXInvalidAccessSpecifier,
30083064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXPublic,
30093064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXProtected,
30103064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXPrivate
30113064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek};
30123064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
30133064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
301404b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * \brief Returns the access control level for the referenced object.
30155142be6b38f44f3c08a93c7b034b3b527ac702c1Argyrios Kyrtzidis *
301604b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * If the cursor refers to a C++ declaration, its access control level within its
301704b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * parent scope is returned. Otherwise, if the cursor refers to a base specifier or
301804b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * access specifier, the specifier itself is returned.
30193064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
30203064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);
30213064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
30223064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
30231f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Determine the number of overloaded declarations referenced by a
30241f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c CXCursor_OverloadedDeclRef cursor.
30251f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
30261f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried.
30271f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
30281f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns The number of overloaded declarations referenced by \c cursor. If it
30291f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
30301f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */
30311f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor);
30321f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
30331f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/**
30341f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Retrieve a cursor for one of the overloaded declarations referenced
30351f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * by a \c CXCursor_OverloadedDeclRef cursor.
30361f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
30371f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried.
30381f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
30391f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param index The zero-based index into the set of overloaded declarations in
30401f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * the cursor.
30411f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
30421f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns A cursor representing the declaration referenced by the given
30431f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c cursor at the specified \c index. If the cursor does not have an
30441f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * associated set of overloaded declarations, or if the index is out of bounds,
30451f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * returns \c clang_getNullCursor();
30461f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */
30471f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor,
30481f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor                                                unsigned index);
30491f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
30501f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/**
30518e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @}
30528e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
305395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
305495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
3055ad72f4dad4cf0fd2b71eb8f4704d2fe7ac58fb44Ted Kremenek * \defgroup CINDEX_ATTRIBUTES Information for attributes
305695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *
305795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @{
305895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
305995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
306095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
306195f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
306295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * \brief For cursors representing an iboutletcollection attribute,
306395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *  this function returns the collection element type.
306495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *
306595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
306695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted KremenekCINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor);
306795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
306895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
306995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @}
307095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
30718e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
30728e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
3073c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors
3074c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3075c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines provide the ability to traverse the abstract syntax tree
3076c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * using cursors.
3077c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3078c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
3079c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
30801efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3081c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3082c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes how the traversal of the children of a particular
3083c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor should proceed after visiting a particular child cursor.
3084c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3085c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A value of this enumeration type should be returned by each
3086c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
3087c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
3088c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXChildVisitResult {
3089c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
30901efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief Terminates the cursor traversal.
3091c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
3092c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Break,
30931efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
3094c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Continues the cursor traversal with the next sibling of
3095c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * the cursor just visited, without visiting its children.
3096c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
3097c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Continue,
3098c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
3099c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Recursively traverse the children of this cursor, using
3100c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * the same visitor and client data.
3101c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
3102c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Recurse
3103c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor};
3104c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
3105c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3106c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visitor invoked for each cursor found by a traversal.
3107c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3108c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This visitor function will be invoked for each cursor found by
3109c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren(). Its first argument is the cursor being
3110c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited, its second argument is the parent visitor for that cursor,
3111c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and its third argument is the client data provided to
3112c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren().
3113c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3114c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The visitor should return one of the \c CXChildVisitResult values
3115c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to direct clang_visitCursorChildren().
3116c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
31171efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbartypedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor,
31181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar                                                   CXCursor parent,
3119c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                                   CXClientData client_data);
3120c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
3121c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3122c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visit the children of a particular cursor.
3123c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3124c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This function visits all the direct children of the given cursor,
3125c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * invoking the given \p visitor function with the cursors of each
3126c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited child. The traversal may be recursive, if the visitor returns
3127c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
3128c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the visitor returns \c CXChildVisit_Break.
3129c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3130c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param parent the cursor whose child may be visited. All kinds of
3131a57259e9d7b30bcce93f0a62eee0488738026172Daniel Dunbar * cursors can be visited, including invalid cursors (which, by
3132c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * definition, have no children).
3133c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3134c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param visitor the visitor function that will be invoked for each
3135c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * child of \p parent.
3136c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3137c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param client_data pointer data supplied by the client, which will
3138c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be passed to the visitor each time it is invoked.
3139c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3140c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \returns a non-zero value if the traversal was terminated
3141c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * prematurely by the visitor returning \c CXChildVisit_Break.
3142c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
31431efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,
3144c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                            CXCursorVisitor visitor,
3145c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                            CXClientData client_data);
31463387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#ifdef __has_feature
31473387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#  if __has_feature(blocks)
31483387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/**
31493387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * \brief Visitor invoked for each cursor found by a traversal.
31503387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall *
31513387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * This visitor block will be invoked for each cursor found by
31523387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * clang_visitChildrenWithBlock(). Its first argument is the cursor being
31533387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * visited, its second argument is the parent visitor for that cursor.
31543387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall *
31553387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * The visitor should return one of the \c CXChildVisitResult values
31563387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * to direct clang_visitChildrenWithBlock().
31573387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */
31583387c65a094a02b2a94c05111d035a97d3d5c794David Chisnalltypedef enum CXChildVisitResult
31593387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall     (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent);
31603387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall
31613387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/**
31623387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * Visits the children of a cursor using the specified block.  Behaves
31633387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * identically to clang_visitChildren() in all other respects.
31643387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */
31653387c65a094a02b2a94c05111d035a97d3d5c794David Chisnallunsigned clang_visitChildrenWithBlock(CXCursor parent,
31663387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall                                      CXCursorVisitorBlock block);
31673387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#  endif
31683387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#endif
31691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3170c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3171c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
3172c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
31731efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3174c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3175c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST
3176c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
31771efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * These routines provide the ability to determine references within and
3178c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * across translation units, by providing the names of the entities referenced
3179c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by cursors, follow reference cursors to the declarations they reference,
3180c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and associate declarations with their definitions.
3181c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3182c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
3183c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
31841efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3185c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3186c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a Unified Symbol Resolution (USR) for the entity referenced
3187c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by the given cursor.
3188c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3189c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A Unified Symbol Resolution (USR) is a string that identifies a particular
3190c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * entity (function, class, variable, etc.) within a program. USRs can be
3191c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * compared across translation units to determine, e.g., when references in
3192c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * one translation refer to an entity defined in another translation unit.
3193c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
3194c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor);
3195c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
3196c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3197896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C class.
3198896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3199896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);
3200896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3201896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3202896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C category.
3203896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3204896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString
320566ccaec73706f3623d2e7d191fe2c944feedcc2bTed Kremenek  clang_constructUSR_ObjCCategory(const char *class_name,
3206896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                 const char *category_name);
3207896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3208896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3209896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C protocol.
3210896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3211896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString
3212896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek  clang_constructUSR_ObjCProtocol(const char *protocol_name);
3213896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3214896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3215896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3216896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C instance variable and
3217896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *   the USR for its containing class.
3218896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3219896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name,
3220896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                    CXString classUSR);
3221896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3222896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3223896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C method and
3224896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *   the USR for its containing class.
3225896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3226896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name,
3227896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                      unsigned isInstanceMethod,
3228896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                      CXString classUSR);
3229896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3230896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3231896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C property and the USR
3232896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *  for its containing class.
3233896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3234896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property,
3235896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                        CXString classUSR);
3236896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3237896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3238c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a name for the entity referenced by this cursor.
3239c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
3240c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);
3241c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
3242358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor/**
3243ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \brief Retrieve a range for a piece that forms the cursors spelling name.
3244ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * Most of the times there is only one range for the complete spelling but for
3245ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * objc methods and objc message expressions, there are multiple pieces for each
3246ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * selector identifier.
3247ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis *
3248ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \param pieceIndex the index of the spelling name piece. If this is greater
3249ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * than the actual number of pieces, it will return a NULL (invalid) range.
3250ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis *
3251ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \param options Reserved.
3252ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis */
3253ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios KyrtzidisCINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor,
3254ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis                                                          unsigned pieceIndex,
3255ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis                                                          unsigned options);
3256ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis
3257ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis/**
3258358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * \brief Retrieve the display name for the entity referenced by this cursor.
3259358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor *
3260358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * The display name contains extra information that helps identify the cursor,
3261358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * such as the parameters of a function or template or the arguments of a
3262358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * class template specialization.
3263358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor */
3264358559d8d7b458c5f64941842383a16e61f0828dDouglas GregorCINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor);
3265358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor
3266c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor/** \brief For a cursor that is a reference, retrieve a cursor representing the
3267c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * entity that it references.
3268c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor *
3269c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Reference cursors refer to other entities in the AST. For example, an
3270c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Objective-C superclass reference cursor refers to an Objective-C class.
32711efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * This function produces the cursor for the Objective-C class from the
3272c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * cursor for the superclass reference. If the input cursor is a declaration or
3273c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * definition, it returns that declaration or definition unchanged.
32741efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Otherwise, returns the NULL cursor.
3275c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor */
3276c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor);
3277b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
32781efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
3279b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \brief For a cursor that is either a reference to or a declaration
3280b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  of some entity, retrieve a cursor that describes the definition of
3281b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  that entity.
3282b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
3283b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  Some entities can be declared multiple times within a translation
3284b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  unit, but only one of those declarations can also be a
3285b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  definition. For example, given:
3286b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
3287b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \code
3288b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int, int);
3289b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int g(int x, int y) { return f(x, y); }
3290b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int a, int b) { return a + b; }
3291b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int, int);
3292b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \endcode
3293b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
3294b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  there are three declarations of the function "f", but only the
3295b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  second one is a definition. The clang_getCursorDefinition()
3296b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  function will take any cursor pointing to a declaration of "f"
3297b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  (the first or fourth lines of the example) or a cursor referenced
3298b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  that uses "f" (the call to "f' inside "g") and will return a
3299b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  declaration cursor pointing to the definition (the second "f"
3300b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  declaration).
3301b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
3302b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  If given a cursor for which there is no corresponding definition,
3303b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  e.g., because there is no definition of that entity within this
3304b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  translation unit, returns a NULL cursor.
3305b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */
3306b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor);
3307b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
33081efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
3309b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Determine whether the declaration pointed to by this cursor
3310b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * is also a definition of that entity.
3311b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */
3312b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);
3313b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
3314c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
33151a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \brief Retrieve the canonical cursor corresponding to the given cursor.
33161a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
33171a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * In the C family of languages, many kinds of entities can be declared several
33181a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * times within a single translation unit. For example, a structure type can
33191a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * be forward-declared (possibly multiple times) and later defined:
33201a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
33211a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \code
33221a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X;
33231a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X;
33241a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X {
33251a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *   int member;
33261a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * };
33271a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \endcode
33281a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
33291a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * The declarations and the definition of \c X are represented by three
33301a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * different cursors, all of which are declarations of the same underlying
33311a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * entity. One of these cursor is considered the "canonical" cursor, which
33321a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * is effectively the representative for the underlying entity. One can
33331a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * determine if two cursors are declarations of the same underlying entity by
33341a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * comparing their canonical cursors.
33351a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
33361a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \returns The canonical cursor for the entity referred to by the given cursor.
33371a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor */
33381a9d0503b67a499797141af0fd6d315d5045f0eaDouglas GregorCINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor);
33391a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor
334034ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis
334134ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis/**
334234ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * \brief If the cursor points to a selector identifier in a objc method or
334334ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * message expression, this returns the selector index.
334434ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis *
33457eee0184570366285589d788bcd7f5dda8345915James Dennett * After getting a cursor with #clang_getCursor, this can be called to
334634ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * determine if the location points to a selector identifier.
334734ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis *
334834ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * \returns The selector index if the cursor is an objc method or message
334934ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * expression and the cursor is pointing to a selector identifier, or -1
335034ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * otherwise.
335134ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis */
335234ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor);
335334ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis
33541a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor/**
3355f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * \brief Given a cursor pointing to a C++ method call or an ObjC message,
3356f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * returns non-zero if the method/message is "dynamic", meaning:
3357f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis *
3358f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * For a C++ method: the call is virtual.
3359f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * For an ObjC message: the receiver is an object instance, not 'super' or a
3360f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * specific class.
3361f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis *
3362f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * If the method/message is "static" or the cursor does not point to a
3363f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * method/message, it will return zero.
3364f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis */
3365f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C);
3366e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis
3367e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis/**
3368e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis * \brief Given a cursor pointing to an ObjC message, returns the CXType of the
3369e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis * receiver.
3370e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis */
3371e4a990f34904eb572c8d6aa1deef19465214359cArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C);
3372f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis
3373f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis/**
33749ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * \brief Property attributes for a \c CXCursor_ObjCPropertyDecl.
33759ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis */
33769ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidistypedef enum {
33779ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_noattr    = 0x00,
33789ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_readonly  = 0x01,
33799ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_getter    = 0x02,
33809ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_assign    = 0x04,
33819ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_readwrite = 0x08,
33829ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_retain    = 0x10,
33839ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_copy      = 0x20,
33849ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_nonatomic = 0x40,
33859ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_setter    = 0x80,
33869ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_atomic    = 0x100,
33879ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_weak      = 0x200,
33889ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_strong    = 0x400,
33899ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis  CXObjCPropertyAttr_unsafe_unretained = 0x800
33909ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis} CXObjCPropertyAttrKind;
33919ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis
33929ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis/**
33939ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * \brief Given a cursor that represents a property declaration, return the
33949ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * associated property attributes. The bits are formed from
33959ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * \c CXObjCPropertyAttrKind.
33969ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis *
33979ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * \param reserved Reserved for future use, pass 0.
33989ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis */
33999ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C,
34009ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis                                                             unsigned reserved);
34019ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis
34029ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis/**
340338dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis * \brief 'Qualifiers' written next to the return and parameter types in
340438dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis * ObjC method declarations.
340538dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis */
340638dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidistypedef enum {
340738dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis  CXObjCDeclQualifier_None = 0x0,
340838dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis  CXObjCDeclQualifier_In = 0x1,
340938dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis  CXObjCDeclQualifier_Inout = 0x2,
341038dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis  CXObjCDeclQualifier_Out = 0x4,
341138dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis  CXObjCDeclQualifier_Bycopy = 0x8,
341238dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis  CXObjCDeclQualifier_Byref = 0x10,
341338dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis  CXObjCDeclQualifier_Oneway = 0x20
341438dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis} CXObjCDeclQualifierKind;
341538dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis
341638dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis/**
341738dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis * \brief Given a cursor that represents an ObjC method or parameter
341838dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis * declaration, return the associated ObjC qualifiers for the return type or the
34198be71a6ed879ca244675ddef3941ff7fc5a1147cArgyrios Kyrtzidis * parameter respectively. The bits are formed from CXObjCDeclQualifierKind.
342038dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis */
342138dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_getObjCDeclQualifiers(CXCursor C);
342238dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis
342338dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis/**
3424514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios Kyrtzidis * \brief Given a cursor that represents an ObjC method or property declaration,
3425514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios Kyrtzidis * return non-zero if the declaration was affected by "@optional".
3426514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios Kyrtzidis * Returns zero if the cursor is not such a declaration or it is "@required".
3427514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios Kyrtzidis */
3428514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_isObjCOptional(CXCursor C);
3429514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios Kyrtzidis
3430514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios Kyrtzidis/**
343180e1acaeb7040548cb494e609b120b134e22a193Argyrios Kyrtzidis * \brief Returns non-zero if the given cursor is a variadic function or method.
343280e1acaeb7040548cb494e609b120b134e22a193Argyrios Kyrtzidis */
343380e1acaeb7040548cb494e609b120b134e22a193Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_isVariadic(CXCursor C);
343480e1acaeb7040548cb494e609b120b134e22a193Argyrios Kyrtzidis
343580e1acaeb7040548cb494e609b120b134e22a193Argyrios Kyrtzidis/**
3436aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * \brief Given a cursor that represents a declaration, return the associated
3437aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * comment's source range.  The range may include multiple consecutive comments
3438aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * with whitespace in between.
3439aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko */
3440aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri GribenkoCINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C);
3441aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko
3442aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko/**
3443aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * \brief Given a cursor that represents a declaration, return the associated
3444aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * comment text, including comment markers.
3445aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko */
3446aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri GribenkoCINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C);
3447aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko
3448aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko/**
3449ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Given a cursor that represents a documentable entity (e.g.,
3450ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * declaration), return the associated \\brief paragraph; otherwise return the
3451ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * first paragraph.
34522d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko */
34532d44d77fed3200e2eff289f55493317e90d3398cDmitri GribenkoCINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C);
34542d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko
34552d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko/**
3456ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Given a cursor that represents a documentable entity (e.g.,
3457ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * declaration), return the associated parsed comment as a
3458ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \c CXComment_FullComment AST node.
3459ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3460ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXComment clang_Cursor_getParsedComment(CXCursor C);
3461ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3462ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3463ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * @}
3464ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3465ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3466ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
34675d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \defgroup CINDEX_MODULE Module introspection
34685d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
34695d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * The functions in this group provide access to information about modules.
34705d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
34715d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * @{
34725d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
34735d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34745d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidistypedef void *CXModule;
34755d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34765d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
34775d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \brief Given a CXCursor_ModuleImportDecl cursor, return the associated module.
34785d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
34795d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios KyrtzidisCINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C);
34805d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34815d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3482d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object.
34835d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
3484e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis * \returns the module file where the provided module object came from.
3485e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis */
3486e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios KyrtzidisCINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module);
3487e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis
3488e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis/**
3489e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis * \param Module a module object.
3490e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis *
34915d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the parent of a sub-module or NULL if the given module is top-level,
34925d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * e.g. for 'std.vector' it will return the 'std' module.
34935d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
3494d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module);
34955d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34965d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3497d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object.
34985d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
34995d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the name of the module, e.g. for the 'std.vector' sub-module it
35005d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * will return "vector".
35015d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
3502d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXString clang_Module_getName(CXModule Module);
35035d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
35045d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3505d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object.
35065d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
35075d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the full name of the module, e.g. "std.vector".
35085d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
3509d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module);
35105d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
35115d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3512d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object.
35135d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
35145d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the number of top level headers associated with this module.
35155d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
3516c1d22393628a145e54396c0ac66e9625d13a7658Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit,
3517c1d22393628a145e54396c0ac66e9625d13a7658Argyrios Kyrtzidis                                                           CXModule Module);
35185d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
35195d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3520d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object.
35215d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
35225d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \param Index top level header index (zero-based).
35235d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
35245d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the specified top level header associated with the module.
35255d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
3526d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE
3527c1d22393628a145e54396c0ac66e9625d13a7658Argyrios KyrtzidisCXFile clang_Module_getTopLevelHeader(CXTranslationUnit,
3528c1d22393628a145e54396c0ac66e9625d13a7658Argyrios Kyrtzidis                                      CXModule Module, unsigned Index);
35295d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
35305d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
35315d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * @}
35325d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
35335d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
35345d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3535ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \defgroup CINDEX_COMMENT Comment AST introspection
3536ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3537ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * The routines in this group provide access to information in the
3538ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * documentation comment ASTs.
3539ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3540ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * @{
3541ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3542ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3543ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3544ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Describes the type of the comment AST node (\c CXComment).  A comment
3545ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * node can be considered block content (e. g., paragraph), inline content
3546ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * (plain text) or neither (the root AST node).
3547ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3548ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkoenum CXCommentKind {
3549ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3550ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief Null comment.  No AST node is constructed at the requested location
3551ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * because there is no text or a syntax error.
3552ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3553ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_Null = 0,
3554ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3555ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3556ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief Plain text.  Inline content.
3557ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3558ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_Text = 1,
3559ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3560ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3561ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A command with word-like arguments that is considered inline content.
3562ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3563ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * For example: \\c command.
3564ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3565ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_InlineCommand = 2,
3566ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3567ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3568ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief HTML start tag with attributes (name-value pairs).  Considered
3569ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * inline content.
3570ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3571ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * For example:
3572ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \verbatim
3573ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * <br> <br /> <a href="http://example.org/">
3574ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \endverbatim
3575ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3576ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_HTMLStartTag = 3,
3577ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3578ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3579ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief HTML end tag.  Considered inline content.
3580ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3581ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * For example:
3582ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \verbatim
3583ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * </a>
3584ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \endverbatim
3585ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3586ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_HTMLEndTag = 4,
3587ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3588ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3589ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A paragraph, contains inline comment.  The paragraph itself is
3590ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * block content.
3591ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3592ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_Paragraph = 5,
3593ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3594ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3595ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A command that has zero or more word-like arguments (number of
3596ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * word-like arguments depends on command name) and a paragraph as an
3597ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * argument.  Block command is block content.
3598ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3599ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * Paragraph argument is also a child of the block command.
3600ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3601ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * For example: \\brief has 0 word-like arguments and a paragraph argument.
3602ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3603ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * AST nodes of special kinds that parser knows about (e. g., \\param
3604ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * command) have their own node kinds.
3605ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3606ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_BlockCommand = 6,
3607ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3608ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3609ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A \\param or \\arg command that describes the function parameter
3610ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * (name, passing direction, description).
3611ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
361270517ca5c07c4b41ff8662b94ee22047b0299f8cDmitri Gribenko   * For example: \\param [in] ParamName description.
3613ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3614ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_ParamCommand = 7,
3615ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3616ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
361796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko   * \brief A \\tparam command that describes a template parameter (name and
361896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko   * description).
361996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko   *
362070517ca5c07c4b41ff8662b94ee22047b0299f8cDmitri Gribenko   * For example: \\tparam T description.
362196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko   */
362296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  CXComment_TParamCommand = 8,
362396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko
362496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  /**
3625ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A verbatim block command (e. g., preformatted code).  Verbatim
3626ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * block has an opening and a closing command and contains multiple lines of
3627ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * text (\c CXComment_VerbatimBlockLine child nodes).
3628ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3629ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * For example:
3630ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \\verbatim
3631ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * aaa
3632ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \\endverbatim
3633ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
363496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  CXComment_VerbatimBlockCommand = 9,
3635ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3636ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3637ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A line of text that is contained within a
3638ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * CXComment_VerbatimBlockCommand node.
3639ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
364096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  CXComment_VerbatimBlockLine = 10,
3641ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3642ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3643ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A verbatim line command.  Verbatim line has an opening command,
3644ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * a single line of text (up to the newline after the opening command) and
3645ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * has no closing command.
3646ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
364796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  CXComment_VerbatimLine = 11,
3648ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3649ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3650ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A full comment attached to a declaration, contains block content.
3651ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
365296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  CXComment_FullComment = 12
3653ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko};
3654ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3655ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
36562d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \brief The most appropriate rendering mode for an inline command, chosen on
36572d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * command semantics in Doxygen.
36582d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko */
36592d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenkoenum CXCommentInlineCommandRenderKind {
36602d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  /**
36612d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   * \brief Command argument should be rendered in a normal font.
36622d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   */
36632d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  CXCommentInlineCommandRenderKind_Normal,
36642d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko
36652d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  /**
36662d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   * \brief Command argument should be rendered in a bold font.
36672d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   */
36682d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  CXCommentInlineCommandRenderKind_Bold,
36692d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko
36702d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  /**
36712d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   * \brief Command argument should be rendered in a monospaced font.
36722d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   */
36732d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  CXCommentInlineCommandRenderKind_Monospaced,
36742d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko
36752d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  /**
36762d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   * \brief Command argument should be rendered emphasized (typically italic
36772d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   * font).
36782d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   */
36792d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  CXCommentInlineCommandRenderKind_Emphasized
36802d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko};
36812d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko
36822d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko/**
3683ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Describes parameter passing direction for \\param or \\arg command.
3684ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3685ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkoenum CXCommentParamPassDirection {
3686ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3687ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief The parameter is an input parameter.
3688ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3689ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXCommentParamPassDirection_In,
3690ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3691ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3692ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief The parameter is an output parameter.
3693ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3694ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXCommentParamPassDirection_Out,
3695ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3696ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3697ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief The parameter is an input and output parameter.
3698ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3699ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXCommentParamPassDirection_InOut
3700ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko};
3701ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3702ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3703ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment AST node of any kind.
3704ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3705ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns the type of the AST node.
3706ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3707ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE enum CXCommentKind clang_Comment_getKind(CXComment Comment);
3708ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3709ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3710ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment AST node of any kind.
3711ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3712ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of children of the AST node.
3713ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3714ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE unsigned clang_Comment_getNumChildren(CXComment Comment);
3715ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3716ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3717ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment AST node of any kind.
3718ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
371970517ca5c07c4b41ff8662b94ee22047b0299f8cDmitri Gribenko * \param ChildIdx child index (zero-based).
3720ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3721ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns the specified child of the AST node.
3722ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3723ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3724ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXComment clang_Comment_getChild(CXComment Comment, unsigned ChildIdx);
3725ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3726ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3727ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A \c CXComment_Paragraph node is considered whitespace if it contains
3728ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * only \c CXComment_Text nodes that are empty or whitespace.
3729ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3730ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * Other AST nodes (except \c CXComment_Paragraph and \c CXComment_Text) are
3731ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * never considered whitespace.
3732ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3733ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if \c Comment is whitespace.
3734ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3735ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE unsigned clang_Comment_isWhitespace(CXComment Comment);
3736ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3737ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3738ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if \c Comment is inline content and has a newline
3739ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * immediately following it in the comment text.  Newlines between paragraphs
3740ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * do not count.
3741ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3742ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3743ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_InlineContentComment_hasTrailingNewline(CXComment Comment);
3744ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3745ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3746ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_Text AST node.
3747ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3748ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text contained in the AST node.
3749ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3750ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_TextComment_getText(CXComment Comment);
3751ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3752ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3753ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node.
3754ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3755ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns name of the inline command.
3756ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3757ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3758ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_InlineCommandComment_getCommandName(CXComment Comment);
3759ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3760ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3761ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node.
3762ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
37632d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \returns the most appropriate rendering mode, chosen on command
37642d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * semantics in Doxygen.
37652d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko */
37662d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri GribenkoCINDEX_LINKAGE enum CXCommentInlineCommandRenderKind
37672d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenkoclang_InlineCommandComment_getRenderKind(CXComment Comment);
37682d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko
37692d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko/**
37702d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node.
37712d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko *
3772ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of command arguments.
3773ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3774ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3775ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_InlineCommandComment_getNumArgs(CXComment Comment);
3776ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3777ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3778ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node.
3779ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3780ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param ArgIdx argument index (zero-based).
3781ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3782ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text of the specified argument.
3783ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3784ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3785ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_InlineCommandComment_getArgText(CXComment Comment,
3786ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko                                               unsigned ArgIdx);
3787ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3788ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3789ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
3790ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * node.
3791ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3792ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns HTML tag name.
3793ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3794ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_HTMLTagComment_getTagName(CXComment Comment);
3795ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3796ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3797ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node.
3798ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3799ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if tag is self-closing (for example, &lt;br /&gt;).
3800ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3801ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3802ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_HTMLStartTagComment_isSelfClosing(CXComment Comment);
3803ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3804ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3805ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node.
3806ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3807ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of attributes (name-value pairs) attached to the start tag.
3808ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3809ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE unsigned clang_HTMLStartTag_getNumAttrs(CXComment Comment);
3810ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3811ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3812ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node.
3813ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3814ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param AttrIdx attribute index (zero-based).
3815ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3816ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns name of the specified attribute.
3817ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3818ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3819ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_HTMLStartTag_getAttrName(CXComment Comment, unsigned AttrIdx);
3820ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3821ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3822ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node.
3823ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3824ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param AttrIdx attribute index (zero-based).
3825ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3826ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns value of the specified attribute.
3827ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3828ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3829ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_HTMLStartTag_getAttrValue(CXComment Comment, unsigned AttrIdx);
3830ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3831ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3832ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand AST node.
3833ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3834ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns name of the block command.
3835ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3836ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3837ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_BlockCommandComment_getCommandName(CXComment Comment);
3838ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3839ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3840ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand AST node.
3841ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3842ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of word-like arguments.
3843ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3844ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3845ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_BlockCommandComment_getNumArgs(CXComment Comment);
3846ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3847ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3848ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand AST node.
3849ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3850ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param ArgIdx argument index (zero-based).
3851ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3852ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text of the specified word-like argument.
3853ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3854ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3855ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_BlockCommandComment_getArgText(CXComment Comment,
3856ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko                                              unsigned ArgIdx);
3857ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3858ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3859ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand or
3860ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \c CXComment_VerbatimBlockCommand AST node.
3861ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3862ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns paragraph argument of the block command.
3863ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3864ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3865ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXComment clang_BlockCommandComment_getParagraph(CXComment Comment);
3866ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3867ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3868ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node.
3869ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3870ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns parameter name.
3871ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3872ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3873ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_ParamCommandComment_getParamName(CXComment Comment);
3874ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3875ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3876ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node.
3877ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3878ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if the parameter that this AST node represents was found
3879ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * in the function prototype and \c clang_ParamCommandComment_getParamIndex
3880ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * function will return a meaningful value.
3881ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3882ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3883ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_ParamCommandComment_isParamIndexValid(CXComment Comment);
3884ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3885ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3886ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node.
3887ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3888ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns zero-based parameter index in function prototype.
3889ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3890ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3891ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_ParamCommandComment_getParamIndex(CXComment Comment);
3892ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3893ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3894ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node.
3895ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3896ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if parameter passing direction was specified explicitly in
3897ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * the comment.
3898ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3899ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3900ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_ParamCommandComment_isDirectionExplicit(CXComment Comment);
3901ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3902ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3903ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node.
3904ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3905ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns parameter passing direction.
3906ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3907ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3908ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkoenum CXCommentParamPassDirection clang_ParamCommandComment_getDirection(
3909ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko                                                            CXComment Comment);
3910ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3911ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
391296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node.
391396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
391496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns template parameter name.
391596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */
391696b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE
391796b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCXString clang_TParamCommandComment_getParamName(CXComment Comment);
391896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko
391996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/**
392096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node.
392196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
392296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns non-zero if the parameter that this AST node represents was found
392396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * in the template parameter list and
392496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \c clang_TParamCommandComment_getDepth and
392596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \c clang_TParamCommandComment_getIndex functions will return a meaningful
392696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * value.
392796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */
392896b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE
392996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenkounsigned clang_TParamCommandComment_isParamPositionValid(CXComment Comment);
393096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko
393196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/**
393296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node.
393396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
393496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns zero-based nesting depth of this parameter in the template parameter list.
393596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
393696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * For example,
393796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \verbatim
393896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *     template<typename C, template<typename T> class TT>
393996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *     void test(TT<int> aaa);
394096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \endverbatim
394196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * for C and TT nesting depth is 0,
394296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * for T nesting depth is 1.
394396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */
394496b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE
394596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenkounsigned clang_TParamCommandComment_getDepth(CXComment Comment);
394696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko
394796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/**
394896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node.
394996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
395096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns zero-based parameter index in the template parameter list at a
395196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * given nesting depth.
395296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
395396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * For example,
395496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \verbatim
395596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *     template<typename C, template<typename T> class TT>
395696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *     void test(TT<int> aaa);
395796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \endverbatim
395896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * for C and TT nesting depth is 0, so we can ask for index at depth 0:
395996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * at depth 0 C's index is 0, TT's index is 1.
396096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
396196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * For T nesting depth is 1, so we can ask for index at depth 0 and 1:
396296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * at depth 0 T's index is 1 (same as TT's),
396396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * at depth 1 T's index is 0.
396496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */
396596b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE
396696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenkounsigned clang_TParamCommandComment_getIndex(CXComment Comment, unsigned Depth);
396796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko
396896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/**
3969ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_VerbatimBlockLine AST node.
3970ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3971ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text contained in the AST node.
3972ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3973ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3974ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_VerbatimBlockLineComment_getText(CXComment Comment);
3975ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3976ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3977ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_VerbatimLine AST node.
3978ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3979ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text contained in the AST node.
3980ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3981ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_VerbatimLineComment_getText(CXComment Comment);
3982ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3983ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3984ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Convert an HTML tag AST node to string.
3985ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3986ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
3987ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * node.
3988ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3989ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns string containing an HTML tag.
3990ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3991ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_HTMLTagComment_getAsString(CXComment Comment);
3992ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3993ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3994ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Convert a given full parsed comment to an HTML fragment.
3995ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3996ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * Specific details of HTML layout are subject to change.  Don't try to parse
3997ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * this HTML back into an AST, use other APIs instead.
3998ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3999ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * Currently the following CSS classes are used:
4000ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \li "para-brief" for \\brief paragraph and equivalent commands;
4001ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \li "para-returns" for \\returns paragraph and equivalent commands;
4002ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \li "word-returns" for the "Returns" word in \\returns paragraph.
4003ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
40043e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * Function argument documentation is rendered as a \<dl\> list with arguments
40053e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * sorted in function prototype order.  CSS classes used:
40063e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * \li "param-name-index-NUMBER" for parameter name (\<dt\>);
40073e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * \li "param-descr-index-NUMBER" for parameter description (\<dd\>);
40083e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * \li "param-name-index-invalid" and "param-descr-index-invalid" are used if
40093e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * parameter index is invalid.
4010ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
401196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * Template parameter documentation is rendered as a \<dl\> list with
401296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * parameters sorted in template parameter list order.  CSS classes used:
401396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \li "tparam-name-index-NUMBER" for parameter name (\<dt\>);
401496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \li "tparam-descr-index-NUMBER" for parameter description (\<dd\>);
40156a425525e52aba5a8e14db35d50a712be4e5e2e1Dmitri Gribenko * \li "tparam-name-index-other" and "tparam-descr-index-other" are used for
401696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * names inside template template parameters;
401796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \li "tparam-name-index-invalid" and "tparam-descr-index-invalid" are used if
401896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * parameter position is invalid.
401996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
4020ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_FullComment AST node.
4021ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
4022ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns string containing an HTML fragment.
4023ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
4024ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_FullComment_getAsHTML(CXComment Comment);
4025ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
4026ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
4027f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * \brief Convert a given full parsed comment to an XML document.
4028f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko *
4029f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * A Relax NG schema for the XML can be found in comment-xml-schema.rng file
4030f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * inside clang source tree.
4031f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko *
4032f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * \param Comment a \c CXComment_FullComment AST node.
4033f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko *
4034f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * \returns string containing an XML document.
4035f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko */
4036e4330a302ac20b41b9800267ebd4b5b01f8553f8Dmitri GribenkoCINDEX_LINKAGE CXString clang_FullComment_getAsXML(CXComment Comment);
4037f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko
4038f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko/**
4039c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
4040c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
40411efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
4042c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
40439ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * \defgroup CINDEX_CPP C++ AST introspection
40449ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek *
40459ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * The routines in this group provide access information in the ASTs specific
40469ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * to C++ language features.
40479ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek *
40489ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @{
40499ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
40509ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
40519ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
4052c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri Gribenko * \brief Determine if a C++ member function or member function template is
4053c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri Gribenko * pure virtual.
4054c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri Gribenko */
4055c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri GribenkoCINDEX_LINKAGE unsigned clang_CXXMethod_isPureVirtual(CXCursor C);
4056c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri Gribenko
4057c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri Gribenko/**
405849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Determine if a C++ member function or member function template is
405949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared 'static'.
40609ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
40619ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed KremenekCINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);
40629ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
40639ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
4064211924b563aa31421836cee7655be729ad02733fDouglas Gregor * \brief Determine if a C++ member function or member function template is
4065211924b563aa31421836cee7655be729ad02733fDouglas Gregor * explicitly declared 'virtual' or if it overrides a virtual method from
4066211924b563aa31421836cee7655be729ad02733fDouglas Gregor * one of the base classes.
4067211924b563aa31421836cee7655be729ad02733fDouglas Gregor */
4068211924b563aa31421836cee7655be729ad02733fDouglas GregorCINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C);
4069211924b563aa31421836cee7655be729ad02733fDouglas Gregor
4070211924b563aa31421836cee7655be729ad02733fDouglas Gregor/**
407149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Given a cursor that represents a template, determine
407249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the cursor kind of the specializations would be generated by instantiating
407349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the template.
407449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
407549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * This routine can be used to determine what flavor of function template,
407649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * class template, or class template partial specialization is stored in the
407749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * cursor. For example, it can describe whether a class template cursor is
407849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared with "struct", "class" or "union".
407949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
408049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \param C The cursor to query. This cursor should represent a template
408149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declaration.
408249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
408349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \returns The cursor kind of the specializations that would be generated
408449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * by instantiating the template \p C. If \p C is not a template, returns
408549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \c CXCursor_NoDeclFound.
408649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor */
408749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);
408849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor
408949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor/**
4090e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \brief Given a cursor that may represent a specialization or instantiation
4091e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template, retrieve the cursor that represents the template that it
4092e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializes or from which it was instantiated.
4093e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
4094e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * This routine determines the template involved both for explicit
4095e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializations of templates and for implicit instantiations of the template,
4096e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * both of which are referred to as "specializations". For a class template
4097e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specialization (e.g., \c std::vector<bool>), this routine will return
4098e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * either the primary template (\c std::vector) or, if the specialization was
4099e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * instantiated from a class template partial specialization, the class template
4100e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * partial specialization. For a class template partial specialization and a
4101e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * function template specialization (including instantiations), this
4102e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * this routine will return the specialized template.
4103e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
4104e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * For members of a class template (e.g., member functions, member classes, or
4105e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * static data members), returns the specialized or instantiated member.
4106e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * Although not strictly "templates" in the C++ language, members of class
4107e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates have the same notions of specializations and instantiations that
4108e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates do, so this routine treats them similarly.
4109e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
4110e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \param C A cursor that may be a specialization of a template or a member
4111e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template.
4112e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
4113e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \returns If the given cursor is a specialization or instantiation of a
4114e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * template or a member thereof, the template or member that it specializes or
4115e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * from which it was instantiated. Otherwise, returns a NULL cursor.
4116e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor */
4117e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas GregorCINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
4118430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
4119430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor/**
4120430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Given a cursor that references something else, return the source range
4121430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * covering that reference.
4122430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor *
4123430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param C A cursor pointing to a member reference, a declaration reference, or
4124430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * an operator call.
4125430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param NameFlags A bitset with three independent flags:
4126430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
4127430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece.
4128430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param PieceIndex For contiguous names or when passing the flag
4129430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece, only one piece with index 0 is
4130430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * available. When the CXNameRange_WantSinglePiece flag is not passed for a
413148d798ce32447607144db70a484cdb99c1180663Benjamin Kramer * non-contiguous names, this index can be used to retrieve the individual
4132430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * pieces of the name. See also CXNameRange_WantSinglePiece.
4133430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor *
4134430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \returns The piece of the name pointed to by the given cursor. If there is no
4135430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
4136430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */
413748a8d14fc6f064a5297024c2b34733a4080b2efeFrancois PichetCINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C,
413848a8d14fc6f064a5297024c2b34733a4080b2efeFrancois Pichet                                                unsigned NameFlags,
4139430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor                                                unsigned PieceIndex);
4140430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
4141430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregorenum CXNameRefFlags {
4142430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
4143430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \brief Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
4144430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * range.
4145430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
4146430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantQualifier = 0x1,
4147430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
4148430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
41497eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Include the explicit template arguments, e.g. \<int> in x.f<int>,
41507eee0184570366285589d788bcd7f5dda8345915James Dennett   * in the range.
4151430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
4152430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantTemplateArgs = 0x2,
4153430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
4154430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
4155430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \brief If the name is non-contiguous, return the full spanning range.
4156430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   *
4157430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * Non-contiguous names occur in Objective-C when a selector with two or more
4158430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * parameters is used, or in C++ when using an operator:
4159430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \code
4160430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * [object doSomething:here withValue:there]; // ObjC
4161430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * return some_vector[1]; // C++
4162430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \endcode
4163430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
4164430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantSinglePiece = 0x4
4165430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor};
4166e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor
4167e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor/**
41689ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @}
41699ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
41709ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
41719ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
41720045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * \defgroup CINDEX_LEX Token extraction and manipulation
41730045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
41740045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * The routines in this group provide access to the tokens within a
41750045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * translation unit, along with a semantic mapping of those tokens to
41760045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * their corresponding cursors.
4177fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4178fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @{
4179fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4180fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
4181fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4182fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a kind of token.
4183fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4184fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef enum CXTokenKind {
4185fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
4186fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A token that contains some kind of punctuation.
4187fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
4188fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Punctuation,
4189896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4190fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
41910045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor   * \brief A language keyword.
4192fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
4193fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Keyword,
4194896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4195fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
4196fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief An identifier (that is not a keyword).
4197fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
4198fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Identifier,
4199896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4200fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
4201fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A numeric, string, or character literal.
4202fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
4203fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Literal,
4204896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4205fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
4206fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A comment.
4207fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
4208fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Comment
4209fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXTokenKind;
4210fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
4211fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4212fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a single preprocessing token.
4213fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4214fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef struct {
4215fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  unsigned int_data[4];
4216fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  void *ptr_data;
4217fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXToken;
4218fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
4219fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4220fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the kind of the given token.
4221fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4222fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken);
4223896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4224fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4225fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the spelling of the given token.
4226fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4227fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * The spelling of a token is the textual representation of that token, e.g.,
4228fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * the text of an identifier or keyword.
4229fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4230fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken);
4231896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4232fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4233fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve the source location of the given token.
4234fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4235896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit,
4236fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                                       CXToken);
4237896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4238fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4239fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve a source range that covers the given token.
4240fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4241fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);
4242fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
4243fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4244fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Tokenize the source code described by the given range into raw
4245fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * lexical tokens.
4246fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4247fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit whose text is being tokenized.
4248fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4249fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Range the source range in which text should be tokenized. All of the
4250fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * tokens produced by tokenization will fall within this source range,
4251fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4252fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens this pointer will be set to point to the array of tokens
4253fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that occur within the given source range. The returned pointer must be
4254fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * freed with clang_disposeTokens() before the translation unit is destroyed.
4255fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4256fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens will be set to the number of tokens in the \c *Tokens
4257fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * array.
4258fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4259fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4260fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
4261fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                   CXToken **Tokens, unsigned *NumTokens);
4262896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4263fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4264fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Annotate the given set of tokens by providing cursors for each token
4265fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that can be mapped to a specific entity within the abstract syntax tree.
4266fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
42670045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * This token-annotation routine is equivalent to invoking
42680045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() for the source locations of each of the
42690045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * tokens. The cursors provided are filtered, so that only those
42700045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * cursors that have a direct correspondence to the token are
42710045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * accepted. For example, given a function call \c f(x),
42720045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() would provide the following cursors:
42730045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
42740045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
42750045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
42760045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
42770045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
42780045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * Only the first and last of these cursors will occur within the
42790045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * annotate, since the tokens "f" and "x' directly refer to a function
42800045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * and a variable, respectively, but the parentheses are just a small
42810045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * part of the full syntax of the function call expression, which is
42820045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * not provided as an annotation.
4283fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4284fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit that owns the given tokens.
4285fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4286fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens the set of tokens to annotate.
4287fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4288fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens the number of tokens in \p Tokens.
4289fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4290fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Cursors an array of \p NumTokens cursors, whose contents will be
4291fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * replaced with the cursors corresponding to each token.
4292fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4293fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU,
4294fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                         CXToken *Tokens, unsigned NumTokens,
4295fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                         CXCursor *Cursors);
4296896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4297fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4298fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Free the given set of tokens.
4299fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4300896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
4301fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                        CXToken *Tokens, unsigned NumTokens);
4302896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4303fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4304fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @}
4305fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4306896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4307fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4308c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_DEBUG Debugging facilities
4309c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
4310c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines are used for testing and debugging, only, and should not
4311c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be relied upon.
4312c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
4313c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
4314c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
43151efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
43164ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff/* for debug/testing */
4317e68fff6fc083c6270d835216a3de0b82c6ef0310Ted KremenekCINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind);
43181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor,
43191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar                                          const char **startBuf,
43204ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          const char **endBuf,
43214ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *startLine,
43224ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *startColumn,
43234ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *endLine,
43244ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *endColumn);
43250a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE void clang_enableStackTraces(void);
4326995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel DunbarCINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data,
4327995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar                                          unsigned stack_size);
4328995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar
43290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
4330c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
4331c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
43321efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
4333c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
4334c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CODE_COMPLET Code completion
4335c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
4336c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Code completion involves taking an (incomplete) source file, along with
4337c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * knowledge of where the user is actively editing that file, and suggesting
4338c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * syntactically- and semantically-valid constructs that the user might want to
4339c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * use at that particular point in the source code. These data structures and
4340c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines provide support for code completion.
4341c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
4342c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
4343c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
43441efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
4345c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
43460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A semantic string that describes a code-completion result.
43470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
43480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A semantic string that describes the formatting of a code-completion
43490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * result as a single "template" of text that should be inserted into the
43500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * source buffer when a particular code-completion result is selected.
43510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * Each semantic string is made up of some number of "chunks", each of which
43520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * contains some text along with a description of what that text means, e.g.,
43530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the name of the entity being referenced, whether the text chunk is part of
43540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the template, or whether it is a "placeholder" that the user should replace
43550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * with actual code,of a specific kind. See \c CXCompletionChunkKind for a
43561efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * description of the different kinds of chunks.
43570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
43580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef void *CXCompletionString;
43591efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
43600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
43610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A single result of code completion.
43620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
43630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef struct {
43640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
43651efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief The kind of entity that this completion refers to.
43660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43671efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * The cursor kind will be a macro, keyword, or a declaration (one of the
43680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * *Decl cursor kinds), describing the entity that the completion is
43690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * referring to.
43700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \todo In the future, we would like to provide a full cursor, to allow
43720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the client to extract additional information from declaration.
43730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
43740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  enum CXCursorKind CursorKind;
43751efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
43761efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
43770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief The code-completion string that describes how to insert this
43780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * code-completion result into the editing buffer.
43790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
43800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionString CompletionString;
43810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor} CXCompletionResult;
43820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
43830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
43840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Describes a single piece of text within a code-completion string.
43850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
43861efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Each "chunk" within a code-completion string (\c CXCompletionString) is
43871efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * either a piece of text with a specific "kind" that describes how that text
43880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * should be interpreted by the client or is another completion string.
43890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
43900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorenum CXCompletionChunkKind {
43910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
43920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A code-completion string that describes "optional" text that
43930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * could be a part of the template (but is not required).
43940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * The Optional chunk is the only kind of chunk that has a code-completion
43961efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * string for its representation, which is accessible via
43970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \c clang_getCompletionChunkCompletionString(). The code-completion string
43980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * describes an additional part of the template that is completely optional.
43990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * For example, optional chunks can be used to describe the placeholders for
44000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * arguments that match up with defaulted function parameters, e.g. given:
44010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
44020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \code
44030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * void f(int x, float y = 3.14, double z = 2.71828);
44040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \endcode
44050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
44060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * The code-completion string for this function would contain:
44070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a TypedText chunk for "f".
44080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a LeftParen chunk for "(".
44090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a Placeholder chunk for "int x"
44100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - an Optional chunk containing the remaining defaulted arguments, e.g.,
44110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *       - a Comma chunk for ","
441271570182471d502a97f7f175aa527152544c75f2Daniel Dunbar   *       - a Placeholder chunk for "float y"
44130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *       - an Optional chunk containing the last defaulted argument:
44140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *           - a Comma chunk for ","
44150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *           - a Placeholder chunk for "double z"
44160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a RightParen chunk for ")"
44170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
441871570182471d502a97f7f175aa527152544c75f2Daniel Dunbar   * There are many ways to handle Optional chunks. Two simple approaches are:
44190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - Completely ignore optional chunks, in which case the template for the
44200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *     function "f" would only include the first parameter ("int x").
44210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - Fully expand all optional chunks, in which case the template for the
44220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *     function "f" would have all of the parameters.
44230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Optional,
44250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44260c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that a user would be expected to type to get this
44271efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * code-completion result.
44280c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
44291efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * There will be exactly one "typed text" chunk in a semantic string, which
44301efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * will typically provide the spelling of a keyword or the name of a
44310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * declaration that could be used at the current code point. Clients are
44320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * expected to filter the code-completion results based on the text in this
44330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * chunk.
44340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_TypedText,
44360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that should be inserted as part of a code-completion result.
44380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
44390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "text" chunk represents text that is part of the template to be
44400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * inserted into user code should this particular code-completion result
44410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * be selected.
44420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Text,
44440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Placeholder text that should be replaced by the user.
44460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
44470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "placeholder" chunk marks a place where the user should insert text
44480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * into the code-completion template. For example, placeholders might mark
44490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the function parameters for a function declaration, to indicate that the
44500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * user should provide arguments for each of those parameters. The actual
44510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * text in a placeholder is a suggestion for the text to display before
44520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the user replaces the placeholder with real code.
44530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Placeholder,
44550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Informative text that should be displayed but never inserted as
44570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * part of the template.
44581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   *
44590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * An "informative" chunk contains annotations that can be displayed to
44600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * help the user decide whether a particular code-completion result is the
44610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * right option, but which is not part of the actual template to be inserted
44620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * by code completion.
44630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Informative,
44650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that describes the current parameter when code-completion is
44670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * referring to function call, message send, or template specialization.
44680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
44690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "current parameter" chunk occurs when code-completion is providing
44700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * information about a parameter corresponding to the argument at the
44710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * code-completion point. For example, given a function
44720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
44730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \code
44740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * int add(int x, int y);
44750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \endcode
44760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
44770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * and the source code \c add(, where the code-completion point is after the
44780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * "(", the code-completion string will contain a "current parameter" chunk
44790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * for "int x", indicating that the current argument will initialize that
44800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * parameter. After typing further, to \c add(17, (where the code-completion
44811efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * point is after the ","), the code-completion string will contain a
44820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * "current paremeter" chunk to "int y".
44830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_CurrentParameter,
44850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left parenthesis ('('), used to initiate a function call or
44870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * signal the beginning of a function parameter list.
44880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftParen,
44900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right parenthesis (')'), used to finish a function call or
44920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * signal the end of a function parameter list.
44930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightParen,
44950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left bracket ('[').
44970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftBracket,
44990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
45000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right bracket (']').
45010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
45020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightBracket,
45030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
45040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left brace ('{').
45050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
45060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftBrace,
45070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
45080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right brace ('}').
45090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
45100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightBrace,
45110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
45120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left angle bracket ('<').
45130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
45140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftAngle,
45150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
45160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right angle bracket ('>').
45170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
45180c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightAngle,
45190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
45200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A comma separator (',').
45210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
4522ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor  CXCompletionChunk_Comma,
4523ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor  /**
45241efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief Text that specifies the result type of a given result.
4525ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   *
4526ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   * This special kind of informative chunk is not meant to be inserted into
45271efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * the text buffer. Rather, it is meant to illustrate the type that an
4528ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   * expression using the given completion string would have.
4529ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   */
453001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_ResultType,
453101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
453201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief A colon (':').
453301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
453401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_Colon,
453501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
453601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief A semicolon (';').
453701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
453801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_SemiColon,
453901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
454001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief An '=' sign.
454101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
454201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_Equal,
454301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
454401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * Horizontal space (' ').
454501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
454601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_HorizontalSpace,
454701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
454801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * Vertical space ('\n'), after which it is generally a good idea to
454901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * perform indentation.
455001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
455101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_VerticalSpace
45520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor};
45531efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
45540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
45550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Determine the kind of a particular chunk within a completion string.
45560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
45580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
45600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the kind of the chunk at the index \c chunk_number.
45620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
45631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE enum CXCompletionChunkKind
45640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkKind(CXCompletionString completion_string,
45650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                             unsigned chunk_number);
45661efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
45670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
45681efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the text associated with a particular chunk within a
45690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * completion string.
45700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
45720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
45740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the text associated with the chunk at index \c chunk_number.
45760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
45772ef6f8f5a35a60870594c5b04e0aa2bf22c6886fTed KremenekCINDEX_LINKAGE CXString
45780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkText(CXCompletionString completion_string,
45790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                             unsigned chunk_number);
45800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
45810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
45821efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the completion string associated with a particular chunk
45830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * within a completion string.
45840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
45860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
45880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the completion string associated with the chunk at index
45906164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c chunk_number.
45910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
45920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE CXCompletionString
45930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkCompletionString(CXCompletionString completion_string,
45940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                                         unsigned chunk_number);
45951efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
45960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
45970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Retrieve the number of chunks in the given code-completion string.
45980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
45990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE unsigned
46000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getNumCompletionChunks(CXCompletionString completion_string);
46010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
46020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
460312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \brief Determine the priority of this code completion.
460412e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
460512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * The priority of a code completion indicates how likely it is that this
460612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * particular completion is the completion that the user will select. The
460712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * priority is selected by various internal heuristics.
460812e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
460912e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \param completion_string The completion string to query.
461012e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
461112e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \returns The priority of this completion string. Smaller values indicate
461212e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * higher-priority (more likely) completions.
461312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor */
461412e131385e892e3723483a1081a89bcad29c8a84Douglas GregorCINDEX_LINKAGE unsigned
461512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregorclang_getCompletionPriority(CXCompletionString completion_string);
461612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor
461712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor/**
461858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \brief Determine the availability of the entity that this code-completion
461958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * string refers to.
462058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
462158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param completion_string The completion string to query.
462258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
462358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the completion string.
462458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */
462558ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind
462658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCompletionAvailability(CXCompletionString completion_string);
462758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
462858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/**
46296164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the number of annotations associated with the given
46306164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string.
46316164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
46326164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query.
46336164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
46346164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns the number of annotations associated with the given completion
46356164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * string.
46366164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */
46376164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE unsigned
46386164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionNumAnnotations(CXCompletionString completion_string);
46396164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen
46406164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/**
46416164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the annotation associated with the given completion string.
46426164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
46436164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query.
46446164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
46456164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param annotation_number the 0-based index of the annotation of the
46466164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string.
46476164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
46486164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns annotation string associated with the completion at index
46496164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c annotation_number, or a NULL string if that annotation is not available.
46506164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */
46516164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE CXString
46526164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionAnnotation(CXCompletionString completion_string,
46536164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen                              unsigned annotation_number);
46546164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen
46556164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/**
4656ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \brief Retrieve the parent context of the given completion string.
4657ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor *
4658ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * The parent context of a completion string is the semantic parent of
4659ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * the declaration (if any) that the code completion represents. For example,
4660ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * a code completion for an Objective-C method would have the method's class
4661ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * or protocol as its context.
4662ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor *
4663ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \param completion_string The code completion string whose parent is
4664ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * being queried.
4665ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor *
4666526d24444c91404dc4165b141e5ec095125c1bc8Argyrios Kyrtzidis * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL.
4667ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor *
46687eee0184570366285589d788bcd7f5dda8345915James Dennett * \returns The name of the completion parent, e.g., "NSObject" if
4669ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * the completion string represents a method in the NSObject class.
4670ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor */
4671ba1030698dbc276db86b11c5329a1edee8a1805eDouglas GregorCINDEX_LINKAGE CXString
4672ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregorclang_getCompletionParent(CXCompletionString completion_string,
4673ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor                          enum CXCursorKind *kind);
4674d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko
4675d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko/**
4676d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * \brief Retrieve the brief documentation comment attached to the declaration
4677d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * that corresponds to the given completion string.
4678d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko */
4679d99ef536b241071b6f4c01db6525dc03242ac30bDmitri GribenkoCINDEX_LINKAGE CXString
4680d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenkoclang_getCompletionBriefComment(CXCompletionString completion_string);
4681d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko
4682ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor/**
46838fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \brief Retrieve a completion string for an arbitrary declaration or macro
46848fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursor.
46858fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor *
46868fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \param cursor The cursor to query.
46878fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor *
46888fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \returns A non-context-sensitive completion string for declaration and macro
46898fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursors, or NULL for other kinds of cursors.
46908fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor */
46918fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas GregorCINDEX_LINKAGE CXCompletionString
46928fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregorclang_getCursorCompletionString(CXCursor cursor);
46938fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor
46948fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor/**
4695ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Contains the results of code-completion.
4696ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor *
4697ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * This data structure contains the results of code completion, as
4698e0cc52ef8afc8d1cba9c534191b5f0ddaff1d694Douglas Gregor * produced by \c clang_codeCompleteAt(). Its contents must be freed by
4699ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \c clang_disposeCodeCompleteResults.
4700ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */
4701ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregortypedef struct {
4702ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  /**
4703ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \brief The code-completion results.
4704ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   */
4705ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  CXCompletionResult *Results;
4706ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor
4707ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  /**
4708ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \brief The number of code-completion results stored in the
4709ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \c Results array.
4710ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   */
4711ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  unsigned NumResults;
4712ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor} CXCodeCompleteResults;
4713ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor
4714ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor/**
4715cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Flags that can be passed to \c clang_codeCompleteAt() to
4716cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * modify its behavior.
4717cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor *
4718cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * The enumerators in this enumeration can be bitwise-OR'd together to
4719cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * provide multiple options to \c clang_codeCompleteAt().
4720cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */
4721cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregorenum CXCodeComplete_Flags {
4722cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  /**
4723cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * \brief Whether to include macros within the set of code
4724cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * completions returned.
4725cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   */
4726cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  CXCodeComplete_IncludeMacros = 0x01,
4727cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
4728cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  /**
4729cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * \brief Whether to include code patterns for language constructs
4730cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * within the set of code completions, e.g., for loops.
4731cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   */
4732d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko  CXCodeComplete_IncludeCodePatterns = 0x02,
4733d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko
4734d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko  /**
4735d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko   * \brief Whether to include brief documentation within the set of code
4736d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko   * completions returned.
4737d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko   */
4738d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko  CXCodeComplete_IncludeBriefComments = 0x04
4739cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor};
4740cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
4741cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/**
47423da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Bits that represent the context under which completion is occurring.
47433da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
47443da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * The enumerators in this enumeration may be bitwise-OR'd together if multiple
47453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * contexts are occurring simultaneously.
47463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */
47473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorenum CXCompletionContext {
47483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief The context for completions is unexposed, as only Clang results
47503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included. (This is equivalent to having no context bits set.)
47513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Unexposed = 0,
47533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47553da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for any possible type should be included in the results.
47563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47573da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_AnyType = 1 << 0,
47583da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47593da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47603da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for any possible value (variables, function calls, etc.)
47613da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included in the results.
47623da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47633da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_AnyValue = 1 << 1,
47643da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to an Objective-C object should
47663da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * be included in the results.
47673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47683da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCObjectValue = 1 << 2,
47693da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to an Objective-C selector
47713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included in the results.
47723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47733da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCSelectorValue = 1 << 3,
47743da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47753da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to a C++ class type should be
47763da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * included in the results.
47773da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47783da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_CXXClassTypeValue = 1 << 4,
47793da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47803da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47813da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for fields of the member being accessed using the dot
47823da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * operator should be included in the results.
47833da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47843da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_DotMemberAccess = 1 << 5,
47853da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47863da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for fields of the member being accessed using the arrow
47873da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * operator should be included in the results.
47883da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47893da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ArrowMemberAccess = 1 << 6,
47903da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47913da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for properties of the Objective-C object being accessed
47923da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * using the dot operator should be included in the results.
47933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCPropertyAccess = 1 << 7,
47953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for enum tags should be included in the results.
47983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_EnumTag = 1 << 8,
48003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for union tags should be included in the results.
48023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_UnionTag = 1 << 9,
48043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48053da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for struct tags should be included in the results.
48063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_StructTag = 1 << 10,
48083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
48093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ class names should be included in the results.
48113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ClassTag = 1 << 11,
48133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ namespaces and namespace aliases should be
48153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * included in the results.
48163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Namespace = 1 << 12,
48183da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48193da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ nested name specifiers should be included in
48203da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
48213da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48223da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_NestedNameSpecifier = 1 << 13,
48233da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
48243da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48253da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C interfaces (classes) should be included
48263da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * in the results.
48273da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48283da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCInterface = 1 << 14,
48293da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48303da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C protocols should be included in
48313da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
48323da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48333da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCProtocol = 1 << 15,
48343da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48353da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C categories should be included in
48363da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
48373da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48383da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCCategory = 1 << 16,
48393da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48403da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C instance messages should be included
48413da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * in the results.
48423da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48433da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCInstanceMessage = 1 << 17,
48443da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C class messages should be included in
48463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
48473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCClassMessage = 1 << 18,
48493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C selector names should be included in
48513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
48523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCSelectorName = 1 << 19,
48543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
48553da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for preprocessor macro names should be included in
48573da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
48583da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48593da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_MacroName = 1 << 20,
48603da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
48613da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48623da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Natural language completions should be included in the results.
48633da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48643da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_NaturalLanguage = 1 << 21,
48653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
48663da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
48673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief The current context is unknown, so set all contexts.
48683da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
48693da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Unknown = ((1 << 22) - 1)
48703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor};
48713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
48723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/**
4873cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Returns a default set of code-completion options that can be
4874cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * passed to\c clang_codeCompleteAt().
4875cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */
4876cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas GregorCINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
4877cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
4878cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/**
48791abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \brief Perform code completion at a given location in a translation unit.
48801abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
48811abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * This function performs code completion at a particular file, line, and
48821abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * column within source code, providing results that suggest potential
48831abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code snippets based on the context of the completion. The basic model
48841abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * for code completion is that Clang will parse a complete source file,
48851abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * performing syntax checking up to the location where code-completion has
48861abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * been requested. At that point, a special code-completion token is passed
48871abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * to the parser, which recognizes this token and determines, based on the
48881abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * current location in the C/Objective-C/C++ grammar and the state of
48891abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * semantic analysis, what completions to provide. These completions are
48901abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * returned via a new \c CXCodeCompleteResults structure.
48911abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
48921abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Code completion itself is meant to be triggered by the client when the
48931abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * user types punctuation characters or whitespace, at which point the
48941abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code-completion location will coincide with the cursor. For example, if \c p
48951abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is a pointer, code-completion might be triggered after the "-" and then
48961abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * after the ">" in \c p->. When the code-completion location is afer the ">",
48971abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the completion results will provide, e.g., the members of the struct that
48981abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * "p" points to. The client is responsible for placing the cursor at the
48991abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * beginning of the token currently being typed, then filtering the results
49001abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * based on the contents of the token. For example, when code-completing for
49011abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the expression \c p->get, the client should provide the location just after
49021abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the
49031abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client can filter the results based on the current token text ("get"), only
49041abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * showing those results that start with "get". The intent of this interface
49051abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is to separate the relatively high-latency acquisition of code-completion
49061abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * results from the filtering of results on a per-character basis, which must
49071abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * have a lower latency.
49081abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
49091abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param TU The translation unit in which code-completion should
49101abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * occur. The source files for this translation unit need not be
49111abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completely up-to-date (and the contents of those source files may
49121abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * be overridden via \p unsaved_files). Cursors referring into the
49131abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * translation unit may be invalidated by this invocation.
49141abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
49151abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_filename The name of the source file where code
49161abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion should be performed. This filename may be any file
49171abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * included in the translation unit.
49181abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
49191abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_line The line at which code-completion should occur.
49201abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
49211abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_column The column at which code-completion should occur.
49221abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Note that the column should point just after the syntactic construct that
49231abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * initiated code completion, and not in the middle of a lexical token.
49241abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
49251abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param unsaved_files the Tiles that have not yet been saved to disk
49261abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing or code completion, including the
49271abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * contents of those files.  The contents and name of these files (as
49281abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * specified by CXUnsavedFile) are copied when necessary, so the
49291abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client only needs to guarantee their validity until the call to
49301abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * this function returns.
49311abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
49321abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p
49331abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * unsaved_files.
49341abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
4935cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \param options Extra options that control the behavior of code
4936cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * completion, expressed as a bitwise OR of the enumerators of the
4937cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * CXCodeComplete_Flags enumeration. The
4938cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \c clang_defaultCodeCompleteOptions() function returns a default set
4939cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * of code-completion options.
4940cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor *
49411abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \returns If successful, a new \c CXCodeCompleteResults structure
49421abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * containing code-completion results, which should eventually be
49431abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * freed with \c clang_disposeCodeCompleteResults(). If code
49441abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion fails, returns NULL.
49451abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor */
49461abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCINDEX_LINKAGE
49471abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
49481abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            const char *complete_filename,
49491abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            unsigned complete_line,
49501abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            unsigned complete_column,
49511abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            struct CXUnsavedFile *unsaved_files,
4952cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor                                            unsigned num_unsaved_files,
4953cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor                                            unsigned options);
49541abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor
49551abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor/**
49561e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \brief Sort the code-completion results in case-insensitive alphabetical
49571e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * order.
49581e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor *
49591e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param Results The set of results to sort.
49601e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param NumResults The number of results in \p Results.
49611e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor */
49621e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas GregorCINDEX_LINKAGE
49631e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregorvoid clang_sortCodeCompletionResults(CXCompletionResult *Results,
49641e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor                                     unsigned NumResults);
49651e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor
49661e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor/**
4967ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Free the given set of code-completion results.
49680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
49691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE
4970ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregorvoid clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
497158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
497220d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor/**
4973a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced prior to the
4974a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * location where code completion was performed.
4975a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
4976896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE
4977a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregorunsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results);
4978a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
4979a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
4980a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given code completion.
4981a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor *
49827eee0184570366285589d788bcd7f5dda8345915James Dennett * \param Results the code completion results to query.
4983a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve.
4984a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor *
4985a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed
4986a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic().
4987a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
4988896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE
4989a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
4990a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                             unsigned Index);
4991a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
4992a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
49933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Determines what compeltions are appropriate for the context
49943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the given code completion.
49953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
49963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \param Results the code completion results to query
49973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
49983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \returns the kinds of completions that are appropriate for use
49993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * along with the given code completion results.
50003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */
50013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas GregorCINDEX_LINKAGE
50023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorunsigned long long clang_codeCompleteGetContexts(
50033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor                                                CXCodeCompleteResults *Results);
5004e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor
5005e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/**
5006e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the cursor kind for the container for the current code
5007e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * completion context. The container is only guaranteed to be set for
5008e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * contexts where a container exists (i.e. member accesses or Objective-C
5009e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * message sends); if there is not a container, this function will return
5010e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * CXCursor_InvalidCode.
5011e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
5012e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query
5013e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
5014e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param IsIncomplete on return, this value will be false if Clang has complete
5015e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information about the container. If Clang does not have complete
5016e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information, this value will be true.
5017e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
5018e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the container kind, or CXCursor_InvalidCode if there is not a
5019e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * container
5020e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */
5021e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE
5022e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregorenum CXCursorKind clang_codeCompleteGetContainerKind(
5023e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor                                                 CXCodeCompleteResults *Results,
5024e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor                                                     unsigned *IsIncomplete);
5025e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor
5026e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/**
5027e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the USR for the container for the current code completion
5028e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * context. If there is not a container for the current context, this
5029e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * function will return the empty string.
5030e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
5031e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query
5032e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
5033e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the USR for the container
5034e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */
5035e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE
5036e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results);
50373da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
50380a47d69af8bda945352997af3da4687a3356096aDouglas Gregor
50390a47d69af8bda945352997af3da4687a3356096aDouglas Gregor/**
50400a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \brief Returns the currently-entered selector for an Objective-C message
50410a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * send, formatted like "initWithFoo:bar:". Only guaranteed to return a
50420a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * non-empty string for CXCompletionContext_ObjCInstanceMessage and
50430a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * CXCompletionContext_ObjCClassMessage.
50440a47d69af8bda945352997af3da4687a3356096aDouglas Gregor *
50450a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \param Results the code completion results to query
50460a47d69af8bda945352997af3da4687a3356096aDouglas Gregor *
50470a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \returns the selector (or partial selector) that has been entered thus far
50480a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * for an Objective-C message send.
50490a47d69af8bda945352997af3da4687a3356096aDouglas Gregor */
50500a47d69af8bda945352997af3da4687a3356096aDouglas GregorCINDEX_LINKAGE
50510a47d69af8bda945352997af3da4687a3356096aDouglas GregorCXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results);
50520a47d69af8bda945352997af3da4687a3356096aDouglas Gregor
50533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/**
505420d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * @}
505520d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor */
50561efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
50571efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
505804bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek/**
505904bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * \defgroup CINDEX_MISC Miscellaneous utility functions
506004bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek *
506104bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @{
506204bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */
506323e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek
506423e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek/**
506523e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek * \brief Return a version string, suitable for showing to a user, but not
506623e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek *        intended to be parsed (the format is not guaranteed to be stable).
506723e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek */
5068f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXString clang_getClangVersion(void);
506904bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek
5070d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek
5071d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek/**
5072d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * \brief Enable/disable crash recovery.
5073d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek *
50747eee0184570366285589d788bcd7f5dda8345915James Dennett * \param isEnabled Flag to indicate if crash recovery is enabled.  A non-zero
50757eee0184570366285589d788bcd7f5dda8345915James Dennett *        value enables crash recovery, while 0 disables it.
5076d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek */
5077d2427ddf00aacdc288c386f3882e0821ca9bd27bTed KremenekCINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled);
5078d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek
507916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek /**
5080896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek  * \brief Visitor invoked for each file in a translation unit
508116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  *        (used with clang_getInclusions()).
508216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  *
508316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * This visitor function will be invoked by clang_getInclusions() for each
50847eee0184570366285589d788bcd7f5dda8345915James Dennett  * file included (either at the top-level or by \#include directives) within
508516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * a translation unit.  The first argument is the file being included, and
508616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * the second and third arguments provide the inclusion stack.  The
508716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * array is sorted in order of immediate inclusion.  For example,
508816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * the first element refers to the location that included 'included_file'.
508916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  */
509016b55a71695a33c094383295cc7b7a2080e098daTed Kremenektypedef void (*CXInclusionVisitor)(CXFile included_file,
509116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   CXSourceLocation* inclusion_stack,
509216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   unsigned include_len,
509316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   CXClientData client_data);
509416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek
509516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/**
509616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * \brief Visit the set of preprocessor inclusions in a translation unit.
509716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   The visitor function is called with the provided data for every included
509816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   file.  This does not include headers included by the PCH file (unless one
509916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   is inspecting the inclusions in the PCH file itself).
510016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek */
510116b55a71695a33c094383295cc7b7a2080e098daTed KremenekCINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu,
510216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                        CXInclusionVisitor visitor,
510316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                        CXClientData client_data);
510416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek
510516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/**
510604bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @}
510704bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */
51081efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
510997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** \defgroup CINDEX_REMAPPING Remapping functions
511097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
511197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @{
511297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
511397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
511497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
511597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief A remapping of original source files and their translated files.
511697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
511797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidistypedef void *CXRemapping;
511897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
511997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
512097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Retrieve a remapping.
512197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
512297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param path the path that contains metadata about remappings.
512397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
512497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \returns the requested remapping. This remapping must be freed
512597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
512697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
512797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path);
512897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
512997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
513030660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \brief Retrieve a remapping.
513130660a898545416f0fea2d717f16f75640001e38Ted Kremenek *
513230660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \param filePaths pointer to an array of file paths containing remapping info.
513330660a898545416f0fea2d717f16f75640001e38Ted Kremenek *
513430660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \param numFiles number of file paths.
513530660a898545416f0fea2d717f16f75640001e38Ted Kremenek *
513630660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \returns the requested remapping. This remapping must be freed
513730660a898545416f0fea2d717f16f75640001e38Ted Kremenek * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
513830660a898545416f0fea2d717f16f75640001e38Ted Kremenek */
513930660a898545416f0fea2d717f16f75640001e38Ted KremenekCINDEX_LINKAGE
514030660a898545416f0fea2d717f16f75640001e38Ted KremenekCXRemapping clang_getRemappingsFromFileList(const char **filePaths,
514130660a898545416f0fea2d717f16f75640001e38Ted Kremenek                                            unsigned numFiles);
514230660a898545416f0fea2d717f16f75640001e38Ted Kremenek
514330660a898545416f0fea2d717f16f75640001e38Ted Kremenek/**
514497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Determine the number of remappings.
514597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
514697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
514797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
514897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
514997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Get the original and the associated filename from the remapping.
515097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
515197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param original If non-NULL, will be set to the original filename.
515297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
515397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param transformed If non-NULL, will be set to the filename that the original
515497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * is associated with.
515597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
515697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index,
515797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis                                     CXString *original, CXString *transformed);
515897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
515997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
516097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Dispose the remapping.
516197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
516297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_dispose(CXRemapping);
516397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
516497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
516597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @}
516697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
516797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
5168aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** \defgroup CINDEX_HIGH Higher level API functions
5169aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
5170aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @{
5171aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */
5172aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5173aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidisenum CXVisitorResult {
5174aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  CXVisit_Break,
5175aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  CXVisit_Continue
5176aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis};
5177aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5178aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef struct {
5179aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  void *context;
5180aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange);
5181aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis} CXCursorAndRangeVisitor;
5182aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
51836f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidistypedef enum {
51846f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  /**
51856f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   * \brief Function returned successfully.
51866f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   */
51876f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  CXResult_Success = 0,
51886f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  /**
51896f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   * \brief One of the parameters was invalid for the function.
51906f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   */
51916f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  CXResult_Invalid = 1,
51926f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  /**
51936f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   * \brief The function was terminated by a callback (e.g. it returned
51946f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   * CXVisit_Break)
51956f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   */
51966f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  CXResult_VisitBreak = 2
51976f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis
51986f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis} CXResult;
51996f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis
5200aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/**
5201aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \brief Find references of a declaration in a specific file.
5202aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
5203aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param cursor pointing to a declaration or a reference of one.
5204aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
5205aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param file to search for references.
5206aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
5207aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for
5208aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * each reference found.
5209aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * The CXSourceRange will point inside the file; if the reference is inside
5210aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * a macro (and not a macro argument) the CXSourceRange will be invalid.
5211389dc5603fa10b508a38f668a7830c6d877b6542Argyrios Kyrtzidis *
52126f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis * \returns one of the CXResult enumerators.
5213aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */
52146f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file,
52156f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis                                               CXCursorAndRangeVisitor visitor);
5216aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5217ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis/**
5218ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \brief Find #import/#include directives in a specific file.
5219ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis *
5220ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \param TU translation unit containing the file to query.
5221ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis *
5222ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \param file to search for #import/#include directives.
5223ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis *
5224ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for
5225ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * each directive found.
5226389dc5603fa10b508a38f668a7830c6d877b6542Argyrios Kyrtzidis *
52276f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis * \returns one of the CXResult enumerators.
5228ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis */
52296f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU,
52306f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis                                                 CXFile file,
52316f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis                                              CXCursorAndRangeVisitor visitor);
5232ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis
5233aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#ifdef __has_feature
5234aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#  if __has_feature(blocks)
5235aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5236aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef enum CXVisitorResult
5237aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis    (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange);
5238aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5239aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios KyrtzidisCINDEX_LINKAGE
52406f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile,
52416f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis                                             CXCursorAndRangeVisitorBlock);
5242aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5243ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios KyrtzidisCINDEX_LINKAGE
52446f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile,
52456f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis                                           CXCursorAndRangeVisitorBlock);
5246ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis
5247aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#  endif
5248aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#endif
5249aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5250bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
5251bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a CXFile.
5252bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
5253dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientFile;
5254bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis
5255bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
52562957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic entity.
52572957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
52582957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIdxClientEntity;
52592957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
52602957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
5261bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic container
5262bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * of entities.
5263bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
5264dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientContainer;
5265bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis
5266bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
5267bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with an AST file (PCH
5268bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * or module).
5269bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
5270dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientASTFile;
52714e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5272bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
5273dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis * \brief Source location passed to index callbacks.
5274bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
52754e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
52764e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  void *ptr_data[2];
52774e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  unsigned int_data;
52784e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxLoc;
52794e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5280bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
52817eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for ppIncludedFile callback.
5282bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
52834e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
5284bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
52857eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Location of '#' in the \#include/\#import directive.
5286bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
52874e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc hashLoc;
5288bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
52897eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Filename as written in the \#include/\#import directive.
5290bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
52914e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  const char *filename;
5292bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
52937eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief The actual file that the \#include/\#import directive resolved to.
5294bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5295dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXFile file;
52964e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  int isImport;
52974e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  int isAngled;
52988d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis  /**
52998d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis   * \brief Non-zero if the directive was automatically turned into a module
53008d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis   * import.
53018d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis   */
53028d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis  int isModuleImport;
53034e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxIncludedFileInfo;
53044e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5305bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
53067eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#importedASTFile.
5307bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
53084e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
53092c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis  /**
53102c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   * \brief Top level AST file containing the imported PCH, module or submodule.
53112c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   */
53124e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXFile file;
5313bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5314134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis   * \brief The imported module or NULL if the AST file is a PCH.
5315bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5316134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis  CXModule module;
5317bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5318134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis   * \brief Location where the file is imported. Applicable only for modules.
5319bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5320134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis  CXIdxLoc loc;
53212c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis  /**
53222c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   * \brief Non-zero if an inclusion directive was automatically turned into
5323134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis   * a module import. Applicable only for modules.
53242c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   */
532537f2f52fbc16b0d426d4d86c7e1662e5c6b9e3b8Argyrios Kyrtzidis  int isImplicit;
53262c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis
53274e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxImportedASTFileInfo;
53284e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5329dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum {
5330dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Unexposed     = 0,
5331dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Typedef       = 1,
5332dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Function      = 2,
5333dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Variable      = 3,
5334dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Field         = 4,
5335dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_EnumConstant  = 5,
53364e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5337dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_ObjCClass     = 6,
5338dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_ObjCProtocol  = 7,
5339dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_ObjCCategory  = 8,
53404e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5341c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCInstanceMethod = 9,
5342c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCClassMethod    = 10,
5343c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCProperty  = 11,
5344c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCIvar      = 12,
53454e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5346c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_Enum          = 13,
5347c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_Struct        = 14,
5348c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_Union         = 15,
53492957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
53502957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXClass              = 16,
53512957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXNamespace          = 17,
53522957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXNamespaceAlias     = 18,
53532957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXStaticVariable     = 19,
53542957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXStaticMethod       = 20,
53552957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXInstanceMethod     = 21,
535617d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos  CXIdxEntity_CXXConstructor        = 22,
535717d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos  CXIdxEntity_CXXDestructor         = 23,
535817d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos  CXIdxEntity_CXXConversionFunction = 24,
535917d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos  CXIdxEntity_CXXTypeAlias          = 25,
536017d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos  CXIdxEntity_CXXInterface          = 26
536117d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos
536217d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos} CXIdxEntityKind;
536317d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos
5364838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidistypedef enum {
5365838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_None = 0,
5366838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_C    = 1,
5367838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_ObjC = 2,
5368838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_CXX  = 3
5369838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis} CXIdxEntityLanguage;
5370838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis
53712957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
53722957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Extra C++ template information for an entity. This can apply to:
53732957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_Function
53742957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXClass
53752957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXStaticMethod
53762957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXInstanceMethod
53772957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConstructor
53782957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConversionFunction
53792957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXTypeAlias
53802957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
53812957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef enum {
53822957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_NonTemplate   = 0,
53832957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_Template      = 1,
53842957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_TemplatePartialSpecialization = 2,
53852957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_TemplateSpecialization = 3
53862957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxEntityCXXTemplateKind;
53872957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
5388b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef enum {
5389b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_Unexposed     = 0,
5390b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_IBAction      = 1,
5391b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_IBOutlet      = 2,
5392b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_IBOutletCollection = 3
5393b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrKind;
5394b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
5395b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct {
5396b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttrKind kind;
5397b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXCursor cursor;
5398b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxLoc loc;
5399b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrInfo;
5400b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
5401b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct {
5402643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXIdxEntityKind kind;
5403643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXIdxEntityCXXTemplateKind templateKind;
5404643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXIdxEntityLanguage lang;
5405643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  const char *name;
5406643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  const char *USR;
5407643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXCursor cursor;
5408643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  const CXIdxAttrInfo *const *attributes;
5409643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  unsigned numAttributes;
5410643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxEntityInfo;
5411643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis
5412643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct {
5413643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXCursor cursor;
5414643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxContainerInfo;
5415643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis
5416643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct {
5417b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  const CXIdxAttrInfo *attrInfo;
5418b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  const CXIdxEntityInfo *objcClass;
5419b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXCursor classCursor;
5420b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxLoc classLoc;
5421b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxIBOutletCollectionAttrInfo;
5422b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
5423838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidistypedef enum {
5424838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis  CXIdxDeclFlag_Skipped = 0x1
5425838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis} CXIdxDeclInfoFlags;
5426838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis
54274e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
54286ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *entityInfo;
5429dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXCursor cursor;
5430dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxLoc loc;
5431b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  const CXIdxContainerInfo *semanticContainer;
5432b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  /**
54337eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Generally same as #semanticContainer but can be different in
5434b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis   * cases like out-of-line C++ member functions.
5435b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis   */
5436b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  const CXIdxContainerInfo *lexicalContainer;
5437dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  int isRedeclaration;
54384e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  int isDefinition;
5439c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  int isContainer;
54402957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxContainerInfo *declAsContainer;
5441c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  /**
5442c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis   * \brief Whether the declaration exists in code or was created implicitly
5443c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis   * by the compiler, e.g. implicit objc methods for properties.
5444c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis   */
5445c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  int isImplicit;
5446b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  const CXIdxAttrInfo *const *attributes;
5447b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  unsigned numAttributes;
5448838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis
5449838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis  unsigned flags;
5450838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis
5451dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxDeclInfo;
54524e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5453dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum {
5454dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainer_ForwardRef = 0,
5455dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainer_Interface = 1,
5456dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainer_Implementation = 2
5457dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerKind;
54584e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
54594e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
54606ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxDeclInfo *declInfo;
5461dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainerKind kind;
5462dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerDeclInfo;
54634e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
54644e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
54656ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *base;
54666ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  CXCursor cursor;
54674e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc loc;
54686ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis} CXIdxBaseClassInfo;
54694e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
54704e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
54716ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *protocol;
54726ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  CXCursor cursor;
54734e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc loc;
54744e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxObjCProtocolRefInfo;
54754e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
54764e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
54776ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxObjCProtocolRefInfo *const *protocols;
54784e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  unsigned numProtocols;
5479c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCProtocolRefListInfo;
54804e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
54814e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
5482c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  const CXIdxObjCContainerDeclInfo *containerInfo;
5483c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  const CXIdxBaseClassInfo *superInfo;
5484c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  const CXIdxObjCProtocolRefListInfo *protocols;
5485c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCInterfaceDeclInfo;
54864e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
54872957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef struct {
5488c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  const CXIdxObjCContainerDeclInfo *containerInfo;
5489c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  const CXIdxEntityInfo *objcClass;
5490c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  CXCursor classCursor;
5491c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  CXIdxLoc classLoc;
5492c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  const CXIdxObjCProtocolRefListInfo *protocols;
5493c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis} CXIdxObjCCategoryDeclInfo;
5494c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis
5495c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidistypedef struct {
54962957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxDeclInfo *declInfo;
5497792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis  const CXIdxEntityInfo *getter;
5498792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis  const CXIdxEntityInfo *setter;
5499792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis} CXIdxObjCPropertyDeclInfo;
5500792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis
5501792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidistypedef struct {
5502792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis  const CXIdxDeclInfo *declInfo;
55032957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxBaseClassInfo *const *bases;
55042957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  unsigned numBases;
55052957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxCXXClassDeclInfo;
55062957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
5507bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
55087eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#indexEntityReference.
5509bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
5510aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidistypedef enum {
5511bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5512bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief The entity is referenced directly in user's code.
5513bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5514aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis  CXIdxEntityRef_Direct = 1,
5515bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5516b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * \brief An implicit reference, e.g. a reference of an ObjC method via the
5517b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * dot syntax.
5518bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5519b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxEntityRef_Implicit = 2
5520aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis} CXIdxEntityRefKind;
5521aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis
5522bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
55237eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#indexEntityReference.
5524bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
55254e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
5526b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  CXIdxEntityRefKind kind;
5527bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5528bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Reference cursor.
5529bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
55304e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXCursor cursor;
55314e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc loc;
5532bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5533bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief The entity that gets referenced.
5534bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
55356ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *referencedEntity;
5536bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5537bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Immediate "parent" of the reference. For example:
5538bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   *
5539bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \code
5540bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * Foo *var;
5541bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \endcode
5542bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   *
5543bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * The parent of reference of type 'Foo' is the variable 'var'.
5544e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis   * For references inside statement bodies of functions/methods,
5545e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis   * the parentEntity will be the function/method.
5546bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
55476ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *parentEntity;
5548bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5549e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis   * \brief Lexical container context of the reference.
5550bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
55512957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxContainerInfo *container;
55524e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxEntityRefInfo;
55534e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
55547eee0184570366285589d788bcd7f5dda8345915James Dennett/**
55557eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief A group of callbacks used by #clang_indexSourceFile and
55567eee0184570366285589d788bcd7f5dda8345915James Dennett * #clang_indexTranslationUnit.
55577eee0184570366285589d788bcd7f5dda8345915James Dennett */
55584e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
5559bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
55606ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis   * \brief Called periodically to check whether indexing should be aborted.
55616ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis   * Should return 0 to continue, and non-zero to abort.
55626ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis   */
55636ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  int (*abortQuery)(CXClientData client_data, void *reserved);
55646ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis
55656ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  /**
5566b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * \brief Called at the end of indexing; passes the complete diagnostic set.
5567bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
55684e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  void (*diagnostic)(CXClientData client_data,
5569b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis                     CXDiagnosticSet, void *reserved);
55704e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5571dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientFile (*enteredMainFile)(CXClientData client_data,
55727eee0184570366285589d788bcd7f5dda8345915James Dennett                                     CXFile mainFile, void *reserved);
5573dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis
5574bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
55757eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Called when a file gets \#included/\#imported.
5576bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5577dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientFile (*ppIncludedFile)(CXClientData client_data,
55786ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                                    const CXIdxIncludedFileInfo *);
55794e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5580bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5581bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Called when a AST file (PCH or module) gets imported.
5582bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   *
5583bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * AST files will not get indexed (there will not be callbacks to index all
5584bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * the entities in an AST file). The recommended action is that, if the AST
55852c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   * file is not already indexed, to initiate a new indexing job specific to
55862c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   * the AST file.
5587bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5588dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientASTFile (*importedASTFile)(CXClientData client_data,
55896ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                                        const CXIdxImportedASTFileInfo *);
55904e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5591bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5592bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Called at the beginning of indexing a translation unit.
5593bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5594dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data,
55956ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                                                 void *reserved);
55964e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
55976ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  void (*indexDeclaration)(CXClientData client_data,
55982957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis                           const CXIdxDeclInfo *);
55994e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5600bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5601bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Called to index a reference of an entity.
5602bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
56034e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  void (*indexEntityReference)(CXClientData client_data,
56046ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                               const CXIdxEntityRefInfo *);
56054e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
56064e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} IndexerCallbacks;
56074e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5608ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind);
56096ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCContainerDeclInfo *
56106ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *);
56116ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis
56126ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo *
56136ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *);
5614dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis
5615ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE
56166ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisconst CXIdxObjCCategoryDeclInfo *
56176ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *);
56186ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis
5619c71d55469e7d5f7b376a30620617a175a9442da9Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo *
5620c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidisclang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *);
5621dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis
5622792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo *
5623792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidisclang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *);
5624792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis
5625b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo *
5626b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidisclang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *);
5627b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
56282957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxCXXClassDeclInfo *
56292957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *);
56302957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
56312957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
56322957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientContainer attached to a
56332957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container.
56342957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
56352957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientContainer
56362957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientContainer(const CXIdxContainerInfo *);
56372957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
56382957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
56392957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientContainer attached to a
56402957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container.
56412957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
56422957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void
56432957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer);
56442957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
56452957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
56462957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientEntity attached to an entity.
56472957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
56482957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientEntity
56492957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientEntity(const CXIdxEntityInfo *);
56502957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
56512957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
56522957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientEntity attached to an entity.
56532957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
56542957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void
56552957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity);
56562957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
56572957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
5658838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * \brief An indexing action/session, to be applied to one or multiple
5659838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * translation units.
56602957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
56612957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIndexAction;
56622957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
56632957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
5664838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * \brief An indexing action/session, to be applied to one or multiple
5665838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * translation units.
56662957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis *
56672957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \param CIdx The index object with which the index action will be associated.
56682957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
56692957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx);
56702957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
56712957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
56722957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Destroy the given index action.
56732957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis *
56742957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * The index action must not be destroyed until all of the translation units
56752957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * created within that index action have been destroyed.
56762957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
56772957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction);
56782957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
567921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidistypedef enum {
568021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis  /**
568121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis   * \brief Used to indicate that no special indexing options are needed.
568221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis   */
568321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis  CXIndexOpt_None = 0x0,
568421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis
568521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis  /**
56867eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Used to indicate that IndexerCallbacks#indexEntityReference should
56877eee0184570366285589d788bcd7f5dda8345915James Dennett   * be invoked for only one reference of an entity per source file that does
56887eee0184570366285589d788bcd7f5dda8345915James Dennett   * not also include a declaration/definition of the entity.
568921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis   */
569022490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis  CXIndexOpt_SuppressRedundantRefs = 0x1,
569122490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis
569222490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis  /**
569322490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis   * \brief Function-local symbols should be indexed. If this is not set
569422490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis   * function-local symbols will be ignored.
569522490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis   */
569658d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis  CXIndexOpt_IndexFunctionLocalSymbols = 0x2,
569758d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis
569858d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis  /**
569958d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis   * \brief Implicit function/class template instantiations should be indexed.
570058d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis   * If this is not set, implicit instantiations will be ignored.
570158d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis   */
5702b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis  CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4,
5703b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis
5704b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis  /**
5705b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis   * \brief Suppress all compiler warnings when parsing for indexing.
5706b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis   */
5707838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis  CXIndexOpt_SuppressWarnings = 0x8,
5708838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis
5709838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis  /**
5710838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis   * \brief Skip a function/method body that was already parsed during an
5711838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis   * indexing session assosiated with a \c CXIndexAction object.
5712838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis   * Bodies in system headers are always skipped.
5713838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis   */
5714838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis  CXIndexOpt_SkipParsedBodiesInSession = 0x10
5715838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis
571621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis} CXIndexOptFlags;
571721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis
5718bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
5719bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Index the given source file and the translation unit corresponding
57207eee0184570366285589d788bcd7f5dda8345915James Dennett * to that file via callbacks implemented through #IndexerCallbacks.
5721bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
5722bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param client_data pointer data supplied by the client, which will
5723bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * be passed to the invoked callbacks.
5724bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
5725bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param index_callbacks Pointer to indexing callbacks that the client
5726bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * implements.
5727bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
57287eee0184570366285589d788bcd7f5dda8345915James Dennett * \param index_callbacks_size Size of #IndexerCallbacks structure that gets
5729bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * passed in index_callbacks.
5730bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
573121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \param index_options A bitmask of options that affects how indexing is
573221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags.
5733bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
5734bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param out_TU [out] pointer to store a CXTranslationUnit that can be reused
5735bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * after indexing is finished. Set to NULL if you do not require it.
5736bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
573721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns
5738bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * non-zero, otherwise returns 0.
573921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
57407eee0184570366285589d788bcd7f5dda8345915James Dennett * The rest of the parameters are the same as #clang_parseTranslationUnit.
5741bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
57422957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction,
57434e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         CXClientData client_data,
57444e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         IndexerCallbacks *index_callbacks,
57454e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned index_callbacks_size,
57464e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned index_options,
57474e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         const char *source_filename,
57484e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         const char * const *command_line_args,
57494e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         int num_command_line_args,
57504e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         struct CXUnsavedFile *unsaved_files,
57514e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned num_unsaved_files,
57524e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         CXTranslationUnit *out_TU,
57534e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned TU_options);
57544e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5755bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
575621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \brief Index the given translation unit via callbacks implemented through
57577eee0184570366285589d788bcd7f5dda8345915James Dennett * #IndexerCallbacks.
575821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
575921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * The order of callback invocations is not guaranteed to be the same as
576021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * when indexing a source file. The high level order will be:
576121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
576221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *   -Preprocessor callbacks invocations
576321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *   -Declaration/reference callbacks invocations
576421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *   -Diagnostic callback invocations
576521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
57667eee0184570366285589d788bcd7f5dda8345915James Dennett * The parameters are the same as #clang_indexSourceFile.
576721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
576821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns
576921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * non-zero, otherwise returns 0.
577021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */
57712957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction,
577221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis                                              CXClientData client_data,
577321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis                                              IndexerCallbacks *index_callbacks,
577421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis                                              unsigned index_callbacks_size,
57752957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis                                              unsigned index_options,
57762957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis                                              CXTranslationUnit);
577721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis
577821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis/**
5779bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXIdxFile, file, line, column, and offset represented by
5780bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * the given CXIdxLoc.
5781bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
5782bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * If the location refers into a macro expansion, retrieves the
5783bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * location of the macro expansion and if it refers into a macro argument
5784bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * retrieves the location of the argument.
5785bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
57864e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc,
5787dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis                                                   CXIdxClientFile *indexFile,
57884e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   CXFile *file,
57894e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   unsigned *line,
57904e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   unsigned *column,
57914e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   unsigned *offset);
57924e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5793bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
5794bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXSourceLocation represented by the given CXIdxLoc.
5795bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
57964e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE
57974e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc);
57984e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5799aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/**
5800aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @}
5801aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */
5802aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5803c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
5804c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
5805c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
58061efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
5807d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus
5808d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek}
5809d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
5810d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
5811d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
5812