Index.h revision 5b419362c29b7aa09d9a75a14fe1b11985625bf0
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   */
118d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen  CXAvailability_NotAvailable,
119d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen  /**
120d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen   * \brief The entity is available, but not accessible; any use of it will be
121d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen   * an error.
122d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen   */
123d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen  CXAvailability_NotAccessible
12458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor};
12558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
1267f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1277f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \defgroup CINDEX_STRING String manipulation routines
1287f17376e0931a337d544b75d9030bc92763be287Douglas Gregor *
1297f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * @{
1307f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
1311efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1327f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1337f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief A character string.
1347f17376e0931a337d544b75d9030bc92763be287Douglas Gregor *
1357f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * The \c CXString type is used to return strings from the interface when
1367f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * the ownership of that string might different from one call to the next.
1377f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * Use \c clang_getCString() to retrieve the string data and, once finished
1387f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * with the string data, call \c clang_disposeString() to free the string.
139ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Naroff */
140ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Narofftypedef struct {
141a60ed47da13393796d8552b9fdca12abbb3eea42Ted Kremenek  void *data;
142ed122735639d83c10f18c28c7fd117bfcd0f62cbTed Kremenek  unsigned private_flags;
143ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Naroff} CXString;
144ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Naroff
1457f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1467f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief Retrieve the character data associated with the given string.
1477f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
148ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve NaroffCINDEX_LINKAGE const char *clang_getCString(CXString string);
149ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Naroff
1507f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1517f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief Free the given string,
1527f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
153ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve NaroffCINDEX_LINKAGE void clang_disposeString(CXString string);
154ef0cef6cec8de5fc60e469a93436eed7212e0dc2Steve Naroff
1557f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/**
1567f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * @}
1577f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */
1581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1591efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
160e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * \brief clang_createIndex() provides a shared context for creating
161e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * translation units. It provides two options:
162e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff *
163e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
164e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * declarations (when loading any new translation units). A "local" declaration
1651efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * is one that belongs in the translation unit itself and not in a precompiled
166e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * header that was used by the translation unit. If zero, all declarations
167e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * will be enumerated.
168e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff *
169b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * Here is an example:
170b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
1710a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *   // excludeDeclsFromPCH = 1, displayDiagnostics=1
1720a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *   Idx = clang_createIndex(1, 1);
173b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
174b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // IndexTest.pch was produced with the following command:
175b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
176b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
177b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
178b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // This will load all the symbols from 'IndexTest.pch'
1791efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
180002a528ab0189fc60cfbf9328962c96ccbe567eeDouglas Gregor *                       TranslationUnitVisitor, 0);
181b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   clang_disposeTranslationUnit(TU);
182b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
183b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // This will load all the symbols from 'IndexTest.c', excluding symbols
184b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   // from 'IndexTest.pch'.
185fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar *   char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
186fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar *   TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
187fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar *                                                  0, 0);
188b2cd48756119f4d8d2a865b4b3e0e8efd02e26a0Douglas Gregor *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
189b2cd48756119f4d8d2a865b4b3e0e8efd02e26a0Douglas Gregor *                       TranslationUnitVisitor, 0);
190b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *   clang_disposeTranslationUnit(TU);
191b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff *
192b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * This process of creating the 'pch', loading it separately, and using it (via
193b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
194b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * (which gives the indexer the same performance benefit as the compiler).
195e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff */
1960a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
1970a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor                                         int displayDiagnostics);
198896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
1990087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor/**
2000087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * \brief Destroy the given index.
2010087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor *
2020087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * The index must not be destroyed until all of the translation units created
2030087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * within that index have been destroyed.
2040087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor */
2058506dde586459887b7e14e23a30af8ac5be5adb6Daniel DunbarCINDEX_LINKAGE void clang_disposeIndex(CXIndex index);
2061efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2071efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
208c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_FILES File manipulation routines
209f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
210f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{
211f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
2121efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
213f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
214f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief A particular source file that is part of a translation unit.
215f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
216f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregortypedef void *CXFile;
2171efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
218f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor
219f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
220f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief Retrieve the complete file and path name of the given file.
22188145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff */
22274844072411bae91d5dbb89955d200cbe1e0a1c8Ted KremenekCINDEX_LINKAGE CXString clang_getFileName(CXFile SFile);
2231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
224f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
225f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief Retrieve the last modification time of the given file.
226f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
22708b0e8daeb683686b876d72674962ad96df21d45Douglas GregorCINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
22888145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff
2293c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/**
230dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * \brief Determine whether the given header is guarded against
231dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * multiple inclusions, either with the conventional
232dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * #ifndef/#define/#endif macro guards or with #pragma once.
233dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor */
234dd3e5549e3c11e217078938aacf72f042eea5343Douglas GregorCINDEX_LINKAGE unsigned
235dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregorclang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
236dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor
237dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor/**
238b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a file handle within the given translation unit.
239b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
240b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param tu the translation unit
2411efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar *
242b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param file_name the name of the file.
243b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
244b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns the file handle for the named file in the translation unit \p tu,
245b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * or a NULL file handle if the file was not a part of this translation unit.
246b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
2471efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,
248b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                    const char *file_name);
2491efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
250b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
251f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @}
252f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
253f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor
254f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
255f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \defgroup CINDEX_LOCATIONS Physical source locations
256f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
257f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * Clang represents physical source locations in its abstract syntax tree in
258f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * great detail, with file, line, and column information for the majority of
259f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * the tokens parsed in the source code. These data types and functions are
260f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * used to represent source location information, either for a particular
261f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * point in the program or for a range of points in the program, and extract
262f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * specific location information from those data types.
263f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor *
264f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{
265f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
2661efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
267f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
2681db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * \brief Identifies a specific source location within a translation
2691db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * unit.
2701db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
27120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * Use clang_getExpansionLocation() or clang_getSpellingLocation()
272a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * to map a source location to a particular file, line, and column.
2733c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */
2743c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct {
2755352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  void *ptr_data[2];
2761db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor  unsigned int_data;
2773c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceLocation;
278fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek
2793c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/**
280d52864bd33c66aacc84133460d8c9c0dfcdd5c18Daniel Dunbar * \brief Identifies a half-open character range in the source code.
2813c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor *
2821db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
2831db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * starting and end locations from a source range, respectively.
2843c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */
2853c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct {
2865352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  void *ptr_data[2];
2871db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor  unsigned begin_int_data;
2881db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor  unsigned end_int_data;
2893c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceRange;
290fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek
2911db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/**
292b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a NULL (invalid) source location.
293b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
294b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getNullLocation();
2951efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
296b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
297b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \determine Determine whether two source locations, which must refer into
2981efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * the same translation unit, refer to exactly the same point in the source
299b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * code.
300b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
301b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns non-zero if the source locations refer to the same location, zero
302b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * if they refer to different locations.
303b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
304b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1,
305b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                             CXSourceLocation loc2);
3061efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
307b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
3081efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieves the source location associated with a given file/line/column
3091efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * in a particular translation unit.
310b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
311b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu,
312b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                                  CXFile file,
313b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                                  unsigned line,
314b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                                  unsigned column);
31583889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall/**
31683889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * \brief Retrieves the source location associated with a given character offset
31783889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * in a particular translation unit.
31883889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall */
31983889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid ChisnallCINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu,
32083889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall                                                           CXFile file,
32183889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall                                                           unsigned offset);
3221efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
323b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
3245352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve a NULL (invalid) source range.
3255352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
3265352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXSourceRange clang_getNullRange();
327896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3285352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
329b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a source range given the beginning and ending source
330b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * locations.
331b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */
332b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin,
333b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor                                            CXSourceLocation end);
3341efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
335b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/**
336ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \brief Determine whether two ranges are equivalent.
337ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor *
338ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \returns non-zero if the ranges are the same, zero if they differ.
339ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor */
340ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas GregorCINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1,
341ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor                                          CXSourceRange range2);
342ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor
343ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor/**
344de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis * \brief Returns non-zero if \arg range is null.
345de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis */
346733dbc805facad7cebec5420f6c47c83848cee5fErik VerbruggenCINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range);
347de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis
348de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis/**
34946766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \brief Retrieve the file, line, column, and offset represented by
35046766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * the given source location.
3511db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
35220174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * If the location refers into a macro expansion, retrieves the
35320174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * location of the macro expansion.
354a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
3551efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param location the location within a source file that will be decomposed
3561efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * into its parts.
3571db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
3581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param file [out] if non-NULL, will be set to the file to which the given
3591db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points.
3601db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
3611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param line [out] if non-NULL, will be set to the line to which the given
3621db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points.
3631db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor *
3641efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param column [out] if non-NULL, will be set to the column to which the given
3651efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source location points.
36646766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor *
36746766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the
36846766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * buffer to which the given source location points.
3691db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */
37020174221af145554b76a0b0f5e4eb3ac70d05945Chandler CarruthCINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location,
37120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               CXFile *file,
37220174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               unsigned *line,
37320174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               unsigned *column,
37420174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth                                               unsigned *offset);
37520174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth
37620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth/**
377e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \brief Retrieve the file, line, column, and offset represented by
378e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the given source location, as specified in a # line directive.
379e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
380e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * Example: given the following source code in a file somefile.c
381e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
382e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * #123 "dummy.c" 1
383e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
384e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * static int func(void)
385e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * {
386e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *     return 0;
387e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * }
388e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
389e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the location information returned by this function would be
390e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
391e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: dummy.c Line: 124 Column: 12
392e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
393e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * whereas clang_getExpansionLocation would have returned
394e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
395e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: somefile.c Line: 3 Column: 12
396e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
397e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param location the location within a source file that will be decomposed
398e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * into its parts.
399e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
400e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param filename [out] if non-NULL, will be set to the filename of the
401e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. Note that filenames returned will be for "virtual" files,
402e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * which don't necessarily exist on the machine running clang - e.g. when
403e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * parsing preprocessed output obtained from a different environment. If
404e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * a non-NULL value is passed in, remember to dispose of the returned value
405e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * using \c clang_disposeString() once you've finished with it. For an invalid
406e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location, an empty string is returned.
407e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
408e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param line [out] if non-NULL, will be set to the line number of the
409e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned.
410e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis *
411e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param column [out] if non-NULL, will be set to the column number of the
412e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned.
413e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis */
414e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios KyrtzidisCINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location,
415e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis                                              CXString *filename,
416e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis                                              unsigned *line,
417e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis                                              unsigned *column);
418e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis
419e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis/**
42020174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * \brief Legacy API to retrieve the file, line, column, and offset represented
42120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * by the given source location.
42220174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth *
42320174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * This interface has been replaced by the newer interface
42420174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * \see clang_getExpansionLocation(). See that interface's documentation for
42520174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * details.
42620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth */
4271db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location,
4281db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor                                                   CXFile *file,
4291db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor                                                   unsigned *line,
43046766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor                                                   unsigned *column,
43146766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor                                                   unsigned *offset);
432e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor
433e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor/**
434a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \brief Retrieve the file, line, column, and offset represented by
435a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * the given source location.
436a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
437a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * If the location refers into a macro instantiation, return where the
438a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * location was originally spelled in the source file.
439a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
440a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param location the location within a source file that will be decomposed
441a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * into its parts.
442a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
443a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param file [out] if non-NULL, will be set to the file to which the given
444a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points.
445a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
446a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param line [out] if non-NULL, will be set to the line to which the given
447a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points.
448a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
449a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param column [out] if non-NULL, will be set to the column to which the given
450a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points.
451a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor *
452a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the
453a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * buffer to which the given source location points.
454a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor */
455a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas GregorCINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location,
456a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              CXFile *file,
457a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              unsigned *line,
458a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              unsigned *column,
459a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor                                              unsigned *offset);
460a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor
461a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor/**
4621efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the first character within a
4631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range.
4641db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */
4651db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range);
4661db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor
4671db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/**
4681efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the last character within a
4691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range.
4701db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */
4711db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range);
4721db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor
473f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/**
474f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @}
475f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */
476c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
477c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
4785352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_DIAG Diagnostic reporting
4795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
4805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{
4815352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
4825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
4835352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
4845352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Describes the severity of a particular diagnostic.
4855352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
4865352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorenum CXDiagnosticSeverity {
4875352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
488896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek   * \brief A diagnostic that has been suppressed, e.g., by a command-line
4895352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * option.
4905352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
4915352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Ignored = 0,
492896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
4935352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
4945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic is a note that should be attached to the
4955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * previous (non-note) diagnostic.
4965352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
4975352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Note    = 1,
4985352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
4995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
5005352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic indicates suspicious code that may not be
5015352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * wrong.
5025352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
5035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Warning = 2,
5045352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
5055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
5065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic indicates that the code is ill-formed.
5075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
5085352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Error   = 3,
5095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
5105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  /**
5115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * \brief This diagnostic indicates that the code is ill-formed such
5125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * that future parser recovery is unlikely to produce useful
5135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   * results.
5145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor   */
5155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor  CXDiagnostic_Fatal   = 4
5165352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor};
5175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
5185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
5195352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief A single diagnostic, containing the diagnostic's severity,
5205352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * location, text, source ranges, and fix-it hints.
5215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
5225352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregortypedef void *CXDiagnostic;
5235352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
5245352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
525153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief A group of CXDiagnostics.
526153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
527153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenektypedef void *CXDiagnosticSet;
528153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
529153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
530153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Determine the number of diagnostics in a CXDiagnosticSet.
531153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
532153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags);
533153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
534153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
535153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Retrieve a diagnostic associated with the given CXDiagnosticSet.
536153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *
537153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param Unit the CXDiagnosticSet to query.
538153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param Index the zero-based diagnostic number to retrieve.
539153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *
540153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \returns the requested diagnostic. This diagnostic must be freed
541153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * via a call to \c clang_disposeDiagnostic().
542153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
543153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,
544153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek                                                     unsigned Index);
545153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
546153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
547153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
548153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Describes the kind of error that occurred (if any) in a call to
549153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \c clang_loadDiagnostics.
550153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
551153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenekenum CXLoadDiag_Error {
552153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  /**
553153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * \brief Indicates that no error occurred.
554153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   */
555153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  CXLoadDiag_None = 0,
556153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
557153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  /**
558153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * \brief Indicates that an unknown error occurred while attempting to
559153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * deserialize diagnostics.
560153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   */
561153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  CXLoadDiag_Unknown = 1,
562153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
563153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  /**
564153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * \brief Indicates that the file containing the serialized diagnostics
565153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * could not be opened.
566153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   */
567153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  CXLoadDiag_CannotLoad = 2,
568153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
569153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  /**
570153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   * \brief Indicates that the serialized diagnostics file is invalid or
571153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   *  corrupt.
572153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek   */
573153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek  CXLoadDiag_InvalidFile = 3
574153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek};
575153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
576153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
577153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Deserialize a set of diagnostics from a Clang diagnostics bitcode
578153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *  file.
579153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *
580153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param The name of the file to deserialize.
581153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param A pointer to a enum value recording if there was a problem
582153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *        deserializing the diagnostics.
583153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param A pointer to a CXString for recording the error string
584153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *        if the file was not successfully loaded.
585153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *
586153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise.  These
587153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *  diagnostics should be released using clang_disposeDiagnosticSet().
588153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
589153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file,
590153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek                                                  enum CXLoadDiag_Error *error,
591153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek                                                  CXString *errorString);
592153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
593153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
594153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Release a CXDiagnosticSet and all of its contained diagnostics.
595153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
596153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags);
597153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
598153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
599153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Retrieve the child diagnostics of a CXDiagnostic.  This
600153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek *  CXDiagnosticSet does not need to be released by clang_diposeDiagnosticSet.
601153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */
602153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D);
603153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek
604153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/**
605a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced for the given
606a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * translation unit.
607a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
608a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit);
609a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
610a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
611a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given translation unit.
6125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
613a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Unit the translation unit to query.
614a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve.
6155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
616a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed
617a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic().
6185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
619a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,
620a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                                unsigned Index);
621a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
622a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
6230373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * \brief Retrieve the complete set of diagnostics associated with a
6240373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek *        translation unit.
6250373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek *
6260373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * \param Unit the translation unit to query.
6270373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek */
6280373fcc3e5b205cc26656c70d7dff737b0e08345Ted KremenekCINDEX_LINKAGE CXDiagnosticSet
6290373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek  clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);
6300373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek
6310373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek/**
632a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Destroy a diagnostic.
633a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
634a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
6355352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
6365352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
6370a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Options to control the display of diagnostics.
6380a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
6390a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * The values in this enum are meant to be combined to customize the
6400a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * behavior of \c clang_displayDiagnostic().
6410a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */
6420a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregorenum CXDiagnosticDisplayOptions {
6430a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  /**
6440a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \brief Display the source-location information where the
6450a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * diagnostic was located.
6460a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
6470a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * When set, diagnostics will be prefixed by the file, line, and
6480a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * (optionally) column to which the diagnostic refers. For example,
6490a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
6500a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \code
6510a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * test.c:28: warning: extra tokens at end of #endif directive
6520a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \endcode
6530a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
6540a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * This option corresponds to the clang flag \c -fshow-source-location.
6550a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   */
6560a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  CXDiagnostic_DisplaySourceLocation = 0x01,
6570a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
6580a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  /**
6590a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \brief If displaying the source-location information of the
6600a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * diagnostic, also include the column number.
6610a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
6620a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * This option corresponds to the clang flag \c -fshow-column.
6630a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   */
6640a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  CXDiagnostic_DisplayColumn = 0x02,
6650a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
6660a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor  /**
6670a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \brief If displaying the source-location information of the
6680a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * diagnostic, also include information about source ranges in a
6690a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * machine-parsable format.
6700a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   *
671896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek   * This option corresponds to the clang flag
6720a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   * \c -fdiagnostics-print-source-range-info.
6730a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor   */
674aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplaySourceRanges = 0x04,
675aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
676aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  /**
677aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \brief Display the option name associated with this diagnostic, if any.
678aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   *
679aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * The option name displayed (e.g., -Wconversion) will be placed in brackets
680aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * after the diagnostic text. This option corresponds to the clang flag
681aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \c -fdiagnostics-show-option.
682aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   */
683aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplayOption = 0x08,
684aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
685aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  /**
686aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \brief Display the category number associated with this diagnostic, if any.
687aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   *
688aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * The category number is displayed within brackets after the diagnostic text.
689aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * This option corresponds to the clang flag
690aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \c -fdiagnostics-show-category=id.
691aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   */
692aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplayCategoryId = 0x10,
693aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
694aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  /**
695aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \brief Display the category name associated with this diagnostic, if any.
696aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   *
697aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * The category name is displayed within brackets after the diagnostic text.
698aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * This option corresponds to the clang flag
699aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   * \c -fdiagnostics-show-category=name.
700aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor   */
701aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor  CXDiagnostic_DisplayCategoryName = 0x20
7020a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor};
7030a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
7040a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/**
705274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \brief Format the given diagnostic in a manner that is suitable for display.
7060a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
707274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * This routine will format the given diagnostic to a string, rendering
708896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the diagnostic according to the various options given. The
709896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \c clang_defaultDiagnosticDisplayOptions() function returns the set of
7100a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * options that most closely mimics the behavior of the clang compiler.
7110a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
7120a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \param Diagnostic The diagnostic to print.
7130a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
714896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Options A set of options that control the diagnostic display,
7150a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * created by combining \c CXDiagnosticDisplayOptions values.
716274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor *
717274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \returns A new string containing for formatted diagnostic.
7180a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */
719274f1906f12ebf8fcc179701deeda6d3271120c1Douglas GregorCINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic,
720274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor                                               unsigned Options);
7210a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
7220a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/**
7230a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Retrieve the set of display options most similar to the
7240a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * default behavior of the clang compiler.
7250a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor *
7260a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \returns A set of display options suitable for use with \c
7270a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * clang_displayDiagnostic().
7280a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */
7290a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void);
7300a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor
7310a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/**
7325352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the severity of the given diagnostic.
7335352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
734896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE enum CXDiagnosticSeverity
7355352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getDiagnosticSeverity(CXDiagnostic);
7365352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
7375352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
7385352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the source location of the given diagnostic.
7395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
7405352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * This location is where Clang would print the caret ('^') when
7415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * displaying the diagnostic on the command line.
7425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
7435352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic);
7445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
7455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
7465352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the text of the given diagnostic.
7475352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
7485352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic);
749a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor
750a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor/**
751aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the name of the command-line option that enabled this
752aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic.
753aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
754aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Diag The diagnostic to be queried.
755aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
756aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Disable If non-NULL, will be set to the option that disables this
757aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic (if any).
758aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
759aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns A string that contains the command-line option used to enable this
760aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * warning, such as "-Wconversion" or "-pedantic".
761aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */
762aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag,
763aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor                                                  CXString *Disable);
764aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
765aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/**
766aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the category number for this diagnostic.
767aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
768aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * Diagnostics can be categorized into groups along with other, related
769aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostics (e.g., diagnostics under the same warning flag). This routine
770aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * retrieves the category number for the given diagnostic.
771aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
772aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The number of the category that contains this diagnostic, or zero
773aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * if this diagnostic is uncategorized.
774aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */
775aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
776aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
777aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/**
778aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the name of a particular diagnostic category.
779aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
780aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Category A diagnostic category number, as returned by
781aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c clang_getDiagnosticCategory().
782aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor *
783aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The name of the given diagnostic category.
784aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */
785aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticCategoryName(unsigned Category);
786aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor
787aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/**
788a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Determine the number of source ranges associated with the given
789a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * diagnostic.
790a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor */
791a3890baf1256ff26081306c7fef70202f8223f41Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic);
792896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
7935352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
794a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Retrieve a source range associated with the diagnostic.
7955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
796a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * A diagnostic's source ranges highlight important elements in the source
7975352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * code. On the command line, Clang displays source ranges by
798896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * underlining them with '~' characters.
7995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
800a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \param Diagnostic the diagnostic whose range is being extracted.
8015352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
802896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Range the zero-based index specifying which range to
8035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
804a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \returns the requested source range.
8055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
806896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic,
807a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor                                                      unsigned Range);
8085352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
8095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
8105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the number of fix-it hints associated with the
8115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * given diagnostic.
8125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
8135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
8145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
8155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
816473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \brief Retrieve the replacement information for a given fix-it.
8175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
818473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * Fix-its are described in terms of a source range whose contents
819473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * should be replaced by a string. This approach generalizes over
820473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * three kinds of operations: removal of source code (the range covers
821473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * the code to be removed and the replacement string is empty),
822473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replacement of source code (the range covers the code to be
823473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced and the replacement string provides the new code), and
824473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion (both the start and end of the range point at the
825473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion location, and the replacement string provides the text to
826473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insert).
8275352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
828473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param Diagnostic The diagnostic whose fix-its are being queried.
8295352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
830473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param FixIt The zero-based index of the fix-it.
8315352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
832473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param ReplacementRange The source range whose contents will be
833473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced with the returned replacement string. Note that source
834473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * ranges are half-open ranges [a, b), so the source code should be
835473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced from a and up to (but not including) b.
8365352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
837473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \returns A string containing text that should be replace the source
838473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * code indicated by the \c ReplacementRange.
8395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
840896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic,
841473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor                                                 unsigned FixIt,
842473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor                                               CXSourceRange *ReplacementRange);
8435352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
8445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
8455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @}
8465352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
8475352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
8485352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
8495352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation
8505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8515352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * The routines in this group provide the ability to create and destroy
8525352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * translation units from files, either by parsing the contents of the files or
8535352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * by reading in a serialized representation of a translation unit.
8545352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8555352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{
8565352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
857896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
8585352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
8595352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Get the original translation unit source file name.
8605352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
8615352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString
8625352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
8635352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
8645352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
8655352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Return the CXTranslationUnit for a given source file and the provided
8665352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * command line arguments one would pass to the compiler.
8675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8685352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: The 'source_filename' argument is optional.  If the caller provides a
8695352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * NULL pointer, the name of the source file is expected to reside in the
8705352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * specified command line arguments.
8715352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: When encountered in 'clang_command_line_args', the following options
8735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * are ignored:
8745352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8755352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-c'
8765352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-emit-ast'
8775352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-fsyntax-only'
8785352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *   '-o <output file>'  (both '-o' and '<output file>' are ignored)
8795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8801ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param CIdx The index object with which the translation unit will be
8811ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * associated.
8825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8835352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param source_filename - The name of the source file to load, or NULL if the
8841ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p clang_command_line_args.
8851ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek *
8861ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param num_clang_command_line_args The number of command-line arguments in
8871ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \p clang_command_line_args.
8881ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek *
8891ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param clang_command_line_args The command-line arguments that would be
8901ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * passed to the \c clang executable if it were being invoked out-of-process.
8911ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * These command-line options will be parsed and will affect how the translation
8921ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * unit is parsed. Note that the following options are ignored: '-c',
8931ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
8945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p
8965352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * unsaved_files.
8975352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor *
8985352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk
8995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * but may be required for code completion, including the contents of
900c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * those files.  The contents and name of these files (as specified by
901c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * CXUnsavedFile) are copied when necessary, so the client only needs to
902c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * guarantee their validity until the call to this function returns.
9035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
9045352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile(
9055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         CXIndex CIdx,
9065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         const char *source_filename,
9075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         int num_clang_command_line_args,
9082ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor                                   const char * const *clang_command_line_args,
9095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor                                         unsigned num_unsaved_files,
910a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                         struct CXUnsavedFile *unsaved_files);
911896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
9125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
9135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Create a translation unit from an AST file (-emit-ast).
9145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
915896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(CXIndex,
916a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                             const char *ast_filename);
9175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor
91844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor/**
91944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * \brief Flags that control the creation of translation units.
92044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor *
92144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * The enumerators in this enumeration type are meant to be bitwise
92244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * ORed together to specify which options should be used when
92344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * constructing the translation unit.
92444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */
9255a43021ac491bf091494167127772a20d9a9bb48Douglas Gregorenum CXTranslationUnit_Flags {
9265a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor  /**
9275a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * \brief Used to indicate that no special translation-unit options are
9285a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * needed.
9295a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   */
9305a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor  CXTranslationUnit_None = 0x0,
9315a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor
9325a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor  /**
9335a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * \brief Used to indicate that the parser should construct a "detailed"
9345a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * preprocessing record, including all macro definitions and instantiations.
9355a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   *
9365a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * Constructing a detailed preprocessing record requires more memory
9375a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * and time to parse, since the information contained in the record
9385a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * is usually not retained. However, it can be useful for
9395a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * applications that require more detailed information about the
9405a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   * behavior of the preprocessor.
9415a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor   */
94244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor  CXTranslationUnit_DetailedPreprocessingRecord = 0x01,
94344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor
94444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor  /**
945b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * \brief Used to indicate that the translation unit is incomplete.
94644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   *
947b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * When a translation unit is considered "incomplete", semantic
948b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * analysis that is typically performed at the end of the
949b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * translation unit will be suppressed. For example, this suppresses
950b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * the completion of tentative declarations in C and of
951b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * instantiation of implicitly-instantiation function templates in
952b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * C++. This option is typically used when parsing a header with the
953b1c031be513705d924038f497279b9b599868ba1Douglas Gregor   * intent of producing a precompiled header.
95444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   */
955b1c031be513705d924038f497279b9b599868ba1Douglas Gregor  CXTranslationUnit_Incomplete = 0x02,
95644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor
95744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor  /**
95844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * \brief Used to indicate that the translation unit should be built with an
95944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * implicit precompiled header for the preamble.
96044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   *
96144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * An implicit precompiled header is used as an optimization when a
96244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * particular translation unit is likely to be reparsed many times
96344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * when the sources aren't changing that often. In this case, an
96444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * implicit precompiled header will be built containing all of the
96544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * initial includes at the top of the main file (what we refer to as
96644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * the "preamble" of the file). In subsequent parses, if the
96744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * preamble or the files in it have not changed, \c
96844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * clang_reparseTranslationUnit() will re-use the implicit
96944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   * precompiled header to improve parsing performance.
97044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor   */
971e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  CXTranslationUnit_PrecompiledPreamble = 0x04,
972e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor
973e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  /**
974e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * \brief Used to indicate that the translation unit should cache some
975e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * code-completion results with each reparse of the source file.
976e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   *
977e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * Caching of code-completion results is a performance optimization that
978e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * introduces some overhead to reparsing but improves the performance of
979e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * code-completion operations.
980e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   */
98199ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  CXTranslationUnit_CacheCompletionResults = 0x08,
98299ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  /**
983b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor   * \brief DEPRECATED: Enable precompiled preambles in C++.
98499ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   *
98599ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   * Note: this is a *temporary* option that is available only while
986b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor   * we are testing C++ precompiled preamble support. It is deprecated.
98799ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   */
98899ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  CXTranslationUnit_CXXPrecompiledPreamble = 0x10,
98999ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor
99099ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor  /**
991b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor   * \brief DEPRECATED: Enabled chained precompiled preambles in C++.
99299ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   *
99399ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   * Note: this is a *temporary* option that is available only while
994b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor   * we are testing C++ precompiled preamble support. It is deprecated.
99599ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor   */
996dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor  CXTranslationUnit_CXXChainedPCH = 0x20,
997dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor
998dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor  /**
999dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor   * \brief Used to indicate that the "detailed" preprocessing record,
1000fd14e91dc0ac5db175c4b30af98e7f8adabcb508Chandler Carruth   * if requested, should also contain nested macro expansions.
1001dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor   *
1002fd14e91dc0ac5db175c4b30af98e7f8adabcb508Chandler Carruth   * Nested macro expansions (i.e., macro expansions that occur
1003fd14e91dc0ac5db175c4b30af98e7f8adabcb508Chandler Carruth   * inside another macro expansion) can, in some code bases, require
1004dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor   * a large amount of storage to due preprocessor metaprogramming. Moreover,
1005dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor   * its fairly rare that this information is useful for libclang clients.
1006dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor   */
1007ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth  CXTranslationUnit_NestedMacroExpansions = 0x40,
1008ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth
1009ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth  /**
1010ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth   * \brief Legacy name to indicate that the "detailed" preprocessing record,
1011fd14e91dc0ac5db175c4b30af98e7f8adabcb508Chandler Carruth   * if requested, should contain nested macro expansions.
1012ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth   *
1013ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth   * \see CXTranslationUnit_NestedMacroExpansions for the current name for this
1014ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth   * value, and its semantics. This is just an alias.
1015ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth   */
1016ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth  CXTranslationUnit_NestedMacroInstantiations =
1017ba7537febdf1bc1cc617e1f1746f2644feba6274Chandler Carruth    CXTranslationUnit_NestedMacroExpansions
10185a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor};
10195a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor
10205a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor/**
1021b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * \brief Returns the set of flags that is suitable for parsing a translation
1022b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * unit that is being edited.
1023b1c031be513705d924038f497279b9b599868ba1Douglas Gregor *
1024b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * The set of flags returned provide options for \c clang_parseTranslationUnit()
1025b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * to indicate that the translation unit is likely to be reparsed many times,
1026b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
1027b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
1028b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set contains an unspecified set of optimizations (e.g., the precompiled
1029b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * preamble) geared toward improving the performance of these routines. The
1030b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set of optimizations enabled may change from one version to the next.
1031b1c031be513705d924038f497279b9b599868ba1Douglas Gregor */
1032e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void);
1033b1c031be513705d924038f497279b9b599868ba1Douglas Gregor
1034b1c031be513705d924038f497279b9b599868ba1Douglas Gregor/**
10355a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Parse the given source file and the translation unit corresponding
10365a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * to that file.
10375a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
10385a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * This routine is the main entry point for the Clang C API, providing the
10395a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * ability to parse a source file into a translation unit that can then be
10405a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * queried by other functions in the API. This routine accepts a set of
10415a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * command-line arguments so that the compilation can be configured in the same
10425a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * way that the compiler is configured on the command line.
10435a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
10445a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param CIdx The index object with which the translation unit will be
10455a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * associated.
10465a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
10475a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param source_filename The name of the source file to load, or NULL if the
10481ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p command_line_args.
10495a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
10505a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param command_line_args The command-line arguments that would be
10515a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * passed to the \c clang executable if it were being invoked out-of-process.
10525a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * These command-line options will be parsed and will affect how the translation
10535a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unit is parsed. Note that the following options are ignored: '-c',
10545a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
10555a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
10565a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_command_line_args The number of command-line arguments in
10575a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \p command_line_args.
10585a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
10595a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk
10601abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing, including the contents of
10615a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * those files.  The contents and name of these files (as specified by
10625a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to
10635a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * guarantee their validity until the call to this function returns.
10645a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
10655a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p
10665a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unsaved_files.
10675a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
10685a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param options A bitmask of options that affects how the translation unit
10695a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * is managed but not its compilation. This should be a bitwise OR of the
10705a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXTranslationUnit_XXX flags.
10715a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor *
10725a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \returns A new translation unit describing the parsed code and containing
10735a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * any diagnostics produced by the compiler. If there is a failure from which
10745a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * the compiler cannot recover, returns NULL.
10755a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */
10765a43021ac491bf091494167127772a20d9a9bb48Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_parseTranslationUnit(CXIndex CIdx,
10775a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                    const char *source_filename,
10782ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor                                         const char * const *command_line_args,
10795a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                      int num_command_line_args,
10805a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                            struct CXUnsavedFile *unsaved_files,
10815a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                     unsigned num_unsaved_files,
10825a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor                                                            unsigned options);
10835a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor
10845352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
10851999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Flags that control how translation units are saved.
10861999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
10871999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise
10881999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * ORed together to specify which options should be used when
10891999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * saving the translation unit.
10901999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */
10911999844e7a18786e61e619e1dc6c789827541863Douglas Gregorenum CXSaveTranslationUnit_Flags {
10921999844e7a18786e61e619e1dc6c789827541863Douglas Gregor  /**
10931999844e7a18786e61e619e1dc6c789827541863Douglas Gregor   * \brief Used to indicate that no special saving options are needed.
10941999844e7a18786e61e619e1dc6c789827541863Douglas Gregor   */
10951999844e7a18786e61e619e1dc6c789827541863Douglas Gregor  CXSaveTranslationUnit_None = 0x0
10961999844e7a18786e61e619e1dc6c789827541863Douglas Gregor};
10971999844e7a18786e61e619e1dc6c789827541863Douglas Gregor
10981999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/**
10991999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Returns the set of flags that is suitable for saving a translation
11001999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * unit.
11011999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
11021999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The set of flags returned provide options for
11031999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \c clang_saveTranslationUnit() by default. The returned flag
11041999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * set contains an unspecified set of options that save translation units with
11051999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * the most commonly-requested data.
11061999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */
11071999844e7a18786e61e619e1dc6c789827541863Douglas GregorCINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU);
11081999844e7a18786e61e619e1dc6c789827541863Douglas Gregor
11091999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/**
111039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Describes the kind of error that occurred (if any) in a call to
111139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \c clang_saveTranslationUnit().
111239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */
111339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregorenum CXSaveError {
111439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
111539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that no error occurred while saving a translation unit.
111639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
111739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_None = 0,
111839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
111939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
112039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that an unknown error occurred while attempting to save
112139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * the file.
112239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   *
112339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * This error typically indicates that file I/O failed when attempting to
112439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * write the file.
112539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
112639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_Unknown = 1,
112739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
112839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
112939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that errors during translation prevented this attempt
113039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * to save the translation unit.
113139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   *
113239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * Errors that prevent the translation unit from being saved can be
113339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
113439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
113539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_TranslationErrors = 2,
113639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
113739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  /**
113839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * \brief Indicates that the translation unit to be saved was somehow
113939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   * invalid (e.g., NULL).
114039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor   */
114139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor  CXSaveError_InvalidTU = 3
114239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor};
114339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor
114439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor/**
11457ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \brief Saves a translation unit into a serialized representation of
11467ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * that translation unit on disk.
11477ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor *
11487ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * Any translation unit that was parsed without error can be saved
11497ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * into a file. The translation unit can then be deserialized into a
11507ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * new \c CXTranslationUnit with \c clang_createTranslationUnit() or,
11517ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * if it is an incomplete translation unit that corresponds to a
11527ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * header, used as a precompiled header when parsing other translation
11537ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * units.
11547ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor *
11557ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param TU The translation unit to save.
11561999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
11577ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param FileName The file to which the translation unit will be saved.
11587ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor *
11591999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \param options A bitmask of options that affects how the translation unit
11601999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * is saved. This should be a bitwise OR of the
11611999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * CXSaveTranslationUnit_XXX flags.
11621999844e7a18786e61e619e1dc6c789827541863Douglas Gregor *
116339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \returns A value that will match one of the enumerators of the CXSaveError
116439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * enumeration. Zero (CXSaveError_None) indicates that the translation unit was
116539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * saved successfully, while a non-zero value indicates that a problem occurred.
11667ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor */
11677ae2faafd30524ef5f863bb3b8701977888839bbDouglas GregorCINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU,
11681999844e7a18786e61e619e1dc6c789827541863Douglas Gregor                                             const char *FileName,
11691999844e7a18786e61e619e1dc6c789827541863Douglas Gregor                                             unsigned options);
11707ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor
11717ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor/**
11725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Destroy the specified CXTranslationUnit object.
11735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
11745352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
1175896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
11765352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
1177e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Flags that control the reparsing of translation units.
1178e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor *
1179e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise
1180e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * ORed together to specify which options should be used when
1181e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * reparsing the translation unit.
1182e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */
1183e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregorenum CXReparse_Flags {
1184e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  /**
1185e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   * \brief Used to indicate that no special reparsing options are needed.
1186e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor   */
1187e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor  CXReparse_None = 0x0
1188e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor};
1189e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor
1190e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/**
1191e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Returns the set of flags that is suitable for reparsing a translation
1192e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * unit.
1193e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor *
1194e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The set of flags returned provide options for
1195e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \c clang_reparseTranslationUnit() by default. The returned flag
1196e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * set contains an unspecified set of optimizations geared toward common uses
1197e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * of reparsing. The set of optimizations enabled may change from one version
1198e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * to the next.
1199e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */
1200e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
1201e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor
1202e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/**
1203abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \brief Reparse the source files that produced this translation unit.
1204abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1205abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * This routine can be used to re-parse the source files that originally
1206abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * created the given translation unit, for example because those source files
1207abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * have changed (either on disk or as passed via \p unsaved_files). The
1208abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * source code will be reparsed with the same command-line options as it
1209abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * was originally parsed.
1210abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1211abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * Reparsing a translation unit invalidates all cursors and source locations
1212abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * that refer into that translation unit. This makes reparsing a translation
1213abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit semantically equivalent to destroying the translation unit and then
1214abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * creating a new translation unit with the same command-line arguments.
1215abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * However, it may be more efficient to reparse a translation
1216abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit using this routine.
1217abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1218abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param TU The translation unit whose contents will be re-parsed. The
1219abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * translation unit must originally have been built with
1220abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_createTranslationUnitFromSourceFile().
1221abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1222abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p
1223abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unsaved_files.
1224abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1225abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param unsaved_files The files that have not yet been saved to disk
1226abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * but may be required for parsing, including the contents of
1227abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * those files.  The contents and name of these files (as specified by
1228abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to
1229abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * guarantee their validity until the call to this function returns.
1230abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor *
1231e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \param options A bitset of options composed of the flags in CXReparse_Flags.
1232e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The function \c clang_defaultReparseOptions() produces a default set of
1233e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * options recommended for most uses, based on the translation unit.
1234e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor *
1235abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \returns 0 if the sources could be reparsed. A non-zero value will be
1236abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * returned if reparsing was impossible, such that the translation unit is
1237abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * invalid. In such cases, the only valid call for \p TU is
1238abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_disposeTranslationUnit(TU).
1239abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor */
1240abc563f554951259bbe0315055cad92ee14d87e4Douglas GregorCINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU,
1241abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor                                                unsigned num_unsaved_files,
1242e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor                                          struct CXUnsavedFile *unsaved_files,
1243e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor                                                unsigned options);
124459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
124559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
124659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief Categorizes how memory is being used by a translation unit.
124759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
1248f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekenum CXTUResourceUsageKind {
1249f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_AST = 1,
1250f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_Identifiers = 2,
1251f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_Selectors = 3,
1252f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_GlobalCompletionResults = 4,
1253457aaf0692dfb2d9638f383334b81027f637f20cTed Kremenek  CXTUResourceUsage_SourceManagerContentCache = 5,
1254ba29bd25515fbd99e98ba0fedb9d93617b27609eTed Kremenek  CXTUResourceUsage_AST_SideTables = 6,
1255f61b831d7f6a15676b07647f507de80324cb7056Ted Kremenek  CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7,
1256e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek  CXTUResourceUsage_SourceManager_Membuffer_MMap = 8,
1257e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek  CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9,
1258e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek  CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10,
12595e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek  CXTUResourceUsage_Preprocessor = 11,
12605e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek  CXTUResourceUsage_PreprocessingRecord = 12,
1261ca7dc2b755eb81ac95121ce1a1f1aa44a4a0fe12Ted Kremenek  CXTUResourceUsage_SourceManager_DataStructures = 13,
1262d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek  CXTUResourceUsage_Preprocessor_HeaderSearch = 14,
1263f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST,
1264f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_MEMORY_IN_BYTES_END =
1265d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek    CXTUResourceUsage_Preprocessor_HeaderSearch,
1266f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek
1267f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsage_First = CXTUResourceUsage_AST,
1268d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek  CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch
126959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek};
127059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
127159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
127259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief Returns the human-readable null-terminated C string that represents
1273f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  *  the name of the memory category.  This string should never be freed.
127459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
127559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted KremenekCINDEX_LINKAGE
1276f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekconst char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind);
127759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1278f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsageEntry {
127959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief The memory usage category. */
1280f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  enum CXTUResourceUsageKind kind;
1281f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  /* \brief Amount of resources used.
1282f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek      The units will depend on the resource kind. */
128359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  unsigned long amount;
1284f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsageEntry;
128559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
128659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
128759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief The memory usage of a CXTranslationUnit, broken into categories.
128859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
1289f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsage {
129059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief Private data member, used for queries. */
129159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  void *data;
129259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
129359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief The number of entries in the 'entries' array. */
129459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  unsigned numEntries;
129559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
129659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  /* \brief An array of key-value pairs, representing the breakdown of memory
129759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek            usage. */
1298f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  CXTUResourceUsageEntry *entries;
129959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1300f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsage;
130159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
130259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/**
130359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  * \brief Return the memory usage of a translation unit.  This object
1304f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek  *  should be released with clang_disposeCXTUResourceUsage().
130559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek  */
1306f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU);
130759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1308f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);
130959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek
1310abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor/**
13115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @}
13125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */
1313896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
13145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/**
1315c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes the kind of entity that a cursor refers to.
1316c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1317c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXCursorKind {
1318c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Declarations */
13191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
1320c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A declaration whose specific kind is not exposed via this
13211efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * interface.
1322c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1323c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * Unexposed declarations have the same operations as any other kind
1324c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * of declaration; one can extract their location information,
1325c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * spelling, find their definitions, etc. However, the specific kind
1326c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * of the declaration is not reported.
1327c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1328c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnexposedDecl                 = 1,
1329c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A C or C++ struct. */
13301efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  CXCursor_StructDecl                    = 2,
1331c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A C or C++ union. */
1332c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnionDecl                     = 3,
1333c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A C++ class. */
1334c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ClassDecl                     = 4,
1335c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An enumeration. */
1336c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_EnumDecl                      = 5,
13371efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
1338c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A field (in C) or non-static data member (in C++) in a
1339c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * struct, union, or C++ class.
1340c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1341c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FieldDecl                     = 6,
1342c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An enumerator constant. */
1343c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_EnumConstantDecl              = 7,
1344c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A function. */
1345c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FunctionDecl                  = 8,
1346c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A variable. */
1347c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_VarDecl                       = 9,
1348c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A function or method parameter. */
1349c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ParmDecl                      = 10,
1350c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @interface. */
1351c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCInterfaceDecl             = 11,
1352c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @interface for a category. */
1353c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCCategoryDecl              = 12,
1354c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @protocol declaration. */
1355c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCProtocolDecl              = 13,
1356c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @property declaration. */
1357c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCPropertyDecl              = 14,
1358c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C instance variable. */
1359c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCIvarDecl                  = 15,
1360c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C instance method. */
1361c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCInstanceMethodDecl        = 16,
1362c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C class method. */
1363c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCClassMethodDecl           = 17,
1364c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @implementation. */
1365c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCImplementationDecl        = 18,
1366c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An Objective-C @implementation for a category. */
1367c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCCategoryImplDecl          = 19,
1368c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief A typedef */
1369c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_TypedefDecl                   = 20,
13708bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek  /** \brief A C++ class method. */
13718bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek  CXCursor_CXXMethod                     = 21,
13728f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek  /** \brief A C++ namespace. */
13738f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek  CXCursor_Namespace                     = 22,
1374a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek  /** \brief A linkage specification, e.g. 'extern "C"'. */
1375a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek  CXCursor_LinkageSpec                   = 23,
137601829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  /** \brief A C++ constructor. */
137701829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  CXCursor_Constructor                   = 24,
137801829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  /** \brief A C++ destructor. */
137901829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  CXCursor_Destructor                    = 25,
138001829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  /** \brief A C++ conversion function. */
138101829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor  CXCursor_ConversionFunction            = 26,
1382fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ template type parameter. */
1383fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_TemplateTypeParameter         = 27,
1384fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ non-type template parameter. */
1385fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_NonTypeTemplateParameter      = 28,
1386fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ template template parameter. */
1387fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_TemplateTemplateParameter     = 29,
1388fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  /** \brief A C++ function template. */
1389fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor  CXCursor_FunctionTemplate              = 30,
139039d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor  /** \brief A C++ class template. */
139139d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor  CXCursor_ClassTemplate                 = 31,
139274dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor  /** \brief A C++ class template partial specialization. */
139374dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor  CXCursor_ClassTemplatePartialSpecialization = 32,
13946931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  /** \brief A C++ namespace alias declaration. */
13956931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  CXCursor_NamespaceAlias                = 33,
13960a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor  /** \brief A C++ using directive. */
13970a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor  CXCursor_UsingDirective                = 34,
1398162e1c1b487352434552147967c3dd296ebee2f7Richard Smith  /** \brief A C++ using declaration. */
13997e24256c95afb64b4d5abf201a0f9f0527cb4cf3Douglas Gregor  CXCursor_UsingDeclaration              = 35,
1400162e1c1b487352434552147967c3dd296ebee2f7Richard Smith  /** \brief A C++ alias declaration */
1401162e1c1b487352434552147967c3dd296ebee2f7Richard Smith  CXCursor_TypeAliasDecl                 = 36,
1402352697a87bca664356f21a838b162084013625eaDouglas Gregor  /** \brief An Objective-C @synthesize definition. */
1403352697a87bca664356f21a838b162084013625eaDouglas Gregor  CXCursor_ObjCSynthesizeDecl            = 37,
1404352697a87bca664356f21a838b162084013625eaDouglas Gregor  /** \brief An Objective-C @dynamic definition. */
1405352697a87bca664356f21a838b162084013625eaDouglas Gregor  CXCursor_ObjCDynamicDecl               = 38,
14062dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis  /** \brief An access specifier. */
14072dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis  CXCursor_CXXAccessSpecifier            = 39,
140842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
140950aa6acd0b8d40c8956372a69e0a73f0802a5494Ted Kremenek  CXCursor_FirstDecl                     = CXCursor_UnexposedDecl,
14102dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis  CXCursor_LastDecl                      = CXCursor_CXXAccessSpecifier,
14111efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1412c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* References */
1413c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstRef                      = 40, /* Decl references */
14141efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  CXCursor_ObjCSuperClassRef             = 40,
1415c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCProtocolRef               = 41,
1416c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCClassRef                  = 42,
1417c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1418c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A reference to a type declaration.
1419c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1420c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * A type reference occurs anywhere where a type is named but not
1421c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * declared. For example, given:
1422c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1423c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \code
1424c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * typedef unsigned size_type;
1425c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * size_type size;
1426c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \endcode
1427c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1428c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * The typedef is a declaration of size_type (CXCursor_TypedefDecl),
1429c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * while the type of the variable "size" is referenced. The cursor
1430c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * referenced by the type of size is the typedef for size_type.
1431c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1432c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_TypeRef                       = 43,
14333064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CXCursor_CXXBaseSpecifier              = 44,
14340b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor  /**
1435a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor   * \brief A reference to a class template, function template, template
1436a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor   * template parameter, or class template partial specialization.
14370b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor   */
14380b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor  CXCursor_TemplateRef                   = 45,
14396931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  /**
14406931900f43cea558c6974075256c07728dbfecc6Douglas Gregor   * \brief A reference to a namespace or namespace alias.
14416931900f43cea558c6974075256c07728dbfecc6Douglas Gregor   */
14426931900f43cea558c6974075256c07728dbfecc6Douglas Gregor  CXCursor_NamespaceRef                  = 46,
1443a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor  /**
144436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \brief A reference to a member of a struct, union, or class that occurs in
144536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * some non-expression context, e.g., a designated initializer.
1446a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor   */
1447a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor  CXCursor_MemberRef                     = 47,
144836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  /**
144936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \brief A reference to a labeled statement.
145036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
145136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * This cursor kind is used to describe the jump to "start_over" in the
145236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * goto statement in the following example:
145336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
145436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \code
145536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *   start_over:
145636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *     ++counter;
145736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
145836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *     goto start_over;
145936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \endcode
146036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
146136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * A label reference cursor refers to a label statement.
146236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   */
146336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  CXCursor_LabelRef                      = 48,
146436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor
14651f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor  /**
14661f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \brief A reference to a set of overloaded functions or function templates
14671f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * that has not yet been resolved to a specific function or function template.
14681f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
14691f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * An overloaded declaration reference cursor occurs in C++ templates where
14701f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * a dependent name refers to a function. For example:
14711f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
14721f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \code
14731f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * template<typename T> void swap(T&, T&);
14741f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
14751f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * struct X { ... };
14761f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * void swap(X&, X&);
14771f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
14781f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * template<typename T>
14791f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * void reverse(T* first, T* last) {
14801f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *   while (first < last - 1) {
14811f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *     swap(*first, *--last);
14821f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *     ++first;
14831f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *   }
14841f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * }
14851f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
14861f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * struct Y { };
14871f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * void swap(Y&, Y&);
14881f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \endcode
14891f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
14901f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * Here, the identifier "swap" is associated with an overloaded declaration
14911f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * reference. In the template definition, "swap" refers to either of the two
14921f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * "swap" functions declared above, so both results will be available. At
14931f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * instantiation time, "swap" may also refer to other functions found via
14941f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * argument-dependent lookup (e.g., the "swap" function at the end of the
14951f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * example).
14961f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   *
14971f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * The functions \c clang_getNumOverloadedDecls() and
14981f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * \c clang_getOverloadedDecl() can be used to retrieve the definitions
14991f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   * referenced by this cursor.
15001f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor   */
15011f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor  CXCursor_OverloadedDeclRef             = 49,
15021f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
15031f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor  CXCursor_LastRef                       = CXCursor_OverloadedDeclRef,
15041efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1505c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Error conditions */
1506c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstInvalid                  = 70,
1507c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_InvalidFile                   = 70,
1508c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_NoDeclFound                   = 71,
1509c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_NotImplemented                = 72,
1510ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek  CXCursor_InvalidCode                   = 73,
1511ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek  CXCursor_LastInvalid                   = CXCursor_InvalidCode,
15121efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1513c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Expressions */
1514c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstExpr                     = 100,
15151efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1516c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1517c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief An expression whose specific kind is not exposed via this
15181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * interface.
1519c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1520c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * Unexposed expressions have the same operations as any other kind
1521c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * of expression; one can extract their location information,
1522c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * spelling, children, etc. However, the specific kind of the
1523c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * expression is not reported.
1524c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1525c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnexposedExpr                 = 100,
15261efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1527c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1528c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief An expression that refers to some value declaration, such
1529c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * as a function, varible, or enumerator.
1530c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1531c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_DeclRefExpr                   = 101,
15321efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1533c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1534c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief An expression that refers to a member of a struct, union,
1535c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * class, Objective-C class, etc.
1536c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1537c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_MemberRefExpr                 = 102,
15381efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1539c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An expression that calls a function. */
1540c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_CallExpr                      = 103,
15411efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1542c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /** \brief An expression that sends a message to an Objective-C
1543c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   object or class. */
1544c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_ObjCMessageExpr               = 104,
15451ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek
15461ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek  /** \brief An expression that represents a block literal. */
15471ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek  CXCursor_BlockExpr                     = 105,
15481ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek
154942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An integer literal.
155042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
155142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IntegerLiteral                = 106,
155242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
155342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A floating point number literal.
155442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
155542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_FloatingLiteral               = 107,
155642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
155742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An imaginary number literal.
155842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
155942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ImaginaryLiteral              = 108,
156042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
156142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A string literal.
156242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
156342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_StringLiteral                 = 109,
156442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
156542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A character literal.
156642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
156742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CharacterLiteral              = 110,
156842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
156942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A parenthesized expression, e.g. "(1)".
157042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
157142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This AST node is only formed if full location information is requested.
157242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
157342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ParenExpr                     = 111,
157442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
157542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief This represents the unary-expression's (except sizeof and
157642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * alignof).
157742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
157842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_UnaryOperator                 = 112,
157942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
158042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C99 6.5.2.1] Array Subscripting.
158142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
158242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ArraySubscriptExpr            = 113,
158342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
158442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A builtin binary operation expression such as "x + y" or
158542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * "x <= y".
158642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
158742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_BinaryOperator                = 114,
158842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
158942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Compound assignment such as "+=".
159042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
159142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CompoundAssignOperator        = 115,
159242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
159342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief The ?: ternary operator.
159442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
159542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ConditionalOperator           = 116,
159642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
159742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An explicit cast in C (C99 6.5.4) or a C-style cast in C++
159842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * (C++ [expr.cast]), which uses the syntax (Type)expr.
159942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
160042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * For example: (int)f.
160142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
160242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CStyleCastExpr                = 117,
160342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
160442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C99 6.5.2.5]
160542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
160642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CompoundLiteralExpr           = 118,
160742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
160842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Describes an C or C++ initializer list.
160942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
161042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_InitListExpr                  = 119,
161142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
161242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief The GNU address of label extension, representing &&label.
161342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
161442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_AddrLabelExpr                 = 120,
161542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
161642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief This is the GNU Statement Expression extension: ({int X=4; X;})
161742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
161842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_StmtExpr                      = 121,
161942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
1620ffbe9b9c64ab2e94b9d48ec56e511f75826fc80aBenjamin Kramer  /** \brief Represents a C11 generic selection.
162142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
162242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_GenericSelectionExpr          = 122,
162342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
162442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Implements the GNU __null extension, which is a name for a null
162542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * pointer constant that has integral type (e.g., int or long) and is the same
162642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * size and alignment as a pointer.
162742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
162842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * The __null extension is typically only used by system headers, which define
162942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * NULL as __null in C++ rather than using 0 (which is an integer that may not
163042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * match the size of a pointer).
163142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
163242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_GNUNullExpr                   = 123,
163342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
163442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s static_cast<> expression.
163542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
163642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXStaticCastExpr             = 124,
163742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
163842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s dynamic_cast<> expression.
163942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
164042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXDynamicCastExpr            = 125,
164142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
164242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s reinterpret_cast<> expression.
164342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
164442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXReinterpretCastExpr        = 126,
164542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
164642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s const_cast<> expression.
164742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
164842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXConstCastExpr              = 127,
164942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
165042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents an explicit C++ type conversion that uses "functional"
165142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * notion (C++ [expr.type.conv]).
165242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
165342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * Example:
165442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
165542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *   x = int(0.5);
165642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
165742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
165842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXFunctionalCastExpr         = 128,
165942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
166042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A C++ typeid expression (C++ [expr.typeid]).
166142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
166242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXTypeidExpr                 = 129,
166342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
166442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C++ 2.13.5] C++ Boolean Literal.
166542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
166642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXBoolLiteralExpr            = 130,
166742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
166842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C++0x 2.14.7] C++ Pointer Literal.
166942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
167042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXNullPtrLiteralExpr         = 131,
167142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
167242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents the "this" expression in C++
167342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
167442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXThisExpr                   = 132,
167542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
167642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief [C++ 15] C++ Throw Expression.
167742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
167842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This handles 'throw' and 'throw' assignment-expression. When
167942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * assignment-expression isn't present, Op will be null.
168042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
168142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXThrowExpr                  = 133,
168242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
168342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A new expression for memory allocation and constructor calls, e.g:
168442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * "new CXXNewExpr(foo)".
168542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
168642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXNewExpr                    = 134,
168742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
168842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A delete expression for memory deallocation and destructor calls,
168942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * e.g. "delete[] pArray".
169042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
169142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXDeleteExpr                 = 135,
169242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
169342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A unary expression.
169442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
169542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_UnaryExpr                     = 136,
169642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
16979793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor  /** \brief An Objective-C string literal i.e. @"foo".
169842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
169942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCStringLiteral             = 137,
170042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
17019793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor  /** \brief An Objective-C @encode expression.
170242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
170342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCEncodeExpr                = 138,
170442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
17059793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor  /** \brief An Objective-C @selector expression.
170642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
170742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCSelectorExpr              = 139,
170842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
17099793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor  /** \brief An Objective-C @protocol expression.
171042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
171142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCProtocolExpr              = 140,
171242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
171342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An Objective-C "bridged" cast expression, which casts between
171442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * Objective-C pointers and C pointers, transferring ownership in the process.
171542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
171642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
171742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *   NSString *str = (__bridge_transfer NSString *)CFCreateString();
171842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
171942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
172042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCBridgedCastExpr           = 141,
172142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
172242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents a C++0x pack expansion that produces a sequence of
172342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * expressions.
172442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
172542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * A pack expansion expression contains a pattern (which itself is an
172642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * expression) followed by an ellipsis. For example:
172742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
172842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
172942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * template<typename F, typename ...Types>
173042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * void forward(F f, Types &&...args) {
173142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *  f(static_cast<Types&&>(args)...);
173242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * }
173342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
173442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
173542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_PackExpansionExpr             = 142,
173642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
173742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Represents an expression that computes the length of a parameter
173842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * pack.
173942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
174042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \code
174142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * template<typename ...Types>
174242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * struct count {
174342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *   static const unsigned value = sizeof...(Types);
174442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * };
174542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * \endcode
174642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
174742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SizeOfPackExpr                = 143,
174842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
174942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_LastExpr                      = CXCursor_SizeOfPackExpr,
17501efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1751c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /* Statements */
1752c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_FirstStmt                     = 200,
1753c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1754c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief A statement whose specific kind is not exposed via this
1755c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * interface.
1756c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1757c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * Unexposed statements have the same operations as any other kind of
1758c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * statement; one can extract their location information, spelling,
1759c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * children, etc. However, the specific kind of the statement is not
1760c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * reported.
1761c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1762c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXCursor_UnexposedStmt                 = 200,
176336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor
176436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  /** \brief A labelled statement in a function.
176536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
176636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * This cursor kind is used to describe the "start_over:" label statement in
176736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * the following example:
176836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
176936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \code
177036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *   start_over:
177136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *     ++counter;
177236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   * \endcode
177336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   *
177436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor   */
177536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor  CXCursor_LabelStmt                     = 201,
177642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
177742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A group of statements like { stmt stmt }.
177842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
177942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This cursor kind is used to describe compound statements, e.g. function
178042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * bodies.
178142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
178242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CompoundStmt                  = 202,
178342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
178442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A case statment.
178542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
178642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CaseStmt                      = 203,
178742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
178842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A default statement.
178942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
179042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DefaultStmt                   = 204,
179142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
179242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An if statement
179342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
179442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IfStmt                        = 205,
179542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
179642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A switch statement.
179742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
179842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SwitchStmt                    = 206,
179942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
180042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A while statement.
180142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
180242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_WhileStmt                     = 207,
180342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
180442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A do statement.
180542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
180642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DoStmt                        = 208,
180742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
180842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A for statement.
180942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
181042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ForStmt                       = 209,
181142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
181242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A goto statement.
181342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
181442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_GotoStmt                      = 210,
181542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
181642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief An indirect goto statement.
181742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
181842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_IndirectGotoStmt              = 211,
181942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
182042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A continue statement.
182142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
182242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ContinueStmt                  = 212,
182342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
182442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A break statement.
182542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
182642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_BreakStmt                     = 213,
182742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
182842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A return statement.
182942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
183042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ReturnStmt                    = 214,
183142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
183242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief A GNU inline assembly statement extension.
183342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
183442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_AsmStmt                       = 215,
183542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
18363f54d48a75234efdbbfcd503fd316a78ffd4b50dDouglas Gregor  /** \brief Objective-C's overall @try-@catch-@finally statement.
183742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
183842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtTryStmt                 = 216,
183942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
184042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's @catch statement.
184142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
184242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtCatchStmt               = 217,
184342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
184442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's @finally statement.
184542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
184642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtFinallyStmt             = 218,
184742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
184842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's @throw statement.
184942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
185042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtThrowStmt               = 219,
185142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
185242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's @synchronized statement.
185342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
185442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAtSynchronizedStmt        = 220,
185542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
185642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's autorelease pool statement.
185742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
185842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCAutoreleasePoolStmt       = 221,
185942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
186042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Objective-C's collection statement.
186142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
186242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_ObjCForCollectionStmt         = 222,
186342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
186442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s catch statement.
186542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
186642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXCatchStmt                  = 223,
186742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
186842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s try statement.
186942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
187042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXTryStmt                    = 224,
187142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
187242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief C++'s for (* : *) statement.
187342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
187442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_CXXForRangeStmt               = 225,
187542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
187642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's try statement.
187742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
187842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHTryStmt                    = 226,
187942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
188042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's except statement.
188142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
188242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHExceptStmt                 = 227,
188342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
188442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Windows Structured Exception Handling's finally statement.
188542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
188642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_SEHFinallyStmt                = 228,
188742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
188842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief The null satement ";": C99 6.8.3p3.
188942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   *
189042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * This cursor kind is used to describe the null statement.
189142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
189242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_NullStmt                      = 230,
189342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
189442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  /** \brief Adaptor class for mixing declarations with statements and
189542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   * expressions.
189642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor   */
189742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_DeclStmt                      = 231,
189842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor
189942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor  CXCursor_LastStmt                      = CXCursor_DeclStmt,
19001efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1901c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
1902c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Cursor that represents the translation unit itself.
1903c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   *
1904c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * The translation unit cursor exists primarily to act as the root
1905c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * cursor for traversing the contents of a translation unit.
1906c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
1907e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_TranslationUnit               = 300,
1908e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek
1909e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  /* Attributes */
1910e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_FirstAttr                     = 400,
1911e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  /**
1912e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   * \brief An attribute whose specific kind is not exposed via this
1913e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   * interface.
1914e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek   */
1915e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_UnexposedAttr                 = 400,
1916e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek
1917e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_IBActionAttr                  = 401,
1918e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek  CXCursor_IBOutletAttr                  = 402,
1919857e918a8a40deb128840308a318bf623d68295fTed Kremenek  CXCursor_IBOutletCollectionAttr        = 403,
19206639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis  CXCursor_CXXFinalAttr                  = 404,
19216639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis  CXCursor_CXXOverrideAttr               = 405,
19225f1c822def3efffe1d8f7299fbbbc3b1cdd4833dErik Verbruggen  CXCursor_AnnotateAttr                  = 406,
192384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCursor_AsmLabelAttr                  = 407,
192484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCursor_LastAttr                      = CXCursor_AsmLabelAttr,
19259f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor
19269f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  /* Preprocessing */
19279f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  CXCursor_PreprocessingDirective        = 500,
1928572feb2a190b5e8b04fb06c4ac50ee0f61e93ff0Douglas Gregor  CXCursor_MacroDefinition               = 501,
19299b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth  CXCursor_MacroExpansion                = 502,
19309b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth  CXCursor_MacroInstantiation            = CXCursor_MacroExpansion,
1931ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor  CXCursor_InclusionDirective            = 503,
19329f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor  CXCursor_FirstPreprocessing            = CXCursor_PreprocessingDirective,
1933ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor  CXCursor_LastPreprocessing             = CXCursor_InclusionDirective
1934c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor};
1935c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1936c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1937c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A cursor representing some element in the abstract syntax tree for
1938c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a translation unit.
1939c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
19401efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The cursor abstraction unifies the different kinds of entities in a
1941c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * program--declaration, statements, expressions, references to declarations,
1942c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * etc.--under a single "cursor" abstraction with a common set of operations.
1943c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Common operation for a cursor include: getting the physical location in
1944c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a source file where the cursor points, getting the name associated with a
1945c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor, and retrieving cursors for any child nodes of a particular cursor.
1946c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
1947c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors can be produced in two specific ways.
1948c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_getTranslationUnitCursor() produces a cursor for a translation unit,
1949c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * from which one can use clang_visitChildren() to explore the rest of the
1950c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * translation unit. clang_getCursor() maps from a physical source location
1951c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to the entity that resides at that location, allowing one to map from the
1952c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * source code into the AST.
1953c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1954c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregortypedef struct {
1955c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  enum CXCursorKind kind;
1956aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  int xdata;
1957c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  void *data[3];
19581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar} CXCursor;
1959c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1960c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1961c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations
1962c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
1963c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
1964c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
19651efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1966c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1967c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the NULL cursor, which represents no entity.
1968c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1969c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getNullCursor(void);
19701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1971c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1972c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the cursor that represents the given translation unit.
1973c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
1974c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The translation unit cursor can be used to start traversing the
1975c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * various declarations within the given translation unit.
1976c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1977c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
1978c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1979c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1980c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether two cursors are equivalent.
1981c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1982c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
19831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
1984c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
1985b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis * \brief Returns non-zero if \arg cursor is null.
1986b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */
19875b419362c29b7aa09d9a75a14fe1b11985625bf0Benjamin KramerCINDEX_LINKAGE int clang_Cursor_isNull(CXCursor);
1988b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis
1989b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/**
19909ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor * \brief Compute a hash value for the given cursor.
19919ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor */
19929ce5584553054d0cb934940586aca0186e87fa57Douglas GregorCINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);
19939ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor
19949ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor/**
1995c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the kind of the given cursor.
1996c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
1997c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
1998c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
1999c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2000c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a declaration.
2001c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2002c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
2003c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2004c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2005c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a simple
2006c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * reference.
2007c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2008c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Note that other kinds of cursors (such as expressions) can also refer to
2009c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * other cursors. Use clang_getCursorReferenced() to determine whether a
2010c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * particular cursor refers to another entity.
2011c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2012c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind);
2013c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2014c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2015c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents an expression.
2016c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2017c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind);
2018c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2019c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2020c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a statement.
2021c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2022c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind);
2023c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2024c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
20258be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor * \brief Determine whether the given cursor kind represents an attribute.
20268be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor */
20278be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas GregorCINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind);
20288be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor
20298be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor/**
20301efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents an invalid
2031c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor.
20321efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar */
2033c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind);
2034c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2035c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
20361efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents a translation
20371efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unit.
2038c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2039c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind);
20401efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2041ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek/***
20429f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * \brief Determine whether the given cursor represents a preprocessing
20439f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * element, such as a preprocessor directive or macro instantiation.
20449f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor */
20459f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas GregorCINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind);
20469f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor
20479f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor/***
2048ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek * \brief Determine whether the given cursor represents a currently
2049ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek *  unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
2050ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek */
2051ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted KremenekCINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind);
2052ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek
2053c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
205416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * \brief Describe the linkage of the entity referred to by a cursor.
205516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */
205616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenekenum CXLinkageKind {
205716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This value indicates that no linkage information is available
205816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * for a provided CXCursor. */
205916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_Invalid,
206016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /**
206116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * \brief This is the linkage for variables, parameters, and so on that
206216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   *  have automatic storage.  This covers normal (non-extern) local variables.
206316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   */
206416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_NoLinkage,
206516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for static variables and static functions. */
206616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_Internal,
206716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for entities with external linkage that live
206816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek   * in C++ anonymous namespaces.*/
206916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_UniqueExternal,
207016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  /** \brief This is the linkage for entities with true, external linkage. */
207116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek  CXLinkage_External
207216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek};
207316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek
207416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/**
207545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the linkage of the entity referred to by a given cursor.
207616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */
207716b4259aecaa22b642d35d36fd89965ed700c1e0Ted KremenekCINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
207816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek
207916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/**
208058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to.
208158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
208258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param cursor The cursor to query.
208358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
208458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the cursor.
208558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */
208658ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind
208758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCursorAvailability(CXCursor cursor);
208858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
208958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/**
209045e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Describe the "language" of the entity referred to by a cursor.
209145e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */
209245e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind {
20936cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek  CXLanguage_Invalid = 0,
209445e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek  CXLanguage_C,
209545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek  CXLanguage_ObjC,
20966cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek  CXLanguage_CPlusPlus
209745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek};
209845e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek
209945e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/**
210045e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the "language" of the entity referred to by a given cursor.
210145e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */
210245e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor);
210345e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek
2104b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/**
2105b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis * \brief Returns the translation unit that a cursor originated from.
2106b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */
2107b0d6eaa6b646c18c49923aefc76973801f561701Argyrios KyrtzidisCINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor);
2108b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis
2109eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2110eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2111eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief A fast container representing a set of CXCursors.
2112eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */
2113eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenektypedef struct CXCursorSetImpl *CXCursorSet;
2114eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2115eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2116eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Creates an empty CXCursorSet.
2117eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */
2118eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE CXCursorSet clang_createCXCursorSet();
2119eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2120eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2121eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Disposes a CXCursorSet and releases its associated memory.
2122eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */
2123eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset);
2124eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2125eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2126eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Queries a CXCursorSet to see if it contains a specific CXCursor.
2127eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek *
2128eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \returns non-zero if the set contains the specified cursor.
2129eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek*/
2130eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset,
2131eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek                                                   CXCursor cursor);
2132eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
2133eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/**
2134eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Inserts a CXCursor into a CXCursorSet.
2135eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek *
2136eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \returns zero if the CXCursor was already in the set, and non-zero otherwise.
2137eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek*/
2138eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,
2139eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek                                                 CXCursor cursor);
2140eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek
21412be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/**
21422be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the semantic parent of the given cursor.
21432be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
21442be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The semantic parent of a cursor is the cursor that semantically contains
21452be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the given \p cursor. For many declarations, the lexical and semantic parents
21462be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the lexical parent is returned by
21472be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorLexicalParent()). They diverge when declarations or
21482be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example:
21492be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
21502be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code
21512be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C {
21522be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *  void f();
21532be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * };
21542be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
21552be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { }
21562be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode
21572be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
21582be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the
21592be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is
21602be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this
21612be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the
21622be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics
21632be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the
21642be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration,
21652be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations
21662be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context.
21672be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
21682be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their
21692be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C
21702be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit.
21713910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor *
21723910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For global declarations, the semantic parent is the translation unit.
21732be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */
21742be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor);
21752be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor
21762be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/**
21772be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the lexical parent of the given cursor.
21782be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
21792be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The lexical parent of a cursor is the cursor in which the given \p cursor
21802be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * was actually written. For many declarations, the lexical and semantic parents
21812be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the semantic parent is returned by
21822be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorSemanticParent()). They diverge when declarations or
21832be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example:
21842be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
21852be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code
21862be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C {
21872be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *  void f();
21882be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * };
21892be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
21902be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { }
21912be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode
21922be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
21932be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the
21942be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is
21952be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this
21962be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the
21972be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics
21982be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the
21992be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration,
22002be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations
22012be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context.
22022be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor *
22032be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their
22042be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C
22052be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit.
22063910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor *
22073910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For declarations written in the global scope, the lexical parent is
22083910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * the translation unit.
22092be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */
22102be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor);
22119f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
22129f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/**
22139f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Determine the set of methods that are overridden by the given
22149f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method.
22159f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
22169f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In both Objective-C and C++, a method (aka virtual member function,
22179f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * in C++) can override a virtual method in a base class. For
22189f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * Objective-C, a method is said to override any method in the class's
22199f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * interface (if we're coming from an implementation), its protocols,
22209f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * or its categories, that has the same selector and is of the same
22219f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * kind (class or instance). If no such method exists, the search
22229f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * continues to the class's superclass, its protocols, and its
22239f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * categories, and so on.
22249f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
22259f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * For C++, a virtual member function overrides any virtual member
22269f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * function with the same signature that occurs in its base
22279f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * classes. With multiple inheritance, a virtual member function can
22289f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * override several virtual member functions coming from different
22299f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * base classes.
22309f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
22319f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In all cases, this function determines the immediate overridden
22329f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method, rather than all of the overridden methods. For example, if
22339f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * a method is originally declared in a class A, then overridden in B
22349f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * (which in inherits from A) and also in C (which inherited from B),
22359f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * then the only overridden method returned from this function when
22369f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoked on C's method will be B's method. The client may then
22379f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoke this function again, given the previously-found overridden
22389f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods, to map out the complete method-override set.
22399f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
22409f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param cursor A cursor representing an Objective-C or C++
22419f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method. This routine will compute the set of methods that this
22429f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method overrides.
22439f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
22449f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param overridden A pointer whose pointee will be replaced with a
22459f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * pointer to an array of cursors, representing the set of overridden
22469f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods. If there are no overridden methods, the pointee will be
22479f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * set to NULL. The pointee must be freed via a call to
22489f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \c clang_disposeOverriddenCursors().
22499f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor *
22509f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param num_overridden A pointer to the number of overridden
22519f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * functions, will be set to the number of overridden functions in the
22529f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * array pointed to by \p overridden.
22539f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */
22549f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor,
22559f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor                                               CXCursor **overridden,
22569f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor                                               unsigned *num_overridden);
22579f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
22589f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/**
22599f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Free the set of overridden cursors returned by \c
22609f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * clang_getOverriddenCursors().
22619f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */
22629f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden);
22639f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor
226445e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/**
2265ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * \brief Retrieve the file that is included by the given inclusion directive
2266ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * cursor.
2267ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor */
2268ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas GregorCINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor);
2269ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor
2270ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor/**
2271c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2272c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
22731efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2274c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2275c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code
2276c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2277c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors represent a location within the Abstract Syntax Tree (AST). These
2278c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines help map between cursors and the physical locations where the
2279c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * described entities occur in the source code. The mapping is provided in
2280c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * both directions, so one can map from source code to the AST and back.
2281c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2282c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
228350398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */
22841efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
22856a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff/**
2286b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Map a source location to the cursor that describes the entity at that
2287b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * location in the source code.
2288b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
2289b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() maps an arbitrary source location within a translation
2290b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * unit down to the most specific cursor that describes the entity at that
22911efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * location. For example, given an expression \c x + y, invoking
2292b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() with a source location pointing to "x" will return the
22931efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * cursor for "x"; similarly for "y". If the cursor points anywhere between
2294b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
2295b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * will return a cursor referring to the "+" expression.
2296b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor *
2297b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns a cursor representing the entity at the given source location, or
2298b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * a NULL cursor if no such entity can be found.
22996a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff */
2300b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation);
23011efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
230298258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor/**
230398258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * \brief Retrieve the physical location of the source constructor referenced
230498258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * by the given cursor.
230598258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor *
230698258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * The location of a declaration is typically the location of the name of that
23071efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * declaration, where the name of that declaration would occur if it is
23081efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unnamed, or some keyword that introduces that particular declaration.
23091efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The location of a reference is where that reference occurs within the
231098258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * source code.
231198258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor */
231298258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor);
2313c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2314b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor/**
2315b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Retrieve the physical extent of the source construct referenced by
2316a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the given cursor.
2317a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor *
2318a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * The extent of a cursor starts with the file/line/column pointing at the
2319a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * first character within the source construct that the cursor refers to and
23201efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * ends with the last character withinin that source construct. For a
2321a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * declaration, the extent covers the declaration itself. For a reference,
2322a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the extent covers the location of the reference (e.g., where the referenced
2323a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * entity was actually used).
2324a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor */
2325a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas GregorCINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor);
2326c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor
2327c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2328c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2329c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
233095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
2331c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
23328e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \defgroup CINDEX_TYPES Type information for CXCursors
23338e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
23348e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @{
23358e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
23368e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23378e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
23388e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Describes the kind of type
23398e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
23408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenekenum CXTypeKind {
23418e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /**
23428e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * \brief Reprents an invalid type (e.g., where no type is available).
23438e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   */
23448e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Invalid = 0,
23458e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23468e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /**
23478e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * \brief A type whose specific kind is not exposed via this
23488e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   * interface.
23498e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek   */
23508e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Unexposed = 1,
23518e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23528e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  /* Builtin types */
23538e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Void = 2,
23548e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Bool = 3,
23558e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char_U = 4,
23568e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UChar = 5,
23578e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char16 = 6,
23588e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char32 = 7,
23598e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UShort = 8,
23608e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UInt = 9,
23618e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ULong = 10,
23628e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ULongLong = 11,
23638e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_UInt128 = 12,
23648e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Char_S = 13,
23658e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_SChar = 14,
23668e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_WChar = 15,
23678e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Short = 16,
23688e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Int = 17,
23698e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Long = 18,
23708e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LongLong = 19,
23718e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Int128 = 20,
23728e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Float = 21,
23738e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Double = 22,
23748e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LongDouble = 23,
23758e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_NullPtr = 24,
23768e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Overload = 25,
23778e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Dependent = 26,
23788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCId = 27,
23798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCClass = 28,
23808e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCSel = 29,
23818e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_FirstBuiltin = CXType_Void,
23828e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LastBuiltin  = CXType_ObjCSel,
23838e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
23848e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Complex = 100,
23858e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Pointer = 101,
23868e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_BlockPointer = 102,
23878e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_LValueReference = 103,
23888e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_RValueReference = 104,
23898e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Record = 105,
23908e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Enum = 106,
23918e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_Typedef = 107,
23928e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  CXType_ObjCInterface = 108,
239304c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek  CXType_ObjCObjectPointer = 109,
239404c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek  CXType_FunctionNoProto = 110,
23955f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis  CXType_FunctionProto = 111,
239684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXType_ConstantArray = 112,
239784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXType_Vector = 113
23988e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek};
23998e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
24008e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
240184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Describes the calling convention of a function type
240284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
240384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidisenum CXCallingConv {
240484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_Default = 0,
240584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_C = 1,
240684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86StdCall = 2,
240784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86FastCall = 3,
240884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86ThisCall = 4,
240984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_X86Pascal = 5,
241084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_AAPCS = 6,
241184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_AAPCS_VFP = 7,
241284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
241384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_Invalid = 100,
241484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis  CXCallingConv_Unexposed = 200
241584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis};
241684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
241784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
241884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
24198e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief The type of an element in the abstract syntax tree.
24208e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
24218e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
24228e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenektypedef struct {
24238e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  enum CXTypeKind kind;
24248e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek  void *data[2];
24258e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek} CXType;
24268e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
24278e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
24288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the type of a CXCursor (if any).
24298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
24308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCursorType(CXCursor C);
24318e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
24328e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
243384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the underlying type of a typedef declaration.
243484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
243584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference a typedef declaration, an invalid type is
243684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned.
243784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
243884b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C);
243984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
244084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
244184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer type of an enum declaration.
244284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
244384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum declaration, an invalid type is
244484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned.
244584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
244684b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C);
244784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
244884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
244984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as a signed
245084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *  long long.
245184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
245284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned.
245384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor
245484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function.
245584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
245684b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C);
245784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
245884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
245984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as an unsigned
246084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *  long long.
246184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
246284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned.
246384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor
246484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function.
246584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
246684b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C);
246784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
246884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
24698e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \determine Determine whether two CXTypes represent the same type.
24708e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
24718e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \returns non-zero if the CXTypes represent the same type and
24728e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek            zero otherwise.
24738e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
24748e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B);
24758e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
24768e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
24778e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the canonical type for a CXType.
24788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
24798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * Clang's type system explicitly models typedefs and all the ways
24808e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * a specific type can be represented.  The canonical type is the underlying
24818e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * type with all the "sugar" removed.  For example, if 'T' is a typedef
24828e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * for 'int', the canonical type for 'T' would be 'int'.
24838e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
24848e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCanonicalType(CXType T);
24858e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
24868e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
2487e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  \determine Determine whether a CXType has the "const" qualifier set,
2488e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  without looking through typedefs that may have added "const" at a different level.
2489e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2490e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T);
2491e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2492e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
2493e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  \determine Determine whether a CXType has the "volatile" qualifier set,
2494e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  without looking through typedefs that may have added "volatile" at a different level.
2495e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2496e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T);
2497e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2498e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
2499e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  \determine Determine whether a CXType has the "restrict" qualifier set,
2500e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor *  without looking through typedefs that may have added "restrict" at a different level.
2501e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */
2502e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T);
2503e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor
2504e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/**
25058e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief For pointer types, returns the type of the pointee.
25068e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek *
25078e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
25088e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getPointeeType(CXType T);
25098e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
25108e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
25118e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the cursor for the declaration of the given type.
25128e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
25138e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T);
25148e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
25155389f48b24937ad7b4093307128b3cbf25235654David Chisnall/**
25165389f48b24937ad7b4093307128b3cbf25235654David Chisnall * Returns the Objective-C type encoding for the specified declaration.
25175389f48b24937ad7b4093307128b3cbf25235654David Chisnall */
25185389f48b24937ad7b4093307128b3cbf25235654David ChisnallCINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C);
25198e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
25208e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
25218e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the spelling of a given CXTypeKind.
25228e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
25238e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K);
25248e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
25258e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
252684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the calling convention associated with a function type.
252784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
252884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, CXCallingConv_Invalid is returned.
252984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
253084b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T);
253184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
253284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
25339a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek * \brief Retrieve the result type associated with a function type.
253484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
253584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, an invalid type is returned.
253604c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek */
253704c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted KremenekCINDEX_LINKAGE CXType clang_getResultType(CXType T);
253804c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek
253904c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek/**
254084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the number of non-variadic arguments associated with a function type.
254184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
254284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, UINT_MAX is returned.
254384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
254484b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_getNumArgTypes(CXType T);
254584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
254684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
254784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the type of an argument of a function type.
254884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
254984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in or the function does not have enough parameters,
255084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * an invalid type is returned.
255184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
255284b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i);
255384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
255484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
255584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return 1 if the CXType is a variadic function type, and 0 otherwise.
255684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
255784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
255884b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T);
255984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
256084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
256184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the result type associated with a given cursor.
256284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
256384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * This only returns a valid type if the cursor refers to a function or method.
25649a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek */
25659a140845438c2fc31e7d48a6dedbc695f4c83c68Ted KremenekCINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C);
25669a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek
25679a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek/**
25683ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek * \brief Return 1 if the CXType is a POD (plain old data) type, and 0
25693ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek *  otherwise.
25703ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek */
25713ce9e7d270e7df86c09c8126b4412d55be7c123bTed KremenekCINDEX_LINKAGE unsigned clang_isPODType(CXType T);
25723ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek
25733ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek/**
257484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the element type of an array, complex, or vector type.
257584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
257684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array, complex, or vector type,
257784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * an invalid type is returned.
257884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
257984b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getElementType(CXType T);
258084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
258184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
258284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the number of elements of an array or vector type.
258384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis *
258484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array or vector type,
258584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * -1 is returned.
258684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */
258784b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getNumElements(CXType T);
258884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis
258984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/**
25905f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * \brief Return the element type of an array type.
25915f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis *
25925f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, an invalid type is returned.
25935f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */
25945f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArrayElementType(CXType T);
25955f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis
25965f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/**
25975f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * \brief Return the the array size of a constant array.
25985f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis *
25995f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, -1 is returned.
26005f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */
26015f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE long long clang_getArraySize(CXType T);
26025f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis
26035f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/**
26043064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns 1 if the base class specified by the cursor with kind
26053064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek *   CX_CXXBaseSpecifier is virtual.
26063064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
26073064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor);
26083064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
26093064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
26103064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Represents the C++ access control level to a base class for a
26113064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * cursor with kind CX_CXXBaseSpecifier.
26123064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
26133064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenekenum CX_CXXAccessSpecifier {
26143064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXInvalidAccessSpecifier,
26153064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXPublic,
26163064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXProtected,
26173064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek  CX_CXXPrivate
26183064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek};
26193064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
26203064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
26213064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns the access control level for the C++ base specifier
26222dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis * represented by a cursor with kind CXCursor_CXXBaseSpecifier or
26232dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis * CXCursor_AccessSpecifier.
26243064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */
26253064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);
26263064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek
26273064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/**
26281f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Determine the number of overloaded declarations referenced by a
26291f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c CXCursor_OverloadedDeclRef cursor.
26301f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
26311f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried.
26321f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
26331f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns The number of overloaded declarations referenced by \c cursor. If it
26341f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
26351f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */
26361f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor);
26371f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
26381f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/**
26391f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Retrieve a cursor for one of the overloaded declarations referenced
26401f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * by a \c CXCursor_OverloadedDeclRef cursor.
26411f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
26421f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried.
26431f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
26441f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param index The zero-based index into the set of overloaded declarations in
26451f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * the cursor.
26461f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor *
26471f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns A cursor representing the declaration referenced by the given
26481f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c cursor at the specified \c index. If the cursor does not have an
26491f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * associated set of overloaded declarations, or if the index is out of bounds,
26501f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * returns \c clang_getNullCursor();
26511f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */
26521f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor,
26531f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor                                                unsigned index);
26541f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor
26551f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/**
26568e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @}
26578e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */
265895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
265995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
2660ad72f4dad4cf0fd2b71eb8f4704d2fe7ac58fb44Ted Kremenek * \defgroup CINDEX_ATTRIBUTES Information for attributes
266195f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *
266295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @{
266395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
266495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
266595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
266695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
266795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * \brief For cursors representing an iboutletcollection attribute,
266895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *  this function returns the collection element type.
266995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek *
267095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
267195f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted KremenekCINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor);
267295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek
267395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/**
267495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @}
267595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */
26768e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek
26778e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/**
2678c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors
2679c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2680c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines provide the ability to traverse the abstract syntax tree
2681c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * using cursors.
2682c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2683c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
2684c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
26851efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2686c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2687c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes how the traversal of the children of a particular
2688c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor should proceed after visiting a particular child cursor.
2689c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2690c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A value of this enumeration type should be returned by each
2691c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
2692c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2693c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXChildVisitResult {
2694c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
26951efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief Terminates the cursor traversal.
2696c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
2697c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Break,
26981efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
2699c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Continues the cursor traversal with the next sibling of
2700c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * the cursor just visited, without visiting its children.
2701c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
2702c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Continue,
2703c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  /**
2704c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * \brief Recursively traverse the children of this cursor, using
2705c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   * the same visitor and client data.
2706c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor   */
2707c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor  CXChildVisit_Recurse
2708c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor};
2709c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2710c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2711c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visitor invoked for each cursor found by a traversal.
2712c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2713c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This visitor function will be invoked for each cursor found by
2714c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren(). Its first argument is the cursor being
2715c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited, its second argument is the parent visitor for that cursor,
2716c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and its third argument is the client data provided to
2717c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren().
2718c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2719c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The visitor should return one of the \c CXChildVisitResult values
2720c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to direct clang_visitCursorChildren().
2721c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
27221efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbartypedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor,
27231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar                                                   CXCursor parent,
2724c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                                   CXClientData client_data);
2725c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2726c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2727c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visit the children of a particular cursor.
2728c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2729c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This function visits all the direct children of the given cursor,
2730c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * invoking the given \p visitor function with the cursors of each
2731c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited child. The traversal may be recursive, if the visitor returns
2732c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
2733c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the visitor returns \c CXChildVisit_Break.
2734c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2735c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param parent the cursor whose child may be visited. All kinds of
2736a57259e9d7b30bcce93f0a62eee0488738026172Daniel Dunbar * cursors can be visited, including invalid cursors (which, by
2737c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * definition, have no children).
2738c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2739c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param visitor the visitor function that will be invoked for each
2740c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * child of \p parent.
2741c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2742c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param client_data pointer data supplied by the client, which will
2743c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be passed to the visitor each time it is invoked.
2744c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2745c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \returns a non-zero value if the traversal was terminated
2746c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * prematurely by the visitor returning \c CXChildVisit_Break.
2747c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
27481efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,
2749c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                            CXCursorVisitor visitor,
2750c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor                                            CXClientData client_data);
27513387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#ifdef __has_feature
27523387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#  if __has_feature(blocks)
27533387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/**
27543387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * \brief Visitor invoked for each cursor found by a traversal.
27553387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall *
27563387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * This visitor block will be invoked for each cursor found by
27573387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * clang_visitChildrenWithBlock(). Its first argument is the cursor being
27583387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * visited, its second argument is the parent visitor for that cursor.
27593387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall *
27603387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * The visitor should return one of the \c CXChildVisitResult values
27613387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * to direct clang_visitChildrenWithBlock().
27623387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */
27633387c65a094a02b2a94c05111d035a97d3d5c794David Chisnalltypedef enum CXChildVisitResult
27643387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall     (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent);
27653387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall
27663387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/**
27673387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * Visits the children of a cursor using the specified block.  Behaves
27683387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * identically to clang_visitChildren() in all other respects.
27693387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */
27703387c65a094a02b2a94c05111d035a97d3d5c794David Chisnallunsigned clang_visitChildrenWithBlock(CXCursor parent,
27713387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall                                      CXCursorVisitorBlock block);
27723387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#  endif
27733387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#endif
27741efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2775c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2776c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2777c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
27781efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2779c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2780c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST
2781c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
27821efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * These routines provide the ability to determine references within and
2783c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * across translation units, by providing the names of the entities referenced
2784c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by cursors, follow reference cursors to the declarations they reference,
2785c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and associate declarations with their definitions.
2786c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2787c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
2788c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
27891efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2790c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2791c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a Unified Symbol Resolution (USR) for the entity referenced
2792c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by the given cursor.
2793c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
2794c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A Unified Symbol Resolution (USR) is a string that identifies a particular
2795c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * entity (function, class, variable, etc.) within a program. USRs can be
2796c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * compared across translation units to determine, e.g., when references in
2797c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * one translation refer to an entity defined in another translation unit.
2798c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2799c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor);
2800c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2801c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
2802896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C class.
2803896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2804896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);
2805896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2806896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2807896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C category.
2808896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2809896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString
281066ccaec73706f3623d2e7d191fe2c944feedcc2bTed Kremenek  clang_constructUSR_ObjCCategory(const char *class_name,
2811896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                 const char *category_name);
2812896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2813896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2814896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C protocol.
2815896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2816896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString
2817896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek  clang_constructUSR_ObjCProtocol(const char *protocol_name);
2818896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2819896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2820896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2821896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C instance variable and
2822896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *   the USR for its containing class.
2823896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2824896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name,
2825896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                    CXString classUSR);
2826896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2827896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2828896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C method and
2829896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *   the USR for its containing class.
2830896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2831896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name,
2832896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                      unsigned isInstanceMethod,
2833896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                      CXString classUSR);
2834896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2835896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2836896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C property and the USR
2837896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek *  for its containing class.
2838896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */
2839896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property,
2840896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek                                                        CXString classUSR);
2841896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
2842896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/**
2843c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a name for the entity referenced by this cursor.
2844c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
2845c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);
2846c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor
2847358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor/**
2848358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * \brief Retrieve the display name for the entity referenced by this cursor.
2849358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor *
2850358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * The display name contains extra information that helps identify the cursor,
2851358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * such as the parameters of a function or template or the arguments of a
2852358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * class template specialization.
2853358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor */
2854358559d8d7b458c5f64941842383a16e61f0828dDouglas GregorCINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor);
2855358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor
2856c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor/** \brief For a cursor that is a reference, retrieve a cursor representing the
2857c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * entity that it references.
2858c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor *
2859c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Reference cursors refer to other entities in the AST. For example, an
2860c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Objective-C superclass reference cursor refers to an Objective-C class.
28611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * This function produces the cursor for the Objective-C class from the
2862c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * cursor for the superclass reference. If the input cursor is a declaration or
2863c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * definition, it returns that declaration or definition unchanged.
28641efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Otherwise, returns the NULL cursor.
2865c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor */
2866c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor);
2867b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
28681efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
2869b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \brief For a cursor that is either a reference to or a declaration
2870b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  of some entity, retrieve a cursor that describes the definition of
2871b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  that entity.
2872b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
2873b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  Some entities can be declared multiple times within a translation
2874b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  unit, but only one of those declarations can also be a
2875b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  definition. For example, given:
2876b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
2877b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \code
2878b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int, int);
2879b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int g(int x, int y) { return f(x, y); }
2880b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int a, int b) { return a + b; }
2881b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  int f(int, int);
2882b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  \endcode
2883b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
2884b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  there are three declarations of the function "f", but only the
2885b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  second one is a definition. The clang_getCursorDefinition()
2886b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  function will take any cursor pointing to a declaration of "f"
2887b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  (the first or fourth lines of the example) or a cursor referenced
2888b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  that uses "f" (the call to "f' inside "g") and will return a
2889b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  declaration cursor pointing to the definition (the second "f"
2890b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  declaration).
2891b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *
2892b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  If given a cursor for which there is no corresponding definition,
2893b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  e.g., because there is no definition of that entity within this
2894b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor *  translation unit, returns a NULL cursor.
2895b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */
2896b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor);
2897b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
28981efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/**
2899b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Determine whether the declaration pointed to by this cursor
2900b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * is also a definition of that entity.
2901b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */
2902b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);
2903b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor
2904c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
29051a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \brief Retrieve the canonical cursor corresponding to the given cursor.
29061a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
29071a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * In the C family of languages, many kinds of entities can be declared several
29081a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * times within a single translation unit. For example, a structure type can
29091a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * be forward-declared (possibly multiple times) and later defined:
29101a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
29111a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \code
29121a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X;
29131a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X;
29141a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X {
29151a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *   int member;
29161a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * };
29171a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \endcode
29181a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
29191a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * The declarations and the definition of \c X are represented by three
29201a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * different cursors, all of which are declarations of the same underlying
29211a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * entity. One of these cursor is considered the "canonical" cursor, which
29221a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * is effectively the representative for the underlying entity. One can
29231a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * determine if two cursors are declarations of the same underlying entity by
29241a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * comparing their canonical cursors.
29251a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor *
29261a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \returns The canonical cursor for the entity referred to by the given cursor.
29271a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor */
29281a9d0503b67a499797141af0fd6d315d5045f0eaDouglas GregorCINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor);
29291a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor
29301a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor/**
2931c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
2932c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
29331efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
2934c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
29359ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * \defgroup CINDEX_CPP C++ AST introspection
29369ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek *
29379ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * The routines in this group provide access information in the ASTs specific
29389ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * to C++ language features.
29399ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek *
29409ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @{
29419ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
29429ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
29439ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
294449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Determine if a C++ member function or member function template is
294549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared 'static'.
29469ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
29479ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed KremenekCINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);
29489ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
29499ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
2950211924b563aa31421836cee7655be729ad02733fDouglas Gregor * \brief Determine if a C++ member function or member function template is
2951211924b563aa31421836cee7655be729ad02733fDouglas Gregor * explicitly declared 'virtual' or if it overrides a virtual method from
2952211924b563aa31421836cee7655be729ad02733fDouglas Gregor * one of the base classes.
2953211924b563aa31421836cee7655be729ad02733fDouglas Gregor */
2954211924b563aa31421836cee7655be729ad02733fDouglas GregorCINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C);
2955211924b563aa31421836cee7655be729ad02733fDouglas Gregor
2956211924b563aa31421836cee7655be729ad02733fDouglas Gregor/**
295749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Given a cursor that represents a template, determine
295849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the cursor kind of the specializations would be generated by instantiating
295949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the template.
296049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
296149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * This routine can be used to determine what flavor of function template,
296249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * class template, or class template partial specialization is stored in the
296349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * cursor. For example, it can describe whether a class template cursor is
296449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared with "struct", "class" or "union".
296549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
296649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \param C The cursor to query. This cursor should represent a template
296749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declaration.
296849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor *
296949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \returns The cursor kind of the specializations that would be generated
297049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * by instantiating the template \p C. If \p C is not a template, returns
297149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \c CXCursor_NoDeclFound.
297249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor */
297349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);
297449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor
297549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor/**
2976e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \brief Given a cursor that may represent a specialization or instantiation
2977e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template, retrieve the cursor that represents the template that it
2978e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializes or from which it was instantiated.
2979e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
2980e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * This routine determines the template involved both for explicit
2981e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializations of templates and for implicit instantiations of the template,
2982e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * both of which are referred to as "specializations". For a class template
2983e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specialization (e.g., \c std::vector<bool>), this routine will return
2984e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * either the primary template (\c std::vector) or, if the specialization was
2985e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * instantiated from a class template partial specialization, the class template
2986e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * partial specialization. For a class template partial specialization and a
2987e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * function template specialization (including instantiations), this
2988e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * this routine will return the specialized template.
2989e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
2990e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * For members of a class template (e.g., member functions, member classes, or
2991e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * static data members), returns the specialized or instantiated member.
2992e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * Although not strictly "templates" in the C++ language, members of class
2993e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates have the same notions of specializations and instantiations that
2994e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates do, so this routine treats them similarly.
2995e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
2996e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \param C A cursor that may be a specialization of a template or a member
2997e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template.
2998e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor *
2999e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \returns If the given cursor is a specialization or instantiation of a
3000e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * template or a member thereof, the template or member that it specializes or
3001e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * from which it was instantiated. Otherwise, returns a NULL cursor.
3002e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor */
3003e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas GregorCINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
3004430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
3005430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor/**
3006430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Given a cursor that references something else, return the source range
3007430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * covering that reference.
3008430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor *
3009430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param C A cursor pointing to a member reference, a declaration reference, or
3010430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * an operator call.
3011430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param NameFlags A bitset with three independent flags:
3012430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
3013430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece.
3014430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param PieceIndex For contiguous names or when passing the flag
3015430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece, only one piece with index 0 is
3016430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * available. When the CXNameRange_WantSinglePiece flag is not passed for a
3017430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * non-contiguous names, this index can be used to retreive the individual
3018430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * pieces of the name. See also CXNameRange_WantSinglePiece.
3019430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor *
3020430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \returns The piece of the name pointed to by the given cursor. If there is no
3021430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
3022430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */
302348a8d14fc6f064a5297024c2b34733a4080b2efeFrancois PichetCINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C,
302448a8d14fc6f064a5297024c2b34733a4080b2efeFrancois Pichet                                                unsigned NameFlags,
3025430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor                                                unsigned PieceIndex);
3026430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
3027430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregorenum CXNameRefFlags {
3028430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
3029430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \brief Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
3030430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * range.
3031430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
3032430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantQualifier = 0x1,
3033430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
3034430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
3035430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \brief Include the explicit template arguments, e.g. <int> in x.f<int>, in
3036430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * the range.
3037430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
3038430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantTemplateArgs = 0x2,
3039430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor
3040430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  /**
3041430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \brief If the name is non-contiguous, return the full spanning range.
3042430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   *
3043430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * Non-contiguous names occur in Objective-C when a selector with two or more
3044430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * parameters is used, or in C++ when using an operator:
3045430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \code
3046430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * [object doSomething:here withValue:there]; // ObjC
3047430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * return some_vector[1]; // C++
3048430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   * \endcode
3049430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor   */
3050430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor  CXNameRange_WantSinglePiece = 0x4
3051430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor};
3052e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor
3053e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor/**
30549ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @}
30559ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */
30569ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek
30579ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/**
30580045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * \defgroup CINDEX_LEX Token extraction and manipulation
30590045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
30600045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * The routines in this group provide access to the tokens within a
30610045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * translation unit, along with a semantic mapping of those tokens to
30620045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * their corresponding cursors.
3063fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3064fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @{
3065fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3066fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
3067fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3068fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a kind of token.
3069fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3070fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef enum CXTokenKind {
3071fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
3072fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A token that contains some kind of punctuation.
3073fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
3074fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Punctuation,
3075896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3076fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
30770045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor   * \brief A language keyword.
3078fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
3079fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Keyword,
3080896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3081fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
3082fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief An identifier (that is not a keyword).
3083fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
3084fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Identifier,
3085896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3086fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
3087fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A numeric, string, or character literal.
3088fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
3089fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Literal,
3090896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3091fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  /**
3092fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   * \brief A comment.
3093fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor   */
3094fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  CXToken_Comment
3095fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXTokenKind;
3096fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
3097fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3098fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a single preprocessing token.
3099fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3100fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef struct {
3101fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  unsigned int_data[4];
3102fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor  void *ptr_data;
3103fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXToken;
3104fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
3105fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3106fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the kind of the given token.
3107fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3108fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken);
3109896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3110fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3111fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the spelling of the given token.
3112fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3113fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * The spelling of a token is the textual representation of that token, e.g.,
3114fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * the text of an identifier or keyword.
3115fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3116fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken);
3117896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3118fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3119fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve the source location of the given token.
3120fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3121896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit,
3122fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                                       CXToken);
3123896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3124fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3125fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve a source range that covers the given token.
3126fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3127fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);
3128fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor
3129fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3130fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Tokenize the source code described by the given range into raw
3131fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * lexical tokens.
3132fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3133fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit whose text is being tokenized.
3134fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3135fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Range the source range in which text should be tokenized. All of the
3136fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * tokens produced by tokenization will fall within this source range,
3137fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3138fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens this pointer will be set to point to the array of tokens
3139fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that occur within the given source range. The returned pointer must be
3140fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * freed with clang_disposeTokens() before the translation unit is destroyed.
3141fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3142fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens will be set to the number of tokens in the \c *Tokens
3143fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * array.
3144fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3145fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3146fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
3147fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                   CXToken **Tokens, unsigned *NumTokens);
3148896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3149fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3150fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Annotate the given set of tokens by providing cursors for each token
3151fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that can be mapped to a specific entity within the abstract syntax tree.
3152fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
31530045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * This token-annotation routine is equivalent to invoking
31540045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() for the source locations of each of the
31550045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * tokens. The cursors provided are filtered, so that only those
31560045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * cursors that have a direct correspondence to the token are
31570045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * accepted. For example, given a function call \c f(x),
31580045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() would provide the following cursors:
31590045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
31600045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
31610045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
31620045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *   * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
31630045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor *
31640045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * Only the first and last of these cursors will occur within the
31650045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * annotate, since the tokens "f" and "x' directly refer to a function
31660045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * and a variable, respectively, but the parentheses are just a small
31670045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * part of the full syntax of the function call expression, which is
31680045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * not provided as an annotation.
3169fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3170fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit that owns the given tokens.
3171fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3172fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens the set of tokens to annotate.
3173fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3174fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens the number of tokens in \p Tokens.
3175fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor *
3176fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Cursors an array of \p NumTokens cursors, whose contents will be
3177fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * replaced with the cursors corresponding to each token.
3178fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3179fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU,
3180fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                         CXToken *Tokens, unsigned NumTokens,
3181fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                         CXCursor *Cursors);
3182896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3183fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3184fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Free the given set of tokens.
3185fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3186896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
3187fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor                                        CXToken *Tokens, unsigned NumTokens);
3188896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3189fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3190fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @}
3191fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */
3192896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek
3193fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/**
3194c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_DEBUG Debugging facilities
3195c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3196c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines are used for testing and debugging, only, and should not
3197c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be relied upon.
3198c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3199c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
3200c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
32011efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
32024ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff/* for debug/testing */
3203e68fff6fc083c6270d835216a3de0b82c6ef0310Ted KremenekCINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind);
32041efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor,
32051efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar                                          const char **startBuf,
32064ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          const char **endBuf,
32074ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *startLine,
32084ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *startColumn,
32094ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *endLine,
32104ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *endColumn);
32110a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE void clang_enableStackTraces(void);
3212995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel DunbarCINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data,
3213995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar                                          unsigned stack_size);
3214995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar
32150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
3216c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
3217c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
32181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3219c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
3220c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CODE_COMPLET Code completion
3221c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3222c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Code completion involves taking an (incomplete) source file, along with
3223c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * knowledge of where the user is actively editing that file, and suggesting
3224c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * syntactically- and semantically-valid constructs that the user might want to
3225c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * use at that particular point in the source code. These data structures and
3226c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines provide support for code completion.
3227c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor *
3228c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{
3229c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
32301efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
3231c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
32320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A semantic string that describes a code-completion result.
32330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A semantic string that describes the formatting of a code-completion
32350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * result as a single "template" of text that should be inserted into the
32360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * source buffer when a particular code-completion result is selected.
32370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * Each semantic string is made up of some number of "chunks", each of which
32380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * contains some text along with a description of what that text means, e.g.,
32390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the name of the entity being referenced, whether the text chunk is part of
32400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the template, or whether it is a "placeholder" that the user should replace
32410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * with actual code,of a specific kind. See \c CXCompletionChunkKind for a
32421efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * description of the different kinds of chunks.
32430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
32440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef void *CXCompletionString;
32451efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
32460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
32470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A single result of code completion.
32480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
32490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef struct {
32500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
32511efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief The kind of entity that this completion refers to.
32520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
32531efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * The cursor kind will be a macro, keyword, or a declaration (one of the
32540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * *Decl cursor kinds), describing the entity that the completion is
32550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * referring to.
32560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
32570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \todo In the future, we would like to provide a full cursor, to allow
32580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the client to extract additional information from declaration.
32590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
32600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  enum CXCursorKind CursorKind;
32611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
32621efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar  /**
32630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief The code-completion string that describes how to insert this
32640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * code-completion result into the editing buffer.
32650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
32660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionString CompletionString;
32670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor} CXCompletionResult;
32680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
32690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
32700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Describes a single piece of text within a code-completion string.
32710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
32721efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Each "chunk" within a code-completion string (\c CXCompletionString) is
32731efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * either a piece of text with a specific "kind" that describes how that text
32740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * should be interpreted by the client or is another completion string.
32750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
32760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorenum CXCompletionChunkKind {
32770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
32780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A code-completion string that describes "optional" text that
32790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * could be a part of the template (but is not required).
32800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
32810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * The Optional chunk is the only kind of chunk that has a code-completion
32821efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * string for its representation, which is accessible via
32830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \c clang_getCompletionChunkCompletionString(). The code-completion string
32840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * describes an additional part of the template that is completely optional.
32850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * For example, optional chunks can be used to describe the placeholders for
32860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * arguments that match up with defaulted function parameters, e.g. given:
32870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
32880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \code
32890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * void f(int x, float y = 3.14, double z = 2.71828);
32900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \endcode
32910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
32920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * The code-completion string for this function would contain:
32930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a TypedText chunk for "f".
32940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a LeftParen chunk for "(".
32950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a Placeholder chunk for "int x"
32960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - an Optional chunk containing the remaining defaulted arguments, e.g.,
32970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *       - a Comma chunk for ","
329871570182471d502a97f7f175aa527152544c75f2Daniel Dunbar   *       - a Placeholder chunk for "float y"
32990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *       - an Optional chunk containing the last defaulted argument:
33000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *           - a Comma chunk for ","
33010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *           - a Placeholder chunk for "double z"
33020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - a RightParen chunk for ")"
33030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
330471570182471d502a97f7f175aa527152544c75f2Daniel Dunbar   * There are many ways to handle Optional chunks. Two simple approaches are:
33050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - Completely ignore optional chunks, in which case the template for the
33060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *     function "f" would only include the first parameter ("int x").
33070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *   - Fully expand all optional chunks, in which case the template for the
33080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *     function "f" would have all of the parameters.
33090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Optional,
33110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that a user would be expected to type to get this
33131efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * code-completion result.
33140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
33151efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * There will be exactly one "typed text" chunk in a semantic string, which
33161efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * will typically provide the spelling of a keyword or the name of a
33170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * declaration that could be used at the current code point. Clients are
33180c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * expected to filter the code-completion results based on the text in this
33190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * chunk.
33200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_TypedText,
33220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that should be inserted as part of a code-completion result.
33240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
33250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "text" chunk represents text that is part of the template to be
33260c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * inserted into user code should this particular code-completion result
33270c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * be selected.
33280c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Text,
33300c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Placeholder text that should be replaced by the user.
33320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
33330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "placeholder" chunk marks a place where the user should insert text
33340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * into the code-completion template. For example, placeholders might mark
33350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the function parameters for a function declaration, to indicate that the
33360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * user should provide arguments for each of those parameters. The actual
33370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * text in a placeholder is a suggestion for the text to display before
33380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * the user replaces the placeholder with real code.
33390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Placeholder,
33410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Informative text that should be displayed but never inserted as
33430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * part of the template.
33441efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   *
33450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * An "informative" chunk contains annotations that can be displayed to
33460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * help the user decide whether a particular code-completion result is the
33470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * right option, but which is not part of the actual template to be inserted
33480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * by code completion.
33490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_Informative,
33510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief Text that describes the current parameter when code-completion is
33530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * referring to function call, message send, or template specialization.
33540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
33550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * A "current parameter" chunk occurs when code-completion is providing
33560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * information about a parameter corresponding to the argument at the
33570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * code-completion point. For example, given a function
33580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
33590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \code
33600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * int add(int x, int y);
33610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \endcode
33620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   *
33630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * and the source code \c add(, where the code-completion point is after the
33640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * "(", the code-completion string will contain a "current parameter" chunk
33650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * for "int x", indicating that the current argument will initialize that
33660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * parameter. After typing further, to \c add(17, (where the code-completion
33671efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * point is after the ","), the code-completion string will contain a
33680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * "current paremeter" chunk to "int y".
33690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_CurrentParameter,
33710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left parenthesis ('('), used to initiate a function call or
33730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * signal the beginning of a function parameter list.
33740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftParen,
33760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right parenthesis (')'), used to finish a function call or
33780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * signal the end of a function parameter list.
33790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightParen,
33810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left bracket ('[').
33830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftBracket,
33850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right bracket (']').
33870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightBracket,
33890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left brace ('{').
33910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftBrace,
33930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right brace ('}').
33950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
33960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightBrace,
33970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
33980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A left angle bracket ('<').
33990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
34000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_LeftAngle,
34010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
34020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A right angle bracket ('>').
34030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
34040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  CXCompletionChunk_RightAngle,
34050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor  /**
34060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   * \brief A comma separator (',').
34070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor   */
3408ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor  CXCompletionChunk_Comma,
3409ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor  /**
34101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * \brief Text that specifies the result type of a given result.
3411ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   *
3412ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   * This special kind of informative chunk is not meant to be inserted into
34131efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar   * the text buffer. Rather, it is meant to illustrate the type that an
3414ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   * expression using the given completion string would have.
3415ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor   */
341601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_ResultType,
341701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
341801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief A colon (':').
341901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
342001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_Colon,
342101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
342201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief A semicolon (';').
342301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
342401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_SemiColon,
342501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
342601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * \brief An '=' sign.
342701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
342801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_Equal,
342901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
343001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * Horizontal space (' ').
343101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
343201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_HorizontalSpace,
343301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  /**
343401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * Vertical space ('\n'), after which it is generally a good idea to
343501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   * perform indentation.
343601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor   */
343701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor  CXCompletionChunk_VerticalSpace
34380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor};
34391efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
34400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
34410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Determine the kind of a particular chunk within a completion string.
34420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
34430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
34440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
34450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
34460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
34470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the kind of the chunk at the index \c chunk_number.
34480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
34491efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE enum CXCompletionChunkKind
34500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkKind(CXCompletionString completion_string,
34510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                             unsigned chunk_number);
34521efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
34530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
34541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the text associated with a particular chunk within a
34550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * completion string.
34560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
34570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
34580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
34590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
34600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
34610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the text associated with the chunk at index \c chunk_number.
34620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
34632ef6f8f5a35a60870594c5b04e0aa2bf22c6886fTed KremenekCINDEX_LINKAGE CXString
34640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkText(CXCompletionString completion_string,
34650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                             unsigned chunk_number);
34660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
34670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
34681efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the completion string associated with a particular chunk
34690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * within a completion string.
34700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
34710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query.
34720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
34730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string.
34740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor *
34750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the completion string associated with the chunk at index
34766164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c chunk_number.
34770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
34780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE CXCompletionString
34790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkCompletionString(CXCompletionString completion_string,
34800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor                                         unsigned chunk_number);
34811efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
34820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
34830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Retrieve the number of chunks in the given code-completion string.
34840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
34850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE unsigned
34860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getNumCompletionChunks(CXCompletionString completion_string);
34870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor
34880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/**
348912e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \brief Determine the priority of this code completion.
349012e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
349112e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * The priority of a code completion indicates how likely it is that this
349212e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * particular completion is the completion that the user will select. The
349312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * priority is selected by various internal heuristics.
349412e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
349512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \param completion_string The completion string to query.
349612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor *
349712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \returns The priority of this completion string. Smaller values indicate
349812e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * higher-priority (more likely) completions.
349912e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor */
350012e131385e892e3723483a1081a89bcad29c8a84Douglas GregorCINDEX_LINKAGE unsigned
350112e131385e892e3723483a1081a89bcad29c8a84Douglas Gregorclang_getCompletionPriority(CXCompletionString completion_string);
350212e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor
350312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor/**
350458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \brief Determine the availability of the entity that this code-completion
350558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * string refers to.
350658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
350758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param completion_string The completion string to query.
350858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor *
350958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the completion string.
351058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */
351158ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind
351258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCompletionAvailability(CXCompletionString completion_string);
351358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
351458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/**
35156164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the number of annotations associated with the given
35166164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string.
35176164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
35186164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query.
35196164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
35206164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns the number of annotations associated with the given completion
35216164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * string.
35226164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */
35236164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE unsigned
35246164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionNumAnnotations(CXCompletionString completion_string);
35256164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen
35266164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/**
35276164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the annotation associated with the given completion string.
35286164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
35296164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query.
35306164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
35316164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param annotation_number the 0-based index of the annotation of the
35326164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string.
35336164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen *
35346164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns annotation string associated with the completion at index
35356164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c annotation_number, or a NULL string if that annotation is not available.
35366164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */
35376164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE CXString
35386164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionAnnotation(CXCompletionString completion_string,
35396164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen                              unsigned annotation_number);
35406164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen
35416164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/**
35428fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \brief Retrieve a completion string for an arbitrary declaration or macro
35438fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursor.
35448fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor *
35458fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \param cursor The cursor to query.
35468fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor *
35478fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \returns A non-context-sensitive completion string for declaration and macro
35488fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursors, or NULL for other kinds of cursors.
35498fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor */
35508fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas GregorCINDEX_LINKAGE CXCompletionString
35518fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregorclang_getCursorCompletionString(CXCursor cursor);
35528fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor
35538fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor/**
3554ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Contains the results of code-completion.
3555ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor *
3556ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * This data structure contains the results of code completion, as
3557e0cc52ef8afc8d1cba9c534191b5f0ddaff1d694Douglas Gregor * produced by \c clang_codeCompleteAt(). Its contents must be freed by
3558ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \c clang_disposeCodeCompleteResults.
3559ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */
3560ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregortypedef struct {
3561ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  /**
3562ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \brief The code-completion results.
3563ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   */
3564ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  CXCompletionResult *Results;
3565ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor
3566ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  /**
3567ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \brief The number of code-completion results stored in the
3568ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   * \c Results array.
3569ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor   */
3570ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor  unsigned NumResults;
3571ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor} CXCodeCompleteResults;
3572ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor
3573ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor/**
3574cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Flags that can be passed to \c clang_codeCompleteAt() to
3575cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * modify its behavior.
3576cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor *
3577cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * The enumerators in this enumeration can be bitwise-OR'd together to
3578cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * provide multiple options to \c clang_codeCompleteAt().
3579cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */
3580cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregorenum CXCodeComplete_Flags {
3581cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  /**
3582cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * \brief Whether to include macros within the set of code
3583cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * completions returned.
3584cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   */
3585cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  CXCodeComplete_IncludeMacros = 0x01,
3586cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
3587cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  /**
3588cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * \brief Whether to include code patterns for language constructs
3589cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   * within the set of code completions, e.g., for loops.
3590cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor   */
3591cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor  CXCodeComplete_IncludeCodePatterns = 0x02
3592cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor};
3593cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
3594cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/**
35953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Bits that represent the context under which completion is occurring.
35963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
35973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * The enumerators in this enumeration may be bitwise-OR'd together if multiple
35983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * contexts are occurring simultaneously.
35993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */
36003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorenum CXCompletionContext {
36013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief The context for completions is unexposed, as only Clang results
36033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included. (This is equivalent to having no context bits set.)
36043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36053da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Unexposed = 0,
36063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
36073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for any possible type should be included in the results.
36093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_AnyType = 1 << 0,
36113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
36123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for any possible value (variables, function calls, etc.)
36143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included in the results.
36153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_AnyValue = 1 << 1,
36173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36183da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to an Objective-C object should
36193da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * be included in the results.
36203da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36213da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCObjectValue = 1 << 2,
36223da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36233da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to an Objective-C selector
36243da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * should be included in the results.
36253da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36263da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCSelectorValue = 1 << 3,
36273da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36283da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for values that resolve to a C++ class type should be
36293da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * included in the results.
36303da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36313da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_CXXClassTypeValue = 1 << 4,
36323da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
36333da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36343da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for fields of the member being accessed using the dot
36353da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * operator should be included in the results.
36363da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36373da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_DotMemberAccess = 1 << 5,
36383da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36393da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for fields of the member being accessed using the arrow
36403da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * operator should be included in the results.
36413da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36423da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ArrowMemberAccess = 1 << 6,
36433da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36443da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for properties of the Objective-C object being accessed
36453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * using the dot operator should be included in the results.
36463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCPropertyAccess = 1 << 7,
36483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
36493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for enum tags should be included in the results.
36513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_EnumTag = 1 << 8,
36533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for union tags should be included in the results.
36553da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_UnionTag = 1 << 9,
36573da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36583da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for struct tags should be included in the results.
36593da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36603da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_StructTag = 1 << 10,
36613da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
36623da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36633da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ class names should be included in the results.
36643da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ClassTag = 1 << 11,
36663da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ namespaces and namespace aliases should be
36683da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * included in the results.
36693da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Namespace = 1 << 12,
36713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for C++ nested name specifiers should be included in
36733da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
36743da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36753da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_NestedNameSpecifier = 1 << 13,
36763da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
36773da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36783da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C interfaces (classes) should be included
36793da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * in the results.
36803da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36813da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCInterface = 1 << 14,
36823da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36833da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C protocols should be included in
36843da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
36853da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36863da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCProtocol = 1 << 15,
36873da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36883da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C categories should be included in
36893da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
36903da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36913da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCCategory = 1 << 16,
36923da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C instance messages should be included
36943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * in the results.
36953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
36963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCInstanceMessage = 1 << 17,
36973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
36983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C class messages should be included in
36993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
37003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
37013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCClassMessage = 1 << 18,
37023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
37033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for Objective-C selector names should be included in
37043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
37053da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
37063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_ObjCSelectorName = 1 << 19,
37073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
37083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
37093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Completions for preprocessor macro names should be included in
37103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * the results.
37113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
37123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_MacroName = 1 << 20,
37133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
37143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
37153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief Natural language completions should be included in the results.
37163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
37173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_NaturalLanguage = 1 << 21,
37183da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
37193da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  /**
37203da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   * \brief The current context is unknown, so set all contexts.
37213da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor   */
37223da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor  CXCompletionContext_Unknown = ((1 << 22) - 1)
37233da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor};
37243da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
37253da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/**
3726cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Returns a default set of code-completion options that can be
3727cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * passed to\c clang_codeCompleteAt().
3728cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */
3729cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas GregorCINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
3730cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor
3731cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/**
37321abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \brief Perform code completion at a given location in a translation unit.
37331abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
37341abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * This function performs code completion at a particular file, line, and
37351abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * column within source code, providing results that suggest potential
37361abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code snippets based on the context of the completion. The basic model
37371abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * for code completion is that Clang will parse a complete source file,
37381abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * performing syntax checking up to the location where code-completion has
37391abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * been requested. At that point, a special code-completion token is passed
37401abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * to the parser, which recognizes this token and determines, based on the
37411abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * current location in the C/Objective-C/C++ grammar and the state of
37421abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * semantic analysis, what completions to provide. These completions are
37431abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * returned via a new \c CXCodeCompleteResults structure.
37441abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
37451abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Code completion itself is meant to be triggered by the client when the
37461abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * user types punctuation characters or whitespace, at which point the
37471abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code-completion location will coincide with the cursor. For example, if \c p
37481abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is a pointer, code-completion might be triggered after the "-" and then
37491abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * after the ">" in \c p->. When the code-completion location is afer the ">",
37501abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the completion results will provide, e.g., the members of the struct that
37511abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * "p" points to. The client is responsible for placing the cursor at the
37521abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * beginning of the token currently being typed, then filtering the results
37531abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * based on the contents of the token. For example, when code-completing for
37541abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the expression \c p->get, the client should provide the location just after
37551abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the
37561abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client can filter the results based on the current token text ("get"), only
37571abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * showing those results that start with "get". The intent of this interface
37581abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is to separate the relatively high-latency acquisition of code-completion
37591abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * results from the filtering of results on a per-character basis, which must
37601abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * have a lower latency.
37611abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
37621abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param TU The translation unit in which code-completion should
37631abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * occur. The source files for this translation unit need not be
37641abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completely up-to-date (and the contents of those source files may
37651abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * be overridden via \p unsaved_files). Cursors referring into the
37661abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * translation unit may be invalidated by this invocation.
37671abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
37681abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_filename The name of the source file where code
37691abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion should be performed. This filename may be any file
37701abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * included in the translation unit.
37711abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
37721abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_line The line at which code-completion should occur.
37731abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
37741abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_column The column at which code-completion should occur.
37751abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Note that the column should point just after the syntactic construct that
37761abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * initiated code completion, and not in the middle of a lexical token.
37771abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
37781abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param unsaved_files the Tiles that have not yet been saved to disk
37791abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing or code completion, including the
37801abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * contents of those files.  The contents and name of these files (as
37811abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * specified by CXUnsavedFile) are copied when necessary, so the
37821abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client only needs to guarantee their validity until the call to
37831abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * this function returns.
37841abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
37851abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p
37861abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * unsaved_files.
37871abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor *
3788cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \param options Extra options that control the behavior of code
3789cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * completion, expressed as a bitwise OR of the enumerators of the
3790cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * CXCodeComplete_Flags enumeration. The
3791cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \c clang_defaultCodeCompleteOptions() function returns a default set
3792cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * of code-completion options.
3793cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor *
37941abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \returns If successful, a new \c CXCodeCompleteResults structure
37951abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * containing code-completion results, which should eventually be
37961abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * freed with \c clang_disposeCodeCompleteResults(). If code
37971abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion fails, returns NULL.
37981abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor */
37991abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCINDEX_LINKAGE
38001abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
38011abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            const char *complete_filename,
38021abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            unsigned complete_line,
38031abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            unsigned complete_column,
38041abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor                                            struct CXUnsavedFile *unsaved_files,
3805cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor                                            unsigned num_unsaved_files,
3806cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor                                            unsigned options);
38071abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor
38081abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor/**
38091e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \brief Sort the code-completion results in case-insensitive alphabetical
38101e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * order.
38111e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor *
38121e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param Results The set of results to sort.
38131e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param NumResults The number of results in \p Results.
38141e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor */
38151e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas GregorCINDEX_LINKAGE
38161e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregorvoid clang_sortCodeCompletionResults(CXCompletionResult *Results,
38171e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor                                     unsigned NumResults);
38181e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor
38191e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor/**
3820ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Free the given set of code-completion results.
38210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */
38221efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE
3823ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregorvoid clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
382458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor
382520d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor/**
3826a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced prior to the
3827a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * location where code completion was performed.
3828a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
3829896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE
3830a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregorunsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results);
3831a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
3832a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
3833a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given code completion.
3834a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor *
3835a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Result the code completion results to query.
3836a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve.
3837a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor *
3838a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed
3839a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic().
3840a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */
3841896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE
3842a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
3843a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor                                             unsigned Index);
3844a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor
3845a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/**
38463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Determines what compeltions are appropriate for the context
38473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the given code completion.
38483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
38493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \param Results the code completion results to query
38503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor *
38513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \returns the kinds of completions that are appropriate for use
38523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * along with the given code completion results.
38533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */
38543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas GregorCINDEX_LINKAGE
38553da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorunsigned long long clang_codeCompleteGetContexts(
38563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor                                                CXCodeCompleteResults *Results);
3857e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor
3858e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/**
3859e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the cursor kind for the container for the current code
3860e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * completion context. The container is only guaranteed to be set for
3861e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * contexts where a container exists (i.e. member accesses or Objective-C
3862e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * message sends); if there is not a container, this function will return
3863e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * CXCursor_InvalidCode.
3864e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
3865e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query
3866e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
3867e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param IsIncomplete on return, this value will be false if Clang has complete
3868e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information about the container. If Clang does not have complete
3869e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information, this value will be true.
3870e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
3871e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the container kind, or CXCursor_InvalidCode if there is not a
3872e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * container
3873e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */
3874e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE
3875e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregorenum CXCursorKind clang_codeCompleteGetContainerKind(
3876e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor                                                 CXCodeCompleteResults *Results,
3877e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor                                                     unsigned *IsIncomplete);
3878e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor
3879e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/**
3880e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the USR for the container for the current code completion
3881e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * context. If there is not a container for the current context, this
3882e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * function will return the empty string.
3883e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
3884e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query
3885e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor *
3886e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the USR for the container
3887e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */
3888e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE
3889e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results);
38903da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor
38910a47d69af8bda945352997af3da4687a3356096aDouglas Gregor
38920a47d69af8bda945352997af3da4687a3356096aDouglas Gregor/**
38930a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \brief Returns the currently-entered selector for an Objective-C message
38940a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * send, formatted like "initWithFoo:bar:". Only guaranteed to return a
38950a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * non-empty string for CXCompletionContext_ObjCInstanceMessage and
38960a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * CXCompletionContext_ObjCClassMessage.
38970a47d69af8bda945352997af3da4687a3356096aDouglas Gregor *
38980a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \param Results the code completion results to query
38990a47d69af8bda945352997af3da4687a3356096aDouglas Gregor *
39000a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \returns the selector (or partial selector) that has been entered thus far
39010a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * for an Objective-C message send.
39020a47d69af8bda945352997af3da4687a3356096aDouglas Gregor */
39030a47d69af8bda945352997af3da4687a3356096aDouglas GregorCINDEX_LINKAGE
39040a47d69af8bda945352997af3da4687a3356096aDouglas GregorCXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results);
39050a47d69af8bda945352997af3da4687a3356096aDouglas Gregor
39063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/**
390720d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * @}
390820d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor */
39091efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
39101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
391104bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek/**
391204bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * \defgroup CINDEX_MISC Miscellaneous utility functions
391304bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek *
391404bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @{
391504bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */
391623e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek
391723e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek/**
391823e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek * \brief Return a version string, suitable for showing to a user, but not
391923e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek *        intended to be parsed (the format is not guaranteed to be stable).
392023e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek */
3921a2a9d6e4e5b6001b86b7dfc5db1ea296ce29a3d3Ted KremenekCINDEX_LINKAGE CXString clang_getClangVersion();
392204bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek
3923d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek
3924d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek/**
3925d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * \brief Enable/disable crash recovery.
3926d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek *
3927d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * \param Flag to indicate if crash recovery is enabled.  A non-zero value
3928d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek *        enables crash recovery, while 0 disables it.
3929d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek */
3930d2427ddf00aacdc288c386f3882e0821ca9bd27bTed KremenekCINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled);
3931d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek
393216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek /**
3933896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek  * \brief Visitor invoked for each file in a translation unit
393416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  *        (used with clang_getInclusions()).
393516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  *
393616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * This visitor function will be invoked by clang_getInclusions() for each
393716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * file included (either at the top-level or by #include directives) within
393816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * a translation unit.  The first argument is the file being included, and
393916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * the second and third arguments provide the inclusion stack.  The
394016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * array is sorted in order of immediate inclusion.  For example,
394116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  * the first element refers to the location that included 'included_file'.
394216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek  */
394316b55a71695a33c094383295cc7b7a2080e098daTed Kremenektypedef void (*CXInclusionVisitor)(CXFile included_file,
394416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   CXSourceLocation* inclusion_stack,
394516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   unsigned include_len,
394616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                   CXClientData client_data);
394716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek
394816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/**
394916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * \brief Visit the set of preprocessor inclusions in a translation unit.
395016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   The visitor function is called with the provided data for every included
395116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   file.  This does not include headers included by the PCH file (unless one
395216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek *   is inspecting the inclusions in the PCH file itself).
395316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek */
395416b55a71695a33c094383295cc7b7a2080e098daTed KremenekCINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu,
395516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                        CXInclusionVisitor visitor,
395616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek                                        CXClientData client_data);
395716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek
395816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/**
395904bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @}
396004bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */
39611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
396297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** \defgroup CINDEX_REMAPPING Remapping functions
396397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
396497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @{
396597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
396697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
396797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
396897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief A remapping of original source files and their translated files.
396997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
397097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidistypedef void *CXRemapping;
397197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
397297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
397397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Retrieve a remapping.
397497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
397597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param path the path that contains metadata about remappings.
397697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
397797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \returns the requested remapping. This remapping must be freed
397897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
397997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
398097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path);
398197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
398297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
398397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Determine the number of remappings.
398497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
398597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
398697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
398797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
398897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Get the original and the associated filename from the remapping.
398997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
399097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param original If non-NULL, will be set to the original filename.
399197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis *
399297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param transformed If non-NULL, will be set to the filename that the original
399397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * is associated with.
399497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
399597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index,
399697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis                                     CXString *original, CXString *transformed);
399797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
399897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
399997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Dispose the remapping.
400097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
400197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_dispose(CXRemapping);
400297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
400397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/**
400497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @}
400597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */
400697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis
4007aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** \defgroup CINDEX_HIGH Higher level API functions
4008aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
4009aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @{
4010aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */
4011aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
4012aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidisenum CXVisitorResult {
4013aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  CXVisit_Break,
4014aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  CXVisit_Continue
4015aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis};
4016aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
4017aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef struct {
4018aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  void *context;
4019aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis  enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange);
4020aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis} CXCursorAndRangeVisitor;
4021aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
4022aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/**
4023aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \brief Find references of a declaration in a specific file.
4024aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
4025aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param cursor pointing to a declaration or a reference of one.
4026aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
4027aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param file to search for references.
4028aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis *
4029aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for
4030aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * each reference found.
4031aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * The CXSourceRange will point inside the file; if the reference is inside
4032aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * a macro (and not a macro argument) the CXSourceRange will be invalid.
4033aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */
4034aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios KyrtzidisCINDEX_LINKAGE void clang_findReferencesInFile(CXCursor cursor, CXFile file,
4035aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis                                               CXCursorAndRangeVisitor visitor);
4036aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
4037aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#ifdef __has_feature
4038aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#  if __has_feature(blocks)
4039aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
4040aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef enum CXVisitorResult
4041aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis    (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange);
4042aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
4043aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios KyrtzidisCINDEX_LINKAGE
4044aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidisvoid clang_findReferencesInFileWithBlock(CXCursor, CXFile,
4045aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis                                         CXCursorAndRangeVisitorBlock);
4046aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
4047aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#  endif
4048aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#endif
4049aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
4050bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
4051bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a CXFile.
4052bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
4053dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientFile;
4054bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis
4055bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
40562957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic entity.
40572957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
40582957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIdxClientEntity;
40592957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
40602957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
4061bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic container
4062bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * of entities.
4063bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
4064dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientContainer;
4065bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis
4066bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
4067bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with an AST file (PCH
4068bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * or module).
4069bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
4070dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientASTFile;
40714e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4072bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
4073dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis * \brief Source location passed to index callbacks.
4074bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
40754e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
40764e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  void *ptr_data[2];
40774e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  unsigned int_data;
40784e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxLoc;
40794e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4080bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
4081bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Data for \see ppIncludedFile callback.
4082bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
40834e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
4084bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4085bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Location of '#' in the #include/#import directive.
4086bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
40874e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc hashLoc;
4088bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4089bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Filename as written in the #include/#import directive.
4090bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
40914e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  const char *filename;
4092bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4093bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief The actual file that the #include/#import directive resolved to.
4094bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
4095dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXFile file;
40964e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  int isImport;
40974e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  int isAngled;
40984e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxIncludedFileInfo;
40994e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4100bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
4101bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Data for \see importedASTFile callback.
4102bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
41034e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
41044e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXFile file;
4105bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4106bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Location where the file is imported. It is useful mostly for
4107bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * modules.
4108bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
41094e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc loc;
4110bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4111bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Non-zero if the AST file is a module otherwise it's a PCH.
4112bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
41134e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  int isModule;
41144e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxImportedASTFileInfo;
41154e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4116dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum {
4117dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Unexposed     = 0,
4118dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Typedef       = 1,
4119dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Function      = 2,
4120dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Variable      = 3,
4121dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_Field         = 4,
4122dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_EnumConstant  = 5,
41234e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4124dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_ObjCClass     = 6,
4125dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_ObjCProtocol  = 7,
4126dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxEntity_ObjCCategory  = 8,
41274e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4128c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCInstanceMethod = 9,
4129c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCClassMethod    = 10,
4130c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCProperty  = 11,
4131c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_ObjCIvar      = 12,
41324e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4133c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_Enum          = 13,
4134c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_Struct        = 14,
4135c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  CXIdxEntity_Union         = 15,
41362957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
41372957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXClass              = 16,
41382957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXNamespace          = 17,
41392957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXNamespaceAlias     = 18,
41402957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXStaticVariable     = 19,
41412957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXStaticMethod       = 20,
41422957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXInstanceMethod     = 21,
41432957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXConstructor        = 22,
41442957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXDestructor         = 23,
41452957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_CXXConversionFunction = 24,
4146838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntity_CXXTypeAlias          = 25
41474e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4148dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxEntityKind;
41494e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4150838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidistypedef enum {
4151838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_None = 0,
4152838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_C    = 1,
4153838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_ObjC = 2,
4154838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis  CXIdxEntityLang_CXX  = 3
4155838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis} CXIdxEntityLanguage;
4156838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis
41572957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
41582957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Extra C++ template information for an entity. This can apply to:
41592957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_Function
41602957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXClass
41612957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXStaticMethod
41622957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXInstanceMethod
41632957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConstructor
41642957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConversionFunction
41652957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXTypeAlias
41662957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
41672957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef enum {
41682957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_NonTemplate   = 0,
41692957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_Template      = 1,
41702957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_TemplatePartialSpecialization = 2,
41712957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  CXIdxEntity_TemplateSpecialization = 3
41722957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxEntityCXXTemplateKind;
41732957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
4174b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef enum {
4175b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_Unexposed     = 0,
4176b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_IBAction      = 1,
4177b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_IBOutlet      = 2,
4178b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttr_IBOutletCollection = 3
4179b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrKind;
4180b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
4181b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct {
4182b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxAttrKind kind;
4183b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXCursor cursor;
4184b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxLoc loc;
4185b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrInfo;
4186b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
4187b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct {
4188643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXIdxEntityKind kind;
4189643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXIdxEntityCXXTemplateKind templateKind;
4190643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXIdxEntityLanguage lang;
4191643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  const char *name;
4192643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  const char *USR;
4193643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXCursor cursor;
4194643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  const CXIdxAttrInfo *const *attributes;
4195643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  unsigned numAttributes;
4196643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxEntityInfo;
4197643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis
4198643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct {
4199643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis  CXCursor cursor;
4200643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxContainerInfo;
4201643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis
4202643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct {
4203b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  const CXIdxAttrInfo *attrInfo;
4204b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  const CXIdxEntityInfo *objcClass;
4205b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXCursor classCursor;
4206b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxLoc classLoc;
4207b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxIBOutletCollectionAttrInfo;
4208b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
42094e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
42106ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *entityInfo;
4211dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXCursor cursor;
4212dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxLoc loc;
4213b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  const CXIdxContainerInfo *semanticContainer;
4214b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  /**
4215b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis   * \brief Generally same as \see semanticContainer but can be different in
4216b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis   * cases like out-of-line C++ member functions.
4217b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis   */
4218b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  const CXIdxContainerInfo *lexicalContainer;
4219dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  int isRedeclaration;
42204e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  int isDefinition;
4221c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  int isContainer;
42222957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxContainerInfo *declAsContainer;
4223c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  /**
4224c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis   * \brief Whether the declaration exists in code or was created implicitly
4225c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis   * by the compiler, e.g. implicit objc methods for properties.
4226c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis   */
4227c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  int isImplicit;
4228b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  const CXIdxAttrInfo *const *attributes;
4229b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  unsigned numAttributes;
4230dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxDeclInfo;
42314e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4232dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum {
4233dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainer_ForwardRef = 0,
4234dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainer_Interface = 1,
4235dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainer_Implementation = 2
4236dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerKind;
42374e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
42384e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
42396ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxDeclInfo *declInfo;
4240dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxObjCContainerKind kind;
4241dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerDeclInfo;
42424e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
42434e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
42446ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *base;
42456ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  CXCursor cursor;
42464e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc loc;
42476ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis} CXIdxBaseClassInfo;
42484e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
42494e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
42506ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *protocol;
42516ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  CXCursor cursor;
42524e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc loc;
42534e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxObjCProtocolRefInfo;
42544e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
42554e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
42566ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxObjCProtocolRefInfo *const *protocols;
42574e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  unsigned numProtocols;
4258c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCProtocolRefListInfo;
42594e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
42604e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
4261c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  const CXIdxObjCContainerDeclInfo *containerInfo;
4262c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  const CXIdxBaseClassInfo *superInfo;
4263c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis  const CXIdxObjCProtocolRefListInfo *protocols;
4264c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCInterfaceDeclInfo;
42654e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
42662957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef struct {
4267c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  const CXIdxObjCContainerDeclInfo *containerInfo;
4268c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  const CXIdxEntityInfo *objcClass;
4269c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  CXCursor classCursor;
4270c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  CXIdxLoc classLoc;
4271c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis  const CXIdxObjCProtocolRefListInfo *protocols;
4272c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis} CXIdxObjCCategoryDeclInfo;
4273c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis
4274c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidistypedef struct {
42752957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxDeclInfo *declInfo;
42762957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxBaseClassInfo *const *bases;
42772957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  unsigned numBases;
42782957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxCXXClassDeclInfo;
42792957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
4280bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
4281bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Data for \see indexEntityReference callback.
4282bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
4283aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidistypedef enum {
4284bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4285bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief The entity is referenced directly in user's code.
4286bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
4287aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis  CXIdxEntityRef_Direct = 1,
4288bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4289b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * \brief An implicit reference, e.g. a reference of an ObjC method via the
4290b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * dot syntax.
4291bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
4292b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis  CXIdxEntityRef_Implicit = 2
4293aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis} CXIdxEntityRefKind;
4294aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis
4295bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
4296bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Data for \see indexEntityReference callback.
4297bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
42984e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
4299b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis  CXIdxEntityRefKind kind;
4300bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4301bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Reference cursor.
4302bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
43034e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXCursor cursor;
43044e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  CXIdxLoc loc;
4305bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4306bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief The entity that gets referenced.
4307bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
43086ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *referencedEntity;
4309bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4310bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Immediate "parent" of the reference. For example:
4311bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   *
4312bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \code
4313bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * Foo *var;
4314bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \endcode
4315bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   *
4316bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * The parent of reference of type 'Foo' is the variable 'var'.
4317e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis   * For references inside statement bodies of functions/methods,
4318e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis   * the parentEntity will be the function/method.
4319bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
43206ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  const CXIdxEntityInfo *parentEntity;
4321bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4322e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis   * \brief Lexical container context of the reference.
4323bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
43242957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis  const CXIdxContainerInfo *container;
43254e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxEntityRefInfo;
43264e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
43274e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct {
4328bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
43296ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis   * \brief Called periodically to check whether indexing should be aborted.
43306ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis   * Should return 0 to continue, and non-zero to abort.
43316ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis   */
43326ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  int (*abortQuery)(CXClientData client_data, void *reserved);
43336ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis
43346ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  /**
4335b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * \brief Called at the end of indexing; passes the complete diagnostic set.
4336bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
43374e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  void (*diagnostic)(CXClientData client_data,
4338b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis                     CXDiagnosticSet, void *reserved);
43394e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4340dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientFile (*enteredMainFile)(CXClientData client_data,
4341dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis                               CXFile mainFile, void *reserved);
4342dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis
4343bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4344bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Called when a file gets #included/#imported.
4345bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
4346dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientFile (*ppIncludedFile)(CXClientData client_data,
43476ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                                    const CXIdxIncludedFileInfo *);
43484e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4349bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4350bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Called when a AST file (PCH or module) gets imported.
4351bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   *
4352bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * AST files will not get indexed (there will not be callbacks to index all
4353bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * the entities in an AST file). The recommended action is that, if the AST
4354bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * file is not already indexed, to block further indexing and initiate a new
43556ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis   * indexing job specific to the AST file.
4356bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
4357dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientASTFile (*importedASTFile)(CXClientData client_data,
43586ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                                        const CXIdxImportedASTFileInfo *);
43594e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4360bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4361bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Called at the beginning of indexing a translation unit.
4362bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
4363dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis  CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data,
43646ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                                                 void *reserved);
43654e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
43666ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis  void (*indexDeclaration)(CXClientData client_data,
43672957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis                           const CXIdxDeclInfo *);
43684e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4369bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis  /**
4370bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   * \brief Called to index a reference of an entity.
4371bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis   */
43724e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis  void (*indexEntityReference)(CXClientData client_data,
43736ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis                               const CXIdxEntityRefInfo *);
43744e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
43754e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} IndexerCallbacks;
43764e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4377ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind);
43786ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCContainerDeclInfo *
43796ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *);
43806ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis
43816ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo *
43826ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *);
4383dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis
4384ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE
43856ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisconst CXIdxObjCCategoryDeclInfo *
43866ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *);
43876ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis
4388c71d55469e7d5f7b376a30620617a175a9442da9Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo *
4389c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidisclang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *);
4390dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis
4391b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo *
4392b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidisclang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *);
4393b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis
43942957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxCXXClassDeclInfo *
43952957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *);
43962957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
43972957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
43982957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientContainer attached to a
43992957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container.
44002957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
44012957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientContainer
44022957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientContainer(const CXIdxContainerInfo *);
44032957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
44042957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
44052957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientContainer attached to a
44062957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container.
44072957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
44082957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void
44092957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer);
44102957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
44112957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
44122957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientEntity attached to an entity.
44132957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
44142957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientEntity
44152957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientEntity(const CXIdxEntityInfo *);
44162957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
44172957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
44182957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientEntity attached to an entity.
44192957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
44202957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void
44212957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity);
44222957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
44232957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
44242957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief An indexing action, to be applied to one or multiple translation units
44252957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * but not on concurrent threads. If there are threads doing indexing
44262957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * concurrently, they should use different CXIndexAction objects.
44272957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
44282957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIndexAction;
44292957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
44302957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
44312957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief An indexing action, to be applied to one or multiple translation units
44322957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * but not on concurrent threads. If there are threads doing indexing
44332957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * concurrently, they should use different CXIndexAction objects.
44342957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis *
44352957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \param CIdx The index object with which the index action will be associated.
44362957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
44372957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx);
44382957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
44392957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/**
44402957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Destroy the given index action.
44412957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis *
44422957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * The index action must not be destroyed until all of the translation units
44432957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * created within that index action have been destroyed.
44442957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */
44452957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction);
44462957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis
444721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidistypedef enum {
444821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis  /**
444921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis   * \brief Used to indicate that no special indexing options are needed.
445021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis   */
445121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis  CXIndexOpt_None = 0x0,
445221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis
445321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis  /**
445421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis   * \brief Used to indicate that \see indexEntityReference should be invoked
4455b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * for only one reference of an entity per source file that does not also
4456b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis   * include a declaration/definition of the entity.
445721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis   */
445822490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis  CXIndexOpt_SuppressRedundantRefs = 0x1,
445922490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis
446022490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis  /**
446122490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis   * \brief Function-local symbols should be indexed. If this is not set
446222490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis   * function-local symbols will be ignored.
446322490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis   */
446422490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis  CXIndexOpt_IndexFunctionLocalSymbols = 0x2
446521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis} CXIndexOptFlags;
446621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis
4467bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
4468bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Index the given source file and the translation unit corresponding
4469bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * to that file via callbacks implemented through \see IndexerCallbacks.
4470bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
4471bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param client_data pointer data supplied by the client, which will
4472bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * be passed to the invoked callbacks.
4473bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
4474bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param index_callbacks Pointer to indexing callbacks that the client
4475bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * implements.
4476bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
4477bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param index_callbacks_size Size of \see IndexerCallbacks structure that gets
4478bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * passed in index_callbacks.
4479bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
448021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \param index_options A bitmask of options that affects how indexing is
448121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags.
4482bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
4483bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param out_TU [out] pointer to store a CXTranslationUnit that can be reused
4484bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * after indexing is finished. Set to NULL if you do not require it.
4485bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
448621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns
4487bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * non-zero, otherwise returns 0.
448821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
4489bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * The rest of the parameters are the same as \see clang_parseTranslationUnit.
4490bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
44912957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction,
44924e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         CXClientData client_data,
44934e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         IndexerCallbacks *index_callbacks,
44944e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned index_callbacks_size,
44954e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned index_options,
44964e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         const char *source_filename,
44974e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         const char * const *command_line_args,
44984e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         int num_command_line_args,
44994e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         struct CXUnsavedFile *unsaved_files,
45004e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned num_unsaved_files,
45014e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         CXTranslationUnit *out_TU,
45024e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                         unsigned TU_options);
45034e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4504bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
450521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \brief Index the given translation unit via callbacks implemented through
450621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \see IndexerCallbacks.
450721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
450821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * The order of callback invocations is not guaranteed to be the same as
450921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * when indexing a source file. The high level order will be:
451021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
451121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *   -Preprocessor callbacks invocations
451221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *   -Declaration/reference callbacks invocations
451321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *   -Diagnostic callback invocations
451421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
451521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * The parameters are the same as \see clang_indexSourceFile.
451621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis *
451721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns
451821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * non-zero, otherwise returns 0.
451921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */
45202957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction,
452121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis                                              CXClientData client_data,
452221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis                                              IndexerCallbacks *index_callbacks,
452321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis                                              unsigned index_callbacks_size,
45242957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis                                              unsigned index_options,
45252957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis                                              CXTranslationUnit);
452621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis
452721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis/**
4528bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXIdxFile, file, line, column, and offset represented by
4529bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * the given CXIdxLoc.
4530bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis *
4531bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * If the location refers into a macro expansion, retrieves the
4532bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * location of the macro expansion and if it refers into a macro argument
4533bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * retrieves the location of the argument.
4534bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
45354e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc,
4536dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis                                                   CXIdxClientFile *indexFile,
45374e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   CXFile *file,
45384e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   unsigned *line,
45394e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   unsigned *column,
45404e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis                                                   unsigned *offset);
45414e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4542bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/**
4543bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXSourceLocation represented by the given CXIdxLoc.
4544bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */
45454e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE
45464e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc);
45474e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis
4548aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/**
4549aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @}
4550aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */
4551aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis
4552c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/**
4553c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @}
4554c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */
45551efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar
4556d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus
4557d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek}
4558d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
4559d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
4560d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
4561