Index.h revision 4522f63e00fa6f1276b1d29763a9a4f46f46b6a1
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
354522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios Kyrtzidis#define CINDEX_VERSION_MINOR 17
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
1906b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek  CXCursor_LastExpr                      = CXCursor_ObjCBoolLiteralExpr,
19071efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1908c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Statements */
1909c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstStmt                     = 200,
1910c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1911c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A statement whose specific kind is not exposed via this
1912c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * interface.
1913c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1914c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * Unexposed statements have the same operations as any other kind of
1915c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * statement; one can extract their location information, spelling,
1916c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * children, etc. However, the specific kind of the statement is not
1917c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * reported.
1918c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1919c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnexposedStmt                 = 200,
192036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor
192136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  /** \brief A labelled statement in a function.
192236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
192336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * This cursor kind is used to describe the "start_over:" label statement in
192436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * the following example:
192536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
192636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \code
192736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *   start_over:
192836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *     ++counter;
192936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \endcode
193036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
193136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   */
193236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  CXCursor_LabelStmt                     = 201,
193342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
193442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A group of statements like { stmt stmt }.
193542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
193642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This cursor kind is used to describe compound statements, e.g. function
193742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * bodies.
193842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
193942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CompoundStmt                  = 202,
194042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
194142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A case statment.
194242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
194342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CaseStmt                      = 203,
194442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
194542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A default statement.
194642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
194742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DefaultStmt                   = 204,
194842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
194942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An if statement
195042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
195142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IfStmt                        = 205,
195242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
195342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A switch statement.
195442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
195542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SwitchStmt                    = 206,
195642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
195742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A while statement.
195842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
195942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_WhileStmt                     = 207,
196042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
196142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A do statement.
196242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
196342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DoStmt                        = 208,
196442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
196542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A for statement.
196642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
196742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ForStmt                       = 209,
196842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
196942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A goto statement.
197042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
197142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_GotoStmt                      = 210,
197242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
197342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An indirect goto statement.
197442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
197542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IndirectGotoStmt              = 211,
197642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
197742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A continue statement.
197842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
197942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ContinueStmt                  = 212,
198042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
198142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A break statement.
198242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
198342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_BreakStmt                     = 213,
198442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
198542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A return statement.
198642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
198742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ReturnStmt                    = 214,
198842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
1989df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier  /** \brief A GCC inline assembly statement extension.
199042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
1991df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier  CXCursor_GCCAsmStmt                    = 215,
19925e02f6525d109c42650575c352bd2fdb14ed4193Argyrios Kyrtzidis  CXCursor_AsmStmt                       = CXCursor_GCCAsmStmt,
199342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
19947eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief Objective-C's overall \@try-\@catch-\@finally statement.
199542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
199642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtTryStmt                 = 216,
199742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
19987eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief Objective-C's \@catch statement.
199942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
200042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtCatchStmt               = 217,
200142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20027eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief Objective-C's \@finally statement.
200342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
200442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtFinallyStmt             = 218,
200542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20067eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief Objective-C's \@throw statement.
200742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
200842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtThrowStmt               = 219,
200942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20107eee0184570366285589d788bcd7f5dda8345915James Dennett  /** \brief Objective-C's \@synchronized statement.
201142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
201242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtSynchronizedStmt        = 220,
201342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
201442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's autorelease pool statement.
201542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
201642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAutoreleasePoolStmt       = 221,
201742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
201842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's collection statement.
201942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
202042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCForCollectionStmt         = 222,
202142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
202242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s catch statement.
202342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
202442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXCatchStmt                  = 223,
202542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
202642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s try statement.
202742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
202842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXTryStmt                    = 224,
202942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
203042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s for (* : *) statement.
203142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
203242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXForRangeStmt               = 225,
203342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
203442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's try statement.
203542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
203642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHTryStmt                    = 226,
203742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
203842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's except statement.
203942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
204042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHExceptStmt                 = 227,
204142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
204242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's finally statement.
204342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
204442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHFinallyStmt                = 228,
204542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20468cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier  /** \brief A MS inline assembly statement extension.
20478cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier   */
20488cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier  CXCursor_MSAsmStmt                     = 229,
20498cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier
205042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief The null satement ";": C99 6.8.3p3.
205142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
205242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This cursor kind is used to describe the null statement.
205342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
205442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_NullStmt                      = 230,
205542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
205642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Adaptor class for mixing declarations with statements and
205742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * expressions.
205842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
205942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DeclStmt                      = 231,
206042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
20614c5fa4292a2ae1fd69c8b984543519c4f119c540Joao Matos  CXCursor_LastStmt                      = CXCursor_DeclStmt,
20621efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2063c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
2064c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Cursor that represents the translation unit itself.
2065c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
2066c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * The translation unit cursor exists primarily to act as the root
2067c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * cursor for traversing the contents of a translation unit.
2068c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
2069e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_TranslationUnit               = 300,
2070e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek
2071ad017fa7a4df7389d245d02a49b3c79ed70bedb9Bill Wendling  /* Attributes */
2072e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_FirstAttr                     = 400,
2073e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  /**
2074e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   * \brief An attribute whose specific kind is not exposed via this
2075e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   * interface.
2076e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   */
2077e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_UnexposedAttr                 = 400,
2078e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek
2079e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_IBActionAttr                  = 401,
2080e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_IBOutletAttr                  = 402,
2081857e918a8a40deb128840308a318bf623d68295fTed Kremenek  CXCursor_IBOutletCollectionAttr        = 403,
20826639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis  CXCursor_CXXFinalAttr                  = 404,
20836639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis  CXCursor_CXXOverrideAttr               = 405,
20845f1c822def3efffe1d8f7299fbbbc3b1cdd4833dErik Verbruggen  CXCursor_AnnotateAttr                  = 406,
208584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCursor_AsmLabelAttr                  = 407,
208684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCursor_LastAttr                      = CXCursor_AsmLabelAttr,
20879f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor
20889f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  /* Preprocessing */
20899f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  CXCursor_PreprocessingDirective        = 500,
2090572feb2a190b5e8b04fb06c4ac50ee0f61e93ff0Douglas Gregor  CXCursor_MacroDefinition               = 501,
20919b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth  CXCursor_MacroExpansion                = 502,
20929b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth  CXCursor_MacroInstantiation            = CXCursor_MacroExpansion,
2093ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor  CXCursor_InclusionDirective            = 503,
20949f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  CXCursor_FirstPreprocessing            = CXCursor_PreprocessingDirective,
20956a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  CXCursor_LastPreprocessing             = CXCursor_InclusionDirective,
20966a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis
20976a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  /* Extra Declarations */
20986a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  /**
20996a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis   * \brief A module import declaration.
21006a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis   */
21016a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  CXCursor_ModuleImportDecl              = 600,
21026a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  CXCursor_FirstExtraDecl                = CXCursor_ModuleImportDecl,
21036a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis  CXCursor_LastExtraDecl                 = CXCursor_ModuleImportDecl
2104c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor};
2105c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2106c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2107c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A cursor representing some element in the abstract syntax tree for
2108c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a translation unit.
2109c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
21101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The cursor abstraction unifies the different kinds of entities in a
2111c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * program--declaration, statements, expressions, references to declarations,
2112c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * etc.--under a single "cursor" abstraction with a common set of operations.
2113c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Common operation for a cursor include: getting the physical location in
2114c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a source file where the cursor points, getting the name associated with a
2115c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor, and retrieving cursors for any child nodes of a particular cursor.
2116c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2117c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors can be produced in two specific ways.
2118c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_getTranslationUnitCursor() produces a cursor for a translation unit,
2119c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * from which one can use clang_visitChildren() to explore the rest of the
2120c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * translation unit. clang_getCursor() maps from a physical source location
2121c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to the entity that resides at that location, allowing one to map from the
2122c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * source code into the AST.
2123c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2124c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregortypedef struct {
2125c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  enum CXCursorKind kind;
2126aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  int xdata;
212767812b2f94f4b5e7d2596db1705ffa1149ddc45aDmitri Gribenko  const void *data[3];
21281efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar} CXCursor;
2129c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2130c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2131ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A comment AST node.
2132ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
2133ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkotypedef struct {
2134e4330a302ac20b41b9800267ebd4b5b01f8553f8Dmitri Gribenko  const void *ASTNode;
2135e4330a302ac20b41b9800267ebd4b5b01f8553f8Dmitri Gribenko  CXTranslationUnit TranslationUnit;
2136ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko} CXComment;
2137ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
2138ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
2139c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations
2140c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2141c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
2142c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
21431efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2144c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2145c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the NULL cursor, which represents no entity.
2146c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2147c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getNullCursor(void);
21481efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2149c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2150c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the cursor that represents the given translation unit.
2151c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2152c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The translation unit cursor can be used to start traversing the
2153c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * various declarations within the given translation unit.
2154c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2155c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
2156c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2157c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2158c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether two cursors are equivalent.
2159c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2160c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
21611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2162c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
21631824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko * \brief Returns non-zero if \p cursor is null.
2164b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */
21651824d54df85a462ada812dadda18130f951d40f3Dmitri GribenkoCINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor);
2166b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis
2167b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/**
21689ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor * \brief Compute a hash value for the given cursor.
21699ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor */
21709ce5584553054d0cb934940586aca0186e87fa57Douglas GregorCINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);
21719ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor
21729ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor/**
2173c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the kind of the given cursor.
2174c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2175c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
2176c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2177c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2178c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a declaration.
2179c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2180c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
2181c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2182c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2183c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a simple
2184c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * reference.
2185c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2186c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Note that other kinds of cursors (such as expressions) can also refer to
2187c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * other cursors. Use clang_getCursorReferenced() to determine whether a
2188c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * particular cursor refers to another entity.
2189c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2190c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind);
2191c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2192c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2193c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents an expression.
2194c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2195c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind);
2196c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2197c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2198c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a statement.
2199c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2200c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind);
2201c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2202c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
22038be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor * \brief Determine whether the given cursor kind represents an attribute.
22048be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor */
22058be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas GregorCINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind);
22068be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor
22078be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor/**
22081efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents an invalid
2209c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor.
22101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar */
2211c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind);
2212c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2213c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
22141efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents a translation
22151efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unit.
2216c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2217c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind);
22181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2219ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek/***
22209f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * \brief Determine whether the given cursor represents a preprocessing
22219f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * element, such as a preprocessor directive or macro instantiation.
22229f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor */
22239f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas GregorCINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind);
22249f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor
22259f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor/***
2226ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek * \brief Determine whether the given cursor represents a currently
2227ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek *  unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
2228ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek */
2229ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted KremenekCINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind);
2230ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek
2231c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
223216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * \brief Describe the linkage of the entity referred to by a cursor.
223316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */
223416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenekenum CXLinkageKind {
223516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This value indicates that no linkage information is available
223616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * for a provided CXCursor. */
223716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_Invalid,
223816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /**
223916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * \brief This is the linkage for variables, parameters, and so on that
224016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   *  have automatic storage.  This covers normal (non-extern) local variables.
224116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   */
224216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_NoLinkage,
224316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for static variables and static functions. */
224416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_Internal,
224516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for entities with external linkage that live
224616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * in C++ anonymous namespaces.*/
224716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_UniqueExternal,
224816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for entities with true, external linkage. */
224916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_External
225016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek};
225116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek
225216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/**
225345e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the linkage of the entity referred to by a given cursor.
225416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */
225516b4259aecaa22b642d35d36fd89965ed700c1e0Ted KremenekCINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
225616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek
225716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/**
2258cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to,
2259cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * taking the current target platform into account.
226058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
226158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param cursor The cursor to query.
226258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
226358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the cursor.
226458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */
226558ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind
226658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCursorAvailability(CXCursor cursor);
226758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
226858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/**
2269cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * Describes the availability of a given entity on a particular platform, e.g.,
2270cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * a particular class might only be available on Mac OS 10.7 or newer.
2271cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */
2272cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregortypedef struct CXPlatformAvailability {
2273cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2274cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief A string that describes the platform for which this structure
2275cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * provides availability information.
2276cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   *
2277cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * Possible values are "ios" or "macosx".
2278cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2279cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  CXString Platform;
2280cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2281cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief The version number in which this entity was introduced.
2282cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2283cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  CXVersion Introduced;
2284cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2285cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief The version number in which this entity was deprecated (but is
2286cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * still available).
2287cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2288cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  CXVersion Deprecated;
2289cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2290cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief The version number in which this entity was obsoleted, and therefore
2291cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * is no longer available.
2292cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2293cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  CXVersion Obsoleted;
2294cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2295cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief Whether the entity is unconditionally unavailable on this platform.
2296cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2297cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  int Unavailable;
2298cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  /**
2299cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * \brief An optional message to provide to a user of this API, e.g., to
2300cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   * suggest replacement APIs.
2301cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor   */
2302cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor  CXString Message;
2303cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor} CXPlatformAvailability;
2304cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor
2305cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/**
2306cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to
2307cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * on any platforms for which availability information is known.
2308cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2309cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param cursor The cursor to query.
2310cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2311cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param always_deprecated If non-NULL, will be set to indicate whether the
2312cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * entity is deprecated on all platforms.
2313cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2314cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param deprecated_message If non-NULL, will be set to the message text
2315cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * provided along with the unconditional deprecation of this entity. The client
2316cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * is responsible for deallocating this string.
2317cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
23187eee0184570366285589d788bcd7f5dda8345915James Dennett * \param always_unavailable If non-NULL, will be set to indicate whether the
2319cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * entity is unavailable on all platforms.
2320cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2321cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param unavailable_message If non-NULL, will be set to the message text
2322cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * provided along with the unconditional unavailability of this entity. The
2323cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * client is responsible for deallocating this string.
2324cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2325cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param availability If non-NULL, an array of CXPlatformAvailability instances
2326cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * that will be populated with platform availability information, up to either
2327cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * the number of platforms for which availability information is available (as
2328cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * returned by this function) or \c availability_size, whichever is smaller.
2329cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2330cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param availability_size The number of elements available in the
2331cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c availability array.
2332cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2333cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \returns The number of platforms (N) for which availability information is
2334cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * available (which is unrelated to \c availability_size).
2335cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor *
2336cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * Note that the client is responsible for calling
2337cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c clang_disposeCXPlatformAvailability to free each of the
2338cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * platform-availability structures returned. There are
2339cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c min(N, availability_size) such structures.
2340cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */
2341cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas GregorCINDEX_LINKAGE int
2342cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregorclang_getCursorPlatformAvailability(CXCursor cursor,
2343cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    int *always_deprecated,
2344cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    CXString *deprecated_message,
2345cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    int *always_unavailable,
2346cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    CXString *unavailable_message,
2347cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    CXPlatformAvailability *availability,
2348cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor                                    int availability_size);
2349cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor
2350cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/**
2351cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Free the memory associated with a \c CXPlatformAvailability structure.
2352cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */
2353cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas GregorCINDEX_LINKAGE void
2354cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregorclang_disposeCXPlatformAvailability(CXPlatformAvailability *availability);
2355cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor
2356cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/**
235745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Describe the "language" of the entity referred to by a cursor.
235845e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */
235945e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind {
23606cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek  CXLanguage_Invalid = 0,
236145e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek  CXLanguage_C,
236245e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek  CXLanguage_ObjC,
23636cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek  CXLanguage_CPlusPlus
236445e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek};
236545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek
236645e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/**
236745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the "language" of the entity referred to by a given cursor.
236845e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */
236945e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor);
237045e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek
2371b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/**
2372b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis * \brief Returns the translation unit that a cursor originated from.
2373b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */
2374b0d6eaa6b646c18c49923aefc76973801f561701Argyrios KyrtzidisCINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor);
2375b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis
2376eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2377eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2378eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief A fast container representing a set of CXCursors.
2379eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */
2380eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenektypedef struct CXCursorSetImpl *CXCursorSet;
2381eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2382eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2383eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Creates an empty CXCursorSet.
2384eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */
2385f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void);
2386eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2387eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2388eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Disposes a CXCursorSet and releases its associated memory.
2389eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */
2390eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset);
2391eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2392eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2393eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Queries a CXCursorSet to see if it contains a specific CXCursor.
2394eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek *
2395eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \returns non-zero if the set contains the specified cursor.
2396eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek*/
2397eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset,
2398eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek                                                   CXCursor cursor);
2399eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2400eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2401eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Inserts a CXCursor into a CXCursorSet.
2402eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek *
2403eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \returns zero if the CXCursor was already in the set, and non-zero otherwise.
2404eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek*/
2405eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,
2406eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek                                                 CXCursor cursor);
2407eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
24082be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/**
24092be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the semantic parent of the given cursor.
24102be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24112be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The semantic parent of a cursor is the cursor that semantically contains
24122be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the given \p cursor. For many declarations, the lexical and semantic parents
24132be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the lexical parent is returned by
24142be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorLexicalParent()). They diverge when declarations or
24152be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example:
24162be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24172be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code
24182be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C {
24192be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *  void f();
24202be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * };
24212be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24222be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { }
24232be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode
24242be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24252be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the
24262be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is
24272be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this
24282be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the
24292be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics
24302be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the
24312be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration,
24322be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations
24332be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context.
24342be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24352be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their
24362be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C
24372be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit.
24383910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor *
24393910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For global declarations, the semantic parent is the translation unit.
24402be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */
24412be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor);
24422be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor
24432be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/**
24442be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the lexical parent of the given cursor.
24452be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24462be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The lexical parent of a cursor is the cursor in which the given \p cursor
24472be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * was actually written. For many declarations, the lexical and semantic parents
24482be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the semantic parent is returned by
24492be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorSemanticParent()). They diverge when declarations or
24502be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example:
24512be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24522be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code
24532be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C {
24542be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *  void f();
24552be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * };
24562be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24572be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { }
24582be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode
24592be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24602be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the
24612be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is
24622be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this
24632be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the
24642be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics
24652be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the
24662be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration,
24672be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations
24682be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context.
24692be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
24702be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their
24712be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C
24722be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit.
24733910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor *
24743910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For declarations written in the global scope, the lexical parent is
24753910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * the translation unit.
24762be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */
24772be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor);
24789f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
24799f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/**
24809f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Determine the set of methods that are overridden by the given
24819f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method.
24829f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
24839f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In both Objective-C and C++, a method (aka virtual member function,
24849f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * in C++) can override a virtual method in a base class. For
24859f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * Objective-C, a method is said to override any method in the class's
2486044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * base class, its protocols, or its categories' protocols, that has the same
2487044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * selector and is of the same kind (class or instance).
2488044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * If no such method exists, the search continues to the class's superclass,
2489044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * its protocols, and its categories, and so on. A method from an Objective-C
2490044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * implementation is considered to override the same methods as its
2491044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * corresponding method in the interface.
24929f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
24939f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * For C++, a virtual member function overrides any virtual member
24949f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * function with the same signature that occurs in its base
24959f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * classes. With multiple inheritance, a virtual member function can
24969f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * override several virtual member functions coming from different
24979f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * base classes.
24989f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
24999f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In all cases, this function determines the immediate overridden
25009f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method, rather than all of the overridden methods. For example, if
25019f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * a method is originally declared in a class A, then overridden in B
25029f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * (which in inherits from A) and also in C (which inherited from B),
25039f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * then the only overridden method returned from this function when
25049f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoked on C's method will be B's method. The client may then
25059f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoke this function again, given the previously-found overridden
25069f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods, to map out the complete method-override set.
25079f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
25089f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param cursor A cursor representing an Objective-C or C++
25099f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method. This routine will compute the set of methods that this
25109f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method overrides.
25119f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
25129f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param overridden A pointer whose pointee will be replaced with a
25139f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * pointer to an array of cursors, representing the set of overridden
25149f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods. If there are no overridden methods, the pointee will be
25159f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * set to NULL. The pointee must be freed via a call to
25169f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \c clang_disposeOverriddenCursors().
25179f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
25189f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param num_overridden A pointer to the number of overridden
25199f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * functions, will be set to the number of overridden functions in the
25209f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * array pointed to by \p overridden.
25219f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */
25229f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor,
25239f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor                                               CXCursor **overridden,
25249f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor                                               unsigned *num_overridden);
25259f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
25269f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/**
25279f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Free the set of overridden cursors returned by \c
25289f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * clang_getOverriddenCursors().
25299f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */
25309f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden);
25319f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
253245e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/**
2533ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * \brief Retrieve the file that is included by the given inclusion directive
2534ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * cursor.
2535ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor */
2536ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas GregorCINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor);
2537ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor
2538ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor/**
2539c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2540c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
25411efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2542c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2543c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code
2544c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2545c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors represent a location within the Abstract Syntax Tree (AST). These
2546c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines help map between cursors and the physical locations where the
2547c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * described entities occur in the source code. The mapping is provided in
2548c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * both directions, so one can map from source code to the AST and back.
2549c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2550c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
255150398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */
25521efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
25536a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff/**
2554b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Map a source location to the cursor that describes the entity at that
2555b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * location in the source code.
2556b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
2557b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() maps an arbitrary source location within a translation
2558b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * unit down to the most specific cursor that describes the entity at that
25591efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * location. For example, given an expression \c x + y, invoking
2560b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() with a source location pointing to "x" will return the
25611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * cursor for "x"; similarly for "y". If the cursor points anywhere between
2562b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
2563b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * will return a cursor referring to the "+" expression.
2564b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
2565b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns a cursor representing the entity at the given source location, or
2566b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * a NULL cursor if no such entity can be found.
25676a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff */
2568b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation);
25691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
257098258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor/**
257198258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * \brief Retrieve the physical location of the source constructor referenced
257298258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * by the given cursor.
257398258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor *
257498258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * The location of a declaration is typically the location of the name of that
25751efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * declaration, where the name of that declaration would occur if it is
25761efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unnamed, or some keyword that introduces that particular declaration.
25771efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The location of a reference is where that reference occurs within the
257898258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * source code.
257998258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor */
258098258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor);
2581c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2582b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor/**
2583b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Retrieve the physical extent of the source construct referenced by
2584a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the given cursor.
2585a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor *
2586a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * The extent of a cursor starts with the file/line/column pointing at the
2587a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * first character within the source construct that the cursor refers to and
25881efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * ends with the last character withinin that source construct. For a
2589a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * declaration, the extent covers the declaration itself. For a reference,
2590a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the extent covers the location of the reference (e.g., where the referenced
2591a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * entity was actually used).
2592a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor */
2593a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas GregorCINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor);
2594c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor
2595c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2596c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2597c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
259895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
2599c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
26008e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \defgroup CINDEX_TYPES Type information for CXCursors
26018e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
26028e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @{
26038e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
26048e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26058e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
26068e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Describes the kind of type
26078e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
26088e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenekenum CXTypeKind {
26098e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /**
26108e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * \brief Reprents an invalid type (e.g., where no type is available).
26118e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   */
26128e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Invalid = 0,
26138e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26148e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /**
26158e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * \brief A type whose specific kind is not exposed via this
26168e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * interface.
26178e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   */
26188e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Unexposed = 1,
26198e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26208e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /* Builtin types */
26218e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Void = 2,
26228e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Bool = 3,
26238e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char_U = 4,
26248e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UChar = 5,
26258e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char16 = 6,
26268e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char32 = 7,
26278e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UShort = 8,
26288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UInt = 9,
26298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ULong = 10,
26308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ULongLong = 11,
26318e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UInt128 = 12,
26328e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char_S = 13,
26338e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_SChar = 14,
26348e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_WChar = 15,
26358e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Short = 16,
26368e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Int = 17,
26378e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Long = 18,
26388e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LongLong = 19,
26398e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Int128 = 20,
26408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Float = 21,
26418e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Double = 22,
26428e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LongDouble = 23,
26438e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_NullPtr = 24,
26448e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Overload = 25,
26458e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Dependent = 26,
26468e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCId = 27,
26478e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCClass = 28,
26488e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCSel = 29,
26498e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_FirstBuiltin = CXType_Void,
26508e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LastBuiltin  = CXType_ObjCSel,
26518e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26528e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Complex = 100,
26538e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Pointer = 101,
26548e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_BlockPointer = 102,
26558e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LValueReference = 103,
26568e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_RValueReference = 104,
26578e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Record = 105,
26588e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Enum = 106,
26598e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Typedef = 107,
26608e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCInterface = 108,
266104c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek  CXType_ObjCObjectPointer = 109,
266204c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek  CXType_FunctionNoProto = 110,
26635f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis  CXType_FunctionProto = 111,
266484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXType_ConstantArray = 112,
266584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXType_Vector = 113
26668e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek};
26678e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26688e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
266984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Describes the calling convention of a function type
267084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
267184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidisenum CXCallingConv {
267284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_Default = 0,
267384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_C = 1,
267484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86StdCall = 2,
267584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86FastCall = 3,
267684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86ThisCall = 4,
267784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86Pascal = 5,
267884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_AAPCS = 6,
267984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_AAPCS_VFP = 7,
2680263366f9241366f29ba65b703120f302490c39ffDerek Schuff  CXCallingConv_PnaclCall = 8,
268138980086c0f791e8c23cc882574f18e5b4a87db6Guy Benyei  CXCallingConv_IntelOclBicc = 9,
268284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
268384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_Invalid = 100,
268484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_Unexposed = 200
268584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis};
268684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
268784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
268884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
26898e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief The type of an element in the abstract syntax tree.
26908e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
26918e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
26928e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenektypedef struct {
26938e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  enum CXTypeKind kind;
26948e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  void *data[2];
26958e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek} CXType;
26968e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26978e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
26988e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the type of a CXCursor (if any).
26998e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
27008e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCursorType(CXCursor C);
27018e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
27028e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
2703ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko * \brief Pretty-print the underlying type using the rules of the
2704ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko * language of the translation unit from which it came.
2705ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko *
2706ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko * If the type is invalid, an empty string is returned.
2707ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko */
2708ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri GribenkoCINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT);
2709ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko
2710ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko/**
271184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the underlying type of a typedef declaration.
271284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
271384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference a typedef declaration, an invalid type is
271484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned.
271584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
271684b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C);
271784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
271884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
271984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer type of an enum declaration.
272084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
272184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum declaration, an invalid type is
272284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned.
272384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
272484b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C);
272584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
272684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
272784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as a signed
272884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *  long long.
272984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
273084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned.
273184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor
273284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function.
273384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
273484b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C);
273584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
273684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
273784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as an unsigned
273884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *  long long.
273984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
274084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned.
274184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor
274284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function.
274384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
274484b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C);
274584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
274684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
27471eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko * \brief Retrieve the bit width of a bit field declaration as an integer.
27481eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko *
27491eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko * If a cursor that is not a bit field declaration is passed in, -1 is returned.
27501eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko */
27511eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri GribenkoCINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C);
27521eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko
27531eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko/**
2754d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * \brief Retrieve the number of non-variadic arguments associated with a given
2755d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * cursor.
2756d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis *
2757e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * The number of arguments can be determined for calls as well as for
2758e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * declarations of functions or methods. For other cursors -1 is returned.
2759d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis */
2760d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C);
2761d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis
2762d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis/**
2763d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * \brief Retrieve the argument cursor of a function or method.
2764d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis *
2765e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * The argument cursor can be determined for calls as well as for declarations
2766e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * of functions or methods. For other cursors and for invalid indices, an
2767e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * invalid cursor is returned.
2768d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis */
2769d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i);
2770d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis
2771d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis/**
27727eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether two CXTypes represent the same type.
27738e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
27747eee0184570366285589d788bcd7f5dda8345915James Dennett * \returns non-zero if the CXTypes represent the same type and
27757eee0184570366285589d788bcd7f5dda8345915James Dennett *          zero otherwise.
27768e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
27778e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B);
27788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
27798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
27808e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the canonical type for a CXType.
27818e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
27828e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * Clang's type system explicitly models typedefs and all the ways
27838e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * a specific type can be represented.  The canonical type is the underlying
27848e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * type with all the "sugar" removed.  For example, if 'T' is a typedef
27858e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * for 'int', the canonical type for 'T' would be 'int'.
27868e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
27878e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCanonicalType(CXType T);
27888e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
27898e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
27907eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "const" qualifier set,
27917eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "const" at a
27927eee0184570366285589d788bcd7f5dda8345915James Dennett * different level.
2793e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2794e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T);
2795e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2796e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
27977eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "volatile" qualifier set,
27987eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "volatile" at
27997eee0184570366285589d788bcd7f5dda8345915James Dennett * a different level.
2800e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2801e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T);
2802e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2803e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
28047eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "restrict" qualifier set,
28057eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "restrict" at a
28067eee0184570366285589d788bcd7f5dda8345915James Dennett * different level.
2807e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2808e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T);
2809e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2810e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
28118e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief For pointer types, returns the type of the pointee.
28128e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
28138e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getPointeeType(CXType T);
28148e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
28158e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
28168e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the cursor for the declaration of the given type.
28178e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
28188e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T);
28198e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
28205389f48b24937ad7b4093307128b3cbf25235654David Chisnall/**
28215389f48b24937ad7b4093307128b3cbf25235654David Chisnall * Returns the Objective-C type encoding for the specified declaration.
28225389f48b24937ad7b4093307128b3cbf25235654David Chisnall */
28235389f48b24937ad7b4093307128b3cbf25235654David ChisnallCINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C);
28248e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
28258e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
28268e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the spelling of a given CXTypeKind.
28278e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
28288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K);
28298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
28308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
283184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the calling convention associated with a function type.
283284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
283384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, CXCallingConv_Invalid is returned.
283484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
283584b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T);
283684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
283784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
28389a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek * \brief Retrieve the result type associated with a function type.
283984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
284084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, an invalid type is returned.
284104c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek */
284204c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted KremenekCINDEX_LINKAGE CXType clang_getResultType(CXType T);
284304c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek
284404c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek/**
28457eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Retrieve the number of non-variadic arguments associated with a
28467eee0184570366285589d788bcd7f5dda8345915James Dennett * function type.
284784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
2848d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * If a non-function type is passed in, -1 is returned.
284984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
2850d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE int clang_getNumArgTypes(CXType T);
285184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
285284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
285384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the type of an argument of a function type.
285484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
28557eee0184570366285589d788bcd7f5dda8345915James Dennett * If a non-function type is passed in or the function does not have enough
28567eee0184570366285589d788bcd7f5dda8345915James Dennett * parameters, an invalid type is returned.
285784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
285884b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i);
285984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
286084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
286184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return 1 if the CXType is a variadic function type, and 0 otherwise.
286284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
286384b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T);
286484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
286584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
286684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the result type associated with a given cursor.
286784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
286884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * This only returns a valid type if the cursor refers to a function or method.
28699a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek */
28709a140845438c2fc31e7d48a6dedbc695f4c83c68Ted KremenekCINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C);
28719a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek
28729a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek/**
28733ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek * \brief Return 1 if the CXType is a POD (plain old data) type, and 0
28743ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek *  otherwise.
28753ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek */
28763ce9e7d270e7df86c09c8126b4412d55be7c123bTed KremenekCINDEX_LINKAGE unsigned clang_isPODType(CXType T);
28773ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek
28783ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek/**
287984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the element type of an array, complex, or vector type.
288084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
288184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array, complex, or vector type,
288284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * an invalid type is returned.
288384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
288484b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getElementType(CXType T);
288584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
288684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
288784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the number of elements of an array or vector type.
288884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
288984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array or vector type,
289084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * -1 is returned.
289184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
289284b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getNumElements(CXType T);
289384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
289484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
28955f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * \brief Return the element type of an array type.
28965f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis *
28975f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, an invalid type is returned.
28985f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */
28995f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArrayElementType(CXType T);
29005f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis
29015f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/**
2902bed28ac1d1463adca3ecf24fca5c30646fa9dbb2Sylvestre Ledru * \brief Return the array size of a constant array.
29035f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis *
29045f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, -1 is returned.
29055f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */
29065f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE long long clang_getArraySize(CXType T);
29075f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis
29085f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/**
2909411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief List the possible error codes for \c clang_Type_getSizeOf,
2910411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
2911411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   \c clang_Cursor_getOffsetOf.
2912411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *
2913411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * A value of this enumeration type can be returned if the target type is not
2914411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * a valid argument to sizeof, alignof or offsetof.
2915411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */
2916411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidisenum CXTypeLayoutError {
2917411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  /**
2918411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   * \brief Type is of kind CXType_Invalid.
2919411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   */
2920411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  CXTypeLayoutError_Invalid = -1,
2921411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  /**
2922411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   * \brief The type is an incomplete Type.
2923411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   */
2924411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  CXTypeLayoutError_Incomplete = -2,
2925411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  /**
2926411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   * \brief The type is a dependent Type.
2927411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   */
2928411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  CXTypeLayoutError_Dependent = -3,
2929411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  /**
2930411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   * \brief The type is not a constant size type.
2931411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   */
2932411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  CXTypeLayoutError_NotConstantSize = -4,
2933411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  /**
2934411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   * \brief The Field name is not valid for this record.
2935411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis   */
2936411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis  CXTypeLayoutError_InvalidFieldName = -5
2937411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis};
2938411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis
2939411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/**
2940411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Return the alignment of a type in bytes as per C++[expr.alignof]
2941411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   standard.
2942411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *
2943411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
2944411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
2945411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   is returned.
2946411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
2947411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   returned.
2948411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is not a constant size type,
2949411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   CXTypeLayoutError_NotConstantSize is returned.
2950411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */
2951411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T);
2952411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis
2953411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/**
2954411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Return the size of a type in bytes as per C++[expr.sizeof] standard.
2955411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *
2956411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned.
2957411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete
2958411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   is returned.
2959411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
2960411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   returned.
2961411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */
2962411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T);
2963411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis
2964411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/**
2965411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Return the offset of a field named S in a record of type T in bits
2966411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   as it would be returned by __offsetof__ as per C++11[18.2p4]
2967411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *
2968411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid
2969411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   is returned.
2970411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the field's type declaration is an incomplete type,
2971411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   CXTypeLayoutError_Incomplete is returned.
2972411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the field's type declaration is a dependent type,
2973411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   CXTypeLayoutError_Dependent is returned.
2974411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the field's name S is not found,
2975411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   CXTypeLayoutError_InvalidFieldName is returned.
2976411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */
2977411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S);
2978411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis
2979411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/**
2980411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Returns non-zero if the cursor specifies a Record member that is a
2981411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis *   bitfield.
2982411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */
2983411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C);
2984411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis
2985411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/**
29863064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns 1 if the base class specified by the cursor with kind
29873064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek *   CX_CXXBaseSpecifier is virtual.
29883064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
29893064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor);
29903064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
29913064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
29923064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Represents the C++ access control level to a base class for a
29933064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * cursor with kind CX_CXXBaseSpecifier.
29943064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
29953064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenekenum CX_CXXAccessSpecifier {
29963064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXInvalidAccessSpecifier,
29973064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXPublic,
29983064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXProtected,
29993064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXPrivate
30003064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek};
30013064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
30023064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
300304b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * \brief Returns the access control level for the referenced object.
30045142be6b38f44f3c08a93c7b034b3b527ac702c1Argyrios Kyrtzidis *
300504b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * If the cursor refers to a C++ declaration, its access control level within its
300604b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * parent scope is returned. Otherwise, if the cursor refers to a base specifier or
300704b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * access specifier, the specifier itself is returned.
30083064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
30093064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);
30103064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
30113064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
30121f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Determine the number of overloaded declarations referenced by a
30131f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c CXCursor_OverloadedDeclRef cursor.
30141f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
30151f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried.
30161f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
30171f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns The number of overloaded declarations referenced by \c cursor. If it
30181f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
30191f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */
30201f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor);
30211f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
30221f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/**
30231f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Retrieve a cursor for one of the overloaded declarations referenced
30241f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * by a \c CXCursor_OverloadedDeclRef cursor.
30251f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
30261f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried.
30271f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
30281f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param index The zero-based index into the set of overloaded declarations in
30291f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * the cursor.
30301f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
30311f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns A cursor representing the declaration referenced by the given
30321f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c cursor at the specified \c index. If the cursor does not have an
30331f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * associated set of overloaded declarations, or if the index is out of bounds,
30341f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * returns \c clang_getNullCursor();
30351f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */
30361f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor,
30371f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor                                                unsigned index);
30381f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
30391f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/**
30408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @}
30418e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
304295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
304395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
3044ad72f4dad4cf0fd2b71eb8f4704d2fe7ac58fb44Ted Kremenek * \defgroup CINDEX_ATTRIBUTES Information for attributes
304595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *
304695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @{
304795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
304895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
304995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
305095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
305195f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * \brief For cursors representing an iboutletcollection attribute,
305295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *  this function returns the collection element type.
305395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *
305495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
305595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted KremenekCINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor);
305695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
305795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
305895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @}
305995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
30608e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
30618e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
3062c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors
3063c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3064c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines provide the ability to traverse the abstract syntax tree
3065c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * using cursors.
3066c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3067c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
3068c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
30691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3070c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3071c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes how the traversal of the children of a particular
3072c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor should proceed after visiting a particular child cursor.
3073c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3074c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A value of this enumeration type should be returned by each
3075c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
3076c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
3077c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXChildVisitResult {
3078c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
30791efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief Terminates the cursor traversal.
3080c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
3081c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Break,
30821efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
3083c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Continues the cursor traversal with the next sibling of
3084c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * the cursor just visited, without visiting its children.
3085c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
3086c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Continue,
3087c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
3088c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Recursively traverse the children of this cursor, using
3089c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * the same visitor and client data.
3090c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
3091c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Recurse
3092c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor};
3093c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
3094c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3095c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visitor invoked for each cursor found by a traversal.
3096c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3097c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This visitor function will be invoked for each cursor found by
3098c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren(). Its first argument is the cursor being
3099c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited, its second argument is the parent visitor for that cursor,
3100c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and its third argument is the client data provided to
3101c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren().
3102c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3103c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The visitor should return one of the \c CXChildVisitResult values
3104c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to direct clang_visitCursorChildren().
3105c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
31061efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbartypedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor,
31071efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar                                                   CXCursor parent,
3108c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                                   CXClientData client_data);
3109c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
3110c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3111c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visit the children of a particular cursor.
3112c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3113c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This function visits all the direct children of the given cursor,
3114c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * invoking the given \p visitor function with the cursors of each
3115c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited child. The traversal may be recursive, if the visitor returns
3116c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
3117c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the visitor returns \c CXChildVisit_Break.
3118c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3119c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param parent the cursor whose child may be visited. All kinds of
3120a57259e9d7b30bcce93f0a62eee0488738026172Daniel Dunbar * cursors can be visited, including invalid cursors (which, by
3121c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * definition, have no children).
3122c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3123c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param visitor the visitor function that will be invoked for each
3124c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * child of \p parent.
3125c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3126c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param client_data pointer data supplied by the client, which will
3127c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be passed to the visitor each time it is invoked.
3128c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3129c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \returns a non-zero value if the traversal was terminated
3130c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * prematurely by the visitor returning \c CXChildVisit_Break.
3131c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
31321efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,
3133c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                            CXCursorVisitor visitor,
3134c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                            CXClientData client_data);
31353387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#ifdef __has_feature
31363387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#  if __has_feature(blocks)
31373387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/**
31383387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * \brief Visitor invoked for each cursor found by a traversal.
31393387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall *
31403387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * This visitor block will be invoked for each cursor found by
31413387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * clang_visitChildrenWithBlock(). Its first argument is the cursor being
31423387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * visited, its second argument is the parent visitor for that cursor.
31433387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall *
31443387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * The visitor should return one of the \c CXChildVisitResult values
31453387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * to direct clang_visitChildrenWithBlock().
31463387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */
31473387c65a094a02b2a94c05111d035a97d3d5c794David Chisnalltypedef enum CXChildVisitResult
31483387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall     (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent);
31493387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall
31503387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/**
31513387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * Visits the children of a cursor using the specified block.  Behaves
31523387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * identically to clang_visitChildren() in all other respects.
31533387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */
31543387c65a094a02b2a94c05111d035a97d3d5c794David Chisnallunsigned clang_visitChildrenWithBlock(CXCursor parent,
31553387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall                                      CXCursorVisitorBlock block);
31563387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#  endif
31573387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#endif
31581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3159c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3160c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
3161c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
31621efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3163c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3164c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST
3165c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
31661efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * These routines provide the ability to determine references within and
3167c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * across translation units, by providing the names of the entities referenced
3168c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by cursors, follow reference cursors to the declarations they reference,
3169c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and associate declarations with their definitions.
3170c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3171c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
3172c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
31731efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3174c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3175c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a Unified Symbol Resolution (USR) for the entity referenced
3176c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by the given cursor.
3177c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3178c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A Unified Symbol Resolution (USR) is a string that identifies a particular
3179c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * entity (function, class, variable, etc.) within a program. USRs can be
3180c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * compared across translation units to determine, e.g., when references in
3181c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * one translation refer to an entity defined in another translation unit.
3182c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
3183c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor);
3184c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
3185c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3186896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C class.
3187896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3188896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);
3189896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3190896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3191896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C category.
3192896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3193896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString
319466ccaec73706f3623d2e7d191fe2c944feedcc2bTed Kremenek  clang_constructUSR_ObjCCategory(const char *class_name,
3195896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                 const char *category_name);
3196896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3197896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3198896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C protocol.
3199896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3200896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString
3201896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek  clang_constructUSR_ObjCProtocol(const char *protocol_name);
3202896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3203896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3204896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3205896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C instance variable and
3206896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *   the USR for its containing class.
3207896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3208896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name,
3209896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                    CXString classUSR);
3210896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3211896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3212896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C method and
3213896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *   the USR for its containing class.
3214896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3215896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name,
3216896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                      unsigned isInstanceMethod,
3217896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                      CXString classUSR);
3218896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3219896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3220896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C property and the USR
3221896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *  for its containing class.
3222896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
3223896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property,
3224896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                        CXString classUSR);
3225896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3226896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
3227c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a name for the entity referenced by this cursor.
3228c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
3229c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);
3230c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
3231358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor/**
3232ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \brief Retrieve a range for a piece that forms the cursors spelling name.
3233ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * Most of the times there is only one range for the complete spelling but for
3234ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * objc methods and objc message expressions, there are multiple pieces for each
3235ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * selector identifier.
3236ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis *
3237ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \param pieceIndex the index of the spelling name piece. If this is greater
3238ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * than the actual number of pieces, it will return a NULL (invalid) range.
3239ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis *
3240ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \param options Reserved.
3241ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis */
3242ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios KyrtzidisCINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor,
3243ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis                                                          unsigned pieceIndex,
3244ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis                                                          unsigned options);
3245ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis
3246ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis/**
3247358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * \brief Retrieve the display name for the entity referenced by this cursor.
3248358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor *
3249358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * The display name contains extra information that helps identify the cursor,
3250358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * such as the parameters of a function or template or the arguments of a
3251358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * class template specialization.
3252358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor */
3253358559d8d7b458c5f64941842383a16e61f0828dDouglas GregorCINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor);
3254358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor
3255c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor/** \brief For a cursor that is a reference, retrieve a cursor representing the
3256c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * entity that it references.
3257c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor *
3258c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Reference cursors refer to other entities in the AST. For example, an
3259c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Objective-C superclass reference cursor refers to an Objective-C class.
32601efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * This function produces the cursor for the Objective-C class from the
3261c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * cursor for the superclass reference. If the input cursor is a declaration or
3262c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * definition, it returns that declaration or definition unchanged.
32631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Otherwise, returns the NULL cursor.
3264c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor */
3265c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor);
3266b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
32671efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
3268b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \brief For a cursor that is either a reference to or a declaration
3269b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  of some entity, retrieve a cursor that describes the definition of
3270b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  that entity.
3271b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
3272b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  Some entities can be declared multiple times within a translation
3273b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  unit, but only one of those declarations can also be a
3274b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  definition. For example, given:
3275b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
3276b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \code
3277b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int, int);
3278b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int g(int x, int y) { return f(x, y); }
3279b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int a, int b) { return a + b; }
3280b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int, int);
3281b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \endcode
3282b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
3283b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  there are three declarations of the function "f", but only the
3284b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  second one is a definition. The clang_getCursorDefinition()
3285b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  function will take any cursor pointing to a declaration of "f"
3286b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  (the first or fourth lines of the example) or a cursor referenced
3287b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  that uses "f" (the call to "f' inside "g") and will return a
3288b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  declaration cursor pointing to the definition (the second "f"
3289b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  declaration).
3290b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
3291b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  If given a cursor for which there is no corresponding definition,
3292b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  e.g., because there is no definition of that entity within this
3293b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  translation unit, returns a NULL cursor.
3294b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */
3295b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor);
3296b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
32971efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
3298b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Determine whether the declaration pointed to by this cursor
3299b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * is also a definition of that entity.
3300b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */
3301b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);
3302b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
3303c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
33041a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \brief Retrieve the canonical cursor corresponding to the given cursor.
33051a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
33061a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * In the C family of languages, many kinds of entities can be declared several
33071a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * times within a single translation unit. For example, a structure type can
33081a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * be forward-declared (possibly multiple times) and later defined:
33091a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
33101a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \code
33111a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X;
33121a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X;
33131a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X {
33141a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *   int member;
33151a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * };
33161a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \endcode
33171a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
33181a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * The declarations and the definition of \c X are represented by three
33191a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * different cursors, all of which are declarations of the same underlying
33201a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * entity. One of these cursor is considered the "canonical" cursor, which
33211a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * is effectively the representative for the underlying entity. One can
33221a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * determine if two cursors are declarations of the same underlying entity by
33231a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * comparing their canonical cursors.
33241a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
33251a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \returns The canonical cursor for the entity referred to by the given cursor.
33261a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor */
33271a9d0503b67a499797141af0fd6d315d5045f0eaDouglas GregorCINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor);
33281a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor
332934ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis
333034ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis/**
333134ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * \brief If the cursor points to a selector identifier in a objc method or
333234ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * message expression, this returns the selector index.
333334ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis *
33347eee0184570366285589d788bcd7f5dda8345915James Dennett * After getting a cursor with #clang_getCursor, this can be called to
333534ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * determine if the location points to a selector identifier.
333634ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis *
333734ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * \returns The selector index if the cursor is an objc method or message
333834ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * expression and the cursor is pointing to a selector identifier, or -1
333934ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * otherwise.
334034ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis */
334134ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor);
334234ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis
33431a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor/**
3344f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * \brief Given a cursor pointing to a C++ method call or an ObjC message,
3345f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * returns non-zero if the method/message is "dynamic", meaning:
3346f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis *
3347f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * For a C++ method: the call is virtual.
3348f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * For an ObjC message: the receiver is an object instance, not 'super' or a
3349f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * specific class.
3350f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis *
3351f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * If the method/message is "static" or the cursor does not point to a
3352f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * method/message, it will return zero.
3353f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis */
3354f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C);
3355e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis
3356e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis/**
3357e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis * \brief Given a cursor pointing to an ObjC message, returns the CXType of the
3358e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis * receiver.
3359e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis */
3360e4a990f34904eb572c8d6aa1deef19465214359cArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C);
3361f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis
3362f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis/**
3363aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * \brief Given a cursor that represents a declaration, return the associated
3364aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * comment's source range.  The range may include multiple consecutive comments
3365aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * with whitespace in between.
3366aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko */
3367aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri GribenkoCINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C);
3368aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko
3369aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko/**
3370aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * \brief Given a cursor that represents a declaration, return the associated
3371aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * comment text, including comment markers.
3372aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko */
3373aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri GribenkoCINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C);
3374aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko
3375aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko/**
3376ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Given a cursor that represents a documentable entity (e.g.,
3377ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * declaration), return the associated \\brief paragraph; otherwise return the
3378ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * first paragraph.
33792d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko */
33802d44d77fed3200e2eff289f55493317e90d3398cDmitri GribenkoCINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C);
33812d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko
33822d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko/**
3383ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Given a cursor that represents a documentable entity (e.g.,
3384ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * declaration), return the associated parsed comment as a
3385ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \c CXComment_FullComment AST node.
3386ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3387ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXComment clang_Cursor_getParsedComment(CXCursor C);
3388ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3389ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3390ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * @}
3391ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3392ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3393ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
33945d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \defgroup CINDEX_MODULE Module introspection
33955d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
33965d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * The functions in this group provide access to information about modules.
33975d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
33985d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * @{
33995d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
34005d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34015d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidistypedef void *CXModule;
34025d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34035d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
34045d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \brief Given a CXCursor_ModuleImportDecl cursor, return the associated module.
34055d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
34065d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios KyrtzidisCINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C);
34075d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34085d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3409d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object.
34105d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
34115d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the parent of a sub-module or NULL if the given module is top-level,
34125d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * e.g. for 'std.vector' it will return the 'std' module.
34135d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
3414d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module);
34155d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34165d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3417d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object.
34185d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
34195d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the name of the module, e.g. for the 'std.vector' sub-module it
34205d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * will return "vector".
34215d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
3422d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXString clang_Module_getName(CXModule Module);
34235d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34245d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3425d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object.
34265d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
34275d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the full name of the module, e.g. "std.vector".
34285d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
3429d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module);
34305d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34315d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3432d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object.
34335d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
34345d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the number of top level headers associated with this module.
34355d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
3436c1d22393628a145e54396c0ac66e9625d13a7658Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit,
3437c1d22393628a145e54396c0ac66e9625d13a7658Argyrios Kyrtzidis                                                           CXModule Module);
34385d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34395d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3440d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object.
34415d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
34425d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \param Index top level header index (zero-based).
34435d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis *
34445d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the specified top level header associated with the module.
34455d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
3446d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE
3447c1d22393628a145e54396c0ac66e9625d13a7658Argyrios KyrtzidisCXFile clang_Module_getTopLevelHeader(CXTranslationUnit,
3448c1d22393628a145e54396c0ac66e9625d13a7658Argyrios Kyrtzidis                                      CXModule Module, unsigned Index);
34495d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34505d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
34515d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * @}
34525d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */
34535d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis
34545d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/**
3455ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \defgroup CINDEX_COMMENT Comment AST introspection
3456ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3457ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * The routines in this group provide access to information in the
3458ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * documentation comment ASTs.
3459ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3460ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * @{
3461ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3462ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3463ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3464ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Describes the type of the comment AST node (\c CXComment).  A comment
3465ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * node can be considered block content (e. g., paragraph), inline content
3466ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * (plain text) or neither (the root AST node).
3467ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3468ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkoenum CXCommentKind {
3469ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3470ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief Null comment.  No AST node is constructed at the requested location
3471ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * because there is no text or a syntax error.
3472ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3473ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_Null = 0,
3474ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3475ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3476ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief Plain text.  Inline content.
3477ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3478ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_Text = 1,
3479ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3480ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3481ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A command with word-like arguments that is considered inline content.
3482ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3483ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * For example: \\c command.
3484ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3485ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_InlineCommand = 2,
3486ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3487ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3488ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief HTML start tag with attributes (name-value pairs).  Considered
3489ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * inline content.
3490ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3491ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * For example:
3492ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \verbatim
3493ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * <br> <br /> <a href="http://example.org/">
3494ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \endverbatim
3495ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3496ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_HTMLStartTag = 3,
3497ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3498ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3499ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief HTML end tag.  Considered inline content.
3500ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3501ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * For example:
3502ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \verbatim
3503ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * </a>
3504ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \endverbatim
3505ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3506ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_HTMLEndTag = 4,
3507ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3508ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3509ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A paragraph, contains inline comment.  The paragraph itself is
3510ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * block content.
3511ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3512ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_Paragraph = 5,
3513ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3514ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3515ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A command that has zero or more word-like arguments (number of
3516ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * word-like arguments depends on command name) and a paragraph as an
3517ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * argument.  Block command is block content.
3518ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3519ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * Paragraph argument is also a child of the block command.
3520ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3521ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * For example: \\brief has 0 word-like arguments and a paragraph argument.
3522ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3523ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * AST nodes of special kinds that parser knows about (e. g., \\param
3524ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * command) have their own node kinds.
3525ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3526ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_BlockCommand = 6,
3527ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3528ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3529ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A \\param or \\arg command that describes the function parameter
3530ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * (name, passing direction, description).
3531ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
353270517ca5c07c4b41ff8662b94ee22047b0299f8cDmitri Gribenko   * For example: \\param [in] ParamName description.
3533ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3534ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXComment_ParamCommand = 7,
3535ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3536ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
353796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko   * \brief A \\tparam command that describes a template parameter (name and
353896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko   * description).
353996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko   *
354070517ca5c07c4b41ff8662b94ee22047b0299f8cDmitri Gribenko   * For example: \\tparam T description.
354196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko   */
354296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  CXComment_TParamCommand = 8,
354396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko
354496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  /**
3545ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A verbatim block command (e. g., preformatted code).  Verbatim
3546ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * block has an opening and a closing command and contains multiple lines of
3547ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * text (\c CXComment_VerbatimBlockLine child nodes).
3548ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   *
3549ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * For example:
3550ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \\verbatim
3551ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * aaa
3552ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \\endverbatim
3553ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
355496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  CXComment_VerbatimBlockCommand = 9,
3555ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3556ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3557ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A line of text that is contained within a
3558ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * CXComment_VerbatimBlockCommand node.
3559ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
356096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  CXComment_VerbatimBlockLine = 10,
3561ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3562ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3563ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A verbatim line command.  Verbatim line has an opening command,
3564ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * a single line of text (up to the newline after the opening command) and
3565ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * has no closing command.
3566ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
356796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  CXComment_VerbatimLine = 11,
3568ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3569ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3570ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief A full comment attached to a declaration, contains block content.
3571ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
357296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko  CXComment_FullComment = 12
3573ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko};
3574ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3575ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
35762d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \brief The most appropriate rendering mode for an inline command, chosen on
35772d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * command semantics in Doxygen.
35782d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko */
35792d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenkoenum CXCommentInlineCommandRenderKind {
35802d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  /**
35812d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   * \brief Command argument should be rendered in a normal font.
35822d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   */
35832d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  CXCommentInlineCommandRenderKind_Normal,
35842d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko
35852d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  /**
35862d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   * \brief Command argument should be rendered in a bold font.
35872d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   */
35882d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  CXCommentInlineCommandRenderKind_Bold,
35892d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko
35902d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  /**
35912d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   * \brief Command argument should be rendered in a monospaced font.
35922d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   */
35932d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  CXCommentInlineCommandRenderKind_Monospaced,
35942d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko
35952d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  /**
35962d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   * \brief Command argument should be rendered emphasized (typically italic
35972d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   * font).
35982d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko   */
35992d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko  CXCommentInlineCommandRenderKind_Emphasized
36002d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko};
36012d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko
36022d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko/**
3603ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Describes parameter passing direction for \\param or \\arg command.
3604ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3605ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkoenum CXCommentParamPassDirection {
3606ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3607ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief The parameter is an input parameter.
3608ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3609ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXCommentParamPassDirection_In,
3610ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3611ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3612ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief The parameter is an output parameter.
3613ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3614ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXCommentParamPassDirection_Out,
3615ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3616ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  /**
3617ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   * \brief The parameter is an input and output parameter.
3618ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko   */
3619ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko  CXCommentParamPassDirection_InOut
3620ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko};
3621ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3622ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3623ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment AST node of any kind.
3624ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3625ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns the type of the AST node.
3626ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3627ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE enum CXCommentKind clang_Comment_getKind(CXComment Comment);
3628ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3629ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3630ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment AST node of any kind.
3631ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3632ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of children of the AST node.
3633ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3634ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE unsigned clang_Comment_getNumChildren(CXComment Comment);
3635ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3636ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3637ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment AST node of any kind.
3638ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
363970517ca5c07c4b41ff8662b94ee22047b0299f8cDmitri Gribenko * \param ChildIdx child index (zero-based).
3640ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3641ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns the specified child of the AST node.
3642ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3643ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3644ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXComment clang_Comment_getChild(CXComment Comment, unsigned ChildIdx);
3645ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3646ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3647ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A \c CXComment_Paragraph node is considered whitespace if it contains
3648ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * only \c CXComment_Text nodes that are empty or whitespace.
3649ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3650ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * Other AST nodes (except \c CXComment_Paragraph and \c CXComment_Text) are
3651ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * never considered whitespace.
3652ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3653ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if \c Comment is whitespace.
3654ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3655ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE unsigned clang_Comment_isWhitespace(CXComment Comment);
3656ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3657ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3658ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if \c Comment is inline content and has a newline
3659ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * immediately following it in the comment text.  Newlines between paragraphs
3660ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * do not count.
3661ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3662ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3663ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_InlineContentComment_hasTrailingNewline(CXComment Comment);
3664ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3665ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3666ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_Text AST node.
3667ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3668ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text contained in the AST node.
3669ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3670ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_TextComment_getText(CXComment Comment);
3671ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3672ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3673ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node.
3674ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3675ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns name of the inline command.
3676ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3677ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3678ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_InlineCommandComment_getCommandName(CXComment Comment);
3679ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3680ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3681ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node.
3682ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
36832d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \returns the most appropriate rendering mode, chosen on command
36842d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * semantics in Doxygen.
36852d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko */
36862d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri GribenkoCINDEX_LINKAGE enum CXCommentInlineCommandRenderKind
36872d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenkoclang_InlineCommandComment_getRenderKind(CXComment Comment);
36882d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko
36892d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko/**
36902d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node.
36912d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko *
3692ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of command arguments.
3693ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3694ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3695ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_InlineCommandComment_getNumArgs(CXComment Comment);
3696ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3697ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3698ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node.
3699ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3700ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param ArgIdx argument index (zero-based).
3701ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3702ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text of the specified argument.
3703ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3704ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3705ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_InlineCommandComment_getArgText(CXComment Comment,
3706ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko                                               unsigned ArgIdx);
3707ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3708ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3709ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
3710ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * node.
3711ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3712ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns HTML tag name.
3713ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3714ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_HTMLTagComment_getTagName(CXComment Comment);
3715ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3716ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3717ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node.
3718ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3719ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if tag is self-closing (for example, &lt;br /&gt;).
3720ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3721ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3722ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_HTMLStartTagComment_isSelfClosing(CXComment Comment);
3723ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3724ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3725ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node.
3726ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3727ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of attributes (name-value pairs) attached to the start tag.
3728ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3729ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE unsigned clang_HTMLStartTag_getNumAttrs(CXComment Comment);
3730ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3731ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3732ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node.
3733ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3734ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param AttrIdx attribute index (zero-based).
3735ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3736ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns name of the specified attribute.
3737ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3738ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3739ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_HTMLStartTag_getAttrName(CXComment Comment, unsigned AttrIdx);
3740ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3741ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3742ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node.
3743ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3744ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param AttrIdx attribute index (zero-based).
3745ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3746ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns value of the specified attribute.
3747ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3748ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3749ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_HTMLStartTag_getAttrValue(CXComment Comment, unsigned AttrIdx);
3750ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3751ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3752ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand AST node.
3753ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3754ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns name of the block command.
3755ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3756ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3757ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_BlockCommandComment_getCommandName(CXComment Comment);
3758ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3759ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3760ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand AST node.
3761ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3762ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of word-like arguments.
3763ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3764ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3765ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_BlockCommandComment_getNumArgs(CXComment Comment);
3766ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3767ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3768ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand AST node.
3769ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3770ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param ArgIdx argument index (zero-based).
3771ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3772ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text of the specified word-like argument.
3773ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3774ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3775ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_BlockCommandComment_getArgText(CXComment Comment,
3776ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko                                              unsigned ArgIdx);
3777ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3778ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3779ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand or
3780ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \c CXComment_VerbatimBlockCommand AST node.
3781ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3782ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns paragraph argument of the block command.
3783ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3784ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3785ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXComment clang_BlockCommandComment_getParagraph(CXComment Comment);
3786ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3787ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3788ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node.
3789ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3790ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns parameter name.
3791ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3792ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3793ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_ParamCommandComment_getParamName(CXComment Comment);
3794ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3795ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3796ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node.
3797ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3798ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if the parameter that this AST node represents was found
3799ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * in the function prototype and \c clang_ParamCommandComment_getParamIndex
3800ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * function will return a meaningful value.
3801ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3802ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3803ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_ParamCommandComment_isParamIndexValid(CXComment Comment);
3804ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3805ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3806ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node.
3807ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3808ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns zero-based parameter index in function prototype.
3809ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3810ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3811ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_ParamCommandComment_getParamIndex(CXComment Comment);
3812ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3813ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3814ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node.
3815ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3816ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if parameter passing direction was specified explicitly in
3817ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * the comment.
3818ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3819ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3820ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_ParamCommandComment_isDirectionExplicit(CXComment Comment);
3821ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3822ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3823ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node.
3824ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3825ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns parameter passing direction.
3826ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3827ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3828ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkoenum CXCommentParamPassDirection clang_ParamCommandComment_getDirection(
3829ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko                                                            CXComment Comment);
3830ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3831ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
383296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node.
383396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
383496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns template parameter name.
383596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */
383696b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE
383796b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCXString clang_TParamCommandComment_getParamName(CXComment Comment);
383896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko
383996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/**
384096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node.
384196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
384296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns non-zero if the parameter that this AST node represents was found
384396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * in the template parameter list and
384496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \c clang_TParamCommandComment_getDepth and
384596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \c clang_TParamCommandComment_getIndex functions will return a meaningful
384696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * value.
384796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */
384896b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE
384996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenkounsigned clang_TParamCommandComment_isParamPositionValid(CXComment Comment);
385096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko
385196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/**
385296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node.
385396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
385496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns zero-based nesting depth of this parameter in the template parameter list.
385596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
385696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * For example,
385796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \verbatim
385896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *     template<typename C, template<typename T> class TT>
385996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *     void test(TT<int> aaa);
386096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \endverbatim
386196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * for C and TT nesting depth is 0,
386296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * for T nesting depth is 1.
386396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */
386496b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE
386596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenkounsigned clang_TParamCommandComment_getDepth(CXComment Comment);
386696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko
386796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/**
386896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node.
386996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
387096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns zero-based parameter index in the template parameter list at a
387196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * given nesting depth.
387296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
387396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * For example,
387496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \verbatim
387596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *     template<typename C, template<typename T> class TT>
387696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *     void test(TT<int> aaa);
387796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \endverbatim
387896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * for C and TT nesting depth is 0, so we can ask for index at depth 0:
387996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * at depth 0 C's index is 0, TT's index is 1.
388096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
388196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * For T nesting depth is 1, so we can ask for index at depth 0 and 1:
388296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * at depth 0 T's index is 1 (same as TT's),
388396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * at depth 1 T's index is 0.
388496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */
388596b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE
388696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenkounsigned clang_TParamCommandComment_getIndex(CXComment Comment, unsigned Depth);
388796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko
388896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/**
3889ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_VerbatimBlockLine AST node.
3890ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3891ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text contained in the AST node.
3892ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3893ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE
3894ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_VerbatimBlockLineComment_getText(CXComment Comment);
3895ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3896ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3897ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_VerbatimLine AST node.
3898ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3899ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text contained in the AST node.
3900ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3901ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_VerbatimLineComment_getText(CXComment Comment);
3902ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3903ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3904ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Convert an HTML tag AST node to string.
3905ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3906ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
3907ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * node.
3908ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3909ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns string containing an HTML tag.
3910ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3911ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_HTMLTagComment_getAsString(CXComment Comment);
3912ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3913ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3914ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Convert a given full parsed comment to an HTML fragment.
3915ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3916ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * Specific details of HTML layout are subject to change.  Don't try to parse
3917ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * this HTML back into an AST, use other APIs instead.
3918ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3919ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * Currently the following CSS classes are used:
3920ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \li "para-brief" for \\brief paragraph and equivalent commands;
3921ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \li "para-returns" for \\returns paragraph and equivalent commands;
3922ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \li "word-returns" for the "Returns" word in \\returns paragraph.
3923ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
39243e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * Function argument documentation is rendered as a \<dl\> list with arguments
39253e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * sorted in function prototype order.  CSS classes used:
39263e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * \li "param-name-index-NUMBER" for parameter name (\<dt\>);
39273e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * \li "param-descr-index-NUMBER" for parameter description (\<dd\>);
39283e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * \li "param-name-index-invalid" and "param-descr-index-invalid" are used if
39293e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * parameter index is invalid.
3930ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
393196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * Template parameter documentation is rendered as a \<dl\> list with
393296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * parameters sorted in template parameter list order.  CSS classes used:
393396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \li "tparam-name-index-NUMBER" for parameter name (\<dt\>);
393496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \li "tparam-descr-index-NUMBER" for parameter description (\<dd\>);
39356a425525e52aba5a8e14db35d50a712be4e5e2e1Dmitri Gribenko * \li "tparam-name-index-other" and "tparam-descr-index-other" are used for
393696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * names inside template template parameters;
393796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \li "tparam-name-index-invalid" and "tparam-descr-index-invalid" are used if
393896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * parameter position is invalid.
393996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko *
3940ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_FullComment AST node.
3941ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko *
3942ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns string containing an HTML fragment.
3943ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */
3944ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_FullComment_getAsHTML(CXComment Comment);
3945ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko
3946ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/**
3947f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * \brief Convert a given full parsed comment to an XML document.
3948f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko *
3949f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * A Relax NG schema for the XML can be found in comment-xml-schema.rng file
3950f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * inside clang source tree.
3951f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko *
3952f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * \param Comment a \c CXComment_FullComment AST node.
3953f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko *
3954f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * \returns string containing an XML document.
3955f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko */
3956e4330a302ac20b41b9800267ebd4b5b01f8553f8Dmitri GribenkoCINDEX_LINKAGE CXString clang_FullComment_getAsXML(CXComment Comment);
3957f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko
3958f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko/**
3959c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
3960c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
39611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3962c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
39639ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * \defgroup CINDEX_CPP C++ AST introspection
39649ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek *
39659ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * The routines in this group provide access information in the ASTs specific
39669ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * to C++ language features.
39679ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek *
39689ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @{
39699ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
39709ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
39719ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
397249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Determine if a C++ member function or member function template is
397349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared 'static'.
39749ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
39759ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed KremenekCINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);
39769ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
39779ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
3978211924b563aa31421836cee7655be729ad02733fDouglas Gregor * \brief Determine if a C++ member function or member function template is
3979211924b563aa31421836cee7655be729ad02733fDouglas Gregor * explicitly declared 'virtual' or if it overrides a virtual method from
3980211924b563aa31421836cee7655be729ad02733fDouglas Gregor * one of the base classes.
3981211924b563aa31421836cee7655be729ad02733fDouglas Gregor */
3982211924b563aa31421836cee7655be729ad02733fDouglas GregorCINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C);
3983211924b563aa31421836cee7655be729ad02733fDouglas Gregor
3984211924b563aa31421836cee7655be729ad02733fDouglas Gregor/**
398549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Given a cursor that represents a template, determine
398649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the cursor kind of the specializations would be generated by instantiating
398749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the template.
398849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
398949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * This routine can be used to determine what flavor of function template,
399049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * class template, or class template partial specialization is stored in the
399149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * cursor. For example, it can describe whether a class template cursor is
399249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared with "struct", "class" or "union".
399349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
399449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \param C The cursor to query. This cursor should represent a template
399549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declaration.
399649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
399749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \returns The cursor kind of the specializations that would be generated
399849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * by instantiating the template \p C. If \p C is not a template, returns
399949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \c CXCursor_NoDeclFound.
400049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor */
400149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);
400249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor
400349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor/**
4004e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \brief Given a cursor that may represent a specialization or instantiation
4005e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template, retrieve the cursor that represents the template that it
4006e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializes or from which it was instantiated.
4007e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
4008e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * This routine determines the template involved both for explicit
4009e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializations of templates and for implicit instantiations of the template,
4010e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * both of which are referred to as "specializations". For a class template
4011e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specialization (e.g., \c std::vector<bool>), this routine will return
4012e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * either the primary template (\c std::vector) or, if the specialization was
4013e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * instantiated from a class template partial specialization, the class template
4014e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * partial specialization. For a class template partial specialization and a
4015e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * function template specialization (including instantiations), this
4016e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * this routine will return the specialized template.
4017e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
4018e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * For members of a class template (e.g., member functions, member classes, or
4019e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * static data members), returns the specialized or instantiated member.
4020e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * Although not strictly "templates" in the C++ language, members of class
4021e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates have the same notions of specializations and instantiations that
4022e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates do, so this routine treats them similarly.
4023e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
4024e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \param C A cursor that may be a specialization of a template or a member
4025e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template.
4026e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
4027e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \returns If the given cursor is a specialization or instantiation of a
4028e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * template or a member thereof, the template or member that it specializes or
4029e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * from which it was instantiated. Otherwise, returns a NULL cursor.
4030e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor */
4031e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas GregorCINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
4032430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
4033430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor/**
4034430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Given a cursor that references something else, return the source range
4035430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * covering that reference.
4036430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor *
4037430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param C A cursor pointing to a member reference, a declaration reference, or
4038430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * an operator call.
4039430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param NameFlags A bitset with three independent flags:
4040430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
4041430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece.
4042430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param PieceIndex For contiguous names or when passing the flag
4043430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece, only one piece with index 0 is
4044430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * available. When the CXNameRange_WantSinglePiece flag is not passed for a
404548d798ce32447607144db70a484cdb99c1180663Benjamin Kramer * non-contiguous names, this index can be used to retrieve the individual
4046430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * pieces of the name. See also CXNameRange_WantSinglePiece.
4047430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor *
4048430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \returns The piece of the name pointed to by the given cursor. If there is no
4049430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
4050430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */
405148a8d14fc6f064a5297024c2b34733a4080b2efeFrancois PichetCINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C,
405248a8d14fc6f064a5297024c2b34733a4080b2efeFrancois Pichet                                                unsigned NameFlags,
4053430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor                                                unsigned PieceIndex);
4054430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
4055430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregorenum CXNameRefFlags {
4056430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
4057430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \brief Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
4058430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * range.
4059430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
4060430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantQualifier = 0x1,
4061430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
4062430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
40637eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Include the explicit template arguments, e.g. \<int> in x.f<int>,
40647eee0184570366285589d788bcd7f5dda8345915James Dennett   * in the range.
4065430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
4066430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantTemplateArgs = 0x2,
4067430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
4068430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
4069430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \brief If the name is non-contiguous, return the full spanning range.
4070430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   *
4071430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * Non-contiguous names occur in Objective-C when a selector with two or more
4072430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * parameters is used, or in C++ when using an operator:
4073430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \code
4074430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * [object doSomething:here withValue:there]; // ObjC
4075430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * return some_vector[1]; // C++
4076430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \endcode
4077430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
4078430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantSinglePiece = 0x4
4079430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor};
4080e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor
4081e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor/**
40829ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @}
40839ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
40849ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
40859ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
40860045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * \defgroup CINDEX_LEX Token extraction and manipulation
40870045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
40880045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * The routines in this group provide access to the tokens within a
40890045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * translation unit, along with a semantic mapping of those tokens to
40900045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * their corresponding cursors.
4091fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4092fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @{
4093fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4094fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
4095fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4096fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a kind of token.
4097fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4098fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef enum CXTokenKind {
4099fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
4100fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A token that contains some kind of punctuation.
4101fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
4102fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Punctuation,
4103896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4104fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
41050045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor   * \brief A language keyword.
4106fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
4107fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Keyword,
4108896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4109fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
4110fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief An identifier (that is not a keyword).
4111fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
4112fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Identifier,
4113896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4114fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
4115fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A numeric, string, or character literal.
4116fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
4117fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Literal,
4118896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4119fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
4120fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A comment.
4121fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
4122fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Comment
4123fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXTokenKind;
4124fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
4125fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4126fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a single preprocessing token.
4127fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4128fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef struct {
4129fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  unsigned int_data[4];
4130fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  void *ptr_data;
4131fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXToken;
4132fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
4133fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4134fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the kind of the given token.
4135fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4136fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken);
4137896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4138fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4139fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the spelling of the given token.
4140fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4141fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * The spelling of a token is the textual representation of that token, e.g.,
4142fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * the text of an identifier or keyword.
4143fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4144fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken);
4145896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4146fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4147fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve the source location of the given token.
4148fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4149896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit,
4150fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                                       CXToken);
4151896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4152fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4153fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve a source range that covers the given token.
4154fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4155fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);
4156fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
4157fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4158fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Tokenize the source code described by the given range into raw
4159fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * lexical tokens.
4160fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4161fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit whose text is being tokenized.
4162fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4163fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Range the source range in which text should be tokenized. All of the
4164fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * tokens produced by tokenization will fall within this source range,
4165fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4166fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens this pointer will be set to point to the array of tokens
4167fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that occur within the given source range. The returned pointer must be
4168fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * freed with clang_disposeTokens() before the translation unit is destroyed.
4169fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4170fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens will be set to the number of tokens in the \c *Tokens
4171fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * array.
4172fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4173fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4174fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
4175fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                   CXToken **Tokens, unsigned *NumTokens);
4176896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4177fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4178fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Annotate the given set of tokens by providing cursors for each token
4179fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that can be mapped to a specific entity within the abstract syntax tree.
4180fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
41810045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * This token-annotation routine is equivalent to invoking
41820045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() for the source locations of each of the
41830045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * tokens. The cursors provided are filtered, so that only those
41840045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * cursors that have a direct correspondence to the token are
41850045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * accepted. For example, given a function call \c f(x),
41860045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() would provide the following cursors:
41870045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
41880045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
41890045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
41900045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
41910045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
41920045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * Only the first and last of these cursors will occur within the
41930045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * annotate, since the tokens "f" and "x' directly refer to a function
41940045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * and a variable, respectively, but the parentheses are just a small
41950045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * part of the full syntax of the function call expression, which is
41960045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * not provided as an annotation.
4197fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4198fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit that owns the given tokens.
4199fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4200fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens the set of tokens to annotate.
4201fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4202fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens the number of tokens in \p Tokens.
4203fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
4204fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Cursors an array of \p NumTokens cursors, whose contents will be
4205fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * replaced with the cursors corresponding to each token.
4206fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4207fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU,
4208fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                         CXToken *Tokens, unsigned NumTokens,
4209fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                         CXCursor *Cursors);
4210896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4211fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4212fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Free the given set of tokens.
4213fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4214896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
4215fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                        CXToken *Tokens, unsigned NumTokens);
4216896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4217fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4218fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @}
4219fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
4220896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4221fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
4222c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_DEBUG Debugging facilities
4223c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
4224c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines are used for testing and debugging, only, and should not
4225c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be relied upon.
4226c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
4227c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
4228c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
42291efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
42304ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff/* for debug/testing */
4231e68fff6fc083c6270d835216a3de0b82c6ef0310Ted KremenekCINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind);
42321efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor,
42331efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar                                          const char **startBuf,
42344ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          const char **endBuf,
42354ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *startLine,
42364ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *startColumn,
42374ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *endLine,
42384ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *endColumn);
42390a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE void clang_enableStackTraces(void);
4240995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel DunbarCINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data,
4241995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar                                          unsigned stack_size);
4242995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar
42430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
4244c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
4245c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
42461efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
4247c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
4248c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CODE_COMPLET Code completion
4249c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
4250c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Code completion involves taking an (incomplete) source file, along with
4251c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * knowledge of where the user is actively editing that file, and suggesting
4252c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * syntactically- and semantically-valid constructs that the user might want to
4253c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * use at that particular point in the source code. These data structures and
4254c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines provide support for code completion.
4255c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
4256c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
4257c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
42581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
4259c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
42600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A semantic string that describes a code-completion result.
42610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
42620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A semantic string that describes the formatting of a code-completion
42630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * result as a single "template" of text that should be inserted into the
42640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * source buffer when a particular code-completion result is selected.
42650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * Each semantic string is made up of some number of "chunks", each of which
42660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * contains some text along with a description of what that text means, e.g.,
42670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the name of the entity being referenced, whether the text chunk is part of
42680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the template, or whether it is a "placeholder" that the user should replace
42690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * with actual code,of a specific kind. See \c CXCompletionChunkKind for a
42701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * description of the different kinds of chunks.
42710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
42720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef void *CXCompletionString;
42731efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
42740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
42750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A single result of code completion.
42760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
42770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef struct {
42780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
42791efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief The kind of entity that this completion refers to.
42800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
42811efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * The cursor kind will be a macro, keyword, or a declaration (one of the
42820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * *Decl cursor kinds), describing the entity that the completion is
42830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * referring to.
42840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
42850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \todo In the future, we would like to provide a full cursor, to allow
42860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the client to extract additional information from declaration.
42870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
42880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  enum CXCursorKind CursorKind;
42891efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
42901efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
42910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief The code-completion string that describes how to insert this
42920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * code-completion result into the editing buffer.
42930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
42940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionString CompletionString;
42950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor} CXCompletionResult;
42960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
42970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
42980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Describes a single piece of text within a code-completion string.
42990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
43001efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Each "chunk" within a code-completion string (\c CXCompletionString) is
43011efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * either a piece of text with a specific "kind" that describes how that text
43020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * should be interpreted by the client or is another completion string.
43030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
43040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorenum CXCompletionChunkKind {
43050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
43060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A code-completion string that describes "optional" text that
43070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * could be a part of the template (but is not required).
43080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * The Optional chunk is the only kind of chunk that has a code-completion
43101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * string for its representation, which is accessible via
43110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \c clang_getCompletionChunkCompletionString(). The code-completion string
43120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * describes an additional part of the template that is completely optional.
43130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * For example, optional chunks can be used to describe the placeholders for
43140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * arguments that match up with defaulted function parameters, e.g. given:
43150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \code
43170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * void f(int x, float y = 3.14, double z = 2.71828);
43180c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \endcode
43190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * The code-completion string for this function would contain:
43210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a TypedText chunk for "f".
43220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a LeftParen chunk for "(".
43230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a Placeholder chunk for "int x"
43240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - an Optional chunk containing the remaining defaulted arguments, e.g.,
43250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *       - a Comma chunk for ","
432671570182471d502a97f7f175aa527152544c75f2Daniel Dunbar   *       - a Placeholder chunk for "float y"
43270c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *       - an Optional chunk containing the last defaulted argument:
43280c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *           - a Comma chunk for ","
43290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *           - a Placeholder chunk for "double z"
43300c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a RightParen chunk for ")"
43310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
433271570182471d502a97f7f175aa527152544c75f2Daniel Dunbar   * There are many ways to handle Optional chunks. Two simple approaches are:
43330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - Completely ignore optional chunks, in which case the template for the
43340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *     function "f" would only include the first parameter ("int x").
43350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - Fully expand all optional chunks, in which case the template for the
43360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *     function "f" would have all of the parameters.
43370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
43380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Optional,
43390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
43400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that a user would be expected to type to get this
43411efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * code-completion result.
43420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43431efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * There will be exactly one "typed text" chunk in a semantic string, which
43441efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * will typically provide the spelling of a keyword or the name of a
43450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * declaration that could be used at the current code point. Clients are
43460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * expected to filter the code-completion results based on the text in this
43470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * chunk.
43480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
43490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_TypedText,
43500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
43510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that should be inserted as part of a code-completion result.
43520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "text" chunk represents text that is part of the template to be
43540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * inserted into user code should this particular code-completion result
43550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * be selected.
43560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
43570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Text,
43580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
43590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Placeholder text that should be replaced by the user.
43600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "placeholder" chunk marks a place where the user should insert text
43620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * into the code-completion template. For example, placeholders might mark
43630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the function parameters for a function declaration, to indicate that the
43640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * user should provide arguments for each of those parameters. The actual
43650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * text in a placeholder is a suggestion for the text to display before
43660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the user replaces the placeholder with real code.
43670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
43680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Placeholder,
43690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
43700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Informative text that should be displayed but never inserted as
43710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * part of the template.
43721efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   *
43730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * An "informative" chunk contains annotations that can be displayed to
43740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * help the user decide whether a particular code-completion result is the
43750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * right option, but which is not part of the actual template to be inserted
43760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * by code completion.
43770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
43780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Informative,
43790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
43800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that describes the current parameter when code-completion is
43810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * referring to function call, message send, or template specialization.
43820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "current parameter" chunk occurs when code-completion is providing
43840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * information about a parameter corresponding to the argument at the
43850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * code-completion point. For example, given a function
43860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \code
43880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * int add(int x, int y);
43890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \endcode
43900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
43910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * and the source code \c add(, where the code-completion point is after the
43920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * "(", the code-completion string will contain a "current parameter" chunk
43930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * for "int x", indicating that the current argument will initialize that
43940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * parameter. After typing further, to \c add(17, (where the code-completion
43951efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * point is after the ","), the code-completion string will contain a
43960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * "current paremeter" chunk to "int y".
43970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
43980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_CurrentParameter,
43990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left parenthesis ('('), used to initiate a function call or
44010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * signal the beginning of a function parameter list.
44020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftParen,
44040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right parenthesis (')'), used to finish a function call or
44060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * signal the end of a function parameter list.
44070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightParen,
44090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left bracket ('[').
44110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftBracket,
44130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right bracket (']').
44150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightBracket,
44170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44180c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left brace ('{').
44190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftBrace,
44210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right brace ('}').
44230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightBrace,
44250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44260c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left angle bracket ('<').
44270c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44280c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftAngle,
44290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44300c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right angle bracket ('>').
44310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
44320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightAngle,
44330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
44340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A comma separator (',').
44350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
4436ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor  CXCompletionChunk_Comma,
4437ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor  /**
44381efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief Text that specifies the result type of a given result.
4439ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   *
4440ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   * This special kind of informative chunk is not meant to be inserted into
44411efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * the text buffer. Rather, it is meant to illustrate the type that an
4442ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   * expression using the given completion string would have.
4443ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   */
444401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_ResultType,
444501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
444601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief A colon (':').
444701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
444801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_Colon,
444901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
445001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief A semicolon (';').
445101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
445201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_SemiColon,
445301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
445401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief An '=' sign.
445501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
445601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_Equal,
445701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
445801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * Horizontal space (' ').
445901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
446001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_HorizontalSpace,
446101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
446201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * Vertical space ('\n'), after which it is generally a good idea to
446301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * perform indentation.
446401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
446501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_VerticalSpace
44660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor};
44671efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
44680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
44690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Determine the kind of a particular chunk within a completion string.
44700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
44710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
44720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
44730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
44740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
44750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the kind of the chunk at the index \c chunk_number.
44760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
44771efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE enum CXCompletionChunkKind
44780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkKind(CXCompletionString completion_string,
44790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                             unsigned chunk_number);
44801efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
44810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
44821efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the text associated with a particular chunk within a
44830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * completion string.
44840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
44850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
44860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
44870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
44880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
44890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the text associated with the chunk at index \c chunk_number.
44900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
44912ef6f8f5a35a60870594c5b04e0aa2bf22c6886fTed KremenekCINDEX_LINKAGE CXString
44920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkText(CXCompletionString completion_string,
44930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                             unsigned chunk_number);
44940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
44950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
44961efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the completion string associated with a particular chunk
44970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * within a completion string.
44980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
44990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
45000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
45020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
45030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the completion string associated with the chunk at index
45046164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c chunk_number.
45050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
45060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE CXCompletionString
45070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkCompletionString(CXCompletionString completion_string,
45080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                                         unsigned chunk_number);
45091efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
45100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
45110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Retrieve the number of chunks in the given code-completion string.
45120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
45130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE unsigned
45140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getNumCompletionChunks(CXCompletionString completion_string);
45150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
45160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
451712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \brief Determine the priority of this code completion.
451812e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
451912e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * The priority of a code completion indicates how likely it is that this
452012e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * particular completion is the completion that the user will select. The
452112e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * priority is selected by various internal heuristics.
452212e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
452312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \param completion_string The completion string to query.
452412e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
452512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \returns The priority of this completion string. Smaller values indicate
452612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * higher-priority (more likely) completions.
452712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor */
452812e131385e892e3723483a1081a89bcad29c8a84Douglas GregorCINDEX_LINKAGE unsigned
452912e131385e892e3723483a1081a89bcad29c8a84Douglas Gregorclang_getCompletionPriority(CXCompletionString completion_string);
453012e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor
453112e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor/**
453258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \brief Determine the availability of the entity that this code-completion
453358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * string refers to.
453458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
453558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param completion_string The completion string to query.
453658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
453758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the completion string.
453858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */
453958ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind
454058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCompletionAvailability(CXCompletionString completion_string);
454158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
454258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/**
45436164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the number of annotations associated with the given
45446164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string.
45456164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
45466164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query.
45476164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
45486164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns the number of annotations associated with the given completion
45496164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * string.
45506164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */
45516164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE unsigned
45526164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionNumAnnotations(CXCompletionString completion_string);
45536164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen
45546164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/**
45556164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the annotation associated with the given completion string.
45566164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
45576164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query.
45586164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
45596164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param annotation_number the 0-based index of the annotation of the
45606164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string.
45616164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
45626164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns annotation string associated with the completion at index
45636164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c annotation_number, or a NULL string if that annotation is not available.
45646164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */
45656164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE CXString
45666164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionAnnotation(CXCompletionString completion_string,
45676164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen                              unsigned annotation_number);
45686164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen
45696164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/**
4570ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \brief Retrieve the parent context of the given completion string.
4571ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor *
4572ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * The parent context of a completion string is the semantic parent of
4573ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * the declaration (if any) that the code completion represents. For example,
4574ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * a code completion for an Objective-C method would have the method's class
4575ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * or protocol as its context.
4576ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor *
4577ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \param completion_string The code completion string whose parent is
4578ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * being queried.
4579ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor *
4580526d24444c91404dc4165b141e5ec095125c1bc8Argyrios Kyrtzidis * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL.
4581ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor *
45827eee0184570366285589d788bcd7f5dda8345915James Dennett * \returns The name of the completion parent, e.g., "NSObject" if
4583ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * the completion string represents a method in the NSObject class.
4584ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor */
4585ba1030698dbc276db86b11c5329a1edee8a1805eDouglas GregorCINDEX_LINKAGE CXString
4586ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregorclang_getCompletionParent(CXCompletionString completion_string,
4587ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor                          enum CXCursorKind *kind);
4588d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko
4589d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko/**
4590d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * \brief Retrieve the brief documentation comment attached to the declaration
4591d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * that corresponds to the given completion string.
4592d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko */
4593d99ef536b241071b6f4c01db6525dc03242ac30bDmitri GribenkoCINDEX_LINKAGE CXString
4594d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenkoclang_getCompletionBriefComment(CXCompletionString completion_string);
4595d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko
4596ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor/**
45978fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \brief Retrieve a completion string for an arbitrary declaration or macro
45988fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursor.
45998fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor *
46008fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \param cursor The cursor to query.
46018fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor *
46028fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \returns A non-context-sensitive completion string for declaration and macro
46038fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursors, or NULL for other kinds of cursors.
46048fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor */
46058fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas GregorCINDEX_LINKAGE CXCompletionString
46068fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregorclang_getCursorCompletionString(CXCursor cursor);
46078fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor
46088fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor/**
4609ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Contains the results of code-completion.
4610ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor *
4611ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * This data structure contains the results of code completion, as
4612e0cc52ef8afc8d1cba9c534191b5f0ddaff1d694Douglas Gregor * produced by \c clang_codeCompleteAt(). Its contents must be freed by
4613ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \c clang_disposeCodeCompleteResults.
4614ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */
4615ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregortypedef struct {
4616ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  /**
4617ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \brief The code-completion results.
4618ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   */
4619ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  CXCompletionResult *Results;
4620ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor
4621ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  /**
4622ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \brief The number of code-completion results stored in the
4623ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \c Results array.
4624ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   */
4625ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  unsigned NumResults;
4626ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor} CXCodeCompleteResults;
4627ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor
4628ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor/**
4629cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Flags that can be passed to \c clang_codeCompleteAt() to
4630cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * modify its behavior.
4631cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor *
4632cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * The enumerators in this enumeration can be bitwise-OR'd together to
4633cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * provide multiple options to \c clang_codeCompleteAt().
4634cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */
4635cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregorenum CXCodeComplete_Flags {
4636cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  /**
4637cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * \brief Whether to include macros within the set of code
4638cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * completions returned.
4639cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   */
4640cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  CXCodeComplete_IncludeMacros = 0x01,
4641cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
4642cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  /**
4643cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * \brief Whether to include code patterns for language constructs
4644cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * within the set of code completions, e.g., for loops.
4645cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   */
4646d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko  CXCodeComplete_IncludeCodePatterns = 0x02,
4647d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko
4648d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko  /**
4649d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko   * \brief Whether to include brief documentation within the set of code
4650d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko   * completions returned.
4651d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko   */
4652d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko  CXCodeComplete_IncludeBriefComments = 0x04
4653cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor};
4654cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
4655cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/**
46563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Bits that represent the context under which completion is occurring.
46573da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
46583da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * The enumerators in this enumeration may be bitwise-OR'd together if multiple
46593da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * contexts are occurring simultaneously.
46603da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */
46613da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorenum CXCompletionContext {
46623da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
46633da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief The context for completions is unexposed, as only Clang results
46643da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included. (This is equivalent to having no context bits set.)
46653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
46663da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Unexposed = 0,
46673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
46683da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
46693da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for any possible type should be included in the results.
46703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
46713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_AnyType = 1 << 0,
46723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
46733da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
46743da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for any possible value (variables, function calls, etc.)
46753da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included in the results.
46763da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
46773da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_AnyValue = 1 << 1,
46783da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
46793da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to an Objective-C object should
46803da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * be included in the results.
46813da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
46823da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCObjectValue = 1 << 2,
46833da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
46843da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to an Objective-C selector
46853da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included in the results.
46863da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
46873da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCSelectorValue = 1 << 3,
46883da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
46893da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to a C++ class type should be
46903da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * included in the results.
46913da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
46923da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_CXXClassTypeValue = 1 << 4,
46933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
46943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
46953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for fields of the member being accessed using the dot
46963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * operator should be included in the results.
46973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
46983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_DotMemberAccess = 1 << 5,
46993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for fields of the member being accessed using the arrow
47013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * operator should be included in the results.
47023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ArrowMemberAccess = 1 << 6,
47043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47053da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for properties of the Objective-C object being accessed
47063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * using the dot operator should be included in the results.
47073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCPropertyAccess = 1 << 7,
47093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for enum tags should be included in the results.
47123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_EnumTag = 1 << 8,
47143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for union tags should be included in the results.
47163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_UnionTag = 1 << 9,
47183da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47193da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for struct tags should be included in the results.
47203da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47213da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_StructTag = 1 << 10,
47223da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47233da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47243da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ class names should be included in the results.
47253da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47263da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ClassTag = 1 << 11,
47273da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47283da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ namespaces and namespace aliases should be
47293da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * included in the results.
47303da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47313da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Namespace = 1 << 12,
47323da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47333da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ nested name specifiers should be included in
47343da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
47353da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47363da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_NestedNameSpecifier = 1 << 13,
47373da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47383da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47393da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C interfaces (classes) should be included
47403da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * in the results.
47413da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47423da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCInterface = 1 << 14,
47433da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47443da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C protocols should be included in
47453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
47463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCProtocol = 1 << 15,
47483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C categories should be included in
47503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
47513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCCategory = 1 << 16,
47533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C instance messages should be included
47553da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * in the results.
47563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47573da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCInstanceMessage = 1 << 17,
47583da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47593da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C class messages should be included in
47603da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
47613da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47623da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCClassMessage = 1 << 18,
47633da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47643da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C selector names should be included in
47653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
47663da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCSelectorName = 1 << 19,
47683da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47693da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for preprocessor macro names should be included in
47713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
47723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47733da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_MacroName = 1 << 20,
47743da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47753da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47763da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Natural language completions should be included in the results.
47773da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47783da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_NaturalLanguage = 1 << 21,
47793da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47803da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
47813da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief The current context is unknown, so set all contexts.
47823da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
47833da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Unknown = ((1 << 22) - 1)
47843da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor};
47853da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
47863da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/**
4787cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Returns a default set of code-completion options that can be
4788cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * passed to\c clang_codeCompleteAt().
4789cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */
4790cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas GregorCINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
4791cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
4792cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/**
47931abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \brief Perform code completion at a given location in a translation unit.
47941abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
47951abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * This function performs code completion at a particular file, line, and
47961abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * column within source code, providing results that suggest potential
47971abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code snippets based on the context of the completion. The basic model
47981abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * for code completion is that Clang will parse a complete source file,
47991abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * performing syntax checking up to the location where code-completion has
48001abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * been requested. At that point, a special code-completion token is passed
48011abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * to the parser, which recognizes this token and determines, based on the
48021abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * current location in the C/Objective-C/C++ grammar and the state of
48031abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * semantic analysis, what completions to provide. These completions are
48041abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * returned via a new \c CXCodeCompleteResults structure.
48051abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
48061abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Code completion itself is meant to be triggered by the client when the
48071abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * user types punctuation characters or whitespace, at which point the
48081abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code-completion location will coincide with the cursor. For example, if \c p
48091abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is a pointer, code-completion might be triggered after the "-" and then
48101abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * after the ">" in \c p->. When the code-completion location is afer the ">",
48111abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the completion results will provide, e.g., the members of the struct that
48121abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * "p" points to. The client is responsible for placing the cursor at the
48131abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * beginning of the token currently being typed, then filtering the results
48141abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * based on the contents of the token. For example, when code-completing for
48151abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the expression \c p->get, the client should provide the location just after
48161abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the
48171abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client can filter the results based on the current token text ("get"), only
48181abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * showing those results that start with "get". The intent of this interface
48191abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is to separate the relatively high-latency acquisition of code-completion
48201abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * results from the filtering of results on a per-character basis, which must
48211abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * have a lower latency.
48221abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
48231abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param TU The translation unit in which code-completion should
48241abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * occur. The source files for this translation unit need not be
48251abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completely up-to-date (and the contents of those source files may
48261abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * be overridden via \p unsaved_files). Cursors referring into the
48271abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * translation unit may be invalidated by this invocation.
48281abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
48291abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_filename The name of the source file where code
48301abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion should be performed. This filename may be any file
48311abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * included in the translation unit.
48321abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
48331abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_line The line at which code-completion should occur.
48341abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
48351abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_column The column at which code-completion should occur.
48361abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Note that the column should point just after the syntactic construct that
48371abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * initiated code completion, and not in the middle of a lexical token.
48381abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
48391abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param unsaved_files the Tiles that have not yet been saved to disk
48401abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing or code completion, including the
48411abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * contents of those files.  The contents and name of these files (as
48421abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * specified by CXUnsavedFile) are copied when necessary, so the
48431abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client only needs to guarantee their validity until the call to
48441abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * this function returns.
48451abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
48461abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p
48471abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * unsaved_files.
48481abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
4849cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \param options Extra options that control the behavior of code
4850cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * completion, expressed as a bitwise OR of the enumerators of the
4851cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * CXCodeComplete_Flags enumeration. The
4852cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \c clang_defaultCodeCompleteOptions() function returns a default set
4853cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * of code-completion options.
4854cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor *
48551abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \returns If successful, a new \c CXCodeCompleteResults structure
48561abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * containing code-completion results, which should eventually be
48571abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * freed with \c clang_disposeCodeCompleteResults(). If code
48581abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion fails, returns NULL.
48591abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor */
48601abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCINDEX_LINKAGE
48611abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
48621abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            const char *complete_filename,
48631abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            unsigned complete_line,
48641abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            unsigned complete_column,
48651abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            struct CXUnsavedFile *unsaved_files,
4866cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor                                            unsigned num_unsaved_files,
4867cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor                                            unsigned options);
48681abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor
48691abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor/**
48701e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \brief Sort the code-completion results in case-insensitive alphabetical
48711e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * order.
48721e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor *
48731e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param Results The set of results to sort.
48741e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param NumResults The number of results in \p Results.
48751e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor */
48761e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas GregorCINDEX_LINKAGE
48771e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregorvoid clang_sortCodeCompletionResults(CXCompletionResult *Results,
48781e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor                                     unsigned NumResults);
48791e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor
48801e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor/**
4881ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Free the given set of code-completion results.
48820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
48831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE
4884ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregorvoid clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
488558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
488620d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor/**
4887a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced prior to the
4888a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * location where code completion was performed.
4889a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
4890896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE
4891a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregorunsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results);
4892a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
4893a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
4894a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given code completion.
4895a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor *
48967eee0184570366285589d788bcd7f5dda8345915James Dennett * \param Results the code completion results to query.
4897a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve.
4898a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor *
4899a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed
4900a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic().
4901a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
4902896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE
4903a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
4904a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                             unsigned Index);
4905a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
4906a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
49073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Determines what compeltions are appropriate for the context
49083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the given code completion.
49093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
49103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \param Results the code completion results to query
49113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
49123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \returns the kinds of completions that are appropriate for use
49133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * along with the given code completion results.
49143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */
49153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas GregorCINDEX_LINKAGE
49163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorunsigned long long clang_codeCompleteGetContexts(
49173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor                                                CXCodeCompleteResults *Results);
4918e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor
4919e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/**
4920e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the cursor kind for the container for the current code
4921e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * completion context. The container is only guaranteed to be set for
4922e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * contexts where a container exists (i.e. member accesses or Objective-C
4923e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * message sends); if there is not a container, this function will return
4924e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * CXCursor_InvalidCode.
4925e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
4926e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query
4927e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
4928e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param IsIncomplete on return, this value will be false if Clang has complete
4929e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information about the container. If Clang does not have complete
4930e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information, this value will be true.
4931e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
4932e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the container kind, or CXCursor_InvalidCode if there is not a
4933e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * container
4934e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */
4935e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE
4936e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregorenum CXCursorKind clang_codeCompleteGetContainerKind(
4937e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor                                                 CXCodeCompleteResults *Results,
4938e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor                                                     unsigned *IsIncomplete);
4939e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor
4940e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/**
4941e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the USR for the container for the current code completion
4942e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * context. If there is not a container for the current context, this
4943e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * function will return the empty string.
4944e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
4945e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query
4946e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
4947e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the USR for the container
4948e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */
4949e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE
4950e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results);
49513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
49520a47d69af8bda945352997af3da4687a3356096aDouglas Gregor
49530a47d69af8bda945352997af3da4687a3356096aDouglas Gregor/**
49540a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \brief Returns the currently-entered selector for an Objective-C message
49550a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * send, formatted like "initWithFoo:bar:". Only guaranteed to return a
49560a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * non-empty string for CXCompletionContext_ObjCInstanceMessage and
49570a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * CXCompletionContext_ObjCClassMessage.
49580a47d69af8bda945352997af3da4687a3356096aDouglas Gregor *
49590a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \param Results the code completion results to query
49600a47d69af8bda945352997af3da4687a3356096aDouglas Gregor *
49610a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \returns the selector (or partial selector) that has been entered thus far
49620a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * for an Objective-C message send.
49630a47d69af8bda945352997af3da4687a3356096aDouglas Gregor */
49640a47d69af8bda945352997af3da4687a3356096aDouglas GregorCINDEX_LINKAGE
49650a47d69af8bda945352997af3da4687a3356096aDouglas GregorCXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results);
49660a47d69af8bda945352997af3da4687a3356096aDouglas Gregor
49673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/**
496820d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * @}
496920d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor */
49701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
49711efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
497204bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek/**
497304bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * \defgroup CINDEX_MISC Miscellaneous utility functions
497404bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek *
497504bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @{
497604bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */
497723e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek
497823e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek/**
497923e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek * \brief Return a version string, suitable for showing to a user, but not
498023e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek *        intended to be parsed (the format is not guaranteed to be stable).
498123e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek */
4982f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXString clang_getClangVersion(void);
498304bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek
4984d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek
4985d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek/**
4986d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * \brief Enable/disable crash recovery.
4987d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek *
49887eee0184570366285589d788bcd7f5dda8345915James Dennett * \param isEnabled Flag to indicate if crash recovery is enabled.  A non-zero
49897eee0184570366285589d788bcd7f5dda8345915James Dennett *        value enables crash recovery, while 0 disables it.
4990d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek */
4991d2427ddf00aacdc288c386f3882e0821ca9bd27bTed KremenekCINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled);
4992d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek
499316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek /**
4994896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek  * \brief Visitor invoked for each file in a translation unit
499516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  *        (used with clang_getInclusions()).
499616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  *
499716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * This visitor function will be invoked by clang_getInclusions() for each
49987eee0184570366285589d788bcd7f5dda8345915James Dennett  * file included (either at the top-level or by \#include directives) within
499916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * a translation unit.  The first argument is the file being included, and
500016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * the second and third arguments provide the inclusion stack.  The
500116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * array is sorted in order of immediate inclusion.  For example,
500216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * the first element refers to the location that included 'included_file'.
500316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  */
500416b55a71695a33c094383295cc7b7a2080e098daTed Kremenektypedef void (*CXInclusionVisitor)(CXFile included_file,
500516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   CXSourceLocation* inclusion_stack,
500616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   unsigned include_len,
500716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   CXClientData client_data);
500816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek
500916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/**
501016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * \brief Visit the set of preprocessor inclusions in a translation unit.
501116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   The visitor function is called with the provided data for every included
501216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   file.  This does not include headers included by the PCH file (unless one
501316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   is inspecting the inclusions in the PCH file itself).
501416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek */
501516b55a71695a33c094383295cc7b7a2080e098daTed KremenekCINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu,
501616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                        CXInclusionVisitor visitor,
501716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                        CXClientData client_data);
501816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek
501916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/**
502004bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @}
502104bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */
50221efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
502397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** \defgroup CINDEX_REMAPPING Remapping functions
502497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
502597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @{
502697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
502797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
502897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
502997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief A remapping of original source files and their translated files.
503097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
503197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidistypedef void *CXRemapping;
503297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
503397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
503497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Retrieve a remapping.
503597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
503697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param path the path that contains metadata about remappings.
503797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
503897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \returns the requested remapping. This remapping must be freed
503997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
504097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
504197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path);
504297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
504397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
504430660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \brief Retrieve a remapping.
504530660a898545416f0fea2d717f16f75640001e38Ted Kremenek *
504630660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \param filePaths pointer to an array of file paths containing remapping info.
504730660a898545416f0fea2d717f16f75640001e38Ted Kremenek *
504830660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \param numFiles number of file paths.
504930660a898545416f0fea2d717f16f75640001e38Ted Kremenek *
505030660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \returns the requested remapping. This remapping must be freed
505130660a898545416f0fea2d717f16f75640001e38Ted Kremenek * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
505230660a898545416f0fea2d717f16f75640001e38Ted Kremenek */
505330660a898545416f0fea2d717f16f75640001e38Ted KremenekCINDEX_LINKAGE
505430660a898545416f0fea2d717f16f75640001e38Ted KremenekCXRemapping clang_getRemappingsFromFileList(const char **filePaths,
505530660a898545416f0fea2d717f16f75640001e38Ted Kremenek                                            unsigned numFiles);
505630660a898545416f0fea2d717f16f75640001e38Ted Kremenek
505730660a898545416f0fea2d717f16f75640001e38Ted Kremenek/**
505897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Determine the number of remappings.
505997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
506097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
506197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
506297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
506397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Get the original and the associated filename from the remapping.
506497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
506597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param original If non-NULL, will be set to the original filename.
506697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
506797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param transformed If non-NULL, will be set to the filename that the original
506897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * is associated with.
506997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
507097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index,
507197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis                                     CXString *original, CXString *transformed);
507297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
507397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
507497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Dispose the remapping.
507597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
507697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_dispose(CXRemapping);
507797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
507897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
507997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @}
508097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
508197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
5082aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** \defgroup CINDEX_HIGH Higher level API functions
5083aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
5084aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @{
5085aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */
5086aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5087aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidisenum CXVisitorResult {
5088aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  CXVisit_Break,
5089aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  CXVisit_Continue
5090aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis};
5091aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5092aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef struct {
5093aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  void *context;
5094aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange);
5095aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis} CXCursorAndRangeVisitor;
5096aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
50976f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidistypedef enum {
50986f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  /**
50996f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   * \brief Function returned successfully.
51006f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   */
51016f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  CXResult_Success = 0,
51026f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  /**
51036f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   * \brief One of the parameters was invalid for the function.
51046f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   */
51056f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  CXResult_Invalid = 1,
51066f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  /**
51076f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   * \brief The function was terminated by a callback (e.g. it returned
51086f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   * CXVisit_Break)
51096f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis   */
51106f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis  CXResult_VisitBreak = 2
51116f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis
51126f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis} CXResult;
51136f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis
5114aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/**
5115aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \brief Find references of a declaration in a specific file.
5116aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
5117aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param cursor pointing to a declaration or a reference of one.
5118aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
5119aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param file to search for references.
5120aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
5121aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for
5122aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * each reference found.
5123aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * The CXSourceRange will point inside the file; if the reference is inside
5124aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * a macro (and not a macro argument) the CXSourceRange will be invalid.
5125389dc5603fa10b508a38f668a7830c6d877b6542Argyrios Kyrtzidis *
51266f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis * \returns one of the CXResult enumerators.
5127aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */
51286f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file,
51296f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis                                               CXCursorAndRangeVisitor visitor);
5130aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5131ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis/**
5132ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \brief Find #import/#include directives in a specific file.
5133ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis *
5134ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \param TU translation unit containing the file to query.
5135ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis *
5136ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \param file to search for #import/#include directives.
5137ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis *
5138ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for
5139ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * each directive found.
5140389dc5603fa10b508a38f668a7830c6d877b6542Argyrios Kyrtzidis *
51416f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis * \returns one of the CXResult enumerators.
5142ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis */
51436f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU,
51446f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis                                                 CXFile file,
51456f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis                                              CXCursorAndRangeVisitor visitor);
5146ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis
5147aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#ifdef __has_feature
5148aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#  if __has_feature(blocks)
5149aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5150aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef enum CXVisitorResult
5151aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis    (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange);
5152aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5153aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios KyrtzidisCINDEX_LINKAGE
51546f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile,
51556f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis                                             CXCursorAndRangeVisitorBlock);
5156aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5157ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios KyrtzidisCINDEX_LINKAGE
51586f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile,
51596f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis                                           CXCursorAndRangeVisitorBlock);
5160ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis
5161aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#  endif
5162aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#endif
5163aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5164bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
5165bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a CXFile.
5166bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
5167dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientFile;
5168bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis
5169bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
51702957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic entity.
51712957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
51722957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIdxClientEntity;
51732957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
51742957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
5175bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic container
5176bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * of entities.
5177bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
5178dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientContainer;
5179bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis
5180bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
5181bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with an AST file (PCH
5182bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * or module).
5183bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
5184dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientASTFile;
51854e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5186bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
5187dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis * \brief Source location passed to index callbacks.
5188bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
51894e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
51904e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  void *ptr_data[2];
51914e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  unsigned int_data;
51924e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxLoc;
51934e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5194bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
51957eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for ppIncludedFile callback.
5196bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
51974e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
5198bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
51997eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Location of '#' in the \#include/\#import directive.
5200bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
52014e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc hashLoc;
5202bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
52037eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Filename as written in the \#include/\#import directive.
5204bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
52054e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  const char *filename;
5206bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
52077eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief The actual file that the \#include/\#import directive resolved to.
5208bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5209dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXFile file;
52104e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  int isImport;
52114e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  int isAngled;
52128d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis  /**
52138d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis   * \brief Non-zero if the directive was automatically turned into a module
52148d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis   * import.
52158d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis   */
52168d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis  int isModuleImport;
52174e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxIncludedFileInfo;
52184e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5219bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
52207eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#importedASTFile.
5221bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
52224e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
52232c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis  /**
52242c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   * \brief Top level AST file containing the imported PCH, module or submodule.
52252c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   */
52264e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXFile file;
5227bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5228134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis   * \brief The imported module or NULL if the AST file is a PCH.
5229bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5230134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis  CXModule module;
5231bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5232134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis   * \brief Location where the file is imported. Applicable only for modules.
5233bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5234134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis  CXIdxLoc loc;
52352c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis  /**
52362c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   * \brief Non-zero if an inclusion directive was automatically turned into
5237134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis   * a module import. Applicable only for modules.
52382c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   */
523937f2f52fbc16b0d426d4d86c7e1662e5c6b9e3b8Argyrios Kyrtzidis  int isImplicit;
52402c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis
52414e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxImportedASTFileInfo;
52424e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5243dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum {
5244dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Unexposed     = 0,
5245dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Typedef       = 1,
5246dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Function      = 2,
5247dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Variable      = 3,
5248dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Field         = 4,
5249dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_EnumConstant  = 5,
52504e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5251dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_ObjCClass     = 6,
5252dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_ObjCProtocol  = 7,
5253dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_ObjCCategory  = 8,
52544e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5255c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCInstanceMethod = 9,
5256c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCClassMethod    = 10,
5257c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCProperty  = 11,
5258c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCIvar      = 12,
52594e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5260c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_Enum          = 13,
5261c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_Struct        = 14,
5262c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_Union         = 15,
52632957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
52642957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXClass              = 16,
52652957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXNamespace          = 17,
52662957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXNamespaceAlias     = 18,
52672957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXStaticVariable     = 19,
52682957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXStaticMethod       = 20,
52692957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXInstanceMethod     = 21,
527017d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos  CXIdxEntity_CXXConstructor        = 22,
527117d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos  CXIdxEntity_CXXDestructor         = 23,
527217d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos  CXIdxEntity_CXXConversionFunction = 24,
527317d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos  CXIdxEntity_CXXTypeAlias          = 25,
527417d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos  CXIdxEntity_CXXInterface          = 26
527517d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos
527617d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos} CXIdxEntityKind;
527717d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos
5278838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidistypedef enum {
5279838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_None = 0,
5280838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_C    = 1,
5281838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_ObjC = 2,
5282838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_CXX  = 3
5283838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis} CXIdxEntityLanguage;
5284838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis
52852957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
52862957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Extra C++ template information for an entity. This can apply to:
52872957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_Function
52882957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXClass
52892957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXStaticMethod
52902957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXInstanceMethod
52912957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConstructor
52922957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConversionFunction
52932957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXTypeAlias
52942957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
52952957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef enum {
52962957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_NonTemplate   = 0,
52972957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_Template      = 1,
52982957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_TemplatePartialSpecialization = 2,
52992957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_TemplateSpecialization = 3
53002957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxEntityCXXTemplateKind;
53012957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
5302b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef enum {
5303b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_Unexposed     = 0,
5304b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_IBAction      = 1,
5305b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_IBOutlet      = 2,
5306b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_IBOutletCollection = 3
5307b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrKind;
5308b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
5309b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct {
5310b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttrKind kind;
5311b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXCursor cursor;
5312b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxLoc loc;
5313b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrInfo;
5314b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
5315b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct {
5316643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXIdxEntityKind kind;
5317643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXIdxEntityCXXTemplateKind templateKind;
5318643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXIdxEntityLanguage lang;
5319643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  const char *name;
5320643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  const char *USR;
5321643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXCursor cursor;
5322643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  const CXIdxAttrInfo *const *attributes;
5323643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  unsigned numAttributes;
5324643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxEntityInfo;
5325643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis
5326643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct {
5327643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXCursor cursor;
5328643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxContainerInfo;
5329643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis
5330643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct {
5331b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  const CXIdxAttrInfo *attrInfo;
5332b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  const CXIdxEntityInfo *objcClass;
5333b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXCursor classCursor;
5334b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxLoc classLoc;
5335b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxIBOutletCollectionAttrInfo;
5336b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
5337838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidistypedef enum {
5338838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis  CXIdxDeclFlag_Skipped = 0x1
5339838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis} CXIdxDeclInfoFlags;
5340838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis
53414e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
53426ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *entityInfo;
5343dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXCursor cursor;
5344dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxLoc loc;
5345b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  const CXIdxContainerInfo *semanticContainer;
5346b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  /**
53477eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Generally same as #semanticContainer but can be different in
5348b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis   * cases like out-of-line C++ member functions.
5349b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis   */
5350b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  const CXIdxContainerInfo *lexicalContainer;
5351dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  int isRedeclaration;
53524e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  int isDefinition;
5353c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  int isContainer;
53542957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxContainerInfo *declAsContainer;
5355c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  /**
5356c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis   * \brief Whether the declaration exists in code or was created implicitly
5357c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis   * by the compiler, e.g. implicit objc methods for properties.
5358c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis   */
5359c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  int isImplicit;
5360b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  const CXIdxAttrInfo *const *attributes;
5361b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  unsigned numAttributes;
5362838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis
5363838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis  unsigned flags;
5364838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis
5365dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxDeclInfo;
53664e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5367dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum {
5368dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainer_ForwardRef = 0,
5369dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainer_Interface = 1,
5370dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainer_Implementation = 2
5371dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerKind;
53724e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
53734e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
53746ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxDeclInfo *declInfo;
5375dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainerKind kind;
5376dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerDeclInfo;
53774e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
53784e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
53796ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *base;
53806ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  CXCursor cursor;
53814e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc loc;
53826ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis} CXIdxBaseClassInfo;
53834e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
53844e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
53856ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *protocol;
53866ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  CXCursor cursor;
53874e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc loc;
53884e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxObjCProtocolRefInfo;
53894e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
53904e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
53916ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxObjCProtocolRefInfo *const *protocols;
53924e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  unsigned numProtocols;
5393c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCProtocolRefListInfo;
53944e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
53954e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
5396c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  const CXIdxObjCContainerDeclInfo *containerInfo;
5397c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  const CXIdxBaseClassInfo *superInfo;
5398c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  const CXIdxObjCProtocolRefListInfo *protocols;
5399c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCInterfaceDeclInfo;
54004e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
54012957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef struct {
5402c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  const CXIdxObjCContainerDeclInfo *containerInfo;
5403c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  const CXIdxEntityInfo *objcClass;
5404c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  CXCursor classCursor;
5405c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  CXIdxLoc classLoc;
5406c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  const CXIdxObjCProtocolRefListInfo *protocols;
5407c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis} CXIdxObjCCategoryDeclInfo;
5408c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis
5409c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidistypedef struct {
54102957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxDeclInfo *declInfo;
5411792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis  const CXIdxEntityInfo *getter;
5412792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis  const CXIdxEntityInfo *setter;
5413792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis} CXIdxObjCPropertyDeclInfo;
5414792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis
5415792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidistypedef struct {
5416792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis  const CXIdxDeclInfo *declInfo;
54172957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxBaseClassInfo *const *bases;
54182957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  unsigned numBases;
54192957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxCXXClassDeclInfo;
54202957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
5421bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
54227eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#indexEntityReference.
5423bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
5424aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidistypedef enum {
5425bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5426bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief The entity is referenced directly in user's code.
5427bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5428aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis  CXIdxEntityRef_Direct = 1,
5429bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5430b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * \brief An implicit reference, e.g. a reference of an ObjC method via the
5431b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * dot syntax.
5432bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5433b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxEntityRef_Implicit = 2
5434aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis} CXIdxEntityRefKind;
5435aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis
5436bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
54377eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#indexEntityReference.
5438bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
54394e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
5440b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  CXIdxEntityRefKind kind;
5441bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5442bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Reference cursor.
5443bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
54444e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXCursor cursor;
54454e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc loc;
5446bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5447bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief The entity that gets referenced.
5448bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
54496ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *referencedEntity;
5450bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5451bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Immediate "parent" of the reference. For example:
5452bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   *
5453bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \code
5454bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * Foo *var;
5455bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \endcode
5456bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   *
5457bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * The parent of reference of type 'Foo' is the variable 'var'.
5458e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis   * For references inside statement bodies of functions/methods,
5459e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis   * the parentEntity will be the function/method.
5460bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
54616ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *parentEntity;
5462bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5463e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis   * \brief Lexical container context of the reference.
5464bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
54652957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxContainerInfo *container;
54664e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxEntityRefInfo;
54674e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
54687eee0184570366285589d788bcd7f5dda8345915James Dennett/**
54697eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief A group of callbacks used by #clang_indexSourceFile and
54707eee0184570366285589d788bcd7f5dda8345915James Dennett * #clang_indexTranslationUnit.
54717eee0184570366285589d788bcd7f5dda8345915James Dennett */
54724e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
5473bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
54746ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis   * \brief Called periodically to check whether indexing should be aborted.
54756ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis   * Should return 0 to continue, and non-zero to abort.
54766ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis   */
54776ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  int (*abortQuery)(CXClientData client_data, void *reserved);
54786ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis
54796ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  /**
5480b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * \brief Called at the end of indexing; passes the complete diagnostic set.
5481bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
54824e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  void (*diagnostic)(CXClientData client_data,
5483b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis                     CXDiagnosticSet, void *reserved);
54844e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5485dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientFile (*enteredMainFile)(CXClientData client_data,
54867eee0184570366285589d788bcd7f5dda8345915James Dennett                                     CXFile mainFile, void *reserved);
5487dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis
5488bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
54897eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Called when a file gets \#included/\#imported.
5490bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5491dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientFile (*ppIncludedFile)(CXClientData client_data,
54926ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                                    const CXIdxIncludedFileInfo *);
54934e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5494bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5495bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Called when a AST file (PCH or module) gets imported.
5496bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   *
5497bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * AST files will not get indexed (there will not be callbacks to index all
5498bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * the entities in an AST file). The recommended action is that, if the AST
54992c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   * file is not already indexed, to initiate a new indexing job specific to
55002c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis   * the AST file.
5501bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5502dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientASTFile (*importedASTFile)(CXClientData client_data,
55036ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                                        const CXIdxImportedASTFileInfo *);
55044e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5505bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5506bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Called at the beginning of indexing a translation unit.
5507bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
5508dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data,
55096ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                                                 void *reserved);
55104e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
55116ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  void (*indexDeclaration)(CXClientData client_data,
55122957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis                           const CXIdxDeclInfo *);
55134e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5514bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
5515bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Called to index a reference of an entity.
5516bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
55174e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  void (*indexEntityReference)(CXClientData client_data,
55186ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                               const CXIdxEntityRefInfo *);
55194e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
55204e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} IndexerCallbacks;
55214e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5522ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind);
55236ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCContainerDeclInfo *
55246ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *);
55256ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis
55266ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo *
55276ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *);
5528dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis
5529ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE
55306ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisconst CXIdxObjCCategoryDeclInfo *
55316ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *);
55326ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis
5533c71d55469e7d5f7b376a30620617a175a9442da9Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo *
5534c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidisclang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *);
5535dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis
5536792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo *
5537792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidisclang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *);
5538792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis
5539b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo *
5540b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidisclang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *);
5541b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
55422957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxCXXClassDeclInfo *
55432957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *);
55442957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
55452957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
55462957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientContainer attached to a
55472957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container.
55482957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
55492957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientContainer
55502957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientContainer(const CXIdxContainerInfo *);
55512957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
55522957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
55532957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientContainer attached to a
55542957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container.
55552957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
55562957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void
55572957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer);
55582957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
55592957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
55602957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientEntity attached to an entity.
55612957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
55622957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientEntity
55632957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientEntity(const CXIdxEntityInfo *);
55642957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
55652957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
55662957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientEntity attached to an entity.
55672957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
55682957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void
55692957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity);
55702957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
55712957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
5572838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * \brief An indexing action/session, to be applied to one or multiple
5573838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * translation units.
55742957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
55752957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIndexAction;
55762957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
55772957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
5578838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * \brief An indexing action/session, to be applied to one or multiple
5579838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * translation units.
55802957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis *
55812957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \param CIdx The index object with which the index action will be associated.
55822957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
55832957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx);
55842957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
55852957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
55862957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Destroy the given index action.
55872957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis *
55882957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * The index action must not be destroyed until all of the translation units
55892957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * created within that index action have been destroyed.
55902957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
55912957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction);
55922957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
559321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidistypedef enum {
559421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis  /**
559521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis   * \brief Used to indicate that no special indexing options are needed.
559621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis   */
559721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis  CXIndexOpt_None = 0x0,
559821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis
559921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis  /**
56007eee0184570366285589d788bcd7f5dda8345915James Dennett   * \brief Used to indicate that IndexerCallbacks#indexEntityReference should
56017eee0184570366285589d788bcd7f5dda8345915James Dennett   * be invoked for only one reference of an entity per source file that does
56027eee0184570366285589d788bcd7f5dda8345915James Dennett   * not also include a declaration/definition of the entity.
560321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis   */
560422490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis  CXIndexOpt_SuppressRedundantRefs = 0x1,
560522490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis
560622490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis  /**
560722490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis   * \brief Function-local symbols should be indexed. If this is not set
560822490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis   * function-local symbols will be ignored.
560922490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis   */
561058d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis  CXIndexOpt_IndexFunctionLocalSymbols = 0x2,
561158d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis
561258d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis  /**
561358d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis   * \brief Implicit function/class template instantiations should be indexed.
561458d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis   * If this is not set, implicit instantiations will be ignored.
561558d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis   */
5616b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis  CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4,
5617b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis
5618b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis  /**
5619b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis   * \brief Suppress all compiler warnings when parsing for indexing.
5620b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis   */
5621838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis  CXIndexOpt_SuppressWarnings = 0x8,
5622838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis
5623838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis  /**
5624838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis   * \brief Skip a function/method body that was already parsed during an
5625838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis   * indexing session assosiated with a \c CXIndexAction object.
5626838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis   * Bodies in system headers are always skipped.
5627838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis   */
5628838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis  CXIndexOpt_SkipParsedBodiesInSession = 0x10
5629838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis
563021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis} CXIndexOptFlags;
563121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis
5632bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
5633bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Index the given source file and the translation unit corresponding
56347eee0184570366285589d788bcd7f5dda8345915James Dennett * to that file via callbacks implemented through #IndexerCallbacks.
5635bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
5636bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param client_data pointer data supplied by the client, which will
5637bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * be passed to the invoked callbacks.
5638bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
5639bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param index_callbacks Pointer to indexing callbacks that the client
5640bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * implements.
5641bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
56427eee0184570366285589d788bcd7f5dda8345915James Dennett * \param index_callbacks_size Size of #IndexerCallbacks structure that gets
5643bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * passed in index_callbacks.
5644bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
564521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \param index_options A bitmask of options that affects how indexing is
564621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags.
5647bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
5648bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param out_TU [out] pointer to store a CXTranslationUnit that can be reused
5649bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * after indexing is finished. Set to NULL if you do not require it.
5650bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
565121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns
5652bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * non-zero, otherwise returns 0.
565321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
56547eee0184570366285589d788bcd7f5dda8345915James Dennett * The rest of the parameters are the same as #clang_parseTranslationUnit.
5655bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
56562957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction,
56574e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         CXClientData client_data,
56584e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         IndexerCallbacks *index_callbacks,
56594e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned index_callbacks_size,
56604e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned index_options,
56614e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         const char *source_filename,
56624e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         const char * const *command_line_args,
56634e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         int num_command_line_args,
56644e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         struct CXUnsavedFile *unsaved_files,
56654e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned num_unsaved_files,
56664e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         CXTranslationUnit *out_TU,
56674e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned TU_options);
56684e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5669bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
567021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \brief Index the given translation unit via callbacks implemented through
56717eee0184570366285589d788bcd7f5dda8345915James Dennett * #IndexerCallbacks.
567221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
567321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * The order of callback invocations is not guaranteed to be the same as
567421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * when indexing a source file. The high level order will be:
567521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
567621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *   -Preprocessor callbacks invocations
567721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *   -Declaration/reference callbacks invocations
567821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *   -Diagnostic callback invocations
567921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
56807eee0184570366285589d788bcd7f5dda8345915James Dennett * The parameters are the same as #clang_indexSourceFile.
568121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
568221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns
568321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * non-zero, otherwise returns 0.
568421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */
56852957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction,
568621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis                                              CXClientData client_data,
568721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis                                              IndexerCallbacks *index_callbacks,
568821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis                                              unsigned index_callbacks_size,
56892957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis                                              unsigned index_options,
56902957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis                                              CXTranslationUnit);
569121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis
569221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis/**
5693bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXIdxFile, file, line, column, and offset represented by
5694bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * the given CXIdxLoc.
5695bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
5696bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * If the location refers into a macro expansion, retrieves the
5697bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * location of the macro expansion and if it refers into a macro argument
5698bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * retrieves the location of the argument.
5699bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
57004e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc,
5701dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis                                                   CXIdxClientFile *indexFile,
57024e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   CXFile *file,
57034e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   unsigned *line,
57044e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   unsigned *column,
57054e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   unsigned *offset);
57064e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5707bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
5708bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXSourceLocation represented by the given CXIdxLoc.
5709bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
57104e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE
57114e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc);
57124e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
5713aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/**
5714aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @}
5715aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */
5716aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
5717c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
5718c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
5719c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
57201efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
5721d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus
5722d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek}
5723d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
5724d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
5725d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
5726