Index.h revision 42b2984771a7fd1b17c78bbb2c59fed3db2f1960
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
23d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus
24d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenekextern "C" {
25d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
26d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
2788145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff/* MSVC DLL import/export. */
282e06fc877a633abea3b40a64950c7316dac29ca8John Thompson#ifdef _MSC_VER
292e06fc877a633abea3b40a64950c7316dac29ca8John Thompson  #ifdef _CINDEX_LIB_
302e06fc877a633abea3b40a64950c7316dac29ca8John Thompson    #define CINDEX_LINKAGE __declspec(dllexport)
312e06fc877a633abea3b40a64950c7316dac29ca8John Thompson  #else
322e06fc877a633abea3b40a64950c7316dac29ca8John Thompson    #define CINDEX_LINKAGE __declspec(dllimport)
332e06fc877a633abea3b40a64950c7316dac29ca8John Thompson  #endif
342e06fc877a633abea3b40a64950c7316dac29ca8John Thompson#else
352e06fc877a633abea3b40a64950c7316dac29ca8John Thompson  #define CINDEX_LINKAGE
362e06fc877a633abea3b40a64950c7316dac29ca8John Thompson#endif
372e06fc877a633abea3b40a64950c7316dac29ca8John Thompson
3887fb9404cd962b78c98947d75d68be1691c4e737Douglas Gregor/** \defgroup CINDEX libclang: C Interface to Clang
3920d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor *
401efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The C Interface to Clang provides a relatively small API that exposes
41f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * facilities for parsing source code into an abstract syntax tree (AST),
42f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * loading already-parsed ASTs, traversing the AST, associating
43f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * physical source locations with elements within the AST, and other
44f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * facilities that support Clang-based development tools.
45f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
461efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * This C interface to Clang will never provide all of the information
47f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * representation stored in Clang's C++ AST, nor should it: the intent is to
48f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * maintain an API that is relatively stable from one release to the next,
49f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * providing only the basic functionality needed to support development tools.
501efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar *
511efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * To avoid namespace pollution, data types are prefixed with "CX" and
52f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * functions are prefixed with "clang_".
5320d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor *
5420d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * @{
5520d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor */
561efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
577f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
587f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief An "index" that consists of a set of translation units that would
597f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * typically be linked together into an executable or library.
607f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
617f17376e0931a337d544b75d9030bc92763be287Douglas Gregortypedef void *CXIndex;
62600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
637f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
647f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief A single translation unit, which resides in an index.
657f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
660a90d32523bfe5fa63e11b648686c9699f786d15Ted Kremenektypedef struct CXTranslationUnitImpl *CXTranslationUnit;
67600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
687f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
69c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Opaque pointer representing client data that will be passed through
70c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to various callbacks and visitors.
717f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
72c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregortypedef void *CXClientData;
731efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
74735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor/**
75735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * \brief Provides the contents of a file that has not yet been saved to disk.
76735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor *
77735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * Each CXUnsavedFile instance provides the name of a file on the
78735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * system along with the current contents of that file that have not
79735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * yet been saved to disk.
80735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor */
81735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregorstruct CXUnsavedFile {
821efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief The file whose contents have not yet been saved.
84735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor   *
85735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor   * This file must already exist in the file system.
86735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor   */
87735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor  const char *Filename;
88735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor
891efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
90c8dfe5ece04e683106eb96c58a2999f70b53ac21Douglas Gregor   * \brief A buffer containing the unsaved contents of this file.
91735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor   */
92735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor  const char *Contents;
93735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor
94735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor  /**
95c8dfe5ece04e683106eb96c58a2999f70b53ac21Douglas Gregor   * \brief The length of the unsaved contents of this buffer.
96735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor   */
97735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor  unsigned long Length;
98735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor};
99735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor
100076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne/**
101076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * \brief Describes the availability of a particular entity, which indicates
102076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * whether the use of this entity will result in a warning or error due to
103076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * it being deprecated or unavailable.
104076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne */
10558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorenum CXAvailabilityKind {
106076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne  /**
107076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   * \brief The entity is available.
108076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   */
10958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor  CXAvailability_Available,
110076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne  /**
111076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   * \brief The entity is available, but has been deprecated (and its use is
112076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   * not recommended).
113076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   */
11458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor  CXAvailability_Deprecated,
115076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne  /**
116076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   * \brief The entity is not available; any use of it will be an error.
117076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne   */
11858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor  CXAvailability_NotAvailable
11958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor};
12058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
1217f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1227f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \defgroup CINDEX_STRING String manipulation routines
1237f17376e0931a337d544b75d9030bc92763be287Douglas Gregor *
1247f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * @{
1257f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
1261efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1277f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1287f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief A character string.
1297f17376e0931a337d544b75d9030bc92763be287Douglas Gregor *
1307f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * The \c CXString type is used to return strings from the interface when
1317f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * the ownership of that string might different from one call to the next.
1327f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * Use \c clang_getCString() to retrieve the string data and, once finished
1337f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * with the string data, call \c clang_disposeString() to free the string.
134ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Naroff */
135ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Narofftypedef struct {
136a60ed47da13393796d8552b9fdca12abbb3eea42Ted Kremenek  void *data;
137ed122735639d83c10f18c28c7fd117bfcd0f62cbTed Kremenek  unsigned private_flags;
138ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Naroff} CXString;
139ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Naroff
1407f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1417f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief Retrieve the character data associated with the given string.
1427f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
143ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve NaroffCINDEX_LINKAGE const char *clang_getCString(CXString string);
144ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Naroff
1457f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1467f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief Free the given string,
1477f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
148ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve NaroffCINDEX_LINKAGE void clang_disposeString(CXString string);
149ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Naroff
1507f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1517f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * @}
1527f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
1531efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
155e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * \brief clang_createIndex() provides a shared context for creating
156e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * translation units. It provides two options:
157e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff *
158e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
159e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * declarations (when loading any new translation units). A "local" declaration
1601efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * is one that belongs in the translation unit itself and not in a precompiled
161e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * header that was used by the translation unit. If zero, all declarations
162e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * will be enumerated.
163e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff *
164b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * Here is an example:
165b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
1660a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *   // excludeDeclsFromPCH = 1, displayDiagnostics=1
1670a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *   Idx = clang_createIndex(1, 1);
168b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
169b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // IndexTest.pch was produced with the following command:
170b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
171b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
172b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
173b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // This will load all the symbols from 'IndexTest.pch'
1741efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
175002a528ab0189fc60cfbf9328962c96ccbe567eeDouglas Gregor *                       TranslationUnitVisitor, 0);
176b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   clang_disposeTranslationUnit(TU);
177b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
178b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // This will load all the symbols from 'IndexTest.c', excluding symbols
179b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // from 'IndexTest.pch'.
180fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar *   char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
181fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar *   TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
182fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar *                                                  0, 0);
183b2cd48756119f4d8d2a865b4b3e0e8efd02e26a0Douglas Gregor *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
184b2cd48756119f4d8d2a865b4b3e0e8efd02e26a0Douglas Gregor *                       TranslationUnitVisitor, 0);
185b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   clang_disposeTranslationUnit(TU);
186b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
187b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * This process of creating the 'pch', loading it separately, and using it (via
188b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
189b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * (which gives the indexer the same performance benefit as the compiler).
190e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff */
1910a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
1920a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor                                         int displayDiagnostics);
193896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
1940087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor/**
1950087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * \brief Destroy the given index.
1960087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor *
1970087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * The index must not be destroyed until all of the translation units created
1980087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * within that index have been destroyed.
1990087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor */
2008506dde586459887b7e14e23a30af8ac5be5adb6Daniel DunbarCINDEX_LINKAGE void clang_disposeIndex(CXIndex index);
2011efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2021efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
203c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_FILES File manipulation routines
204f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
205f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{
206f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
2071efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
208f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
209f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief A particular source file that is part of a translation unit.
210f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
211f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregortypedef void *CXFile;
2121efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
213f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor
214f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
215f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief Retrieve the complete file and path name of the given file.
21688145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff */
21774844072411bae91d5dbb89955d200cbe1e0a1c8Ted KremenekCINDEX_LINKAGE CXString clang_getFileName(CXFile SFile);
2181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
219f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
220f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief Retrieve the last modification time of the given file.
221f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
22208b0e8daeb683686b876d72674962ad96df21d45Douglas GregorCINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
22388145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff
2243c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/**
225dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * \brief Determine whether the given header is guarded against
226dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * multiple inclusions, either with the conventional
227dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * #ifndef/#define/#endif macro guards or with #pragma once.
228dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor */
229dd3e5549e3c11e217078938aacf72f042eea5343Douglas GregorCINDEX_LINKAGE unsigned
230dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregorclang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
231dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor
232dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor/**
233b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a file handle within the given translation unit.
234b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
235b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param tu the translation unit
2361efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar *
237b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param file_name the name of the file.
238b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
239b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns the file handle for the named file in the translation unit \p tu,
240b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * or a NULL file handle if the file was not a part of this translation unit.
241b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
2421efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,
243b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                    const char *file_name);
2441efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
245b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
246f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @}
247f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
248f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor
249f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
250f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \defgroup CINDEX_LOCATIONS Physical source locations
251f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
252f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * Clang represents physical source locations in its abstract syntax tree in
253f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * great detail, with file, line, and column information for the majority of
254f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * the tokens parsed in the source code. These data types and functions are
255f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * used to represent source location information, either for a particular
256f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * point in the program or for a range of points in the program, and extract
257f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * specific location information from those data types.
258f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
259f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{
260f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
2611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
262f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
2631db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * \brief Identifies a specific source location within a translation
2641db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * unit.
2651db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
26620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * Use clang_getExpansionLocation() or clang_getSpellingLocation()
267a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * to map a source location to a particular file, line, and column.
2683c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */
2693c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct {
2705352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  void *ptr_data[2];
2711db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor  unsigned int_data;
2723c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceLocation;
273fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek
2743c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/**
275d52864bd33c66aacc84133460d8c9c0dfcdd5c18Daniel Dunbar * \brief Identifies a half-open character range in the source code.
2763c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor *
2771db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
2781db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * starting and end locations from a source range, respectively.
2793c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */
2803c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct {
2815352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  void *ptr_data[2];
2821db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor  unsigned begin_int_data;
2831db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor  unsigned end_int_data;
2843c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceRange;
285fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek
2861db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/**
287b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a NULL (invalid) source location.
288b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
289b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getNullLocation();
2901efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
291b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
292b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \determine Determine whether two source locations, which must refer into
2931efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * the same translation unit, refer to exactly the same point in the source
294b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * code.
295b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
296b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns non-zero if the source locations refer to the same location, zero
297b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * if they refer to different locations.
298b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
299b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1,
300b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                             CXSourceLocation loc2);
3011efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
302b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
3031efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieves the source location associated with a given file/line/column
3041efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * in a particular translation unit.
305b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
306b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu,
307b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                                  CXFile file,
308b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                                  unsigned line,
309b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                                  unsigned column);
31083889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall/**
31183889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * \brief Retrieves the source location associated with a given character offset
31283889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * in a particular translation unit.
31383889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall */
31483889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid ChisnallCINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu,
31583889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall                                                           CXFile file,
31683889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall                                                           unsigned offset);
3171efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
318b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
3195352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve a NULL (invalid) source range.
3205352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
3215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXSourceRange clang_getNullRange();
322896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3235352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
324b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a source range given the beginning and ending source
325b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * locations.
326b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
327b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin,
328b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                            CXSourceLocation end);
3291efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
330b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
331ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \brief Determine whether two ranges are equivalent.
332ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor *
333ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \returns non-zero if the ranges are the same, zero if they differ.
334ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor */
335ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas GregorCINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1,
336ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor                                          CXSourceRange range2);
337ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor
338ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor/**
339de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis * \brief Returns non-zero if \arg range is null.
340de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis */
341de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidisint clang_Range_isNull(CXSourceRange range);
342de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis
343de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis/**
34446766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \brief Retrieve the file, line, column, and offset represented by
34546766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * the given source location.
3461db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
34720174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * If the location refers into a macro expansion, retrieves the
34820174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * location of the macro expansion.
349a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
3501efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param location the location within a source file that will be decomposed
3511efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * into its parts.
3521db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
3531efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param file [out] if non-NULL, will be set to the file to which the given
3541db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points.
3551db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
3561efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param line [out] if non-NULL, will be set to the line to which the given
3571db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points.
3581db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
3591efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param column [out] if non-NULL, will be set to the column to which the given
3601efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source location points.
36146766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor *
36246766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the
36346766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * buffer to which the given source location points.
3641db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */
36520174221af145554b76a0b0f5e4eb3ac70d05945Chandler CarruthCINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location,
36620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               CXFile *file,
36720174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               unsigned *line,
36820174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               unsigned *column,
36920174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               unsigned *offset);
37020174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth
37120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth/**
372e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \brief Retrieve the file, line, column, and offset represented by
373e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the given source location, as specified in a # line directive.
374e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
375e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * Example: given the following source code in a file somefile.c
376e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
377e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * #123 "dummy.c" 1
378e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
379e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * static int func(void)
380e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * {
381e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *     return 0;
382e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * }
383e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
384e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the location information returned by this function would be
385e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
386e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: dummy.c Line: 124 Column: 12
387e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
388e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * whereas clang_getExpansionLocation would have returned
389e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
390e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: somefile.c Line: 3 Column: 12
391e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
392e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param location the location within a source file that will be decomposed
393e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * into its parts.
394e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
395e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param filename [out] if non-NULL, will be set to the filename of the
396e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. Note that filenames returned will be for "virtual" files,
397e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * which don't necessarily exist on the machine running clang - e.g. when
398e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * parsing preprocessed output obtained from a different environment. If
399e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * a non-NULL value is passed in, remember to dispose of the returned value
400e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * using \c clang_disposeString() once you've finished with it. For an invalid
401e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location, an empty string is returned.
402e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
403e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param line [out] if non-NULL, will be set to the line number of the
404e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned.
405e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
406e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param column [out] if non-NULL, will be set to the column number of the
407e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned.
408e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis */
409e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios KyrtzidisCINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location,
410e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis                                              CXString *filename,
411e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis                                              unsigned *line,
412e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis                                              unsigned *column);
413e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis
414e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis/**
41520174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * \brief Legacy API to retrieve the file, line, column, and offset represented
41620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * by the given source location.
41720174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth *
41820174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * This interface has been replaced by the newer interface
41920174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * \see clang_getExpansionLocation(). See that interface's documentation for
42020174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * details.
42120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth */
4221db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location,
4231db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor                                                   CXFile *file,
4241db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor                                                   unsigned *line,
42546766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor                                                   unsigned *column,
42646766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor                                                   unsigned *offset);
427e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor
428e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor/**
429a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \brief Retrieve the file, line, column, and offset represented by
430a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * the given source location.
431a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
432a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * If the location refers into a macro instantiation, return where the
433a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * location was originally spelled in the source file.
434a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
435a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param location the location within a source file that will be decomposed
436a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * into its parts.
437a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
438a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param file [out] if non-NULL, will be set to the file to which the given
439a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points.
440a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
441a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param line [out] if non-NULL, will be set to the line to which the given
442a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points.
443a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
444a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param column [out] if non-NULL, will be set to the column to which the given
445a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points.
446a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
447a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the
448a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * buffer to which the given source location points.
449a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor */
450a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas GregorCINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location,
451a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              CXFile *file,
452a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              unsigned *line,
453a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              unsigned *column,
454a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              unsigned *offset);
455a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor
456a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor/**
4571efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the first character within a
4581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range.
4591db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */
4601db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range);
4611db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor
4621db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/**
4631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the last character within a
4641efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range.
4651db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */
4661db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range);
4671db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor
468f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
469f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @}
470f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
471c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
472c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
4735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_DIAG Diagnostic reporting
4745352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
4755352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{
4765352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
4775352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
4785352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
4795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Describes the severity of a particular diagnostic.
4805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
4815352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorenum CXDiagnosticSeverity {
4825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
483896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek   * \brief A diagnostic that has been suppressed, e.g., by a command-line
4845352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * option.
4855352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
4865352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Ignored = 0,
487896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4885352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
4895352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic is a note that should be attached to the
4905352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * previous (non-note) diagnostic.
4915352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
4925352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Note    = 1,
4935352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
4945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
4955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic indicates suspicious code that may not be
4965352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * wrong.
4975352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
4985352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Warning = 2,
4995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
5005352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
5015352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic indicates that the code is ill-formed.
5025352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
5035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Error   = 3,
5045352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
5055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
5065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic indicates that the code is ill-formed such
5075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * that future parser recovery is unlikely to produce useful
5085352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * results.
5095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
5105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Fatal   = 4
5115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor};
5125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
5135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
5145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief A single diagnostic, containing the diagnostic's severity,
5155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * location, text, source ranges, and fix-it hints.
5165352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
5175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregortypedef void *CXDiagnostic;
5185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
5195352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
520a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced for the given
521a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * translation unit.
522a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
523a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit);
524a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
525a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
526a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given translation unit.
5275352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
528a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Unit the translation unit to query.
529a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve.
5305352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
531a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed
532a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic().
5335352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
534a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,
535a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                                unsigned Index);
536a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
537a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
538a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Destroy a diagnostic.
539a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
540a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
5415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
5425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
5430a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Options to control the display of diagnostics.
5440a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
5450a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * The values in this enum are meant to be combined to customize the
5460a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * behavior of \c clang_displayDiagnostic().
5470a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */
5480a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregorenum CXDiagnosticDisplayOptions {
5490a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  /**
5500a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \brief Display the source-location information where the
5510a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * diagnostic was located.
5520a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
5530a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * When set, diagnostics will be prefixed by the file, line, and
5540a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * (optionally) column to which the diagnostic refers. For example,
5550a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
5560a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \code
5570a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * test.c:28: warning: extra tokens at end of #endif directive
5580a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \endcode
5590a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
5600a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * This option corresponds to the clang flag \c -fshow-source-location.
5610a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   */
5620a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  CXDiagnostic_DisplaySourceLocation = 0x01,
5630a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
5640a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  /**
5650a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \brief If displaying the source-location information of the
5660a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * diagnostic, also include the column number.
5670a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
5680a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * This option corresponds to the clang flag \c -fshow-column.
5690a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   */
5700a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  CXDiagnostic_DisplayColumn = 0x02,
5710a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
5720a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  /**
5730a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \brief If displaying the source-location information of the
5740a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * diagnostic, also include information about source ranges in a
5750a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * machine-parsable format.
5760a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
577896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek   * This option corresponds to the clang flag
5780a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \c -fdiagnostics-print-source-range-info.
5790a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   */
580aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplaySourceRanges = 0x04,
581aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
582aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  /**
583aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \brief Display the option name associated with this diagnostic, if any.
584aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   *
585aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * The option name displayed (e.g., -Wconversion) will be placed in brackets
586aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * after the diagnostic text. This option corresponds to the clang flag
587aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \c -fdiagnostics-show-option.
588aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   */
589aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplayOption = 0x08,
590aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
591aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  /**
592aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \brief Display the category number associated with this diagnostic, if any.
593aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   *
594aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * The category number is displayed within brackets after the diagnostic text.
595aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * This option corresponds to the clang flag
596aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \c -fdiagnostics-show-category=id.
597aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   */
598aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplayCategoryId = 0x10,
599aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
600aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  /**
601aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \brief Display the category name associated with this diagnostic, if any.
602aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   *
603aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * The category name is displayed within brackets after the diagnostic text.
604aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * This option corresponds to the clang flag
605aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \c -fdiagnostics-show-category=name.
606aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   */
607aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplayCategoryName = 0x20
6080a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor};
6090a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
6100a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/**
611274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \brief Format the given diagnostic in a manner that is suitable for display.
6120a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
613274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * This routine will format the given diagnostic to a string, rendering
614896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the diagnostic according to the various options given. The
615896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \c clang_defaultDiagnosticDisplayOptions() function returns the set of
6160a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * options that most closely mimics the behavior of the clang compiler.
6170a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
6180a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \param Diagnostic The diagnostic to print.
6190a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
620896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Options A set of options that control the diagnostic display,
6210a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * created by combining \c CXDiagnosticDisplayOptions values.
622274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor *
623274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \returns A new string containing for formatted diagnostic.
6240a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */
625274f1906f12ebf8fcc179701deeda6d3271120c1Douglas GregorCINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic,
626274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor                                               unsigned Options);
6270a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
6280a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/**
6290a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Retrieve the set of display options most similar to the
6300a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * default behavior of the clang compiler.
6310a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
6320a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \returns A set of display options suitable for use with \c
6330a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * clang_displayDiagnostic().
6340a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */
6350a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void);
6360a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
6370a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/**
6385352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the severity of the given diagnostic.
6395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
640896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE enum CXDiagnosticSeverity
6415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getDiagnosticSeverity(CXDiagnostic);
6425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
6435352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
6445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the source location of the given diagnostic.
6455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
6465352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * This location is where Clang would print the caret ('^') when
6475352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * displaying the diagnostic on the command line.
6485352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
6495352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic);
6505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
6515352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
6525352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the text of the given diagnostic.
6535352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
6545352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic);
655a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor
656a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor/**
657aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the name of the command-line option that enabled this
658aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic.
659aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
660aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Diag The diagnostic to be queried.
661aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
662aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Disable If non-NULL, will be set to the option that disables this
663aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic (if any).
664aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
665aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns A string that contains the command-line option used to enable this
666aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * warning, such as "-Wconversion" or "-pedantic".
667aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */
668aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag,
669aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor                                                  CXString *Disable);
670aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
671aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/**
672aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the category number for this diagnostic.
673aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
674aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * Diagnostics can be categorized into groups along with other, related
675aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostics (e.g., diagnostics under the same warning flag). This routine
676aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * retrieves the category number for the given diagnostic.
677aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
678aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The number of the category that contains this diagnostic, or zero
679aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * if this diagnostic is uncategorized.
680aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */
681aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
682aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
683aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/**
684aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the name of a particular diagnostic category.
685aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
686aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Category A diagnostic category number, as returned by
687aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c clang_getDiagnosticCategory().
688aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
689aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The name of the given diagnostic category.
690aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */
691aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticCategoryName(unsigned Category);
692aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
693aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/**
694a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Determine the number of source ranges associated with the given
695a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * diagnostic.
696a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor */
697a3890baf1256ff26081306c7fef70202f8223f41Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic);
698896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
6995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
700a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Retrieve a source range associated with the diagnostic.
7015352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
702a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * A diagnostic's source ranges highlight important elements in the source
7035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * code. On the command line, Clang displays source ranges by
704896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * underlining them with '~' characters.
7055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
706a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \param Diagnostic the diagnostic whose range is being extracted.
7075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
708896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Range the zero-based index specifying which range to
7095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
710a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \returns the requested source range.
7115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
712896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic,
713a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor                                                      unsigned Range);
7145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
7155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
7165352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the number of fix-it hints associated with the
7175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * given diagnostic.
7185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
7195352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
7205352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
7215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
722473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \brief Retrieve the replacement information for a given fix-it.
7235352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
724473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * Fix-its are described in terms of a source range whose contents
725473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * should be replaced by a string. This approach generalizes over
726473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * three kinds of operations: removal of source code (the range covers
727473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * the code to be removed and the replacement string is empty),
728473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replacement of source code (the range covers the code to be
729473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced and the replacement string provides the new code), and
730473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion (both the start and end of the range point at the
731473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion location, and the replacement string provides the text to
732473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insert).
7335352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
734473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param Diagnostic The diagnostic whose fix-its are being queried.
7355352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
736473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param FixIt The zero-based index of the fix-it.
7375352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
738473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param ReplacementRange The source range whose contents will be
739473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced with the returned replacement string. Note that source
740473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * ranges are half-open ranges [a, b), so the source code should be
741473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced from a and up to (but not including) b.
7425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
743473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \returns A string containing text that should be replace the source
744473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * code indicated by the \c ReplacementRange.
7455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
746896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic,
747473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor                                                 unsigned FixIt,
748473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor                                               CXSourceRange *ReplacementRange);
7495352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
7505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
7515352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @}
7525352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
7535352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
7545352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
7555352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation
7565352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
7575352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * The routines in this group provide the ability to create and destroy
7585352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * translation units from files, either by parsing the contents of the files or
7595352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * by reading in a serialized representation of a translation unit.
7605352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
7615352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{
7625352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
763896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
7645352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
7655352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Get the original translation unit source file name.
7665352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
7675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString
7685352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
7695352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
7705352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
7715352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Return the CXTranslationUnit for a given source file and the provided
7725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * command line arguments one would pass to the compiler.
7735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
7745352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: The 'source_filename' argument is optional.  If the caller provides a
7755352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * NULL pointer, the name of the source file is expected to reside in the
7765352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * specified command line arguments.
7775352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
7785352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: When encountered in 'clang_command_line_args', the following options
7795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * are ignored:
7805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
7815352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-c'
7825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-emit-ast'
7835352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-fsyntax-only'
7845352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-o <output file>'  (both '-o' and '<output file>' are ignored)
7855352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
7861ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param CIdx The index object with which the translation unit will be
7871ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * associated.
7885352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
7895352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param source_filename - The name of the source file to load, or NULL if the
7901ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p clang_command_line_args.
7911ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek *
7921ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param num_clang_command_line_args The number of command-line arguments in
7931ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \p clang_command_line_args.
7941ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek *
7951ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param clang_command_line_args The command-line arguments that would be
7961ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * passed to the \c clang executable if it were being invoked out-of-process.
7971ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * These command-line options will be parsed and will affect how the translation
7981ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * unit is parsed. Note that the following options are ignored: '-c',
7991ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
8005352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8015352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p
8025352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * unsaved_files.
8035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8045352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk
8055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * but may be required for code completion, including the contents of
806c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * those files.  The contents and name of these files (as specified by
807c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * CXUnsavedFile) are copied when necessary, so the client only needs to
808c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * guarantee their validity until the call to this function returns.
8095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
8105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile(
8115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         CXIndex CIdx,
8125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         const char *source_filename,
8135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         int num_clang_command_line_args,
8142ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor                                   const char * const *clang_command_line_args,
8155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         unsigned num_unsaved_files,
816a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                         struct CXUnsavedFile *unsaved_files);
817896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
8185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
8195352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Create a translation unit from an AST file (-emit-ast).
8205352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
821896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(CXIndex,
822a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                             const char *ast_filename);
8235352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
82444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor/**
82544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * \brief Flags that control the creation of translation units.
82644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor *
82744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * The enumerators in this enumeration type are meant to be bitwise
82844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * ORed together to specify which options should be used when
82944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * constructing the translation unit.
83044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */
8315a43021ac491bf091494167127772a20d9a9bb48Douglas Gregorenum CXTranslationUnit_Flags {
8325a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor  /**
8335a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * \brief Used to indicate that no special translation-unit options are
8345a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * needed.
8355a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   */
8365a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor  CXTranslationUnit_None = 0x0,
8375a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor
8385a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor  /**
8395a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * \brief Used to indicate that the parser should construct a "detailed"
8405a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * preprocessing record, including all macro definitions and instantiations.
8415a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   *
8425a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * Constructing a detailed preprocessing record requires more memory
8435a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * and time to parse, since the information contained in the record
8445a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * is usually not retained. However, it can be useful for
8455a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * applications that require more detailed information about the
8465a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * behavior of the preprocessor.
8475a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   */
84844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor  CXTranslationUnit_DetailedPreprocessingRecord = 0x01,
84944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor
85044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor  /**
851b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * \brief Used to indicate that the translation unit is incomplete.
85244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   *
853b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * When a translation unit is considered "incomplete", semantic
854b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * analysis that is typically performed at the end of the
855b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * translation unit will be suppressed. For example, this suppresses
856b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * the completion of tentative declarations in C and of
857b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * instantiation of implicitly-instantiation function templates in
858b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * C++. This option is typically used when parsing a header with the
859b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * intent of producing a precompiled header.
86044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   */
861b1c031be513705d924038f497279b9b599868ba1Douglas Gregor  CXTranslationUnit_Incomplete = 0x02,
86244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor
86344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor  /**
86444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * \brief Used to indicate that the translation unit should be built with an
86544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * implicit precompiled header for the preamble.
86644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   *
86744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * An implicit precompiled header is used as an optimization when a
86844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * particular translation unit is likely to be reparsed many times
86944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * when the sources aren't changing that often. In this case, an
87044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * implicit precompiled header will be built containing all of the
87144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * initial includes at the top of the main file (what we refer to as
87244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * the "preamble" of the file). In subsequent parses, if the
87344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * preamble or the files in it have not changed, \c
87444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * clang_reparseTranslationUnit() will re-use the implicit
87544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * precompiled header to improve parsing performance.
87644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   */
877e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  CXTranslationUnit_PrecompiledPreamble = 0x04,
878e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor
879e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  /**
880e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * \brief Used to indicate that the translation unit should cache some
881e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * code-completion results with each reparse of the source file.
882e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   *
883e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * Caching of code-completion results is a performance optimization that
884e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * introduces some overhead to reparsing but improves the performance of
885e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * code-completion operations.
886e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   */
88799ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  CXTranslationUnit_CacheCompletionResults = 0x08,
88899ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  /**
889b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor   * \brief DEPRECATED: Enable precompiled preambles in C++.
89099ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   *
89199ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   * Note: this is a *temporary* option that is available only while
892b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor   * we are testing C++ precompiled preamble support. It is deprecated.
89399ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   */
89499ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  CXTranslationUnit_CXXPrecompiledPreamble = 0x10,
89599ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor
89699ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  /**
897b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor   * \brief DEPRECATED: Enabled chained precompiled preambles in C++.
89899ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   *
89999ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   * Note: this is a *temporary* option that is available only while
900b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor   * we are testing C++ precompiled preamble support. It is deprecated.
90199ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   */
902dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor  CXTranslationUnit_CXXChainedPCH = 0x20,
903dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor
904dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor  /**
905dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor   * \brief Used to indicate that the "detailed" preprocessing record,
906fd14e91dc0ac5db175c4b30af98e7f8adabcb508Chandler Carruth   * if requested, should also contain nested macro expansions.
907dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor   *
908fd14e91dc0ac5db175c4b30af98e7f8adabcb508Chandler Carruth   * Nested macro expansions (i.e., macro expansions that occur
909fd14e91dc0ac5db175c4b30af98e7f8adabcb508Chandler Carruth   * inside another macro expansion) can, in some code bases, require
910dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor   * a large amount of storage to due preprocessor metaprogramming. Moreover,
911dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor   * its fairly rare that this information is useful for libclang clients.
912dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor   */
913ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth  CXTranslationUnit_NestedMacroExpansions = 0x40,
914ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth
915ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth  /**
916ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth   * \brief Legacy name to indicate that the "detailed" preprocessing record,
917fd14e91dc0ac5db175c4b30af98e7f8adabcb508Chandler Carruth   * if requested, should contain nested macro expansions.
918ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth   *
919ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth   * \see CXTranslationUnit_NestedMacroExpansions for the current name for this
920ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth   * value, and its semantics. This is just an alias.
921ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth   */
922ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth  CXTranslationUnit_NestedMacroInstantiations =
923ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth    CXTranslationUnit_NestedMacroExpansions
9245a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor};
9255a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor
9265a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor/**
927b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * \brief Returns the set of flags that is suitable for parsing a translation
928b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * unit that is being edited.
929b1c031be513705d924038f497279b9b599868ba1Douglas Gregor *
930b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * The set of flags returned provide options for \c clang_parseTranslationUnit()
931b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * to indicate that the translation unit is likely to be reparsed many times,
932b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
933b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
934b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set contains an unspecified set of optimizations (e.g., the precompiled
935b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * preamble) geared toward improving the performance of these routines. The
936b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set of optimizations enabled may change from one version to the next.
937b1c031be513705d924038f497279b9b599868ba1Douglas Gregor */
938e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void);
939b1c031be513705d924038f497279b9b599868ba1Douglas Gregor
940b1c031be513705d924038f497279b9b599868ba1Douglas Gregor/**
9415a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Parse the given source file and the translation unit corresponding
9425a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * to that file.
9435a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
9445a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * This routine is the main entry point for the Clang C API, providing the
9455a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * ability to parse a source file into a translation unit that can then be
9465a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * queried by other functions in the API. This routine accepts a set of
9475a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * command-line arguments so that the compilation can be configured in the same
9485a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * way that the compiler is configured on the command line.
9495a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
9505a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param CIdx The index object with which the translation unit will be
9515a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * associated.
9525a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
9535a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param source_filename The name of the source file to load, or NULL if the
9541ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p command_line_args.
9555a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
9565a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param command_line_args The command-line arguments that would be
9575a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * passed to the \c clang executable if it were being invoked out-of-process.
9585a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * These command-line options will be parsed and will affect how the translation
9595a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unit is parsed. Note that the following options are ignored: '-c',
9605a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
9615a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
9625a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_command_line_args The number of command-line arguments in
9635a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \p command_line_args.
9645a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
9655a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk
9661abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing, including the contents of
9675a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * those files.  The contents and name of these files (as specified by
9685a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to
9695a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * guarantee their validity until the call to this function returns.
9705a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
9715a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p
9725a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unsaved_files.
9735a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
9745a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param options A bitmask of options that affects how the translation unit
9755a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * is managed but not its compilation. This should be a bitwise OR of the
9765a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXTranslationUnit_XXX flags.
9775a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
9785a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \returns A new translation unit describing the parsed code and containing
9795a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * any diagnostics produced by the compiler. If there is a failure from which
9805a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * the compiler cannot recover, returns NULL.
9815a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */
9825a43021ac491bf091494167127772a20d9a9bb48Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_parseTranslationUnit(CXIndex CIdx,
9835a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                    const char *source_filename,
9842ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor                                         const char * const *command_line_args,
9855a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                      int num_command_line_args,
9865a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                            struct CXUnsavedFile *unsaved_files,
9875a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                     unsigned num_unsaved_files,
9885a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                            unsigned options);
9895a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor
9905352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
9911999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Flags that control how translation units are saved.
9921999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
9931999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise
9941999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * ORed together to specify which options should be used when
9951999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * saving the translation unit.
9961999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */
9971999844e7a18786e61e619e1dc6c789827541863Douglas Gregorenum CXSaveTranslationUnit_Flags {
9981999844e7a18786e61e619e1dc6c789827541863Douglas Gregor  /**
9991999844e7a18786e61e619e1dc6c789827541863Douglas Gregor   * \brief Used to indicate that no special saving options are needed.
10001999844e7a18786e61e619e1dc6c789827541863Douglas Gregor   */
10011999844e7a18786e61e619e1dc6c789827541863Douglas Gregor  CXSaveTranslationUnit_None = 0x0
10021999844e7a18786e61e619e1dc6c789827541863Douglas Gregor};
10031999844e7a18786e61e619e1dc6c789827541863Douglas Gregor
10041999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/**
10051999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Returns the set of flags that is suitable for saving a translation
10061999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * unit.
10071999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
10081999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The set of flags returned provide options for
10091999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \c clang_saveTranslationUnit() by default. The returned flag
10101999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * set contains an unspecified set of options that save translation units with
10111999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * the most commonly-requested data.
10121999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */
10131999844e7a18786e61e619e1dc6c789827541863Douglas GregorCINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU);
10141999844e7a18786e61e619e1dc6c789827541863Douglas Gregor
10151999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/**
101639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Describes the kind of error that occurred (if any) in a call to
101739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \c clang_saveTranslationUnit().
101839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */
101939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregorenum CXSaveError {
102039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
102139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that no error occurred while saving a translation unit.
102239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
102339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_None = 0,
102439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
102539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
102639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that an unknown error occurred while attempting to save
102739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * the file.
102839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   *
102939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * This error typically indicates that file I/O failed when attempting to
103039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * write the file.
103139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
103239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_Unknown = 1,
103339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
103439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
103539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that errors during translation prevented this attempt
103639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * to save the translation unit.
103739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   *
103839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * Errors that prevent the translation unit from being saved can be
103939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
104039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
104139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_TranslationErrors = 2,
104239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
104339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
104439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that the translation unit to be saved was somehow
104539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * invalid (e.g., NULL).
104639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
104739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_InvalidTU = 3
104839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor};
104939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
105039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor/**
10517ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \brief Saves a translation unit into a serialized representation of
10527ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * that translation unit on disk.
10537ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor *
10547ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * Any translation unit that was parsed without error can be saved
10557ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * into a file. The translation unit can then be deserialized into a
10567ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * new \c CXTranslationUnit with \c clang_createTranslationUnit() or,
10577ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * if it is an incomplete translation unit that corresponds to a
10587ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * header, used as a precompiled header when parsing other translation
10597ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * units.
10607ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor *
10617ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param TU The translation unit to save.
10621999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
10637ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param FileName The file to which the translation unit will be saved.
10647ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor *
10651999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \param options A bitmask of options that affects how the translation unit
10661999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * is saved. This should be a bitwise OR of the
10671999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * CXSaveTranslationUnit_XXX flags.
10681999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
106939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \returns A value that will match one of the enumerators of the CXSaveError
107039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * enumeration. Zero (CXSaveError_None) indicates that the translation unit was
107139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * saved successfully, while a non-zero value indicates that a problem occurred.
10727ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor */
10737ae2faafd30524ef5f863bb3b8701977888839bbDouglas GregorCINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU,
10741999844e7a18786e61e619e1dc6c789827541863Douglas Gregor                                             const char *FileName,
10751999844e7a18786e61e619e1dc6c789827541863Douglas Gregor                                             unsigned options);
10767ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor
10777ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor/**
10785352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Destroy the specified CXTranslationUnit object.
10795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
10805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
1081896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
10825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
1083e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Flags that control the reparsing of translation units.
1084e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor *
1085e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise
1086e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * ORed together to specify which options should be used when
1087e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * reparsing the translation unit.
1088e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */
1089e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregorenum CXReparse_Flags {
1090e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  /**
1091e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * \brief Used to indicate that no special reparsing options are needed.
1092e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   */
1093e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  CXReparse_None = 0x0
1094e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor};
1095e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor
1096e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/**
1097e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Returns the set of flags that is suitable for reparsing a translation
1098e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * unit.
1099e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor *
1100e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The set of flags returned provide options for
1101e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \c clang_reparseTranslationUnit() by default. The returned flag
1102e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * set contains an unspecified set of optimizations geared toward common uses
1103e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * of reparsing. The set of optimizations enabled may change from one version
1104e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * to the next.
1105e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */
1106e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
1107e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor
1108e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/**
1109abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \brief Reparse the source files that produced this translation unit.
1110abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1111abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * This routine can be used to re-parse the source files that originally
1112abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * created the given translation unit, for example because those source files
1113abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * have changed (either on disk or as passed via \p unsaved_files). The
1114abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * source code will be reparsed with the same command-line options as it
1115abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * was originally parsed.
1116abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1117abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * Reparsing a translation unit invalidates all cursors and source locations
1118abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * that refer into that translation unit. This makes reparsing a translation
1119abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit semantically equivalent to destroying the translation unit and then
1120abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * creating a new translation unit with the same command-line arguments.
1121abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * However, it may be more efficient to reparse a translation
1122abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit using this routine.
1123abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1124abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param TU The translation unit whose contents will be re-parsed. The
1125abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * translation unit must originally have been built with
1126abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_createTranslationUnitFromSourceFile().
1127abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1128abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p
1129abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unsaved_files.
1130abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1131abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param unsaved_files The files that have not yet been saved to disk
1132abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * but may be required for parsing, including the contents of
1133abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * those files.  The contents and name of these files (as specified by
1134abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to
1135abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * guarantee their validity until the call to this function returns.
1136abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1137e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \param options A bitset of options composed of the flags in CXReparse_Flags.
1138e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The function \c clang_defaultReparseOptions() produces a default set of
1139e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * options recommended for most uses, based on the translation unit.
1140e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor *
1141abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \returns 0 if the sources could be reparsed. A non-zero value will be
1142abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * returned if reparsing was impossible, such that the translation unit is
1143abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * invalid. In such cases, the only valid call for \p TU is
1144abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_disposeTranslationUnit(TU).
1145abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor */
1146abc563f554951259bbe0315055cad92ee14d87e4Douglas GregorCINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU,
1147abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor                                                unsigned num_unsaved_files,
1148e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor                                          struct CXUnsavedFile *unsaved_files,
1149e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor                                                unsigned options);
115059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
115159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
115259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief Categorizes how memory is being used by a translation unit.
115359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
1154f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekenum CXTUResourceUsageKind {
1155f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_AST = 1,
1156f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_Identifiers = 2,
1157f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_Selectors = 3,
1158f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_GlobalCompletionResults = 4,
1159457aaf0692dfb2d9638f383334b81027f637f20cTed Kremenek  CXTUResourceUsage_SourceManagerContentCache = 5,
1160ba29bd25515fbd99e98ba0fedb9d93617b27609eTed Kremenek  CXTUResourceUsage_AST_SideTables = 6,
1161f61b831d7f6a15676b07647f507de80324cb7056Ted Kremenek  CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7,
1162e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek  CXTUResourceUsage_SourceManager_Membuffer_MMap = 8,
1163e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek  CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9,
1164e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek  CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10,
11655e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek  CXTUResourceUsage_Preprocessor = 11,
11665e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek  CXTUResourceUsage_PreprocessingRecord = 12,
1167ca7dc2b755eb81ac95121ce1a1f1aa44a4a0fe12Ted Kremenek  CXTUResourceUsage_SourceManager_DataStructures = 13,
1168d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek  CXTUResourceUsage_Preprocessor_HeaderSearch = 14,
1169f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST,
1170f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_MEMORY_IN_BYTES_END =
1171d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek    CXTUResourceUsage_Preprocessor_HeaderSearch,
1172f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek
1173f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_First = CXTUResourceUsage_AST,
1174d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek  CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch
117559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek};
117659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
117759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
117859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief Returns the human-readable null-terminated C string that represents
1179f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  *  the name of the memory category.  This string should never be freed.
118059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
118159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted KremenekCINDEX_LINKAGE
1182f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekconst char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind);
118359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1184f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsageEntry {
118559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief The memory usage category. */
1186f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  enum CXTUResourceUsageKind kind;
1187f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  /* \brief Amount of resources used.
1188f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek      The units will depend on the resource kind. */
118959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  unsigned long amount;
1190f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsageEntry;
119159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
119259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
119359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief The memory usage of a CXTranslationUnit, broken into categories.
119459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
1195f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsage {
119659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief Private data member, used for queries. */
119759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  void *data;
119859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
119959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief The number of entries in the 'entries' array. */
120059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  unsigned numEntries;
120159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
120259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief An array of key-value pairs, representing the breakdown of memory
120359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek            usage. */
1204f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsageEntry *entries;
120559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1206f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsage;
120759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
120859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
120959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief Return the memory usage of a translation unit.  This object
1210f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  *  should be released with clang_disposeCXTUResourceUsage().
121159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
1212f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU);
121359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1214f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);
121559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1216abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor/**
12175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @}
12185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
1219896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
12205352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
1221c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes the kind of entity that a cursor refers to.
1222c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1223c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXCursorKind {
1224c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Declarations */
12251efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
1226c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A declaration whose specific kind is not exposed via this
12271efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * interface.
1228c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1229c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * Unexposed declarations have the same operations as any other kind
1230c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * of declaration; one can extract their location information,
1231c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * spelling, find their definitions, etc. However, the specific kind
1232c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * of the declaration is not reported.
1233c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1234c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnexposedDecl                 = 1,
1235c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A C or C++ struct. */
12361efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  CXCursor_StructDecl                    = 2,
1237c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A C or C++ union. */
1238c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnionDecl                     = 3,
1239c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A C++ class. */
1240c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ClassDecl                     = 4,
1241c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An enumeration. */
1242c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_EnumDecl                      = 5,
12431efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
1244c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A field (in C) or non-static data member (in C++) in a
1245c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * struct, union, or C++ class.
1246c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1247c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FieldDecl                     = 6,
1248c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An enumerator constant. */
1249c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_EnumConstantDecl              = 7,
1250c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A function. */
1251c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FunctionDecl                  = 8,
1252c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A variable. */
1253c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_VarDecl                       = 9,
1254c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A function or method parameter. */
1255c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ParmDecl                      = 10,
1256c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @interface. */
1257c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCInterfaceDecl             = 11,
1258c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @interface for a category. */
1259c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCCategoryDecl              = 12,
1260c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @protocol declaration. */
1261c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCProtocolDecl              = 13,
1262c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @property declaration. */
1263c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCPropertyDecl              = 14,
1264c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C instance variable. */
1265c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCIvarDecl                  = 15,
1266c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C instance method. */
1267c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCInstanceMethodDecl        = 16,
1268c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C class method. */
1269c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCClassMethodDecl           = 17,
1270c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @implementation. */
1271c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCImplementationDecl        = 18,
1272c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @implementation for a category. */
1273c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCCategoryImplDecl          = 19,
1274c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A typedef */
1275c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_TypedefDecl                   = 20,
12768bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek  /** \brief A C++ class method. */
12778bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek  CXCursor_CXXMethod                     = 21,
12788f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek  /** \brief A C++ namespace. */
12798f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek  CXCursor_Namespace                     = 22,
1280a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek  /** \brief A linkage specification, e.g. 'extern "C"'. */
1281a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek  CXCursor_LinkageSpec                   = 23,
128201829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  /** \brief A C++ constructor. */
128301829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  CXCursor_Constructor                   = 24,
128401829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  /** \brief A C++ destructor. */
128501829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  CXCursor_Destructor                    = 25,
128601829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  /** \brief A C++ conversion function. */
128701829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  CXCursor_ConversionFunction            = 26,
1288fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ template type parameter. */
1289fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_TemplateTypeParameter         = 27,
1290fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ non-type template parameter. */
1291fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_NonTypeTemplateParameter      = 28,
1292fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ template template parameter. */
1293fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_TemplateTemplateParameter     = 29,
1294fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ function template. */
1295fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_FunctionTemplate              = 30,
129639d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor  /** \brief A C++ class template. */
129739d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor  CXCursor_ClassTemplate                 = 31,
129874dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor  /** \brief A C++ class template partial specialization. */
129974dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor  CXCursor_ClassTemplatePartialSpecialization = 32,
13006931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  /** \brief A C++ namespace alias declaration. */
13016931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  CXCursor_NamespaceAlias                = 33,
13020a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor  /** \brief A C++ using directive. */
13030a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor  CXCursor_UsingDirective                = 34,
1304162e1c1b487352434552147967c3dd296ebee2f7Richard Smith  /** \brief A C++ using declaration. */
13057e24256c95afb64b4d5abf201a0f9f0527cb4cf3Douglas Gregor  CXCursor_UsingDeclaration              = 35,
1306162e1c1b487352434552147967c3dd296ebee2f7Richard Smith  /** \brief A C++ alias declaration */
1307162e1c1b487352434552147967c3dd296ebee2f7Richard Smith  CXCursor_TypeAliasDecl                 = 36,
1308352697a87bca664356f21a838b162084013625eaDouglas Gregor  /** \brief An Objective-C @synthesize definition. */
1309352697a87bca664356f21a838b162084013625eaDouglas Gregor  CXCursor_ObjCSynthesizeDecl            = 37,
1310352697a87bca664356f21a838b162084013625eaDouglas Gregor  /** \brief An Objective-C @dynamic definition. */
1311352697a87bca664356f21a838b162084013625eaDouglas Gregor  CXCursor_ObjCDynamicDecl               = 38,
13122dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis  /** \brief An access specifier. */
13132dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis  CXCursor_CXXAccessSpecifier            = 39,
131442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
131550aa6acd0b8d40c8956372a69e0a73f0802a5494Ted Kremenek  CXCursor_FirstDecl                     = CXCursor_UnexposedDecl,
13162dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis  CXCursor_LastDecl                      = CXCursor_CXXAccessSpecifier,
13171efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1318c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* References */
1319c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstRef                      = 40, /* Decl references */
13201efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  CXCursor_ObjCSuperClassRef             = 40,
1321c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCProtocolRef               = 41,
1322c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCClassRef                  = 42,
1323c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1324c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A reference to a type declaration.
1325c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1326c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * A type reference occurs anywhere where a type is named but not
1327c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * declared. For example, given:
1328c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1329c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \code
1330c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * typedef unsigned size_type;
1331c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * size_type size;
1332c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \endcode
1333c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1334c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * The typedef is a declaration of size_type (CXCursor_TypedefDecl),
1335c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * while the type of the variable "size" is referenced. The cursor
1336c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * referenced by the type of size is the typedef for size_type.
1337c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1338c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_TypeRef                       = 43,
13393064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CXCursor_CXXBaseSpecifier              = 44,
13400b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor  /**
1341a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor   * \brief A reference to a class template, function template, template
1342a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor   * template parameter, or class template partial specialization.
13430b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor   */
13440b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor  CXCursor_TemplateRef                   = 45,
13456931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  /**
13466931900f43cea558c6974075256c07728dbfecc6Douglas Gregor   * \brief A reference to a namespace or namespace alias.
13476931900f43cea558c6974075256c07728dbfecc6Douglas Gregor   */
13486931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  CXCursor_NamespaceRef                  = 46,
1349a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor  /**
135036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \brief A reference to a member of a struct, union, or class that occurs in
135136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * some non-expression context, e.g., a designated initializer.
1352a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor   */
1353a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor  CXCursor_MemberRef                     = 47,
135436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  /**
135536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \brief A reference to a labeled statement.
135636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
135736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * This cursor kind is used to describe the jump to "start_over" in the
135836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * goto statement in the following example:
135936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
136036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \code
136136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *   start_over:
136236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *     ++counter;
136336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
136436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *     goto start_over;
136536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \endcode
136636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
136736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * A label reference cursor refers to a label statement.
136836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   */
136936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  CXCursor_LabelRef                      = 48,
137036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor
13711f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor  /**
13721f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \brief A reference to a set of overloaded functions or function templates
13731f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * that has not yet been resolved to a specific function or function template.
13741f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
13751f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * An overloaded declaration reference cursor occurs in C++ templates where
13761f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * a dependent name refers to a function. For example:
13771f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
13781f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \code
13791f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * template<typename T> void swap(T&, T&);
13801f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
13811f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * struct X { ... };
13821f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * void swap(X&, X&);
13831f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
13841f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * template<typename T>
13851f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * void reverse(T* first, T* last) {
13861f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *   while (first < last - 1) {
13871f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *     swap(*first, *--last);
13881f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *     ++first;
13891f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *   }
13901f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * }
13911f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
13921f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * struct Y { };
13931f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * void swap(Y&, Y&);
13941f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \endcode
13951f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
13961f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * Here, the identifier "swap" is associated with an overloaded declaration
13971f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * reference. In the template definition, "swap" refers to either of the two
13981f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * "swap" functions declared above, so both results will be available. At
13991f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * instantiation time, "swap" may also refer to other functions found via
14001f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * argument-dependent lookup (e.g., the "swap" function at the end of the
14011f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * example).
14021f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
14031f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * The functions \c clang_getNumOverloadedDecls() and
14041f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \c clang_getOverloadedDecl() can be used to retrieve the definitions
14051f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * referenced by this cursor.
14061f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   */
14071f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor  CXCursor_OverloadedDeclRef             = 49,
14081f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
14091f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor  CXCursor_LastRef                       = CXCursor_OverloadedDeclRef,
14101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1411c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Error conditions */
1412c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstInvalid                  = 70,
1413c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_InvalidFile                   = 70,
1414c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_NoDeclFound                   = 71,
1415c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_NotImplemented                = 72,
1416ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek  CXCursor_InvalidCode                   = 73,
1417ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek  CXCursor_LastInvalid                   = CXCursor_InvalidCode,
14181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1419c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Expressions */
1420c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstExpr                     = 100,
14211efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1422c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1423c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief An expression whose specific kind is not exposed via this
14241efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * interface.
1425c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1426c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * Unexposed expressions have the same operations as any other kind
1427c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * of expression; one can extract their location information,
1428c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * spelling, children, etc. However, the specific kind of the
1429c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * expression is not reported.
1430c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1431c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnexposedExpr                 = 100,
14321efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1433c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1434c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief An expression that refers to some value declaration, such
1435c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * as a function, varible, or enumerator.
1436c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1437c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_DeclRefExpr                   = 101,
14381efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1439c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1440c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief An expression that refers to a member of a struct, union,
1441c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * class, Objective-C class, etc.
1442c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1443c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_MemberRefExpr                 = 102,
14441efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1445c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An expression that calls a function. */
1446c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_CallExpr                      = 103,
14471efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1448c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An expression that sends a message to an Objective-C
1449c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   object or class. */
1450c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCMessageExpr               = 104,
14511ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek
14521ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek  /** \brief An expression that represents a block literal. */
14531ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek  CXCursor_BlockExpr                     = 105,
14541ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek
145542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An integer literal.
145642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
145742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IntegerLiteral                = 106,
145842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
145942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A floating point number literal.
146042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
146142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_FloatingLiteral               = 107,
146242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
146342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An imaginary number literal.
146442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
146542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ImaginaryLiteral              = 108,
146642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
146742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A string literal.
146842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
146942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_StringLiteral                 = 109,
147042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
147142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A character literal.
147242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
147342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CharacterLiteral              = 110,
147442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
147542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A parenthesized expression, e.g. "(1)".
147642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
147742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This AST node is only formed if full location information is requested.
147842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
147942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ParenExpr                     = 111,
148042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
148142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief This represents the unary-expression's (except sizeof and
148242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * alignof).
148342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
148442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_UnaryOperator                 = 112,
148542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
148642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C99 6.5.2.1] Array Subscripting.
148742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
148842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ArraySubscriptExpr            = 113,
148942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
149042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A builtin binary operation expression such as "x + y" or
149142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * "x <= y".
149242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
149342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_BinaryOperator                = 114,
149442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
149542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Compound assignment such as "+=".
149642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
149742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CompoundAssignOperator        = 115,
149842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
149942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief The ?: ternary operator.
150042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
150142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ConditionalOperator           = 116,
150242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
150342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An explicit cast in C (C99 6.5.4) or a C-style cast in C++
150442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * (C++ [expr.cast]), which uses the syntax (Type)expr.
150542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
150642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * For example: (int)f.
150742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
150842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CStyleCastExpr                = 117,
150942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
151042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C99 6.5.2.5]
151142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
151242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CompoundLiteralExpr           = 118,
151342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
151442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Describes an C or C++ initializer list.
151542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
151642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_InitListExpr                  = 119,
151742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
151842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief The GNU address of label extension, representing &&label.
151942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
152042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_AddrLabelExpr                 = 120,
152142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
152242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief This is the GNU Statement Expression extension: ({int X=4; X;})
152342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
152442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_StmtExpr                      = 121,
152542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
152642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents a C1X generic selection.
152742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
152842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_GenericSelectionExpr          = 122,
152942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
153042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Implements the GNU __null extension, which is a name for a null
153142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * pointer constant that has integral type (e.g., int or long) and is the same
153242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * size and alignment as a pointer.
153342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
153442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * The __null extension is typically only used by system headers, which define
153542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * NULL as __null in C++ rather than using 0 (which is an integer that may not
153642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * match the size of a pointer).
153742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
153842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_GNUNullExpr                   = 123,
153942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
154042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s static_cast<> expression.
154142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
154242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXStaticCastExpr             = 124,
154342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
154442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s dynamic_cast<> expression.
154542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
154642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXDynamicCastExpr            = 125,
154742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
154842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s reinterpret_cast<> expression.
154942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
155042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXReinterpretCastExpr        = 126,
155142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
155242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s const_cast<> expression.
155342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
155442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXConstCastExpr              = 127,
155542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
155642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents an explicit C++ type conversion that uses "functional"
155742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * notion (C++ [expr.type.conv]).
155842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
155942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * Example:
156042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
156142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *   x = int(0.5);
156242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
156342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
156442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXFunctionalCastExpr         = 128,
156542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
156642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A C++ typeid expression (C++ [expr.typeid]).
156742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
156842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXTypeidExpr                 = 129,
156942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
157042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C++ 2.13.5] C++ Boolean Literal.
157142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
157242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXBoolLiteralExpr            = 130,
157342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
157442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C++0x 2.14.7] C++ Pointer Literal.
157542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
157642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXNullPtrLiteralExpr         = 131,
157742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
157842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents the "this" expression in C++
157942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
158042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXThisExpr                   = 132,
158142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
158242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C++ 15] C++ Throw Expression.
158342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
158442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This handles 'throw' and 'throw' assignment-expression. When
158542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * assignment-expression isn't present, Op will be null.
158642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
158742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXThrowExpr                  = 133,
158842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
158942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A new expression for memory allocation and constructor calls, e.g:
159042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * "new CXXNewExpr(foo)".
159142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
159242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXNewExpr                    = 134,
159342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
159442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A delete expression for memory deallocation and destructor calls,
159542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * e.g. "delete[] pArray".
159642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
159742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXDeleteExpr                 = 135,
159842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
159942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A unary expression.
160042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
160142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_UnaryExpr                     = 136,
160242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
160342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief ObjCStringLiteral, used for Objective-C string literals i.e. "foo".
160442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
160542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCStringLiteral             = 137,
160642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
160742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief ObjCEncodeExpr, used for in Objective-C.
160842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
160942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCEncodeExpr                = 138,
161042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
161142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief ObjCSelectorExpr used for in Objective-C.
161242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
161342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCSelectorExpr              = 139,
161442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
161542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's protocol expression.
161642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
161742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCProtocolExpr              = 140,
161842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
161942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An Objective-C "bridged" cast expression, which casts between
162042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * Objective-C pointers and C pointers, transferring ownership in the process.
162142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
162242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
162342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *   NSString *str = (__bridge_transfer NSString *)CFCreateString();
162442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
162542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
162642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCBridgedCastExpr           = 141,
162742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
162842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents a C++0x pack expansion that produces a sequence of
162942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * expressions.
163042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
163142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * A pack expansion expression contains a pattern (which itself is an
163242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * expression) followed by an ellipsis. For example:
163342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
163442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
163542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * template<typename F, typename ...Types>
163642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * void forward(F f, Types &&...args) {
163742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *  f(static_cast<Types&&>(args)...);
163842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * }
163942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
164042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
164142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_PackExpansionExpr             = 142,
164242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
164342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents an expression that computes the length of a parameter
164442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * pack.
164542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
164642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
164742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * template<typename ...Types>
164842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * struct count {
164942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *   static const unsigned value = sizeof...(Types);
165042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * };
165142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
165242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
165342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SizeOfPackExpr                = 143,
165442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
165542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_LastExpr                      = CXCursor_SizeOfPackExpr,
16561efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1657c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Statements */
1658c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstStmt                     = 200,
1659c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1660c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A statement whose specific kind is not exposed via this
1661c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * interface.
1662c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1663c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * Unexposed statements have the same operations as any other kind of
1664c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * statement; one can extract their location information, spelling,
1665c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * children, etc. However, the specific kind of the statement is not
1666c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * reported.
1667c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1668c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnexposedStmt                 = 200,
166936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor
167036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  /** \brief A labelled statement in a function.
167136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
167236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * This cursor kind is used to describe the "start_over:" label statement in
167336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * the following example:
167436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
167536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \code
167636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *   start_over:
167736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *     ++counter;
167836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \endcode
167936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
168036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   */
168136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  CXCursor_LabelStmt                     = 201,
168242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
168342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A group of statements like { stmt stmt }.
168442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
168542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This cursor kind is used to describe compound statements, e.g. function
168642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * bodies.
168742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
168842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CompoundStmt                  = 202,
168942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
169042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A case statment.
169142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
169242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CaseStmt                      = 203,
169342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
169442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A default statement.
169542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
169642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DefaultStmt                   = 204,
169742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
169842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An if statement
169942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
170042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IfStmt                        = 205,
170142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
170242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A switch statement.
170342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
170442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SwitchStmt                    = 206,
170542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
170642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A while statement.
170742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
170842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_WhileStmt                     = 207,
170942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
171042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A do statement.
171142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
171242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DoStmt                        = 208,
171342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
171442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A for statement.
171542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
171642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ForStmt                       = 209,
171742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
171842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A goto statement.
171942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
172042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_GotoStmt                      = 210,
172142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
172242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An indirect goto statement.
172342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
172442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IndirectGotoStmt              = 211,
172542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
172642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A continue statement.
172742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
172842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ContinueStmt                  = 212,
172942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
173042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A break statement.
173142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
173242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_BreakStmt                     = 213,
173342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
173442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A return statement.
173542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
173642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ReturnStmt                    = 214,
173742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
173842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A GNU inline assembly statement extension.
173942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
174042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_AsmStmt                       = 215,
174142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
174242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's overall @try-@catc-@finall statement.
174342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
174442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtTryStmt                 = 216,
174542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
174642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's @catch statement.
174742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
174842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtCatchStmt               = 217,
174942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
175042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's @finally statement.
175142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
175242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtFinallyStmt             = 218,
175342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
175442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's @throw statement.
175542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
175642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtThrowStmt               = 219,
175742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
175842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's @synchronized statement.
175942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
176042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtSynchronizedStmt        = 220,
176142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
176242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's autorelease pool statement.
176342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
176442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAutoreleasePoolStmt       = 221,
176542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
176642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's collection statement.
176742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
176842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCForCollectionStmt         = 222,
176942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
177042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s catch statement.
177142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
177242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXCatchStmt                  = 223,
177342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
177442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s try statement.
177542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
177642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXTryStmt                    = 224,
177742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
177842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s for (* : *) statement.
177942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
178042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXForRangeStmt               = 225,
178142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
178242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's try statement.
178342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
178442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHTryStmt                    = 226,
178542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
178642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's except statement.
178742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
178842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHExceptStmt                 = 227,
178942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
179042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's finally statement.
179142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
179242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHFinallyStmt                = 228,
179342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
179442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief The null satement ";": C99 6.8.3p3.
179542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
179642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This cursor kind is used to describe the null statement.
179742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
179842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_NullStmt                      = 230,
179942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
180042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Adaptor class for mixing declarations with statements and
180142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * expressions.
180242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
180342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DeclStmt                      = 231,
180442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
180542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_LastStmt                      = CXCursor_DeclStmt,
18061efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1807c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1808c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Cursor that represents the translation unit itself.
1809c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1810c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * The translation unit cursor exists primarily to act as the root
1811c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * cursor for traversing the contents of a translation unit.
1812c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1813e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_TranslationUnit               = 300,
1814e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek
1815e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  /* Attributes */
1816e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_FirstAttr                     = 400,
1817e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  /**
1818e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   * \brief An attribute whose specific kind is not exposed via this
1819e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   * interface.
1820e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   */
1821e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_UnexposedAttr                 = 400,
1822e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek
1823e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_IBActionAttr                  = 401,
1824e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_IBOutletAttr                  = 402,
1825857e918a8a40deb128840308a318bf623d68295fTed Kremenek  CXCursor_IBOutletCollectionAttr        = 403,
18266639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis  CXCursor_CXXFinalAttr                  = 404,
18276639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis  CXCursor_CXXOverrideAttr               = 405,
18286639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis  CXCursor_LastAttr                      = CXCursor_CXXOverrideAttr,
18299f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor
18309f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  /* Preprocessing */
18319f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  CXCursor_PreprocessingDirective        = 500,
1832572feb2a190b5e8b04fb06c4ac50ee0f61e93ff0Douglas Gregor  CXCursor_MacroDefinition               = 501,
18339b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth  CXCursor_MacroExpansion                = 502,
18349b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth  CXCursor_MacroInstantiation            = CXCursor_MacroExpansion,
1835ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor  CXCursor_InclusionDirective            = 503,
18369f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  CXCursor_FirstPreprocessing            = CXCursor_PreprocessingDirective,
1837ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor  CXCursor_LastPreprocessing             = CXCursor_InclusionDirective
1838c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor};
1839c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1840c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1841c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A cursor representing some element in the abstract syntax tree for
1842c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a translation unit.
1843c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
18441efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The cursor abstraction unifies the different kinds of entities in a
1845c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * program--declaration, statements, expressions, references to declarations,
1846c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * etc.--under a single "cursor" abstraction with a common set of operations.
1847c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Common operation for a cursor include: getting the physical location in
1848c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a source file where the cursor points, getting the name associated with a
1849c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor, and retrieving cursors for any child nodes of a particular cursor.
1850c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
1851c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors can be produced in two specific ways.
1852c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_getTranslationUnitCursor() produces a cursor for a translation unit,
1853c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * from which one can use clang_visitChildren() to explore the rest of the
1854c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * translation unit. clang_getCursor() maps from a physical source location
1855c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to the entity that resides at that location, allowing one to map from the
1856c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * source code into the AST.
1857c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1858c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregortypedef struct {
1859c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  enum CXCursorKind kind;
1860c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  void *data[3];
18611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar} CXCursor;
1862c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1863c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1864c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations
1865c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
1866c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
1867c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
18681efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1869c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1870c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the NULL cursor, which represents no entity.
1871c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1872c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getNullCursor(void);
18731efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1874c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1875c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the cursor that represents the given translation unit.
1876c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
1877c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The translation unit cursor can be used to start traversing the
1878c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * various declarations within the given translation unit.
1879c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1880c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
1881c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1882c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1883c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether two cursors are equivalent.
1884c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1885c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
18861efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1887c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1888b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis * \brief Returns non-zero if \arg cursor is null.
1889b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */
1890fa865df489fe68668c554dece36c68b4ce03920fArgyrios Kyrtzidisint clang_Cursor_isNull(CXCursor);
1891b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis
1892b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/**
18939ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor * \brief Compute a hash value for the given cursor.
18949ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor */
18959ce5584553054d0cb934940586aca0186e87fa57Douglas GregorCINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);
18969ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor
18979ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor/**
1898c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the kind of the given cursor.
1899c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1900c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
1901c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1902c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1903c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a declaration.
1904c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1905c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
1906c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1907c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1908c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a simple
1909c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * reference.
1910c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
1911c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Note that other kinds of cursors (such as expressions) can also refer to
1912c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * other cursors. Use clang_getCursorReferenced() to determine whether a
1913c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * particular cursor refers to another entity.
1914c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1915c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind);
1916c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1917c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1918c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents an expression.
1919c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1920c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind);
1921c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1922c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1923c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a statement.
1924c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1925c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind);
1926c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1927c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
19288be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor * \brief Determine whether the given cursor kind represents an attribute.
19298be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor */
19308be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas GregorCINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind);
19318be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor
19328be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor/**
19331efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents an invalid
1934c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor.
19351efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar */
1936c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind);
1937c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1938c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
19391efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents a translation
19401efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unit.
1941c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1942c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind);
19431efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1944ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek/***
19459f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * \brief Determine whether the given cursor represents a preprocessing
19469f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * element, such as a preprocessor directive or macro instantiation.
19479f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor */
19489f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas GregorCINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind);
19499f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor
19509f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor/***
1951ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek * \brief Determine whether the given cursor represents a currently
1952ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek *  unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
1953ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek */
1954ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted KremenekCINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind);
1955ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek
1956c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
195716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * \brief Describe the linkage of the entity referred to by a cursor.
195816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */
195916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenekenum CXLinkageKind {
196016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This value indicates that no linkage information is available
196116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * for a provided CXCursor. */
196216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_Invalid,
196316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /**
196416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * \brief This is the linkage for variables, parameters, and so on that
196516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   *  have automatic storage.  This covers normal (non-extern) local variables.
196616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   */
196716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_NoLinkage,
196816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for static variables and static functions. */
196916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_Internal,
197016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for entities with external linkage that live
197116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * in C++ anonymous namespaces.*/
197216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_UniqueExternal,
197316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for entities with true, external linkage. */
197416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_External
197516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek};
197616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek
197716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/**
197845e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the linkage of the entity referred to by a given cursor.
197916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */
198016b4259aecaa22b642d35d36fd89965ed700c1e0Ted KremenekCINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
198116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek
198216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/**
198358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to.
198458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
198558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param cursor The cursor to query.
198658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
198758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the cursor.
198858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */
198958ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind
199058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCursorAvailability(CXCursor cursor);
199158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
199258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/**
199345e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Describe the "language" of the entity referred to by a cursor.
199445e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */
199545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind {
19966cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek  CXLanguage_Invalid = 0,
199745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek  CXLanguage_C,
199845e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek  CXLanguage_ObjC,
19996cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek  CXLanguage_CPlusPlus
200045e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek};
200145e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek
200245e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/**
200345e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the "language" of the entity referred to by a given cursor.
200445e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */
200545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor);
200645e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek
2007b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/**
2008b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis * \brief Returns the translation unit that a cursor originated from.
2009b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */
2010b0d6eaa6b646c18c49923aefc76973801f561701Argyrios KyrtzidisCINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor);
2011b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis
2012eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2013eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2014eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief A fast container representing a set of CXCursors.
2015eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */
2016eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenektypedef struct CXCursorSetImpl *CXCursorSet;
2017eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2018eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2019eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Creates an empty CXCursorSet.
2020eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */
2021eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE CXCursorSet clang_createCXCursorSet();
2022eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2023eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2024eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Disposes a CXCursorSet and releases its associated memory.
2025eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */
2026eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset);
2027eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2028eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2029eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Queries a CXCursorSet to see if it contains a specific CXCursor.
2030eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek *
2031eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \returns non-zero if the set contains the specified cursor.
2032eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek*/
2033eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset,
2034eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek                                                   CXCursor cursor);
2035eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2036eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2037eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Inserts a CXCursor into a CXCursorSet.
2038eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek *
2039eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \returns zero if the CXCursor was already in the set, and non-zero otherwise.
2040eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek*/
2041eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,
2042eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek                                                 CXCursor cursor);
2043eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
20442be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/**
20452be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the semantic parent of the given cursor.
20462be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
20472be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The semantic parent of a cursor is the cursor that semantically contains
20482be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the given \p cursor. For many declarations, the lexical and semantic parents
20492be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the lexical parent is returned by
20502be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorLexicalParent()). They diverge when declarations or
20512be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example:
20522be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
20532be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code
20542be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C {
20552be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *  void f();
20562be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * };
20572be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
20582be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { }
20592be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode
20602be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
20612be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the
20622be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is
20632be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this
20642be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the
20652be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics
20662be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the
20672be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration,
20682be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations
20692be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context.
20702be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
20712be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their
20722be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C
20732be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit.
20743910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor *
20753910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For global declarations, the semantic parent is the translation unit.
20762be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */
20772be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor);
20782be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor
20792be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/**
20802be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the lexical parent of the given cursor.
20812be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
20822be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The lexical parent of a cursor is the cursor in which the given \p cursor
20832be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * was actually written. For many declarations, the lexical and semantic parents
20842be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the semantic parent is returned by
20852be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorSemanticParent()). They diverge when declarations or
20862be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example:
20872be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
20882be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code
20892be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C {
20902be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *  void f();
20912be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * };
20922be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
20932be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { }
20942be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode
20952be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
20962be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the
20972be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is
20982be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this
20992be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the
21002be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics
21012be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the
21022be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration,
21032be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations
21042be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context.
21052be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
21062be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their
21072be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C
21082be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit.
21093910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor *
21103910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For declarations written in the global scope, the lexical parent is
21113910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * the translation unit.
21122be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */
21132be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor);
21149f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
21159f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/**
21169f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Determine the set of methods that are overridden by the given
21179f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method.
21189f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
21199f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In both Objective-C and C++, a method (aka virtual member function,
21209f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * in C++) can override a virtual method in a base class. For
21219f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * Objective-C, a method is said to override any method in the class's
21229f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * interface (if we're coming from an implementation), its protocols,
21239f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * or its categories, that has the same selector and is of the same
21249f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * kind (class or instance). If no such method exists, the search
21259f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * continues to the class's superclass, its protocols, and its
21269f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * categories, and so on.
21279f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
21289f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * For C++, a virtual member function overrides any virtual member
21299f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * function with the same signature that occurs in its base
21309f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * classes. With multiple inheritance, a virtual member function can
21319f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * override several virtual member functions coming from different
21329f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * base classes.
21339f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
21349f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In all cases, this function determines the immediate overridden
21359f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method, rather than all of the overridden methods. For example, if
21369f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * a method is originally declared in a class A, then overridden in B
21379f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * (which in inherits from A) and also in C (which inherited from B),
21389f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * then the only overridden method returned from this function when
21399f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoked on C's method will be B's method. The client may then
21409f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoke this function again, given the previously-found overridden
21419f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods, to map out the complete method-override set.
21429f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
21439f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param cursor A cursor representing an Objective-C or C++
21449f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method. This routine will compute the set of methods that this
21459f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method overrides.
21469f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
21479f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param overridden A pointer whose pointee will be replaced with a
21489f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * pointer to an array of cursors, representing the set of overridden
21499f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods. If there are no overridden methods, the pointee will be
21509f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * set to NULL. The pointee must be freed via a call to
21519f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \c clang_disposeOverriddenCursors().
21529f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
21539f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param num_overridden A pointer to the number of overridden
21549f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * functions, will be set to the number of overridden functions in the
21559f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * array pointed to by \p overridden.
21569f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */
21579f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor,
21589f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor                                               CXCursor **overridden,
21599f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor                                               unsigned *num_overridden);
21609f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
21619f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/**
21629f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Free the set of overridden cursors returned by \c
21639f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * clang_getOverriddenCursors().
21649f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */
21659f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden);
21669f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
216745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/**
2168ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * \brief Retrieve the file that is included by the given inclusion directive
2169ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * cursor.
2170ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor */
2171ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas GregorCINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor);
2172ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor
2173ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor/**
2174c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2175c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
21761efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2177c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2178c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code
2179c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2180c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors represent a location within the Abstract Syntax Tree (AST). These
2181c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines help map between cursors and the physical locations where the
2182c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * described entities occur in the source code. The mapping is provided in
2183c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * both directions, so one can map from source code to the AST and back.
2184c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2185c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
218650398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */
21871efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
21886a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff/**
2189b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Map a source location to the cursor that describes the entity at that
2190b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * location in the source code.
2191b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
2192b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() maps an arbitrary source location within a translation
2193b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * unit down to the most specific cursor that describes the entity at that
21941efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * location. For example, given an expression \c x + y, invoking
2195b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() with a source location pointing to "x" will return the
21961efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * cursor for "x"; similarly for "y". If the cursor points anywhere between
2197b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
2198b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * will return a cursor referring to the "+" expression.
2199b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
2200b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns a cursor representing the entity at the given source location, or
2201b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * a NULL cursor if no such entity can be found.
22026a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff */
2203b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation);
22041efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
220598258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor/**
220698258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * \brief Retrieve the physical location of the source constructor referenced
220798258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * by the given cursor.
220898258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor *
220998258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * The location of a declaration is typically the location of the name of that
22101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * declaration, where the name of that declaration would occur if it is
22111efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unnamed, or some keyword that introduces that particular declaration.
22121efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The location of a reference is where that reference occurs within the
221398258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * source code.
221498258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor */
221598258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor);
2216c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2217b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor/**
2218b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Retrieve the physical extent of the source construct referenced by
2219a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the given cursor.
2220a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor *
2221a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * The extent of a cursor starts with the file/line/column pointing at the
2222a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * first character within the source construct that the cursor refers to and
22231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * ends with the last character withinin that source construct. For a
2224a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * declaration, the extent covers the declaration itself. For a reference,
2225a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the extent covers the location of the reference (e.g., where the referenced
2226a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * entity was actually used).
2227a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor */
2228a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas GregorCINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor);
2229c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor
2230c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2231c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2232c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
223395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
2234c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
22358e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \defgroup CINDEX_TYPES Type information for CXCursors
22368e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
22378e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @{
22388e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
22398e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
22408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
22418e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Describes the kind of type
22428e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
22438e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenekenum CXTypeKind {
22448e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /**
22458e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * \brief Reprents an invalid type (e.g., where no type is available).
22468e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   */
22478e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Invalid = 0,
22488e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
22498e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /**
22508e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * \brief A type whose specific kind is not exposed via this
22518e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * interface.
22528e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   */
22538e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Unexposed = 1,
22548e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
22558e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /* Builtin types */
22568e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Void = 2,
22578e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Bool = 3,
22588e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char_U = 4,
22598e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UChar = 5,
22608e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char16 = 6,
22618e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char32 = 7,
22628e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UShort = 8,
22638e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UInt = 9,
22648e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ULong = 10,
22658e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ULongLong = 11,
22668e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UInt128 = 12,
22678e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char_S = 13,
22688e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_SChar = 14,
22698e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_WChar = 15,
22708e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Short = 16,
22718e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Int = 17,
22728e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Long = 18,
22738e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LongLong = 19,
22748e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Int128 = 20,
22758e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Float = 21,
22768e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Double = 22,
22778e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LongDouble = 23,
22788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_NullPtr = 24,
22798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Overload = 25,
22808e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Dependent = 26,
22818e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCId = 27,
22828e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCClass = 28,
22838e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCSel = 29,
22848e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_FirstBuiltin = CXType_Void,
22858e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LastBuiltin  = CXType_ObjCSel,
22868e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
22878e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Complex = 100,
22888e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Pointer = 101,
22898e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_BlockPointer = 102,
22908e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LValueReference = 103,
22918e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_RValueReference = 104,
22928e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Record = 105,
22938e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Enum = 106,
22948e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Typedef = 107,
22958e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCInterface = 108,
229604c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek  CXType_ObjCObjectPointer = 109,
229704c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek  CXType_FunctionNoProto = 110,
22985f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis  CXType_FunctionProto = 111,
22995f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis  CXType_ConstantArray = 112
23008e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek};
23018e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23028e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
23038e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief The type of an element in the abstract syntax tree.
23048e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
23058e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
23068e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenektypedef struct {
23078e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  enum CXTypeKind kind;
23088e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  void *data[2];
23098e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek} CXType;
23108e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23118e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
23128e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the type of a CXCursor (if any).
23138e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
23148e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCursorType(CXCursor C);
23158e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23168e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
23178e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \determine Determine whether two CXTypes represent the same type.
23188e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
23198e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \returns non-zero if the CXTypes represent the same type and
23208e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek            zero otherwise.
23218e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
23228e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B);
23238e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23248e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
23258e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the canonical type for a CXType.
23268e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
23278e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * Clang's type system explicitly models typedefs and all the ways
23288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * a specific type can be represented.  The canonical type is the underlying
23298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * type with all the "sugar" removed.  For example, if 'T' is a typedef
23308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * for 'int', the canonical type for 'T' would be 'int'.
23318e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
23328e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCanonicalType(CXType T);
23338e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23348e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
2335e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  \determine Determine whether a CXType has the "const" qualifier set,
2336e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  without looking through typedefs that may have added "const" at a different level.
2337e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2338e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T);
2339e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2340e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
2341e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  \determine Determine whether a CXType has the "volatile" qualifier set,
2342e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  without looking through typedefs that may have added "volatile" at a different level.
2343e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2344e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T);
2345e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2346e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
2347e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  \determine Determine whether a CXType has the "restrict" qualifier set,
2348e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  without looking through typedefs that may have added "restrict" at a different level.
2349e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2350e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T);
2351e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2352e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
23538e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief For pointer types, returns the type of the pointee.
23548e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
23558e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
23568e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getPointeeType(CXType T);
23578e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23588e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
23598e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the cursor for the declaration of the given type.
23608e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
23618e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T);
23628e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23635389f48b24937ad7b4093307128b3cbf25235654David Chisnall/**
23645389f48b24937ad7b4093307128b3cbf25235654David Chisnall * Returns the Objective-C type encoding for the specified declaration.
23655389f48b24937ad7b4093307128b3cbf25235654David Chisnall */
23665389f48b24937ad7b4093307128b3cbf25235654David ChisnallCINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C);
23678e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23688e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
23698e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the spelling of a given CXTypeKind.
23708e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
23718e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K);
23728e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23738e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
23749a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek * \brief Retrieve the result type associated with a function type.
237504c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek */
237604c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted KremenekCINDEX_LINKAGE CXType clang_getResultType(CXType T);
237704c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek
237804c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek/**
23799a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek * \brief Retrieve the result type associated with a given cursor.  This only
23809a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek *  returns a valid type of the cursor refers to a function or method.
23819a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek */
23829a140845438c2fc31e7d48a6dedbc695f4c83c68Ted KremenekCINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C);
23839a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek
23849a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek/**
23853ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek * \brief Return 1 if the CXType is a POD (plain old data) type, and 0
23863ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek *  otherwise.
23873ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek */
23883ce9e7d270e7df86c09c8126b4412d55be7c123bTed KremenekCINDEX_LINKAGE unsigned clang_isPODType(CXType T);
23893ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek
23903ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek/**
23915f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * \brief Return the element type of an array type.
23925f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis *
23935f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, an invalid type is returned.
23945f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */
23955f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArrayElementType(CXType T);
23965f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis
23975f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/**
23985f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * \brief Return the the array size of a constant array.
23995f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis *
24005f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, -1 is returned.
24015f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */
24025f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE long long clang_getArraySize(CXType T);
24035f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis
24045f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/**
24053064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns 1 if the base class specified by the cursor with kind
24063064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek *   CX_CXXBaseSpecifier is virtual.
24073064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
24083064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor);
24093064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
24103064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
24113064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Represents the C++ access control level to a base class for a
24123064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * cursor with kind CX_CXXBaseSpecifier.
24133064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
24143064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenekenum CX_CXXAccessSpecifier {
24153064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXInvalidAccessSpecifier,
24163064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXPublic,
24173064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXProtected,
24183064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXPrivate
24193064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek};
24203064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
24213064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
24223064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns the access control level for the C++ base specifier
24232dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis * represented by a cursor with kind CXCursor_CXXBaseSpecifier or
24242dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis * CXCursor_AccessSpecifier.
24253064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
24263064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);
24273064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
24283064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
24291f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Determine the number of overloaded declarations referenced by a
24301f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c CXCursor_OverloadedDeclRef cursor.
24311f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
24321f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried.
24331f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
24341f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns The number of overloaded declarations referenced by \c cursor. If it
24351f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
24361f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */
24371f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor);
24381f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
24391f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/**
24401f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Retrieve a cursor for one of the overloaded declarations referenced
24411f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * by a \c CXCursor_OverloadedDeclRef cursor.
24421f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
24431f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried.
24441f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
24451f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param index The zero-based index into the set of overloaded declarations in
24461f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * the cursor.
24471f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
24481f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns A cursor representing the declaration referenced by the given
24491f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c cursor at the specified \c index. If the cursor does not have an
24501f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * associated set of overloaded declarations, or if the index is out of bounds,
24511f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * returns \c clang_getNullCursor();
24521f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */
24531f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor,
24541f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor                                                unsigned index);
24551f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
24561f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/**
24578e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @}
24588e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
245995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
246095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
2461ad72f4dad4cf0fd2b71eb8f4704d2fe7ac58fb44Ted Kremenek * \defgroup CINDEX_ATTRIBUTES Information for attributes
246295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *
246395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @{
246495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
246595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
246695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
246795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
246895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * \brief For cursors representing an iboutletcollection attribute,
246995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *  this function returns the collection element type.
247095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *
247195f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
247295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted KremenekCINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor);
247395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
247495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
247595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @}
247695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
24778e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
24788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
2479c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors
2480c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2481c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines provide the ability to traverse the abstract syntax tree
2482c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * using cursors.
2483c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2484c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
2485c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
24861efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2487c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2488c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes how the traversal of the children of a particular
2489c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor should proceed after visiting a particular child cursor.
2490c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2491c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A value of this enumeration type should be returned by each
2492c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
2493c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2494c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXChildVisitResult {
2495c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
24961efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief Terminates the cursor traversal.
2497c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
2498c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Break,
24991efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
2500c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Continues the cursor traversal with the next sibling of
2501c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * the cursor just visited, without visiting its children.
2502c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
2503c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Continue,
2504c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
2505c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Recursively traverse the children of this cursor, using
2506c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * the same visitor and client data.
2507c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
2508c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Recurse
2509c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor};
2510c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2511c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2512c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visitor invoked for each cursor found by a traversal.
2513c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2514c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This visitor function will be invoked for each cursor found by
2515c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren(). Its first argument is the cursor being
2516c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited, its second argument is the parent visitor for that cursor,
2517c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and its third argument is the client data provided to
2518c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren().
2519c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2520c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The visitor should return one of the \c CXChildVisitResult values
2521c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to direct clang_visitCursorChildren().
2522c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
25231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbartypedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor,
25241efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar                                                   CXCursor parent,
2525c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                                   CXClientData client_data);
2526c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2527c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2528c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visit the children of a particular cursor.
2529c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2530c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This function visits all the direct children of the given cursor,
2531c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * invoking the given \p visitor function with the cursors of each
2532c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited child. The traversal may be recursive, if the visitor returns
2533c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
2534c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the visitor returns \c CXChildVisit_Break.
2535c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2536c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param parent the cursor whose child may be visited. All kinds of
2537a57259e9d7b30bcce93f0a62eee0488738026172Daniel Dunbar * cursors can be visited, including invalid cursors (which, by
2538c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * definition, have no children).
2539c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2540c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param visitor the visitor function that will be invoked for each
2541c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * child of \p parent.
2542c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2543c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param client_data pointer data supplied by the client, which will
2544c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be passed to the visitor each time it is invoked.
2545c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2546c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \returns a non-zero value if the traversal was terminated
2547c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * prematurely by the visitor returning \c CXChildVisit_Break.
2548c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
25491efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,
2550c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                            CXCursorVisitor visitor,
2551c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                            CXClientData client_data);
25523387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#ifdef __has_feature
25533387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#  if __has_feature(blocks)
25543387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/**
25553387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * \brief Visitor invoked for each cursor found by a traversal.
25563387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall *
25573387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * This visitor block will be invoked for each cursor found by
25583387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * clang_visitChildrenWithBlock(). Its first argument is the cursor being
25593387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * visited, its second argument is the parent visitor for that cursor.
25603387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall *
25613387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * The visitor should return one of the \c CXChildVisitResult values
25623387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * to direct clang_visitChildrenWithBlock().
25633387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */
25643387c65a094a02b2a94c05111d035a97d3d5c794David Chisnalltypedef enum CXChildVisitResult
25653387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall     (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent);
25663387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall
25673387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/**
25683387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * Visits the children of a cursor using the specified block.  Behaves
25693387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * identically to clang_visitChildren() in all other respects.
25703387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */
25713387c65a094a02b2a94c05111d035a97d3d5c794David Chisnallunsigned clang_visitChildrenWithBlock(CXCursor parent,
25723387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall                                      CXCursorVisitorBlock block);
25733387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#  endif
25743387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#endif
25751efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2576c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2577c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2578c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
25791efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2580c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2581c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST
2582c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
25831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * These routines provide the ability to determine references within and
2584c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * across translation units, by providing the names of the entities referenced
2585c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by cursors, follow reference cursors to the declarations they reference,
2586c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and associate declarations with their definitions.
2587c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2588c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
2589c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
25901efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2591c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2592c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a Unified Symbol Resolution (USR) for the entity referenced
2593c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by the given cursor.
2594c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2595c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A Unified Symbol Resolution (USR) is a string that identifies a particular
2596c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * entity (function, class, variable, etc.) within a program. USRs can be
2597c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * compared across translation units to determine, e.g., when references in
2598c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * one translation refer to an entity defined in another translation unit.
2599c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2600c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor);
2601c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2602c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2603896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C class.
2604896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2605896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);
2606896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2607896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2608896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C category.
2609896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2610896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString
261166ccaec73706f3623d2e7d191fe2c944feedcc2bTed Kremenek  clang_constructUSR_ObjCCategory(const char *class_name,
2612896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                 const char *category_name);
2613896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2614896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2615896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C protocol.
2616896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2617896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString
2618896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek  clang_constructUSR_ObjCProtocol(const char *protocol_name);
2619896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2620896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2621896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2622896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C instance variable and
2623896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *   the USR for its containing class.
2624896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2625896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name,
2626896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                    CXString classUSR);
2627896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2628896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2629896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C method and
2630896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *   the USR for its containing class.
2631896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2632896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name,
2633896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                      unsigned isInstanceMethod,
2634896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                      CXString classUSR);
2635896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2636896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2637896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C property and the USR
2638896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *  for its containing class.
2639896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2640896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property,
2641896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                        CXString classUSR);
2642896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2643896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2644c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a name for the entity referenced by this cursor.
2645c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2646c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);
2647c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2648358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor/**
2649358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * \brief Retrieve the display name for the entity referenced by this cursor.
2650358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor *
2651358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * The display name contains extra information that helps identify the cursor,
2652358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * such as the parameters of a function or template or the arguments of a
2653358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * class template specialization.
2654358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor */
2655358559d8d7b458c5f64941842383a16e61f0828dDouglas GregorCINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor);
2656358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor
2657c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor/** \brief For a cursor that is a reference, retrieve a cursor representing the
2658c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * entity that it references.
2659c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor *
2660c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Reference cursors refer to other entities in the AST. For example, an
2661c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Objective-C superclass reference cursor refers to an Objective-C class.
26621efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * This function produces the cursor for the Objective-C class from the
2663c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * cursor for the superclass reference. If the input cursor is a declaration or
2664c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * definition, it returns that declaration or definition unchanged.
26651efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Otherwise, returns the NULL cursor.
2666c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor */
2667c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor);
2668b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
26691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
2670b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \brief For a cursor that is either a reference to or a declaration
2671b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  of some entity, retrieve a cursor that describes the definition of
2672b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  that entity.
2673b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
2674b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  Some entities can be declared multiple times within a translation
2675b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  unit, but only one of those declarations can also be a
2676b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  definition. For example, given:
2677b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
2678b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \code
2679b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int, int);
2680b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int g(int x, int y) { return f(x, y); }
2681b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int a, int b) { return a + b; }
2682b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int, int);
2683b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \endcode
2684b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
2685b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  there are three declarations of the function "f", but only the
2686b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  second one is a definition. The clang_getCursorDefinition()
2687b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  function will take any cursor pointing to a declaration of "f"
2688b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  (the first or fourth lines of the example) or a cursor referenced
2689b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  that uses "f" (the call to "f' inside "g") and will return a
2690b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  declaration cursor pointing to the definition (the second "f"
2691b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  declaration).
2692b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
2693b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  If given a cursor for which there is no corresponding definition,
2694b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  e.g., because there is no definition of that entity within this
2695b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  translation unit, returns a NULL cursor.
2696b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */
2697b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor);
2698b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
26991efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
2700b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Determine whether the declaration pointed to by this cursor
2701b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * is also a definition of that entity.
2702b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */
2703b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);
2704b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
2705c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
27061a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \brief Retrieve the canonical cursor corresponding to the given cursor.
27071a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
27081a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * In the C family of languages, many kinds of entities can be declared several
27091a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * times within a single translation unit. For example, a structure type can
27101a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * be forward-declared (possibly multiple times) and later defined:
27111a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
27121a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \code
27131a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X;
27141a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X;
27151a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X {
27161a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *   int member;
27171a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * };
27181a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \endcode
27191a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
27201a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * The declarations and the definition of \c X are represented by three
27211a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * different cursors, all of which are declarations of the same underlying
27221a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * entity. One of these cursor is considered the "canonical" cursor, which
27231a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * is effectively the representative for the underlying entity. One can
27241a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * determine if two cursors are declarations of the same underlying entity by
27251a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * comparing their canonical cursors.
27261a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
27271a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \returns The canonical cursor for the entity referred to by the given cursor.
27281a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor */
27291a9d0503b67a499797141af0fd6d315d5045f0eaDouglas GregorCINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor);
27301a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor
27311a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor/**
2732c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2733c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
27341efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2735c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
27369ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * \defgroup CINDEX_CPP C++ AST introspection
27379ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek *
27389ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * The routines in this group provide access information in the ASTs specific
27399ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * to C++ language features.
27409ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek *
27419ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @{
27429ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
27439ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
27449ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
274549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Determine if a C++ member function or member function template is
274649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared 'static'.
27479ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
27489ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed KremenekCINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);
27499ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
27509ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
2751211924b563aa31421836cee7655be729ad02733fDouglas Gregor * \brief Determine if a C++ member function or member function template is
2752211924b563aa31421836cee7655be729ad02733fDouglas Gregor * explicitly declared 'virtual' or if it overrides a virtual method from
2753211924b563aa31421836cee7655be729ad02733fDouglas Gregor * one of the base classes.
2754211924b563aa31421836cee7655be729ad02733fDouglas Gregor */
2755211924b563aa31421836cee7655be729ad02733fDouglas GregorCINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C);
2756211924b563aa31421836cee7655be729ad02733fDouglas Gregor
2757211924b563aa31421836cee7655be729ad02733fDouglas Gregor/**
275849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Given a cursor that represents a template, determine
275949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the cursor kind of the specializations would be generated by instantiating
276049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the template.
276149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
276249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * This routine can be used to determine what flavor of function template,
276349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * class template, or class template partial specialization is stored in the
276449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * cursor. For example, it can describe whether a class template cursor is
276549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared with "struct", "class" or "union".
276649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
276749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \param C The cursor to query. This cursor should represent a template
276849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declaration.
276949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
277049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \returns The cursor kind of the specializations that would be generated
277149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * by instantiating the template \p C. If \p C is not a template, returns
277249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \c CXCursor_NoDeclFound.
277349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor */
277449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);
277549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor
277649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor/**
2777e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \brief Given a cursor that may represent a specialization or instantiation
2778e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template, retrieve the cursor that represents the template that it
2779e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializes or from which it was instantiated.
2780e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
2781e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * This routine determines the template involved both for explicit
2782e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializations of templates and for implicit instantiations of the template,
2783e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * both of which are referred to as "specializations". For a class template
2784e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specialization (e.g., \c std::vector<bool>), this routine will return
2785e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * either the primary template (\c std::vector) or, if the specialization was
2786e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * instantiated from a class template partial specialization, the class template
2787e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * partial specialization. For a class template partial specialization and a
2788e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * function template specialization (including instantiations), this
2789e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * this routine will return the specialized template.
2790e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
2791e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * For members of a class template (e.g., member functions, member classes, or
2792e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * static data members), returns the specialized or instantiated member.
2793e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * Although not strictly "templates" in the C++ language, members of class
2794e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates have the same notions of specializations and instantiations that
2795e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates do, so this routine treats them similarly.
2796e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
2797e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \param C A cursor that may be a specialization of a template or a member
2798e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template.
2799e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
2800e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \returns If the given cursor is a specialization or instantiation of a
2801e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * template or a member thereof, the template or member that it specializes or
2802e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * from which it was instantiated. Otherwise, returns a NULL cursor.
2803e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor */
2804e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas GregorCINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
2805430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
2806430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor/**
2807430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Given a cursor that references something else, return the source range
2808430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * covering that reference.
2809430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor *
2810430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param C A cursor pointing to a member reference, a declaration reference, or
2811430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * an operator call.
2812430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param NameFlags A bitset with three independent flags:
2813430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
2814430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece.
2815430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param PieceIndex For contiguous names or when passing the flag
2816430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece, only one piece with index 0 is
2817430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * available. When the CXNameRange_WantSinglePiece flag is not passed for a
2818430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * non-contiguous names, this index can be used to retreive the individual
2819430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * pieces of the name. See also CXNameRange_WantSinglePiece.
2820430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor *
2821430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \returns The piece of the name pointed to by the given cursor. If there is no
2822430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
2823430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */
282448a8d14fc6f064a5297024c2b34733a4080b2efeFrancois PichetCINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C,
282548a8d14fc6f064a5297024c2b34733a4080b2efeFrancois Pichet                                                unsigned NameFlags,
2826430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor                                                unsigned PieceIndex);
2827430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
2828430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregorenum CXNameRefFlags {
2829430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
2830430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \brief Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
2831430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * range.
2832430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
2833430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantQualifier = 0x1,
2834430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
2835430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
2836430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \brief Include the explicit template arguments, e.g. <int> in x.f<int>, in
2837430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * the range.
2838430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
2839430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantTemplateArgs = 0x2,
2840430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
2841430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
2842430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \brief If the name is non-contiguous, return the full spanning range.
2843430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   *
2844430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * Non-contiguous names occur in Objective-C when a selector with two or more
2845430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * parameters is used, or in C++ when using an operator:
2846430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \code
2847430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * [object doSomething:here withValue:there]; // ObjC
2848430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * return some_vector[1]; // C++
2849430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \endcode
2850430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
2851430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantSinglePiece = 0x4
2852430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor};
2853e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor
2854e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor/**
28559ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @}
28569ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
28579ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
28589ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
28590045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * \defgroup CINDEX_LEX Token extraction and manipulation
28600045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
28610045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * The routines in this group provide access to the tokens within a
28620045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * translation unit, along with a semantic mapping of those tokens to
28630045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * their corresponding cursors.
2864fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2865fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @{
2866fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2867fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
2868fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2869fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a kind of token.
2870fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2871fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef enum CXTokenKind {
2872fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
2873fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A token that contains some kind of punctuation.
2874fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
2875fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Punctuation,
2876896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2877fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
28780045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor   * \brief A language keyword.
2879fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
2880fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Keyword,
2881896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2882fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
2883fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief An identifier (that is not a keyword).
2884fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
2885fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Identifier,
2886896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2887fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
2888fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A numeric, string, or character literal.
2889fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
2890fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Literal,
2891896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2892fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
2893fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A comment.
2894fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
2895fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Comment
2896fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXTokenKind;
2897fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
2898fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2899fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a single preprocessing token.
2900fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2901fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef struct {
2902fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  unsigned int_data[4];
2903fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  void *ptr_data;
2904fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXToken;
2905fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
2906fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2907fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the kind of the given token.
2908fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2909fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken);
2910896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2911fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2912fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the spelling of the given token.
2913fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2914fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * The spelling of a token is the textual representation of that token, e.g.,
2915fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * the text of an identifier or keyword.
2916fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2917fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken);
2918896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2919fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2920fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve the source location of the given token.
2921fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2922896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit,
2923fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                                       CXToken);
2924896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2925fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2926fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve a source range that covers the given token.
2927fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2928fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);
2929fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
2930fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2931fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Tokenize the source code described by the given range into raw
2932fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * lexical tokens.
2933fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2934fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit whose text is being tokenized.
2935fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2936fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Range the source range in which text should be tokenized. All of the
2937fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * tokens produced by tokenization will fall within this source range,
2938fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2939fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens this pointer will be set to point to the array of tokens
2940fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that occur within the given source range. The returned pointer must be
2941fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * freed with clang_disposeTokens() before the translation unit is destroyed.
2942fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2943fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens will be set to the number of tokens in the \c *Tokens
2944fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * array.
2945fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2946fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2947fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
2948fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                   CXToken **Tokens, unsigned *NumTokens);
2949896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2950fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2951fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Annotate the given set of tokens by providing cursors for each token
2952fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that can be mapped to a specific entity within the abstract syntax tree.
2953fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
29540045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * This token-annotation routine is equivalent to invoking
29550045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() for the source locations of each of the
29560045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * tokens. The cursors provided are filtered, so that only those
29570045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * cursors that have a direct correspondence to the token are
29580045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * accepted. For example, given a function call \c f(x),
29590045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() would provide the following cursors:
29600045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
29610045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
29620045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
29630045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
29640045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
29650045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * Only the first and last of these cursors will occur within the
29660045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * annotate, since the tokens "f" and "x' directly refer to a function
29670045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * and a variable, respectively, but the parentheses are just a small
29680045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * part of the full syntax of the function call expression, which is
29690045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * not provided as an annotation.
2970fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2971fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit that owns the given tokens.
2972fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2973fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens the set of tokens to annotate.
2974fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2975fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens the number of tokens in \p Tokens.
2976fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
2977fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Cursors an array of \p NumTokens cursors, whose contents will be
2978fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * replaced with the cursors corresponding to each token.
2979fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2980fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU,
2981fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                         CXToken *Tokens, unsigned NumTokens,
2982fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                         CXCursor *Cursors);
2983896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2984fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2985fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Free the given set of tokens.
2986fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2987896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
2988fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                        CXToken *Tokens, unsigned NumTokens);
2989896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2990fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2991fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @}
2992fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
2993896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2994fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
2995c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_DEBUG Debugging facilities
2996c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2997c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines are used for testing and debugging, only, and should not
2998c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be relied upon.
2999c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3000c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
3001c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
30021efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
30034ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff/* for debug/testing */
3004e68fff6fc083c6270d835216a3de0b82c6ef0310Ted KremenekCINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind);
30051efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor,
30061efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar                                          const char **startBuf,
30074ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          const char **endBuf,
30084ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *startLine,
30094ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *startColumn,
30104ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *endLine,
30114ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *endColumn);
30120a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE void clang_enableStackTraces(void);
3013995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel DunbarCINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data,
3014995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar                                          unsigned stack_size);
3015995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar
30160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
3017c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
3018c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
30191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3020c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3021c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CODE_COMPLET Code completion
3022c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3023c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Code completion involves taking an (incomplete) source file, along with
3024c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * knowledge of where the user is actively editing that file, and suggesting
3025c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * syntactically- and semantically-valid constructs that the user might want to
3026c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * use at that particular point in the source code. These data structures and
3027c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines provide support for code completion.
3028c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3029c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
3030c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
30311efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3032c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
30330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A semantic string that describes a code-completion result.
30340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
30350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A semantic string that describes the formatting of a code-completion
30360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * result as a single "template" of text that should be inserted into the
30370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * source buffer when a particular code-completion result is selected.
30380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * Each semantic string is made up of some number of "chunks", each of which
30390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * contains some text along with a description of what that text means, e.g.,
30400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the name of the entity being referenced, whether the text chunk is part of
30410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the template, or whether it is a "placeholder" that the user should replace
30420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * with actual code,of a specific kind. See \c CXCompletionChunkKind for a
30431efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * description of the different kinds of chunks.
30440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
30450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef void *CXCompletionString;
30461efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
30470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
30480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A single result of code completion.
30490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
30500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef struct {
30510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
30521efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief The kind of entity that this completion refers to.
30530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
30541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * The cursor kind will be a macro, keyword, or a declaration (one of the
30550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * *Decl cursor kinds), describing the entity that the completion is
30560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * referring to.
30570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
30580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \todo In the future, we would like to provide a full cursor, to allow
30590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the client to extract additional information from declaration.
30600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
30610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  enum CXCursorKind CursorKind;
30621efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
30631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
30640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief The code-completion string that describes how to insert this
30650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * code-completion result into the editing buffer.
30660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
30670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionString CompletionString;
30680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor} CXCompletionResult;
30690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
30700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
30710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Describes a single piece of text within a code-completion string.
30720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
30731efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Each "chunk" within a code-completion string (\c CXCompletionString) is
30741efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * either a piece of text with a specific "kind" that describes how that text
30750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * should be interpreted by the client or is another completion string.
30760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
30770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorenum CXCompletionChunkKind {
30780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
30790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A code-completion string that describes "optional" text that
30800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * could be a part of the template (but is not required).
30810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
30820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * The Optional chunk is the only kind of chunk that has a code-completion
30831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * string for its representation, which is accessible via
30840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \c clang_getCompletionChunkCompletionString(). The code-completion string
30850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * describes an additional part of the template that is completely optional.
30860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * For example, optional chunks can be used to describe the placeholders for
30870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * arguments that match up with defaulted function parameters, e.g. given:
30880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
30890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \code
30900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * void f(int x, float y = 3.14, double z = 2.71828);
30910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \endcode
30920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
30930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * The code-completion string for this function would contain:
30940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a TypedText chunk for "f".
30950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a LeftParen chunk for "(".
30960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a Placeholder chunk for "int x"
30970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - an Optional chunk containing the remaining defaulted arguments, e.g.,
30980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *       - a Comma chunk for ","
309971570182471d502a97f7f175aa527152544c75f2Daniel Dunbar   *       - a Placeholder chunk for "float y"
31000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *       - an Optional chunk containing the last defaulted argument:
31010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *           - a Comma chunk for ","
31020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *           - a Placeholder chunk for "double z"
31030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a RightParen chunk for ")"
31040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
310571570182471d502a97f7f175aa527152544c75f2Daniel Dunbar   * There are many ways to handle Optional chunks. Two simple approaches are:
31060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - Completely ignore optional chunks, in which case the template for the
31070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *     function "f" would only include the first parameter ("int x").
31080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - Fully expand all optional chunks, in which case the template for the
31090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *     function "f" would have all of the parameters.
31100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Optional,
31120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that a user would be expected to type to get this
31141efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * code-completion result.
31150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
31161efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * There will be exactly one "typed text" chunk in a semantic string, which
31171efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * will typically provide the spelling of a keyword or the name of a
31180c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * declaration that could be used at the current code point. Clients are
31190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * expected to filter the code-completion results based on the text in this
31200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * chunk.
31210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_TypedText,
31230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that should be inserted as part of a code-completion result.
31250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
31260c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "text" chunk represents text that is part of the template to be
31270c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * inserted into user code should this particular code-completion result
31280c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * be selected.
31290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31300c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Text,
31310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Placeholder text that should be replaced by the user.
31330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
31340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "placeholder" chunk marks a place where the user should insert text
31350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * into the code-completion template. For example, placeholders might mark
31360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the function parameters for a function declaration, to indicate that the
31370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * user should provide arguments for each of those parameters. The actual
31380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * text in a placeholder is a suggestion for the text to display before
31390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the user replaces the placeholder with real code.
31400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Placeholder,
31420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Informative text that should be displayed but never inserted as
31440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * part of the template.
31451efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   *
31460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * An "informative" chunk contains annotations that can be displayed to
31470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * help the user decide whether a particular code-completion result is the
31480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * right option, but which is not part of the actual template to be inserted
31490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * by code completion.
31500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Informative,
31520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that describes the current parameter when code-completion is
31540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * referring to function call, message send, or template specialization.
31550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
31560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "current parameter" chunk occurs when code-completion is providing
31570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * information about a parameter corresponding to the argument at the
31580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * code-completion point. For example, given a function
31590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
31600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \code
31610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * int add(int x, int y);
31620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \endcode
31630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
31640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * and the source code \c add(, where the code-completion point is after the
31650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * "(", the code-completion string will contain a "current parameter" chunk
31660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * for "int x", indicating that the current argument will initialize that
31670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * parameter. After typing further, to \c add(17, (where the code-completion
31681efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * point is after the ","), the code-completion string will contain a
31690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * "current paremeter" chunk to "int y".
31700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_CurrentParameter,
31720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left parenthesis ('('), used to initiate a function call or
31740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * signal the beginning of a function parameter list.
31750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftParen,
31770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right parenthesis (')'), used to finish a function call or
31790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * signal the end of a function parameter list.
31800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightParen,
31820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left bracket ('[').
31840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftBracket,
31860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right bracket (']').
31880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightBracket,
31900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left brace ('{').
31920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftBrace,
31940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right brace ('}').
31960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
31970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightBrace,
31980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
31990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left angle bracket ('<').
32000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
32010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftAngle,
32020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
32030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right angle bracket ('>').
32040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
32050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightAngle,
32060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
32070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A comma separator (',').
32080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
3209ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor  CXCompletionChunk_Comma,
3210ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor  /**
32111efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief Text that specifies the result type of a given result.
3212ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   *
3213ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   * This special kind of informative chunk is not meant to be inserted into
32141efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * the text buffer. Rather, it is meant to illustrate the type that an
3215ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   * expression using the given completion string would have.
3216ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   */
321701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_ResultType,
321801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
321901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief A colon (':').
322001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
322101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_Colon,
322201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
322301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief A semicolon (';').
322401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
322501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_SemiColon,
322601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
322701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief An '=' sign.
322801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
322901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_Equal,
323001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
323101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * Horizontal space (' ').
323201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
323301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_HorizontalSpace,
323401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
323501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * Vertical space ('\n'), after which it is generally a good idea to
323601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * perform indentation.
323701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
323801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_VerticalSpace
32390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor};
32401efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
32410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
32420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Determine the kind of a particular chunk within a completion string.
32430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
32450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
32470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the kind of the chunk at the index \c chunk_number.
32490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
32501efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE enum CXCompletionChunkKind
32510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkKind(CXCompletionString completion_string,
32520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                             unsigned chunk_number);
32531efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
32540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
32551efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the text associated with a particular chunk within a
32560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * completion string.
32570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
32590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
32610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the text associated with the chunk at index \c chunk_number.
32630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
32642ef6f8f5a35a60870594c5b04e0aa2bf22c6886fTed KremenekCINDEX_LINKAGE CXString
32650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkText(CXCompletionString completion_string,
32660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                             unsigned chunk_number);
32670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
32680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
32691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the completion string associated with a particular chunk
32700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * within a completion string.
32710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
32730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
32750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the completion string associated with the chunk at index
32770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \c chunk_number, or NULL if that chunk is not represented by a completion
32780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * string.
32790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
32800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE CXCompletionString
32810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkCompletionString(CXCompletionString completion_string,
32820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                                         unsigned chunk_number);
32831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
32840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
32850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Retrieve the number of chunks in the given code-completion string.
32860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
32870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE unsigned
32880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getNumCompletionChunks(CXCompletionString completion_string);
32890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
32900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
329112e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \brief Determine the priority of this code completion.
329212e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
329312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * The priority of a code completion indicates how likely it is that this
329412e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * particular completion is the completion that the user will select. The
329512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * priority is selected by various internal heuristics.
329612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
329712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \param completion_string The completion string to query.
329812e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
329912e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \returns The priority of this completion string. Smaller values indicate
330012e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * higher-priority (more likely) completions.
330112e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor */
330212e131385e892e3723483a1081a89bcad29c8a84Douglas GregorCINDEX_LINKAGE unsigned
330312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregorclang_getCompletionPriority(CXCompletionString completion_string);
330412e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor
330512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor/**
330658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \brief Determine the availability of the entity that this code-completion
330758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * string refers to.
330858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
330958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param completion_string The completion string to query.
331058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
331158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the completion string.
331258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */
331358ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind
331458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCompletionAvailability(CXCompletionString completion_string);
331558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
331658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/**
33178fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \brief Retrieve a completion string for an arbitrary declaration or macro
33188fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursor.
33198fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor *
33208fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \param cursor The cursor to query.
33218fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor *
33228fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \returns A non-context-sensitive completion string for declaration and macro
33238fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursors, or NULL for other kinds of cursors.
33248fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor */
33258fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas GregorCINDEX_LINKAGE CXCompletionString
33268fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregorclang_getCursorCompletionString(CXCursor cursor);
33278fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor
33288fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor/**
3329ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Contains the results of code-completion.
3330ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor *
3331ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * This data structure contains the results of code completion, as
3332e0cc52ef8afc8d1cba9c534191b5f0ddaff1d694Douglas Gregor * produced by \c clang_codeCompleteAt(). Its contents must be freed by
3333ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \c clang_disposeCodeCompleteResults.
3334ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */
3335ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregortypedef struct {
3336ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  /**
3337ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \brief The code-completion results.
3338ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   */
3339ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  CXCompletionResult *Results;
3340ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor
3341ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  /**
3342ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \brief The number of code-completion results stored in the
3343ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \c Results array.
3344ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   */
3345ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  unsigned NumResults;
3346ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor} CXCodeCompleteResults;
3347ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor
3348ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor/**
3349cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Flags that can be passed to \c clang_codeCompleteAt() to
3350cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * modify its behavior.
3351cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor *
3352cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * The enumerators in this enumeration can be bitwise-OR'd together to
3353cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * provide multiple options to \c clang_codeCompleteAt().
3354cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */
3355cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregorenum CXCodeComplete_Flags {
3356cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  /**
3357cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * \brief Whether to include macros within the set of code
3358cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * completions returned.
3359cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   */
3360cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  CXCodeComplete_IncludeMacros = 0x01,
3361cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
3362cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  /**
3363cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * \brief Whether to include code patterns for language constructs
3364cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * within the set of code completions, e.g., for loops.
3365cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   */
3366cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  CXCodeComplete_IncludeCodePatterns = 0x02
3367cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor};
3368cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
3369cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/**
33703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Bits that represent the context under which completion is occurring.
33713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
33723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * The enumerators in this enumeration may be bitwise-OR'd together if multiple
33733da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * contexts are occurring simultaneously.
33743da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */
33753da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorenum CXCompletionContext {
33763da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
33773da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief The context for completions is unexposed, as only Clang results
33783da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included. (This is equivalent to having no context bits set.)
33793da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
33803da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Unexposed = 0,
33813da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
33823da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
33833da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for any possible type should be included in the results.
33843da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
33853da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_AnyType = 1 << 0,
33863da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
33873da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
33883da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for any possible value (variables, function calls, etc.)
33893da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included in the results.
33903da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
33913da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_AnyValue = 1 << 1,
33923da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
33933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to an Objective-C object should
33943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * be included in the results.
33953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
33963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCObjectValue = 1 << 2,
33973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
33983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to an Objective-C selector
33993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included in the results.
34003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCSelectorValue = 1 << 3,
34023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to a C++ class type should be
34043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * included in the results.
34053da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_CXXClassTypeValue = 1 << 4,
34073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
34083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for fields of the member being accessed using the dot
34103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * operator should be included in the results.
34113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_DotMemberAccess = 1 << 5,
34133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for fields of the member being accessed using the arrow
34153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * operator should be included in the results.
34163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ArrowMemberAccess = 1 << 6,
34183da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34193da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for properties of the Objective-C object being accessed
34203da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * using the dot operator should be included in the results.
34213da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34223da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCPropertyAccess = 1 << 7,
34233da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
34243da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34253da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for enum tags should be included in the results.
34263da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34273da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_EnumTag = 1 << 8,
34283da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34293da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for union tags should be included in the results.
34303da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34313da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_UnionTag = 1 << 9,
34323da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34333da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for struct tags should be included in the results.
34343da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34353da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_StructTag = 1 << 10,
34363da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
34373da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34383da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ class names should be included in the results.
34393da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34403da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ClassTag = 1 << 11,
34413da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34423da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ namespaces and namespace aliases should be
34433da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * included in the results.
34443da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Namespace = 1 << 12,
34463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ nested name specifiers should be included in
34483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
34493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_NestedNameSpecifier = 1 << 13,
34513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
34523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C interfaces (classes) should be included
34543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * in the results.
34553da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCInterface = 1 << 14,
34573da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34583da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C protocols should be included in
34593da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
34603da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34613da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCProtocol = 1 << 15,
34623da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34633da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C categories should be included in
34643da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
34653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34663da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCCategory = 1 << 16,
34673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34683da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C instance messages should be included
34693da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * in the results.
34703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCInstanceMessage = 1 << 17,
34723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34733da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C class messages should be included in
34743da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
34753da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34763da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCClassMessage = 1 << 18,
34773da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34783da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C selector names should be included in
34793da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
34803da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34813da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCSelectorName = 1 << 19,
34823da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
34833da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34843da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for preprocessor macro names should be included in
34853da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
34863da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34873da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_MacroName = 1 << 20,
34883da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
34893da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34903da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Natural language completions should be included in the results.
34913da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34923da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_NaturalLanguage = 1 << 21,
34933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
34943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
34953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief The current context is unknown, so set all contexts.
34963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
34973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Unknown = ((1 << 22) - 1)
34983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor};
34993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
35003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/**
3501cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Returns a default set of code-completion options that can be
3502cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * passed to\c clang_codeCompleteAt().
3503cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */
3504cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas GregorCINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
3505cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
3506cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/**
35071abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \brief Perform code completion at a given location in a translation unit.
35081abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
35091abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * This function performs code completion at a particular file, line, and
35101abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * column within source code, providing results that suggest potential
35111abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code snippets based on the context of the completion. The basic model
35121abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * for code completion is that Clang will parse a complete source file,
35131abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * performing syntax checking up to the location where code-completion has
35141abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * been requested. At that point, a special code-completion token is passed
35151abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * to the parser, which recognizes this token and determines, based on the
35161abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * current location in the C/Objective-C/C++ grammar and the state of
35171abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * semantic analysis, what completions to provide. These completions are
35181abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * returned via a new \c CXCodeCompleteResults structure.
35191abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
35201abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Code completion itself is meant to be triggered by the client when the
35211abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * user types punctuation characters or whitespace, at which point the
35221abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code-completion location will coincide with the cursor. For example, if \c p
35231abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is a pointer, code-completion might be triggered after the "-" and then
35241abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * after the ">" in \c p->. When the code-completion location is afer the ">",
35251abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the completion results will provide, e.g., the members of the struct that
35261abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * "p" points to. The client is responsible for placing the cursor at the
35271abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * beginning of the token currently being typed, then filtering the results
35281abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * based on the contents of the token. For example, when code-completing for
35291abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the expression \c p->get, the client should provide the location just after
35301abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the
35311abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client can filter the results based on the current token text ("get"), only
35321abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * showing those results that start with "get". The intent of this interface
35331abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is to separate the relatively high-latency acquisition of code-completion
35341abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * results from the filtering of results on a per-character basis, which must
35351abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * have a lower latency.
35361abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
35371abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param TU The translation unit in which code-completion should
35381abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * occur. The source files for this translation unit need not be
35391abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completely up-to-date (and the contents of those source files may
35401abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * be overridden via \p unsaved_files). Cursors referring into the
35411abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * translation unit may be invalidated by this invocation.
35421abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
35431abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_filename The name of the source file where code
35441abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion should be performed. This filename may be any file
35451abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * included in the translation unit.
35461abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
35471abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_line The line at which code-completion should occur.
35481abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
35491abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_column The column at which code-completion should occur.
35501abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Note that the column should point just after the syntactic construct that
35511abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * initiated code completion, and not in the middle of a lexical token.
35521abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
35531abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param unsaved_files the Tiles that have not yet been saved to disk
35541abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing or code completion, including the
35551abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * contents of those files.  The contents and name of these files (as
35561abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * specified by CXUnsavedFile) are copied when necessary, so the
35571abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client only needs to guarantee their validity until the call to
35581abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * this function returns.
35591abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
35601abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p
35611abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * unsaved_files.
35621abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
3563cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \param options Extra options that control the behavior of code
3564cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * completion, expressed as a bitwise OR of the enumerators of the
3565cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * CXCodeComplete_Flags enumeration. The
3566cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \c clang_defaultCodeCompleteOptions() function returns a default set
3567cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * of code-completion options.
3568cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor *
35691abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \returns If successful, a new \c CXCodeCompleteResults structure
35701abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * containing code-completion results, which should eventually be
35711abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * freed with \c clang_disposeCodeCompleteResults(). If code
35721abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion fails, returns NULL.
35731abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor */
35741abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCINDEX_LINKAGE
35751abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
35761abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            const char *complete_filename,
35771abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            unsigned complete_line,
35781abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            unsigned complete_column,
35791abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            struct CXUnsavedFile *unsaved_files,
3580cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor                                            unsigned num_unsaved_files,
3581cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor                                            unsigned options);
35821abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor
35831abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor/**
35841e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \brief Sort the code-completion results in case-insensitive alphabetical
35851e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * order.
35861e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor *
35871e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param Results The set of results to sort.
35881e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param NumResults The number of results in \p Results.
35891e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor */
35901e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas GregorCINDEX_LINKAGE
35911e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregorvoid clang_sortCodeCompletionResults(CXCompletionResult *Results,
35921e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor                                     unsigned NumResults);
35931e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor
35941e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor/**
3595ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Free the given set of code-completion results.
35960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
35971efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE
3598ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregorvoid clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
359958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
360020d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor/**
3601a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced prior to the
3602a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * location where code completion was performed.
3603a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
3604896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE
3605a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregorunsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results);
3606a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
3607a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
3608a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given code completion.
3609a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor *
3610a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Result the code completion results to query.
3611a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve.
3612a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor *
3613a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed
3614a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic().
3615a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
3616896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE
3617a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
3618a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                             unsigned Index);
3619a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
3620a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
36213da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Determines what compeltions are appropriate for the context
36223da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the given code completion.
36233da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
36243da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \param Results the code completion results to query
36253da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
36263da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \returns the kinds of completions that are appropriate for use
36273da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * along with the given code completion results.
36283da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */
36293da626b4f38eb0350de960d71271ca77af7a9cc8Douglas GregorCINDEX_LINKAGE
36303da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorunsigned long long clang_codeCompleteGetContexts(
36313da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor                                                CXCodeCompleteResults *Results);
3632e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor
3633e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/**
3634e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the cursor kind for the container for the current code
3635e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * completion context. The container is only guaranteed to be set for
3636e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * contexts where a container exists (i.e. member accesses or Objective-C
3637e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * message sends); if there is not a container, this function will return
3638e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * CXCursor_InvalidCode.
3639e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
3640e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query
3641e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
3642e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param IsIncomplete on return, this value will be false if Clang has complete
3643e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information about the container. If Clang does not have complete
3644e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information, this value will be true.
3645e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
3646e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the container kind, or CXCursor_InvalidCode if there is not a
3647e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * container
3648e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */
3649e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE
3650e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregorenum CXCursorKind clang_codeCompleteGetContainerKind(
3651e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor                                                 CXCodeCompleteResults *Results,
3652e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor                                                     unsigned *IsIncomplete);
3653e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor
3654e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/**
3655e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the USR for the container for the current code completion
3656e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * context. If there is not a container for the current context, this
3657e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * function will return the empty string.
3658e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
3659e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query
3660e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
3661e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the USR for the container
3662e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */
3663e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE
3664e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results);
36653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
36660a47d69af8bda945352997af3da4687a3356096aDouglas Gregor
36670a47d69af8bda945352997af3da4687a3356096aDouglas Gregor/**
36680a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \brief Returns the currently-entered selector for an Objective-C message
36690a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * send, formatted like "initWithFoo:bar:". Only guaranteed to return a
36700a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * non-empty string for CXCompletionContext_ObjCInstanceMessage and
36710a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * CXCompletionContext_ObjCClassMessage.
36720a47d69af8bda945352997af3da4687a3356096aDouglas Gregor *
36730a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \param Results the code completion results to query
36740a47d69af8bda945352997af3da4687a3356096aDouglas Gregor *
36750a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \returns the selector (or partial selector) that has been entered thus far
36760a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * for an Objective-C message send.
36770a47d69af8bda945352997af3da4687a3356096aDouglas Gregor */
36780a47d69af8bda945352997af3da4687a3356096aDouglas GregorCINDEX_LINKAGE
36790a47d69af8bda945352997af3da4687a3356096aDouglas GregorCXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results);
36800a47d69af8bda945352997af3da4687a3356096aDouglas Gregor
36813da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/**
368220d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * @}
368320d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor */
36841efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
36851efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
368604bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek/**
368704bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * \defgroup CINDEX_MISC Miscellaneous utility functions
368804bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek *
368904bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @{
369004bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */
369123e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek
369223e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek/**
369323e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek * \brief Return a version string, suitable for showing to a user, but not
369423e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek *        intended to be parsed (the format is not guaranteed to be stable).
369523e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek */
3696a2a9d6e4e5b6001b86b7dfc5db1ea296ce29a3d3Ted KremenekCINDEX_LINKAGE CXString clang_getClangVersion();
369704bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek
3698d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek
3699d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek/**
3700d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * \brief Enable/disable crash recovery.
3701d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek *
3702d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * \param Flag to indicate if crash recovery is enabled.  A non-zero value
3703d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek *        enables crash recovery, while 0 disables it.
3704d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek */
3705d2427ddf00aacdc288c386f3882e0821ca9bd27bTed KremenekCINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled);
3706d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek
370716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek /**
3708896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek  * \brief Visitor invoked for each file in a translation unit
370916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  *        (used with clang_getInclusions()).
371016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  *
371116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * This visitor function will be invoked by clang_getInclusions() for each
371216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * file included (either at the top-level or by #include directives) within
371316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * a translation unit.  The first argument is the file being included, and
371416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * the second and third arguments provide the inclusion stack.  The
371516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * array is sorted in order of immediate inclusion.  For example,
371616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * the first element refers to the location that included 'included_file'.
371716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  */
371816b55a71695a33c094383295cc7b7a2080e098daTed Kremenektypedef void (*CXInclusionVisitor)(CXFile included_file,
371916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   CXSourceLocation* inclusion_stack,
372016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   unsigned include_len,
372116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   CXClientData client_data);
372216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek
372316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/**
372416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * \brief Visit the set of preprocessor inclusions in a translation unit.
372516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   The visitor function is called with the provided data for every included
372616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   file.  This does not include headers included by the PCH file (unless one
372716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   is inspecting the inclusions in the PCH file itself).
372816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek */
372916b55a71695a33c094383295cc7b7a2080e098daTed KremenekCINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu,
373016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                        CXInclusionVisitor visitor,
373116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                        CXClientData client_data);
373216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek
373316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/**
373404bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @}
373504bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */
37361efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
373797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** \defgroup CINDEX_REMAPPING Remapping functions
373897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
373997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @{
374097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
374197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
374297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
374397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief A remapping of original source files and their translated files.
374497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
374597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidistypedef void *CXRemapping;
374697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
374797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
374897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Retrieve a remapping.
374997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
375097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param path the path that contains metadata about remappings.
375197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
375297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \returns the requested remapping. This remapping must be freed
375397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
375497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
375597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path);
375697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
375797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
375897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Determine the number of remappings.
375997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
376097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
376197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
376297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
376397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Get the original and the associated filename from the remapping.
376497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
376597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param original If non-NULL, will be set to the original filename.
376697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
376797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param transformed If non-NULL, will be set to the filename that the original
376897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * is associated with.
376997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
377097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index,
377197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis                                     CXString *original, CXString *transformed);
377297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
377397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
377497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Dispose the remapping.
377597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
377697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_dispose(CXRemapping);
377797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
377897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
377997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @}
378097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
378197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
3782c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3783c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
3784c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
37851efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3786d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus
3787d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek}
3788d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
3789d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
3790d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
3791